/* Палитра: Deep Navy, Fresh Lime, Ocean Teal, Sky Blue, Warm Sand. Шрифт — Inter (подключён в base.html).
   Светлая тема — по умолчанию; тёмная включается кнопкой в шапке (data-theme="dark") */
:root {
  --navy: #0e2f3e;
  --lime: #aef977;
  --teal: #087589;
  --sky: #8bb5c5;
  --sand: #ebe7e0;

  --bg: #f4f3f0;
  --surface: #ffffff;
  --surface-2: var(--sand);
  --text: #0e2f3e;
  --muted: #51666f;
  --line: #dedad2;
  --line-strong: #c6c1b6;
  --accent: var(--teal);
  --accent-strong: var(--navy);
  --accent-soft: #dbe9ed;
  /* Сплошные кнопки и выбранные переключатели */
  --solid: var(--navy);
  --on-solid: #ffffff;
  /* Тёмные плашки: первый экран, блок ответов, результат калькулятора, подвал */
  --panel: var(--navy);
  --on-panel: #ffffff;
  --on-panel-muted: #b7cbd3;
  --panel-line: rgb(255 255 255 / 18%);
  /* Вердикты: текст на них всегда тёмный */
  --good: var(--lime);
  --bad: #ffc4b5;
  --maybe: #f6e7a8;
  --on-verdict: #0e2f3e;
  --warn-ink: #7a5d1e;
  --shadow: 0 1px 2px rgb(14 47 62 / 4%), 0 10px 30px rgb(14 47 62 / 6%);
  --radius: 24px;
  --radius-sm: 14px;
  --wrap: 80rem;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #071c25;
  --surface: #0e2f3e;
  --surface-2: #123848;
  --text: #eaf1f3;
  --muted: #9fb8c2;
  --line: #1d4354;
  --line-strong: #2d5a6e;
  --accent: var(--lime);
  --accent-strong: #cdfcaa;
  --accent-soft: #143f4f;
  --solid: var(--lime);
  --on-solid: #0e2f3e;
  --panel: #0e2f3e;
  --warn-ink: #f6e7a8;
  --shadow: 0 1px 2px rgb(0 0 0 / 25%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.05; text-wrap: balance; letter-spacing: -.04em; font-weight: 600; }
h1 { font-size: clamp(2.4rem, 1.5rem + 3.8vw, 4.5rem); margin: .35em 0 .4em; }
h2 { font-size: clamp(1.6rem, 1.25rem + 1.4vw, 2.4rem); margin: 1.8em 0 .6em; line-height: 1.1; }
h3 { font-size: 1.3rem; margin: 1.4em 0 .4em; letter-spacing: -.03em; line-height: 1.2; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 48rem) { .wrap { padding: 0 32px; } }
.muted { color: var(--muted); font-size: .92em; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
/* Мелкая подпись прописными — метки разделов, меню, плашки */
.eyebrow, .label {
  margin: 0; font-size: .72rem; font-weight: 600; line-height: 1.3; letter-spacing: .04em; text-transform: uppercase;
}

/* Шапка */
.site-header { background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
@media (min-width: 60rem) { .site-header { position: sticky; top: 0; z-index: 5; } }
.header-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding-top: 14px; padding-bottom: 14px; }
.logo {
  display: inline-flex; align-items: center; min-height: 44px; gap: 9px; color: var(--text); text-decoration: none;
  font-size: 1.5rem; font-weight: 700; letter-spacing: -.05em; line-height: 1;
}
.logo:hover { color: var(--text); }
.logo svg { flex: none; }
.main-nav-list { display: flex; flex-wrap: wrap; gap: 0 2px; }
.main-nav a {
  color: var(--text); text-decoration: none; padding: 12px 12px; border-radius: 99px;
  font-size: .74rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  transition: background-color .15s, color .15s;
}
.main-nav a:hover { background: var(--surface-2); }
.main-nav a[aria-current] { background: var(--solid); color: var(--on-solid); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lang-switch, .theme-toggle, .nav-toggle {
  display: inline-grid; place-items: center; height: 44px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--text); cursor: pointer; transition: background-color .15s, border-color .15s;
}
.lang-switch { min-width: 44px; padding: 0 14px; border-radius: 22px; text-decoration: none; font-size: .74rem; font-weight: 600; letter-spacing: .04em; }
.theme-toggle, .nav-toggle { width: 44px; border-radius: 50%; }
.lang-switch:hover, .theme-toggle:hover, .nav-toggle:hover { color: var(--text); background: var(--surface); border-color: var(--text); }
.theme-toggle .sun, [data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }

/* Гамбургер: на узком экране меню прячется под кнопку, три полоски сходятся в крестик */
.nav-toggle { display: none; }
.burger { position: relative; width: 18px; height: 14px; }
.burger i {
  position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor;
  /* закрытие: сначала поворот обратно, потом разъезд */
  transition: top .2s .2s cubic-bezier(.4, 0, .2, 1), transform .2s cubic-bezier(.4, 0, .2, 1), opacity .1s .2s;
}
.burger i:nth-child(1) { top: 0; }
.burger i:nth-child(2) { top: 6px; }
.burger i:nth-child(3) { top: 12px; }
/* открытие: сначала сходятся в центр, потом поворот */
[aria-expanded="true"] .burger i { top: 6px; transition: top .2s cubic-bezier(.4, 0, .2, 1), transform .2s .2s cubic-bezier(.4, 0, .2, 1), opacity .1s .1s; }
[aria-expanded="true"] .burger i:nth-child(1) { transform: rotate(45deg); }
[aria-expanded="true"] .burger i:nth-child(2) { opacity: 0; }
[aria-expanded="true"] .burger i:nth-child(3) { transform: rotate(-45deg); }

@media (max-width: 59.99rem) {
  .js .header-row { gap: 0 8px; }
  .js .nav-toggle { display: inline-grid; }
  .js .main-nav {
    order: 3; flex-basis: 100%;
    display: grid; grid-template-rows: 0fr; visibility: hidden;
    transition: grid-template-rows .3s cubic-bezier(.4, 0, .2, 1), visibility 0s .3s;
  }
  .js .main-nav-list {
    /* nowrap: иначе при неполной высоте пункты переносятся в соседние колонки и скачут */
    overflow: hidden; min-height: 0; flex-direction: column; flex-wrap: nowrap; gap: 0;
    opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .3s cubic-bezier(.4, 0, .2, 1);
  }
  .js .main-nav-list a {
    padding: 14px 4px; border-radius: 0; border-bottom: 1px solid var(--line);
    font-size: 1.5rem; font-weight: 600; letter-spacing: -.04em; text-transform: none;
  }
  .js .main-nav-list a[aria-current] { background: none; color: var(--accent); }
  .js .nav-open .main-nav { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .3s cubic-bezier(.4, 0, .2, 1); }
  .js .nav-open .main-nav-list { opacity: 1; transform: none; transition: opacity .25s .08s, transform .3s cubic-bezier(.4, 0, .2, 1); }
  .js .main-nav-list a:first-child { margin-top: 8px; border-top: 1px solid var(--line); }
}

.crumbs { margin-top: 28px; color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs span { margin: 0 4px; }

/* Кнопки и метки */
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border-radius: 99px; border: 1px solid transparent; text-decoration: none;
  font-size: .74rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--solid); color: var(--on-solid); }
.btn-primary:hover { background: var(--teal); color: #fff; }
.btn-ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--text); color: var(--text); }
.btn-lime, .btn-lime:hover { background: var(--lime); color: var(--navy); }
.btn-lime:hover { background: #fff; }
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 99px; white-space: nowrap;
  font-size: .68rem; font-weight: 600; line-height: 1.4; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text); border: 1px solid currentColor;
}
/* Стрелка в кружке — на плитках и в строках списков */
.arrow {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid currentColor; transition: transform .2s, background-color .2s, color .2s;
}

