/* Сайт Вадима Соколова. Токены — docs/DECISIONS.md, композиция — mockups/.
   Сначала телефон, затем планшет (≥ 768) и компьютер (≥ 1280; схема фонда — с 1240). */

:root {
  --bg: #f8f9f7;
  --text: #121d27;
  --text-2: #566372;
  --caption: #5b6878;
  --line: #d5dce2;
  --dark: #0d1b27;
  --dark-hover: #1c3042;
  --frame: #0a141d;
  --mint: #99e8cb;
  --teal: #00866f;
  --teal-text: #007560;
  --brick: #b4513a;
  --on-dark: #f3f9f8;
  --on-dark-2: #c3d0d8;
  --on-dark-3: #a9bfcc;
  --on-dark-accent: #d7f3ea;

  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --gutter: clamp(20px, 8px + 4.1vw, 64px);
  --max: 1238px;
  --header-h: 112px;   /* высота шапки по макету */
  --hdr: 112px;        /* фактическая высота шапки с линией; уточняет main.js */
  --ftr: 63px;         /* фактическая высота подвала; уточняет main.js */
  --section-pad: 32px; /* минимальный отступ раздела сверху и снизу */
  --radius: 10px;
}

@media (min-width: 768px) {
  :root { --section-pad: 40px; }
}
@media (min-width: 1100px) {
  :root { --ftr: 76px; }
}
@media (min-width: 1280px) {
  /* На 1366 × 768 каждый раздел помещается в один экран, как в макетах */
  :root { --header-h: 84px; --hdr: 84px; --section-pad: 22px; }
}

/* ---------- База ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  /* Якоря и фокус с клавиатуры не уходят под закреплённую шапку */
  scroll-padding-top: var(--hdr);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--teal); }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; background: var(--dark); color: #fff; border-radius: 4px;
}
.skip-link:focus { top: 12px; color: #fff; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

.br-desktop { display: none; }
@media (min-width: 1240px) { .br-desktop { display: inline; } }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 4px; cursor: pointer;
  font-family: var(--sans); font-weight: 500;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn--dark { background: var(--dark); color: #fff; }
.btn--dark:hover { background: var(--dark-hover); color: #fff; }
.btn--lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn--outline { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--dark); }
.btn--outline:hover { background: var(--dark); color: #fff; }
.btn--header { padding: 14px 24px; font-size: 15px; line-height: 20px; white-space: nowrap; }

/* ---------- Шапка ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand tools" "nav nav";
  column-gap: 16px; row-gap: 12px;
  min-height: calc(var(--header-h) - 1px); /* + линия шапки = высота по макету */
  padding-top: 12px;
}
.brand { grid-area: brand; display: flex; flex-direction: column; gap: 4px; max-width: 290px; }
.brand:hover { color: var(--text); }
.brand__name {
  font-family: var(--serif); font-size: 20px; line-height: 20px;
  letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
}
.brand__tagline { font-size: 12px; line-height: 16px; color: var(--caption); }

.site-header__tools { grid-area: tools; display: flex; align-items: flex-start; gap: 24px; }
.btn--header { display: none; }

.lang-switch { display: flex; gap: 6px; font-size: 14px; line-height: 20px; color: var(--caption); }
.lang-switch__item { color: var(--caption); border-bottom: 2px solid transparent; }
.lang-switch__item.is-current { color: var(--text); font-weight: 600; border-bottom-color: var(--teal); }
.lang-switch__item.is-unavailable { opacity: 0.55; cursor: default; }

.site-nav { grid-area: nav; align-self: end; }
.site-nav ul { display: flex; justify-content: space-between; }
.site-nav a {
  display: block; padding-bottom: 5px;
  font-size: 14px; line-height: 20px;
  border-bottom: 2px solid transparent;
}
.site-nav a.is-active { border-bottom-color: var(--teal); color: var(--text); }

@media (min-width: 640px) {
  .site-header__tools { align-items: center; }
  .btn--header { display: inline-flex; padding: 10px 18px; font-size: 14px; }
  .brand { max-width: none; }
  .site-nav ul { justify-content: flex-start; gap: 32px; }
}

@media (min-width: 1280px) {
  .site-header__inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav tools";
    align-items: center;
    padding-top: 0;
  }
  .brand__name { font-size: 28px; line-height: 28px; }
  .brand__tagline { font-size: 13px; line-height: 18px; }
  .site-nav { align-self: center; justify-self: center; }
  .site-nav ul { gap: 24px; }
  .site-nav a { font-size: 16px; line-height: 24px; padding-bottom: 6px; padding-top: 8px; }
  .lang-switch { gap: 8px; }
  .lang-switch__item { padding-bottom: 2px; }
  .btn--header { padding: 14px 20px; font-size: 15px; }
}
@media (min-width: 1366px) {
  .brand__tagline { font-size: 14px; }
  .site-nav ul { gap: 36px; }
  .btn--header { padding: 14px 24px; }
}

/* Самые узкие телефоны: пять пунктов меню в одну строку */
@media (max-width: 359px) {
  .site-nav a { font-size: 13px; }
}

/* ---------- Общие элементы разделов ---------- */

/* Каждый раздел — не ниже экрана под шапкой, содержимое по центру.
   Переход по меню ставит раздел ровно под шапку, соседей в кадре нет. */
.hero, .section {
  min-height: calc(100vh - var(--hdr));
  min-height: calc(100svh - var(--hdr));
  display: flex; flex-direction: column; justify-content: center;
  padding-block: var(--section-pad);
}
/* Контакт вместе с подвалом занимает последний экран */
.section--contact {
  min-height: calc(100vh - var(--hdr) - var(--ftr));
  min-height: calc(100svh - var(--hdr) - var(--ftr));
}

.h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(32px, 29.6px + 0.62vw, 40px);
  line-height: 1.1; letter-spacing: -0.02em;
  text-wrap: balance;
}
.h2--contact { font-size: clamp(36px, 33.6px + 0.62vw, 42px); }

