/* =========================================================================
   SEO-аудит сайта: сканер на первом экране, поводы, слои проверки,
   ТЗ, матрица приоритетов, форматы и сроки, внедрение.
   Цвета приоритетов: критично — leak, важно — signal, по пути — fog.
   ========================================================================= */

.p-hi { --c: var(--leak); --cs: rgba(255, 107, 91, 0.16); --ct: #ff8a7d; }
.p-mid { --c: var(--signal); --cs: rgba(255, 176, 32, 0.16); --ct: #ffc04d; }
.p-low { --c: var(--fog); --cs: rgba(170, 181, 207, 0.14); --ct: #c3cbe0; }

/* ---------------------------------------------------------- сканер */
.scan { position: relative; display: grid; gap: 14px; padding: clamp(14px, 2vw, 20px); border-radius: var(--radius-lg); background: var(--night-2); border: 1px solid var(--night-line); color: #eef2fb; box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.6); }
.scan-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--night); border: 1px solid var(--night-line); font-size: 0.88rem; }
.scan-dots { display: flex; gap: 5px; }
.scan-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--night-line); }
.scan-url { flex: 1; min-width: 0; color: var(--fog); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-meter { color: var(--fog); font-size: 0.8rem; white-space: nowrap; }
.scan-meter b { font-family: var(--font-display); font-weight: 600; color: #fff; font-size: 0.95rem; font-variant-numeric: tabular-nums; margin-left: 4px; }
.scan-body { display: grid; grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr); gap: 14px; align-items: start; }
.scan-pages { display: grid; gap: 10px; }
.scan-page { position: relative; padding: 10px 12px 12px; border-radius: 12px; background: var(--night); border: 1px solid var(--night-line); transition: border-color 0.3s, box-shadow 0.3s; }
.scan-page.is-active { border-color: rgba(142, 171, 255, 0.7); box-shadow: 0 0 0 4px rgba(76, 125, 255, 0.12); }
.scan-page-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 9px; font-size: 0.7rem; line-height: 1.2; color: var(--fog-dim); }
.scan-page-head b { color: #cdd6ea; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-lines { position: relative; display: grid; gap: 6px; padding-right: 14px; }
.scan-lines i { position: relative; display: block; height: 7px; }
.scan-lines i.blk { height: 18px; }
.scan-lines i::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 100%); border-radius: 4px; background: rgba(170, 181, 207, 0.15); transition: background-color 0.35s; }
.scan-lines i.is-seen::before { background: rgba(142, 171, 255, 0.3); }
.scan-lines i.is-hit::before { background: var(--cs); box-shadow: inset 0 0 0 1px var(--c); }
.scan-lines i.is-hit::after { content: ""; position: absolute; right: -14px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--cs); }
.scan-beam { position: absolute; left: -6px; right: 0; top: 0; height: 2px; border-radius: 2px; background: var(--flow-light); box-shadow: 0 0 12px 2px rgba(76, 125, 255, 0.75); opacity: 0; pointer-events: none; }
.scan-beam::before { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 26px; background: linear-gradient(to top, rgba(76, 125, 255, 0.22), transparent); }
.scan-found { list-style: none; display: grid; gap: 8px; align-content: start; }
.finding { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--night-line); border-left: 3px solid var(--c); font-size: 0.84rem; line-height: 1.3; }
.finding .prio { grid-row: span 2; align-self: start; margin-top: 1px; }
.finding b { font-weight: 500; color: #eef2fb; }
.finding small { color: #8a96b4; font-size: 0.74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prio { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--cs); color: var(--ct); font-size: 0.7rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.scan-foot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.scan-foot > div { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--night); border: 1px solid var(--night-line); }
.scan-foot .num { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem); color: #fff; }
.scan-foot .num.is-hi { color: #ff8a7d; }
.scan-foot small { color: var(--fog); font-size: 0.74rem; line-height: 1.3; }
.scan-foot.is-done > div { border-color: rgba(255, 176, 32, 0.45); }
.scan-note { margin: 10px 0 0; color: var(--fg-dim); font-size: var(--step--1); }

/* ---------------------------------------------------------- поводы для аудита */
.when { display: grid; border-top: 1px solid var(--line); }
.when-row { display: grid; grid-template-columns: 240px minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px clamp(20px, 3vw, 44px); align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); }
.when-row q { font-size: var(--step-1); font-weight: 650; line-height: 1.35; quotes: "«" "»"; }
.when-row p { margin: 0; color: var(--fg-soft); }
.when-spark { padding: 10px 12px; border-radius: var(--radius-md); background: var(--night-2); border: 1px solid var(--night-line); }
.when-spark svg { width: 100%; height: auto; overflow: visible; }
.when-spark .ax { stroke: var(--night-line); stroke-width: 1; }
.when-spark .ev { stroke: var(--fog-dim); stroke-width: 1; stroke-dasharray: 3 4; }
.when-spark text { font-family: var(--font-text); font-size: 10.5px; fill: var(--fog); }
.when-spark text.t-signal { fill: var(--signal); }
.when-spark .ln { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.when-spark .ln--leak { stroke: var(--leak); }
.when-spark .ln--flow { stroke: var(--flow-light); }
.when-spark .ln--signal { stroke: var(--signal); }
.when-spark .ln--dash { stroke-dasharray: 2 6; }
.when-spark .pt { fill: var(--night-2); stroke-width: 2.4; }
.when-spark .pt--leak { stroke: var(--leak); }

/* ---------------------------------------------------------- слои проверки */
.layers .pain-tab > span:last-child { color: var(--fg-dim); font-size: 0.9rem; line-height: 1.4; }
.layers .pain-tab > span:last-child strong { color: var(--fg); margin-bottom: 2px; }
.layers-side { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 18px; }
.layers-side .pain-panel { position: static; min-height: 0; }
.layers-side .pain-panel ul { margin-bottom: 18px; }
.stack { width: 100%; max-width: 440px; height: auto; margin-inline: auto; overflow: visible; }
.stack .plate { cursor: pointer; transition: transform 0.5s var(--ease-out); }
.stack .plate .top { fill: var(--night-3); stroke: rgba(142, 171, 255, 0.35); stroke-width: 1; transition: fill 0.4s, stroke 0.4s; }
.stack .plate .side { fill: #0e1830; stroke: rgba(142, 171, 255, 0.18); stroke-width: 1; }
.stack .plate .side--r { fill: #0a1226; }
.stack .plate .lead { stroke: var(--night-line); stroke-width: 1; }
.stack .plate text { font-family: var(--font-text); font-size: 13px; font-weight: 500; fill: var(--fog-dim); transition: fill 0.4s; }
.stack .plate:hover .top { stroke: var(--flow-light); }
.stack .plate.is-on { transform: translateX(16px); }
.stack .plate.is-on .top { fill: url(#plateOn); stroke: #ffd27a; }
.stack .plate.is-on .side { fill: #b36d00; }
.stack .plate.is-on .side--r { fill: #8a5400; }
.stack .plate.is-on .lead { stroke: var(--signal); }
.stack .plate.is-on text { fill: #fff; font-weight: 650; }
.layer-eg { margin: 0; padding: 14px 16px; border-radius: var(--radius-md); background: rgba(255, 176, 32, 0.1); color: var(--fg); font-size: 0.95rem; line-height: 1.5; }
.layer-eg b { font-weight: 650; color: var(--signal); }

/* ---------------------------------------------------------- ТЗ */
.tz { display: grid; gap: 12px; padding: clamp(16px, 2.2vw, 24px); border-radius: var(--radius-lg); background: var(--night); color: #eef2fb; box-shadow: 0 40px 80px -40px rgba(11, 19, 36, 0.55); }
.tz-top { display: flex; justify-content: space-between; gap: 12px; color: var(--fog); font-size: 0.85rem; }
.tz-top span:first-child { color: #fff; font-weight: 600; }
.tz-row { padding: 14px 16px; border-radius: 14px; background: var(--night-2); border: 1px solid var(--night-line); border-left: 3px solid var(--c); }
.tz-row header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.tz-n { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; letter-spacing: -0.02em; }
.tz-row dl { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 7px 14px; margin: 0; font-size: 0.9rem; line-height: 1.45; }
.tz-row dt { color: var(--fog-dim); }
.tz-row dd { margin: 0; color: #dfe6f6; }
.tz-row dd b { font-family: var(--font-display); font-weight: 600; color: var(--signal); }
.tz-note { margin: 0; color: var(--fog-dim); font-size: var(--step--1); }

/* ---------------------------------------------------------- матрица приоритетов */
.matrix-wrap { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(24px, 4vw, 64px); align-items: center; margin-top: clamp(56px, 7vw, 96px); }
.matrix-copy .h3 { margin-bottom: 14px; }
.tasks-key { list-style: none; counter-reset: t; display: grid; margin-top: 20px; border-top: 1px solid var(--line); }
.tasks-key li { counter-increment: t; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); border-radius: 8px; font-size: 0.95rem; transition: background-color 0.25s; }
.tasks-key li::before { content: counter(t); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; background: var(--qc); color: var(--qt, var(--ink)); }
.tasks-key li b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tasks-key li.is-hl { background: var(--surface-2); }
.q-first { --qc: var(--signal); --qt: var(--ink); }
.q-plan { --qc: var(--flow); --qt: #fff; }
.q-way { --qc: #c9d1e1; --qt: var(--ink); }
.q-later { --qc: #8b95ad; --qt: #fff; }
.matrix { padding: clamp(12px, 2vw, 22px); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.matrix svg { width: 100%; height: auto; overflow: visible; }
.matrix .quad { fill: var(--surface-2); }
.matrix .quad--first { fill: var(--signal-soft); stroke: rgba(232, 148, 0, 0.45); stroke-width: 1.5; }
.matrix .quad--first.is-pulse { fill: #ffe3ad; }
.matrix .ql { font-family: var(--font-text); font-size: 14px; font-weight: 600; fill: var(--fg-dim); }
.matrix .ql--first { fill: #8a5400; }
.matrix .axes path { fill: none; stroke: var(--fg-dim); stroke-width: 1.5; stroke-linecap: round; }
.matrix .axes text { font-family: var(--font-text); font-size: 13px; fill: var(--fg-dim); }
.matrix .dot { cursor: default; }
.matrix .dot circle { fill: var(--qc); stroke: #fff; stroke-width: 3; transition: r 0.25s, stroke-width 0.25s; }
.matrix .dot text { font-family: var(--font-display); font-size: 13px; font-weight: 600; fill: var(--qt, var(--ink)); pointer-events: none; }
.matrix .dot.is-hl circle { r: 19; stroke: var(--ink); stroke-width: 2; }
.matrix-note { margin: 12px 0 0; color: var(--fg-dim); font-size: var(--step--1); }

/* ---------------------------------------------------------- форматы */
.formats-wrap { border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
/* На узких телефонах таблица прокручивается внутри карточки, а не сжимает заголовки столбцов */
@media (max-width: 420px) { .formats-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; } .formats { min-width: 440px; } }
.formats { width: 100%; border-collapse: collapse; table-layout: fixed; }
.formats col:first-child { width: 34%; }
.formats th, .formats td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.formats tbody tr:last-child th, .formats tbody tr:last-child td { border-bottom: 0; }
.formats thead th { vertical-align: top; padding-top: 22px; padding-bottom: 20px; font-weight: 400; }
.formats thead th:first-child { width: 34%; }
.formats thead b { display: block; font-weight: 650; font-size: var(--step-0); line-height: 1.3; margin-bottom: 10px; }
.formats thead .cost { display: block; font-family: var(--font-display); font-weight: 600; font-size: clamp(1.1rem, 0.9rem + 0.9vw, 1.6rem); letter-spacing: -0.03em; line-height: 1.1; }
.formats thead small { display: block; margin-top: 8px; color: var(--fg-soft); font-size: 0.85rem; line-height: 1.35; }
.formats tbody th { text-align: left; font-weight: 500; color: var(--fg); line-height: 1.4; }
.formats .fm { background: rgba(255, 176, 32, 0.09); }
.formats thead .fm { box-shadow: inset 0 3px 0 var(--signal); }
.formats .ck { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(47, 191, 138, 0.14); }
.formats .ck svg { width: 18px; height: 18px; fill: none; stroke: #1d9d6e; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.formats .no { color: var(--fg-dim); font-size: 0.88rem; }

/* ---------------------------------------------------------- сроки */
.terms { margin-top: 28px; padding: clamp(20px, 3vw, 32px); border-radius: var(--radius-lg); border: 1px solid var(--line); }
.terms-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 20px; }
.terms-head p { margin: 0; font-size: 0.95rem; }
.terms-grid { display: grid; gap: 12px; }
.terms-axis, .terms-row { display: grid; grid-template-columns: minmax(130px, 0.28fr) minmax(0, 1fr); gap: 18px; align-items: center; }
.terms-axis > div { display: flex; justify-content: space-between; color: var(--fg-dim); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.terms-axis i { font-style: normal; width: 0; display: flex; justify-content: center; }
.terms-row > span { font-weight: 500; line-height: 1.3; }
.terms-track { position: relative; height: 30px; border-radius: 8px; background: repeating-linear-gradient(90deg, var(--surface-2) 0 calc(12.5% - 2px), transparent calc(12.5% - 2px) 12.5%); }
.tb { position: absolute; top: 0; bottom: 0; left: calc(var(--s) * 1%); width: calc((var(--e) - var(--s)) * 1%); border-radius: 8px; background: var(--flow); transform-origin: left center; }
.tb--main { background: var(--signal); }
.tb--soft { background: repeating-linear-gradient(135deg, rgba(76, 125, 255, 0.45) 0 6px, rgba(76, 125, 255, 0.2) 6px 12px); border-radius: 0 8px 8px 0; }
.tb--main + .tb--soft { background: repeating-linear-gradient(135deg, rgba(255, 176, 32, 0.55) 0 6px, rgba(255, 176, 32, 0.25) 6px 12px); }
.tb--gap { top: 50%; bottom: auto; height: 0; border-top: 2px dashed var(--fg-dim); border-radius: 0; background: none; }
.tb--ok { background: var(--ok); }
.tl { position: absolute; top: 50%; left: calc(var(--at) * 1%); transform: translateY(-50%); font-size: 0.8rem; font-weight: 600; white-space: nowrap; color: var(--fg); }
.tl--left { left: auto; right: calc(100% - var(--at) * 1% + 6px); padding: 0 6px; background: var(--bg); border-radius: 6px; }

/* ---------------------------------------------------------- кейсы: подписи столбиков шире */
[data-bars] .case-row .bar { grid-template-columns: 104px minmax(0, 1fr) auto; }

/* ---------------------------------------------------------- адаптив */
@media (max-width: 1080px) {
  .matrix-wrap { grid-template-columns: 1fr; }
  .layers-side { position: static; }
  .stack { max-width: 360px; }
  .when-row { grid-template-columns: 200px minmax(0, 1fr); }
  .when-row p { grid-column: 2; }
}
@media (max-width: 760px) {
  .scan-body { grid-template-columns: 1fr; }
  .scan-pages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .scan-page { padding: 8px 9px 10px; }
  .scan-page-head span { display: none; }
  .scan-lines { gap: 5px; padding-right: 10px; }
  .scan-lines i.is-hit::after { right: -10px; width: 6px; height: 6px; margin-top: -3px; }
  .when-row { grid-template-columns: 1fr; gap: 12px; }
  .when-row p { grid-column: auto; }
  .when-spark { max-width: 300px; }
}
@media (max-width: 640px) {
  .scan-meter { font-size: 0.72rem; }
  .finding { font-size: 0.8rem; padding: 8px 10px; }
  .scan-foot > div { padding: 8px 10px; }
  .tz-row dl { grid-template-columns: 1fr; gap: 2px; }
  .tz-row dt { margin-top: 6px; font-size: 0.8rem; }
  .tz-row dt:first-child { margin-top: 0; }
  .formats th, .formats td { padding: 12px 6px; }
  .formats thead th:first-child, .formats col:first-child { width: 31%; }
  .formats thead b { font-size: 0.8rem; margin-bottom: 6px; }
  .formats thead .cost { font-family: var(--font-text); font-weight: 700; font-size: 0.86rem; letter-spacing: 0; }
  .formats thead small { font-size: 0.72rem; }
  .formats tbody th { font-size: 0.84rem; padding-left: 12px; }
  .formats .ck { width: 26px; height: 26px; }
  .formats .ck svg { width: 15px; height: 15px; }
  .formats .no { font-size: 0.78rem; }
  .terms-axis, .terms-row { grid-template-columns: 1fr; gap: 6px; }
  .terms-axis > span { display: none; }
  .tl { font-size: 0.72rem; }
  .matrix .ql { font-size: 19px; }
  .matrix .axes text { font-size: 18px; }
  .matrix .dot circle { r: 18; }
  .matrix .dot text { font-size: 16px; }
  .matrix .dot.is-hl circle { r: 22; }
  [data-bars] .case-row .bar { grid-template-columns: 92px minmax(0, 1fr) auto; }
}
@media (max-width: 420px) {
  .hero .h1--long { font-size: 8vw; }
}