/* Текст */
.prose { max-width: 46rem; }
.prose p, .prose li { overflow-wrap: anywhere; }
.prose li + li { margin-top: .35em; }
.prose ul li::marker { color: var(--accent); }
.lead { font-size: 1.25rem; line-height: 1.45; color: var(--muted); letter-spacing: -.01em; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.4em 0; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 12px 14px; text-align: left; vertical-align: top; }
.prose thead th {
  border-bottom-color: var(--text); color: var(--muted);
  font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; vertical-align: bottom;
}
.prose th { font-weight: 600; }
.prose blockquote { margin: 1.4em 0; padding: 18px 22px; background: var(--surface-2); border-radius: var(--radius-sm); }
.prose blockquote p { margin: .3em 0; }

/* Тёмная плашка: внутри неё свои цвета текста и линий */
.panel {
  --text: var(--on-panel); --muted: var(--on-panel-muted); --line: var(--panel-line); --line-strong: var(--panel-line);
  --accent: var(--lime); --accent-strong: #ffffff;
  background: var(--panel); color: var(--on-panel); border-radius: var(--radius);
}
[data-theme="dark"] .panel { box-shadow: inset 0 0 0 1px var(--line); }

/* Главная: первый экран — тёмная плашка с огромным заголовком и срезом кабеля на фоне */
.hero {
  position: relative; overflow: hidden; isolation: isolate; margin-top: 4px;
  display: grid; grid-template-rows: 1fr auto auto; gap: 28px;
  min-height: min(44rem, 100svh - 96px); padding: 24px 20px 20px;
  border-radius: 28px;
}
/* Фото на весь экран и тёмная вуаль поверх — чтобы белый текст читался */
.hero-bg { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 70% 0; }
.hero::before {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background: linear-gradient(180deg, rgb(14 47 62 / 62%), rgb(14 47 62 / 38%) 42%, rgb(14 47 62 / 88%));
}
.hero h1 {
  margin: 0; font-size: clamp(3.1rem, 9.6vw, 7.6rem); line-height: .95; letter-spacing: -.055em; text-wrap: wrap;
}
.hero-bottom { display: grid; gap: 24px; align-items: end; }
.hero .lead { margin: 0; max-width: 27rem; color: var(--on-panel); font-size: 1.15rem; font-weight: 500; }
.hero-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 20px; min-height: 7.5rem; padding: 16px;
  border-radius: 18px; background: #fff; color: var(--navy); text-decoration: none; transition: transform .2s;
}
.tile:hover { color: var(--navy); transform: translateY(-3px); }
.tile-lime { background: var(--lime); }
.tile svg { align-self: flex-end; }
.hero-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; margin: 0; padding: 14px 0 0;
  border-top: 1px solid var(--panel-line); list-style: none;
}
@media (min-width: 52rem) {
  .hero { padding: 36px 40px 28px; }
  .hero-bottom { grid-template-columns: 1fr auto; }
  .hero-tiles { grid-template-columns: 9.5rem 9.5rem; }
  .tile { min-height: 9.5rem; }
}