.section-head { display: grid; gap: 16px; margin-bottom: 36px; }
.section-head__lead {
  font-size: 17px; line-height: 26px; color: var(--text-2);
  max-width: 1040px; text-wrap: pretty;
}
.eyebrow {
  font-size: 14px; line-height: 20px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-text);
  margin-bottom: -8px;
}
.label {
  display: block;
  font-size: 14px; line-height: 20px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal-text);
}

@media (min-width: 1200px) {
  .section-head { gap: 8px; margin-bottom: 24px; }
  .section-head__lead { font-size: 18px; line-height: 28px; }
  .section-head__lead--full { font-size: 17px; line-height: 26px; max-width: none; text-wrap: balance; }
  .section-head--split {
    grid-template-columns: auto minmax(0, 560px);
    justify-content: space-between; align-items: start; column-gap: 48px;
    margin-bottom: 22px;
  }
  .section-head--split .section-head__lead { font-size: 17px; line-height: 26px; margin-top: 2px; text-wrap: balance; }
  .h2--nowrap-desktop { white-space: nowrap; }
}

/* ---------- Первый экран ---------- */

.hero { padding-block: 28px 40px; }
.hero__grid { display: grid; gap: 36px; }
.hero__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(40px, 33.6px + 1.64vw, 56px);
  line-height: 1.08; letter-spacing: -0.02em;
  text-wrap: balance;
}
.hero__lead {
  margin-top: 20px; max-width: 560px;
  font-size: 17px; line-height: 26px; color: var(--text-2);
}
.hero__exp { margin-top: 16px; font-size: 16px; line-height: 24px; font-weight: 500; }
/* EN на телефоне: без принудительного переноса после двоеточия (иначе слово повисает на строке) */
@media (max-width: 767.98px) { :lang(en) > .hero__lead br { display: none; } }
.hero__actions { margin-top: 24px; display: grid; gap: 12px; }

.hero__preview { position: relative; }
.preview {
  position: relative; display: block; width: 100%;
  padding: 0 0 20px; border: 0; background: none; cursor: pointer; text-align: left;
}
.preview:focus-visible { outline: none; }
.preview:focus-visible .preview__frame { outline: 2px solid var(--teal); outline-offset: 4px; }
.preview__frame {
  display: block; padding: 10px;
  background: var(--frame);
  border: 1px solid rgba(153, 232, 203, 0.18);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(13, 27, 39, 0.14);
  transition: box-shadow .25s, transform .25s;
}
.preview__frame img { width: 100%; height: auto; aspect-ratio: 1405 / 857; border-radius: 6px; object-fit: cover; }
.preview__pill {
  position: absolute; left: 16px; bottom: 0;
  height: 40px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; color: var(--dark); border-radius: 20px;
  box-shadow: 0 6px 16px rgba(13, 27, 39, 0.18);
  font-size: 14px; line-height: 20px; font-weight: 600;
  transition: background-color .2s, color .2s;
}
.preview__arrow { flex: none; transition: transform .2s; }
.preview:hover .preview__frame { box-shadow: 0 16px 36px rgba(13, 27, 39, 0.22); }
.preview:hover .preview__pill { background: var(--mint); }
.preview:hover .preview__arrow { transform: translate(2px, -2px); }
.preview__caption {
  margin-top: 16px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px;
  font-size: 14px; line-height: 20px; color: var(--caption);
}

@media (min-width: 768px) {
  .hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 40px; }
  .hero__secondary {
    height: auto; padding: 0 0 4px; border-radius: 0;
    background: none; box-shadow: inset 0 -1.5px 0 var(--text);
  }
  .hero__secondary:hover { background: none; color: var(--teal); box-shadow: inset 0 -1.5px 0 var(--teal); }
  .hero__preview { max-width: 640px; }
}

@media (min-width: 960px) {
  .hero { padding-block: 32px; }
  .hero__grid {
    grid-template-columns: minmax(0, 620fr) minmax(0, 602fr);
    align-items: center; gap: 16px;
  }
  .hero__text { display: flex; flex-direction: column; gap: 28px; }
  .hero__lead { margin-top: 0; font-size: 19px; line-height: 30px; }
  .hero__exp { margin-top: -8px; font-size: 17px; }
  .hero__actions { margin-top: 8px; }
  .hero__preview { max-width: none; padding-top: 56px; }
  .preview { padding-bottom: 22px; }
  .preview__frame { padding: 16px; }
  .preview__pill { left: 24px; padding: 0 18px; }
  .preview__caption { margin-top: 14px; }
}

/* ---------- Подход: айсберг ---------- */

.iceberg { display: grid; gap: 28px; }
.iceberg__visual {
  position: relative; overflow: hidden;
  border-radius: var(--radius); background: var(--dark);
  aspect-ratio: 342 / 425;
}
.iceberg__img, .iceberg__visual picture { position: absolute; inset: 0; width: 100%; height: 100%; }
.iceberg__img { object-fit: cover; }
.iceberg__svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.iceberg__svg--desktop { display: none; }

.ice-line { fill: none; stroke: #8df0d6; stroke-opacity: 0.9; stroke-width: 1.2; stroke-linejoin: round; transition: stroke .2s, stroke-opacity .2s, stroke-width .2s; }
.ice-dot { fill: var(--mint); transition: r .2s, fill .2s, opacity .2s; }
.ice-ring { fill: none; stroke: var(--mint); stroke-opacity: 0.35; stroke-width: 1; transition: opacity .2s; }
.ice-glow { opacity: 0; transition: opacity .3s; }

.iceberg__tags { position: absolute; inset: 0; }
.iceberg__tag {
  position: absolute; left: 69.6%; right: 2%; top: var(--y);
  transform: translateY(-50%);
  /* Область подписи сужается вместе с картинкой, поэтому на узких экранах шрифт уменьшается вместе с ней
     (от 364 px и шире — прежние 12 px); иначе слово не помещается и обрезается краем картинки */
  font-size: clamp(9.5px, 3.3vw, 12px); line-height: 16px; font-weight: 500; color: var(--on-dark);
}
.iceberg__tag--top { left: 73.1%; font-family: var(--serif); font-size: clamp(13px, 4.4vw, 16px); line-height: 22px; font-weight: 400; }

.iceberg__layers { display: grid; }
.layer {
  position: relative;
  padding: 18px 0 18px 40px;
  border-top: 1px solid var(--line);
}
.layer--top { padding-top: 0; border-top: 0; }
.layer__dot {
  position: absolute; left: 6px; top: 24px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--mint); border: 1.5px solid var(--dark);
}
.layer--top .layer__dot { left: 0; top: 0; width: 26px; height: 26px; }
.layer__title { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 26px; }
.layer__problem { margin-top: 4px; font-size: 14px; line-height: 20px; color: var(--text-2); }
.layer__action { margin-top: 4px; font-size: 14px; line-height: 20px; font-weight: 500; }