/* Главная: разделы */
.section { margin-top: clamp(4.5rem, 9vw, 8rem); }
.section-head { display: grid; gap: 14px; margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.section-head h2 { margin: 0; font-size: clamp(2.2rem, 1.4rem + 3.4vw, 4rem); line-height: 1; letter-spacing: -.05em; }

/* Темы: фото целиком на белой плитке, под ним — заголовок и вопросы */
.topics { display: grid; gap: 48px 24px; }
@media (min-width: 52rem) { .topics { grid-template-columns: repeat(3, 1fr); } }
.topic { position: relative; display: flex; flex-direction: column; align-items: flex-start; }
.topic-frame { position: relative; display: block; width: 100%; overflow: hidden; border-radius: var(--radius); background: #fff; }
.topic-pic { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: contain; transition: transform .4s; }
.topic.is-link:hover .topic-pic { transform: scale(1.04); }
.topic-num { position: absolute; left: 18px; top: 16px; color: var(--navy); }
.topic .badge { margin-top: 20px; }
.topic h3 { margin: 24px 0 10px; font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); line-height: 1.1; letter-spacing: -.04em; }
.topic h3 a { color: var(--text); text-decoration: none; }
.topic h3 a::after { content: ""; position: absolute; inset: 0; }
.topic h3 a:focus-visible { outline: none; }
.topic:has(h3 a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 8px; border-radius: 8px; }
.topic > p { margin: 0; color: var(--muted); max-width: 26rem; }
.questions { list-style: none; width: 100%; margin: 22px 0 0; padding: 0; font-size: .95rem; }
.questions li { padding: 9px 0; border-top: 1px solid var(--line); }
.more { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; }
.more svg { transition: transform .2s; }
.topic.is-link:hover .more svg { transform: translateX(4px); }

/* Список коротких відповідей: хаб /vidpovidi/, головна, блок у статтях — рядки з лініями */
.answer-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-strong); }
.answer-list li { margin: 0; }
.answer-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; padding: 18px 0;
  border-bottom: 1px solid var(--line-strong); color: var(--text); text-decoration: none; transition: padding .2s, color .15s;
}
.answer-list a:hover { padding-left: 10px; color: var(--accent); }
.answer-q { font-size: 1.15rem; font-weight: 600; line-height: 1.25; letter-spacing: -.02em; }
.answer-v {
  flex: none; max-width: min(100%, 15rem); padding: 5px 12px; border-radius: 14px; color: var(--on-verdict);
  font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.answer-v.verdict-good { background: var(--good); }
.answer-v.verdict-bad { background: var(--bad); }
.answer-v.verdict-maybe { background: var(--maybe); }
.answer-all { margin-top: 1.4em; font-weight: 600; }
.answers-block { margin: 2.5em 0; }
@media (max-width: 40rem) {
  .answer-list a { flex-direction: column; align-items: flex-start; }
}

/* Главная: ответы — тёмная плашка, слева заголовок, справа список */
.answers-panel { position: relative; overflow: hidden; isolation: isolate; display: grid; gap: 28px 64px; padding: 32px 20px; border-radius: 28px; }
/* Кабель крупным планом — в пустом углу под заголовком, края растворяются в плашке */
.answers-bg {
  display: none; position: absolute; z-index: -1; left: 0; bottom: 0; width: 50%; height: 58%; max-width: none;
  object-fit: cover; object-position: 0 60%; mix-blend-mode: lighten;
  -webkit-mask-image: linear-gradient(to right, #000 50%, transparent), linear-gradient(to top, #000 55%, transparent);
  mask-image: linear-gradient(to right, #000 50%, transparent), linear-gradient(to top, #000 55%, transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
@media (min-width: 60rem) { .answers-bg { display: block; } }
.answers-panel .section-head { margin: 0; align-content: start; }
.answers-panel .btn { justify-self: start; margin-top: 10px; }
.answers-panel .answer-q { font-size: clamp(1.15rem, 1rem + .6vw, 1.45rem); }
@media (min-width: 60rem) { .answers-panel { grid-template-columns: 1fr 1.25fr; padding: 56px; } }

/* Главная: калькуляторы — цветные плитки */
.calc-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.calc {
  position: relative; display: flex; flex-direction: column; min-height: 17rem; padding: 22px;
  border-radius: var(--radius); background: var(--sky); color: var(--navy); transition: transform .2s;
}
.calc:nth-child(3n+2) { background: var(--lime); }
.calc:nth-child(3n+3) { background: var(--teal); color: #fff; }
.calc:has(a):hover { transform: translateY(-4px); }
.calc:has(a):hover .arrow { background: currentColor; }
.calc:has(a):hover .arrow svg { color: var(--navy); }
.calc:nth-child(3n+3):has(a):hover .arrow svg { color: var(--teal); }
.calc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.calc b { display: block; margin-top: auto; padding-top: 40px; font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); font-weight: 600; line-height: 1.1; letter-spacing: -.04em; }
.calc b a { color: inherit; text-decoration: none; }
.calc b a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.calc b a:focus-visible { outline: none; }
.calc:has(b a:focus-visible) { outline: 2px solid var(--text); outline-offset: 3px; }
.calc-text { margin-top: 10px; font-size: .95rem; line-height: 1.45; opacity: .85; }
.calc .badge { color: inherit; }

/* Главная: о сайте — заголовок слева, текст справа */
.about { display: grid; gap: 28px 64px; padding-top: 28px; border-top: 1px solid var(--text); }
.about-pic { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); }
.about h2 { margin: 0 0 .6em; font-size: clamp(1.8rem, 1.3rem + 2vw, 2.8rem); letter-spacing: -.045em; }
.about p { max-width: 40rem; font-size: 1.08rem; }
@media (min-width: 52rem) { .about { grid-template-columns: 1fr 1.25fr; align-items: start; } }

/* Фото на белом фоне: в тёмной теме остаётся светлой плашкой */
.photo { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #fff; }
.section-photo { margin: 1.8em 0; border-radius: var(--radius); overflow: hidden; }

/* Подвал — тёмная плашка */
.site-footer { margin-top: clamp(4.5rem, 9vw, 8rem); padding-bottom: 16px; font-size: .95rem; }
.footer-panel { padding: 32px 20px 20px; border-radius: 28px; }
.footer-row { display: grid; gap: 20px 64px; }
.footer-logo { font-size: clamp(2.6rem, 1.6rem + 5vw, 5.5rem); gap: .22em; }
.footer-logo svg { width: .82em; height: .82em; }
.site-footer p { margin: .4em 0; max-width: 34rem; }
.site-footer .muted { font-size: 1em; }
.footer-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; margin-top: 32px; padding-top: 14px;
  border-top: 1px solid var(--panel-line);
}
.footer-foot a { color: inherit; text-decoration: none; }
.footer-foot a:hover { color: var(--lime); }
@media (min-width: 52rem) {
  .footer-panel { padding: 48px 40px 24px; }
  .footer-row { grid-template-columns: 1fr 1fr; align-items: end; }
}