@media (min-width: 720px) and (max-width: 1279.98px) {
  .iceberg { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 40px; align-items: start; }
  .iceberg__visual { position: sticky; top: calc(var(--hdr) + 24px); }
}

/* Компьютер: подписи слоёв справа от айсберга, линии к точкам на картинке */
@media (min-width: 1280px) {
  .iceberg { display: block; position: relative; }
  .iceberg__visual { aspect-ratio: 1238 / 543; }
  .iceberg__svg--mobile, .iceberg__tags { display: none; }
  .iceberg__svg--desktop { display: block; }

  .iceberg__layers {
    position: absolute; inset: 0;
    display: block; pointer-events: none;
  }
  .layer {
    position: absolute; left: 44.75%; width: 53.6%;
    padding: 0; border: 0; border-radius: 8px;
    pointer-events: auto;
    transition: opacity .25s, background-color .25s, box-shadow .25s;
  }
  .layer[data-layer="0"] { top: 10.31%; }
  .layer[data-layer="1"] { top: 25.23%; }
  .layer[data-layer="2"] { top: 43.28%; }
  .layer[data-layer="3"] { top: 61.33%; }
  .layer[data-layer="4"] { top: 79.37%; }
  .layer__dot { display: none; }
  .layer__title { font-size: 22px; line-height: 24px; color: var(--on-dark); transition: color .25s; }
  .layer__problem { margin-top: 3px; line-height: 19px; color: var(--on-dark-3); }
  .layer__action { margin-top: 3px; line-height: 19px; color: var(--on-dark-accent); }

  /* Подсветка слоя при наведении (класс ставит main.js) */
  .layer:hover { background: rgba(153, 232, 203, 0.08); box-shadow: 0 0 0 4px rgba(153, 232, 203, 0.08); }
  .layer:hover .layer__title { color: var(--mint); }
  .iceberg.has-active .layer:not(:hover) { opacity: 0.45; }
  .iceberg.has-active .ice-line { stroke-opacity: 0.25; }
  .iceberg.has-active .ice-dot, .iceberg.has-active .ice-ring { opacity: 0.35; }
  .iceberg .ice-glow.is-active { opacity: 1; }
  .iceberg .ice-line.is-active { stroke: #fff; stroke-opacity: 1; stroke-width: 2; }
  .iceberg .ice-dot.is-active { r: 7; fill: #fff; opacity: 1; }
  .iceberg .ice-ring.is-active { opacity: 1; }
}

/* ---------- Подход: схема работы ---------- */

.section--process .section-head__lead { font-size: 17px; }

.steps { display: grid; }
.step { position: relative; padding: 0 0 32px 40px; }
.step::before {
  content: ""; position: absolute; left: 6px; top: 20px; bottom: 0;
  width: 1.5px; background: var(--teal); opacity: 0.45;
}
.step:last-child { padding-bottom: 8px; }
.step:last-child::before { display: none; }
.step__head { display: contents; }
.step__num {
  float: left; margin-right: 12px;
  font-family: var(--serif); font-size: 24px; line-height: 30px; color: var(--teal);
}
.step__dot {
  position: absolute; left: 0; top: 8px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--teal);
}
.step__title { font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 30px; }
.step__text { clear: both; margin-top: 8px; font-size: 16px; line-height: 24px; color: var(--text-2); }
.step__result { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.step__result p { margin-top: 4px; font-size: 16px; line-height: 24px; font-weight: 500; }

.theses {
  margin-top: 16px; padding-block: 28px;
  border-block: 1px solid var(--line);
  display: grid; gap: 16px;
}
.thesis {
  display: flex; gap: 14px; align-items: flex-start;
  font-family: var(--serif); font-size: 22px; line-height: 30px;
}
.thesis__icon { flex: none; width: 26px; height: 26px; margin-top: 2px; }
.thesis--up .thesis__icon { color: var(--teal); }
.thesis--down .thesis__icon { color: var(--brick); }
.footnote { margin-top: 20px; font-size: 14px; line-height: 20px; color: var(--text-2); }

@media (min-width: 768px) {
  .steps, .theses, .footnote { max-width: 760px; }
}

@media (min-width: 1100px) {
  .steps {
    max-width: none;
    position: relative;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: auto auto auto auto;
    column-gap: 39px;
  }
  /* Общая линия с наконечником */
  .steps::before {
    content: ""; position: absolute; left: 6px; right: 6px; top: 53px;
    height: 1.5px; background: var(--teal);
  }
  .steps::after {
    content: ""; position: absolute; right: 7px; top: 49px;
    width: 9px; height: 9px;
    border-top: 1.5px solid var(--teal); border-right: 1.5px solid var(--teal);
    transform: rotate(45deg);
  }
  .step {
    display: grid; grid-row: span 4; grid-template-rows: subgrid;
    padding: 0;
  }
  .step::before { display: none; }
  .step__head { display: block; position: relative; height: 74px; }
  .step__num { float: none; display: block; margin: 0; font-size: 30px; line-height: 36px; }
  .step__dot { left: 0; top: 48px; width: 12px; height: 12px; }
  .step__title { font-size: 24px; line-height: 30px; min-height: 60px; }
  .step__text { margin-top: 8px; }
  .step__result { margin-top: 0; align-self: start; padding-top: 12px; }
  .step__result p { margin-top: 4px; }
  .steps .step__text { padding-bottom: 8px; }

  .theses, .footnote { max-width: none; }
  .theses {
    margin-top: 12px; padding-block: 14px;
    grid-template-columns: 1fr 1fr; gap: 0;
  }
  .thesis { font-size: 24px; line-height: 32px; padding-right: 40px; }
  .thesis__icon { width: 28px; height: 28px; margin-top: 1px; }
  .thesis--down { padding-left: 38px; border-left: 1px solid var(--line); }
  .footnote { margin-top: 12px; }
}

/* ---------- Примеры ---------- */

.section--examples .section-head__lead--wide { max-width: 1040px; }
.cards { display: grid; gap: 20px; }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--dark); color: var(--on-dark);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .25s, box-shadow .25s;
}
.card__media { aspect-ratio: 342 / 170; background: var(--frame); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.card__body { flex: 1; display: flex; flex-direction: column; padding: 20px; }
.card__title { font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 28px; }
.card__status {
  margin-top: 8px; display: flex; align-items: center; gap: 8px;
  font-size: 13px; line-height: 18px; color: var(--mint);
}
.card__status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.card__text { margin-top: 8px; font-size: 14px; line-height: 21px; color: var(--on-dark-2); }
.card__cta {
  margin-top: 16px; height: 44px; width: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--mint); color: var(--dark);
  border: 0; border-radius: 4px; cursor: pointer;
  font-size: 14px; font-weight: 600;
  transition: background-color .2s;
}
/* Вся карточка кликабельна: зона кнопки растянута на карточку */
.card__cta::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card__cta:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(13, 27, 39, 0.22); }
.card:hover .card__cta { background: #b5f0da; }

@media (min-width: 640px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 23px; }
  .card { min-height: 424px; }
  .card__media { aspect-ratio: 292 / 178; }
  .card__text { margin-top: 12px; }
  .card__cta { margin-top: auto; height: 42px; }
  .card__body { padding-bottom: 22px; }
  .card__text { margin-bottom: 24px; }
}

/* ---------- Опыт ---------- */

.case {
  background: var(--dark); color: var(--on-dark);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: grid;
}
.case__eyebrow { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--mint); }
.case__title {
  margin-top: 8px;
  font-family: var(--serif); font-weight: 400;
  font-size: 28px; line-height: 34px; letter-spacing: -0.01em;
}
.case__body { margin-top: 16px; font-size: 16px; line-height: 26px; color: var(--on-dark-2); }

.case__diagram { margin-top: 24px; position: relative; }
.hub-links { display: none; }
.hub {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px; text-align: center;
  border-radius: var(--radius);
  background: rgba(130, 230, 210, 0.12);
  border: 1px solid rgba(95, 214, 189, 0.9);
}
.hub__title { font-family: var(--serif); font-size: 22px; line-height: 27px; }
.hub__text { font-size: 14px; line-height: 20px; color: #b6d3d3; }
.hub-stem { display: block; margin: 0 auto; width: 1.5px; height: 20px; background: #7be3cc; opacity: 0.75; }

.nodes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.node {
  min-height: 80px; padding: 12px;
  display: flex; flex-direction: column; justify-content: center;
  background: rgba(130, 230, 210, 0.07);
  border: 1px solid rgba(95, 214, 189, 0.6);
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.node:nth-child(n+5) { grid-column: 1 / -1; }
.node__title { font-size: 15px; line-height: 20px; font-weight: 600; color: var(--on-dark); hyphens: auto; }
.node__note { margin-top: 2px; font-size: 14px; line-height: 18px; color: var(--on-dark-2); }
.node__extra::before { content: ", "; }

.case__facts { margin-top: 20px; text-align: center; font-size: 14px; line-height: 20px; color: var(--on-dark-3); }
.case__badge { margin-top: 8px; text-align: center; font-size: 14px; line-height: 20px; color: #8fa6b4; }

.tools { margin-top: 24px; font-size: 15px; line-height: 22px; color: var(--text-2); }
.tools strong { font-weight: 600; color: var(--text); }

@media (min-width: 768px) {
  .case { padding: 32px; }
  .nodes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .node:nth-child(n+5) { grid-column: auto; }
}

/* Компьютер: текст слева, схема с кругом справа (702 × 320) */
@media (min-width: 1240px) {
  .case {
    position: relative;
    grid-template-columns: minmax(300px, 420px) 702px;
    justify-content: space-between;
    column-gap: 40px;
    padding: 28px 40px 28px 36px;
    min-height: 420px;
  }
  .case__title { font-size: 32px; line-height: 38px; }
  .case__body { margin-top: 18px; }
  .case__diagram {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 210px 1fr 210px;
    grid-template-rows: repeat(3, 100px);
    row-gap: 10px;
    align-self: start;
  }
  .hub-links {
    display: block; position: absolute; left: 0; top: 0;
    width: 702px; height: 320px; overflow: visible; pointer-events: none;
  }
  .hub-links path { fill: none; stroke: #7be3cc; stroke-opacity: 0.75; stroke-width: 1.4; stroke-linecap: round; }
  .hub {
    grid-column: 2; grid-row: 1 / 4; align-self: center; justify-self: center;
    position: relative;
    width: 200px; height: 200px; border-radius: 50%;
    padding: 0 24px; justify-content: center;
  }
  .hub__text { font-size: 12px; line-height: 17px; }
  .hub-stem { display: none; }
  .nodes { display: contents; }
  .node {
    position: relative; min-height: 0; height: 100px;
    padding: 0 14px;
  }
  .node:nth-child(-n+3) { grid-column: 1; }
  .node:nth-child(n+4) { grid-column: 3; }
  .node:nth-child(1), .node:nth-child(4) { grid-row: 1; }
  .node:nth-child(2), .node:nth-child(5) { grid-row: 2; }
  .node:nth-child(3), .node:nth-child(6) { grid-row: 3; }
  .node__title { font-size: 17px; line-height: 22px; hyphens: manual; }
  .node__note { margin-top: 3px; }
  .node__extra { display: block; }
  .node__extra::before { content: none; }
  .case__facts {
    grid-column: 1 / -1; grid-row: 4;
    margin-top: 20px; font-size: 15px; line-height: 22px; color: var(--on-dark-2);
  }
  .case__badge {
    position: absolute; left: 36px; bottom: 22px;
    margin: 0; text-align: left; color: var(--on-dark-3);
  }
}

/* ---------- Контакт ---------- */

.contact { display: grid; gap: 32px; }
.contact__lead { margin-top: 20px; font-size: 17px; line-height: 26px; color: var(--text-2); max-width: 580px; }

.channels {
  background: var(--dark); border-radius: var(--radius);
  padding: 20px; display: grid; gap: 12px;
}
.channel {
  min-height: 76px; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(153, 232, 203, 0.08);
  border: 1px solid rgba(153, 232, 203, 0.55);
  border-radius: 6px;
  color: var(--on-dark);
  transition: background-color .2s, color .2s;
}
.channel__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.channel__label { font-family: var(--serif); font-size: 22px; line-height: 28px; }
/* Адрес в одну строку: на узких экранах шрифт чуть меньше (и поля карточек уже, см. ниже);
   переносить посреди слова придётся, только если места не хватает совсем (уже 280 px) */
.channel__handle { font-size: clamp(11.5px, 3.7vw, 14px); line-height: 20px; color: var(--on-dark-3); overflow-wrap: break-word; transition: color .2s; }
.channel__arrow { flex: none; width: 20px; height: 20px; color: var(--mint); transition: color .2s, transform .2s; }
.channel:hover, .channel:focus-visible { background: var(--mint); color: var(--dark); }
.channel:hover .channel__handle, .channel:focus-visible .channel__handle,
.channel:hover .channel__arrow, .channel:focus-visible .channel__arrow { color: var(--dark); }
.channel:hover .channel__arrow { transform: translate(2px, -2px); }
.channel:focus-visible { outline-color: var(--mint); }

.copy-btn {
  margin-top: 16px; height: 44px; padding: 0 4px;
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 0; border-bottom: 1.5px solid var(--text); border-radius: 0;
  font-size: 15px; line-height: 20px; font-weight: 500; color: var(--text);
  cursor: pointer;
}
.copy-btn:hover { color: var(--teal); border-bottom-color: var(--teal); }
.copy-status { min-height: 20px; margin-top: 8px; font-size: 14px; line-height: 20px; color: var(--teal-text); }

/* Самые узкие экраны (до 360 px): поля карточек меньше, чтобы адрес почты поместился в одну строку */
@media (max-width: 359.98px) {
  .channels { padding: 14px; }
  .channel { padding: 12px 14px; }
}

@media (min-width: 1100px) {
  .contact {
    grid-template-columns: minmax(0, 640px) minmax(0, 542px);
    justify-content: space-between; align-items: center;
  }
  .contact__lead { margin-top: 24px; font-size: 19px; line-height: 30px; }
  .contact__actions { padding-top: 24px; }
  .channels { padding: 36px; gap: 18px; }
  .channel { height: 78px; padding: 0 28px; }
  .channel__text { flex-direction: row; align-items: center; justify-content: space-between; flex: 1; gap: 16px; }
  .channel__label { font-size: 24px; line-height: 30px; }
  .channel__handle { font-size: 15px; white-space: nowrap; overflow-wrap: normal; }
  .copy-btn { margin-top: 20px; }
}

/* ---------- Подвал ---------- */

.site-footer__inner {
  padding-block: 16px 28px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.site-footer__copy { font-size: 12px; line-height: 18px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--caption); }
.site-footer__top { font-size: 13px; line-height: 18px; color: var(--caption); }
@media (min-width: 1100px) {
  .site-footer__inner { padding-block: 21px 36px; }
}

/* ---------- Низкие окна ---------- */
/* Ноутбуки дают браузеру ~ 650–760 px высоты: плотнее отступы и интервалы, чтобы раздел
   помещался в экран. Размеры шрифтов и композиция не меняются. */
@media (min-width: 1280px) and (max-height: 759px) {
  :root { --section-pad: 12px; }
  .hero { padding-block: 16px; }
  .section-head { margin-bottom: 14px; gap: 4px; }
  .section-head--split { margin-bottom: 14px; }
  /* Этапы: линия и точки привязаны к высоте шапки шага */
  .step__head { height: 62px; }
  .steps::before { top: 41px; }
  .steps::after { top: 37px; }
  .step__dot { top: 36px; }
  .steps .step__text { padding-bottom: 4px; }
  .theses { margin-top: 8px; padding-block: 8px; }
  .footnote { margin-top: 8px; }
  /* Опыт */
  .case { padding-block: 18px; min-height: 0; }
  .case__facts { margin-top: 10px; }
  .case__badge { bottom: 14px; }
  .tools { margin-top: 14px; }
}

/* ---------- Окно с интерактивным примером ---------- */

html.is-modal-open { overflow: hidden; }

.demo-modal {
  position: fixed; inset: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--frame); color: var(--on-dark);
  overflow: hidden;
}
.demo-modal[open] { display: flex; flex-direction: column; }
.demo-modal::backdrop { background: rgba(10, 20, 29, 0.72); }

.demo-modal__bar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 8px 12px 8px 16px;
  border-bottom: 1px solid rgba(153, 232, 203, 0.18);
}
.demo-modal__heading { min-width: 0; }
.demo-modal__title {
  font-family: var(--serif); font-weight: 400; font-size: 18px; line-height: 24px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.demo-modal__note { font-size: 12px; line-height: 16px; color: var(--on-dark-3); }
.demo-modal__hint { display: none; }
.demo-modal__close {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  background: rgba(153, 232, 203, 0.08); color: var(--on-dark);
  border: 1px solid rgba(153, 232, 203, 0.45); border-radius: 6px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background-color .2s, color .2s;
}
.demo-modal__close:hover { background: var(--mint); color: var(--dark); }
.demo-modal__close:focus-visible { outline-color: var(--mint); }

/* Телефон вертикально: подсказка отдельной строкой под заголовком */
.demo-modal__bar { flex-wrap: wrap; row-gap: 6px; }
.demo-modal__mobile-hint {
  flex-basis: 100%;
  font-size: 12px; line-height: 16px; color: var(--mint);
}
@media (min-width: 768px) {
  .demo-modal__mobile-hint { display: none; }
}

.demo-modal__body { position: relative; flex: 1; min-height: 0; background: #fff; }
.demo-modal__frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

.demo-modal__state {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 24px; text-align: center;
  background: var(--frame); color: var(--on-dark-2);
  font-size: 15px; line-height: 22px;
}
.demo-modal__state[hidden] { display: none; }
.demo-modal__state p { max-width: 420px; }
.demo-modal__spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(153, 232, 203, 0.25); border-top-color: var(--mint);
  animation: demo-spin .9s linear infinite;
}
@keyframes demo-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .demo-modal__spinner { animation: none; } }
.demo-modal__action {
  height: 44px; padding: 0 20px;
  background: var(--mint); color: var(--dark);
  border: 0; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.demo-modal__action:focus-visible { outline-color: var(--mint); }

/* Компьютер и планшет: почти весь экран, видна рамка страницы.
   Телефон горизонтально (низкий экран) — на весь экран, без рамки. */
@media (min-width: 768px) and (min-height: 501px) {
  .demo-modal {
    inset: 24px; width: auto; height: auto;
    border: 1px solid rgba(153, 232, 203, 0.18); border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  }
}
@media (min-width: 768px) {
  .demo-modal__bar { padding: 8px 16px 8px 24px; }
  .demo-modal__title { font-size: 20px; line-height: 26px; }
  .demo-modal__note { font-size: 13px; line-height: 18px; }
  .demo-modal__hint { display: inline; }
}
