/* Страница кейса в стиле доски: светлое полотно в точку, белые фреймы с подписью сверху,
   слева панель «Слои» как оглавление, снизу панель «На доску / Написать». Блоки из Figma «Кейс: конструктор». */
:root {
  --canvas: #F5F5F5;
  --panel: #FFFFFF;
  --line: #E6E6E6;
  --ink: #1E1E1E;
  --muted: #6B6B6B;
  --soft: #9A9A9A;
  --hover: #F2F2F2;
  --accent: #FF3B30;
  --accent-tint: #FFECEA;
  --paper: #FBF0CD;
  --paper-ink: #3B3220;
  --comp: #9747FF;
  --comp-tint: #F1EAFF;
  --r-sm: 6px;
  --r: 12px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --pad: 56px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 40px; }
body {
  margin: 0; color: var(--ink); font: 400 20px/1.5 "Golos Text", system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  background: var(--canvas) radial-gradient(circle, #D2D2D2 1px, transparent 1.3px) 0 0 / 32px 32px fixed;
}
/* Вход в кейс продолжает «провал» с доски: белый экран тает */
body::after { content: ""; position: fixed; inset: 0; z-index: 50; background: #fff; pointer-events: none; animation: surface .6s ease-out forwards; }
body.is-leaving::after { animation: dive .4s ease-in forwards; }
@keyframes surface { to { opacity: 0; } }
@keyframes dive { from { opacity: 0; } to { opacity: 1; } }
a { color: inherit; }
p, h1, h2, h3, ul, ol, figure, dl, dd { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
.lucide { width: 1em; height: 1em; flex: none; }
:focus-visible { outline: 2px solid var(--comp); outline-offset: 2px; }

/* ---------- Слои: оглавление кейса ---------- */
.layers {
  position: fixed; top: 10px; left: 10px; bottom: 10px; z-index: 15; width: 214px; overflow-y: auto;
  padding: 12px 8px; background: var(--panel); border-radius: 16px; box-shadow: 0 1px 4px rgba(12, 12, 13, .05), 0 1px 4px rgba(12, 12, 13, .1);
}
.layers-h { display: flex; align-items: center; gap: 8px; padding: 4px 0 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.layers-h .lucide { width: 14px; height: 14px; }
.layers ul { list-style: none; padding: 0; display: grid; gap: 1px; }
.layers a {
  height: 33px; padding: 8px 12px; border-radius: var(--r-sm); font-size: 12px; line-height: 1.4; text-decoration: none;
  display: flex; align-items: center; gap: 8px; white-space: nowrap; transition: background-color .15s;
}
.layers a .lucide { width: 12px; height: 12px; color: var(--soft); }
.layers a:hover { background: var(--hover); }
.layers a[aria-current="true"] { background: var(--accent-tint); }
.layers a[aria-current="true"] .lucide { color: var(--accent); }
.layers a.is-comp, .layers a.is-comp .lucide { color: var(--comp); }
.layers a.is-comp[aria-current="true"] { background: var(--comp-tint); }

/* ---------- Колонка блоков ---------- */
.page { padding: 48px 40px 160px 274px; }
.col { max-width: 1200px; margin: 0 auto; display: grid; gap: 96px; }
.blk-label { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font: 600 14px/1.4 "Golos Text", sans-serif; color: var(--muted); }
.blk-label .lucide { width: 14px; height: 14px; }
.is-comp > .blk-label { color: var(--comp); }
.blk-body { display: grid; gap: 32px; padding: var(--pad); background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); }
.kicker { font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--comp); }
.head { display: grid; gap: 12px; }
h1 { font-size: clamp(40px, 5vw, 64px); line-height: 1; font-weight: 700; letter-spacing: -.03em; max-width: 15ch; }
h2 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.lead { font-size: 24px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); }

/* Появление блоков по прокрутке (только когда есть JS) */
.js .blk { opacity: 0; translate: 0 28px; transition: opacity .6s ease, translate .6s cubic-bezier(.2, .8, .2, 1); }
.js .blk.is-in { opacity: 1; translate: none; }

/* ---------- Обложка ---------- */
.hero { display: grid; gap: 24px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .lucide { width: 14px; height: 14px; }
.crumbs .sep { color: var(--soft); }
.crumbs span:last-child { display: inline-flex; align-items: center; gap: 6px; color: var(--comp); }
.meta { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--muted); }
.meta img { width: 28px; height: 28px; }
.cover { border-radius: var(--r); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }

/* ---------- Коротко ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 24px; }
.facts dt { font-size: 16px; color: var(--muted); }
.facts dd { margin-top: 4px; }
/* роль одной фразой: первой строкой на всю ширину */
.facts .is-role { grid-column: 1 / -1; max-width: 62ch; }
.facts .is-role b { font-weight: 600; }

/* ---------- Проблема: текст и стикеры ---------- */
.split { display: grid; grid-template-columns: 1fr 360px; gap: 40px; align-items: start; }
.notes { display: grid; gap: 16px; }
.note {
  padding: 20px 23px 25px; border-radius: var(--r-sm); background: var(--paper); color: var(--paper-ink); font-size: 23px; line-height: 1.38;
  box-shadow: 0 1px 2px rgba(60, 45, 10, .08), 0 14px 26px -12px rgba(60, 45, 10, .28); rotate: var(--rot, 0deg);
}
.note:nth-child(1) { --rot: 1.5deg; }
.note:nth-child(2) { --rot: -1deg; }
.note h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 18px; line-height: 1.2; }
.note h3 .lucide { width: 18px; height: 18px; }

/* ---------- Решение: текст слева, экран с аннотациями справа ---------- */
.dec { display: grid; grid-template-columns: 420px 1fr; gap: 48px; align-items: center; }
.dec-text { display: grid; gap: 16px; align-content: start; }
.num { justify-self: start; padding: 4px 8px; border-radius: var(--r-sm); background: var(--comp-tint); color: var(--comp); font: 500 13px/1.3 var(--mono); }
.chip { display: inline-flex; padding: 4px 10px; border-radius: var(--r-sm); background: var(--hover); color: var(--muted); font-size: 14px; line-height: 1.4; font-weight: 600; }
.chip.is-comp { background: var(--comp); color: #fff; }
.pairs { display: grid; gap: 10px; }
.pair { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: baseline; font-size: 16px; line-height: 1.4; }
.pair .chip { justify-self: start; }
.cost { display: grid; gap: 8px; padding-top: 4px; font-size: 16px; line-height: 1.4; color: var(--muted); }
.cost .chip { justify-self: start; }
.dec.is-wide { grid-template-columns: 1fr; }
.dec.is-wide .dec-text { max-width: 760px; }
.dec.is-wide .pairs { grid-template-columns: 1fr 1fr; gap: 16px; }
.dec.is-wide .pair { grid-template-columns: 1fr; padding: 20px; border-radius: var(--r); background: var(--canvas); font-size: 20px; }
.dec.is-wide .pair:last-child { background: var(--comp-tint); }

/* Экран: координаты аннотаций в процентах картинки; линия идёт от точки до --to (тоже в процентах) */
.shot { position: relative; container-type: inline-size; counter-reset: ann; }
.shot > img, .shot > video { display: block; width: 100%; height: auto; border-radius: var(--r); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }
.ann { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); counter-increment: ann; }
.ann::before {
  content: ""; position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--comp); box-shadow: 0 0 0 2px #fff; transition: scale .3s cubic-bezier(.34, 1.56, .64, 1) var(--d, 0s);
}
.ann i { position: absolute; top: -1px; left: 0; width: calc((var(--to) - var(--x)) * 1cqw); height: 2px; background: var(--comp); transform-origin: 0 50%; transition: scale .35s ease calc(var(--d, 0s) + .15s); }
.ann b {
  position: absolute; top: 0; left: calc((var(--to) - var(--x)) * 1cqw); translate: 0 -50%;
  padding: 5px 10px; border-radius: var(--r-sm); background: var(--comp); color: #fff; font-size: 13px; line-height: 1.3; font-weight: 600; white-space: nowrap;
  transition: opacity .3s ease calc(var(--d, 0s) + .4s), translate .3s ease calc(var(--d, 0s) + .4s);
}
.ann.is-l i { left: auto; right: 0; width: calc((var(--x) - var(--to)) * 1cqw); transform-origin: 100% 50%; }
.ann.is-l b { left: auto; right: calc((var(--x) - var(--to)) * 1cqw); }
.js .shot:not(.is-in) .ann::before, .js .shot:not(.is-in) .ann i { scale: 0; }
.js .shot:not(.is-in) .ann b { opacity: 0; translate: 0 calc(-50% + 6px); }
.ann-legend { display: none; }

/* ---------- Скрытые слои: отвергнутые варианты ---------- */
.hidden { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.hidden article { display: grid; gap: 10px; align-content: start; padding: 20px 20px 24px; border: 1px dashed var(--line); border-radius: var(--r); background: var(--canvas); }
.hidden h3 { display: flex; align-items: center; gap: 8px; font-size: 20px; line-height: 1.3; color: var(--muted); }
.hidden h3 .lucide { width: 18px; height: 18px; color: var(--soft); }
.hidden p { font-size: 16px; line-height: 1.4; color: var(--muted); }

/* ---------- Экраны: галерея с лайтбоксом ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 16px; }
.gallery figure { display: grid; gap: 8px; }
.gallery figcaption { font-size: 14px; line-height: 1.4; color: var(--muted); }
.gallery .image-lightbox-drag__thumb { --image-lightbox-drag-radius: var(--r); --image-lightbox-drag-focus: var(--comp); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }
.gallery .image-lightbox-drag__img { aspect-ratio: 4 / 3; object-fit: contain; background: var(--canvas); } /* экраны разных пропорций вписываются целиком */
.gallery.is-dark .image-lightbox-drag__img { background: #121212; }
.gallery .is-wide { grid-column: 1 / -1; }
/* экраны телефона целиком, по четыре в ряд */
.gallery.is-phones { grid-template-columns: repeat(4, 1fr); gap: 24px 16px; }
/* углы экрана скруглены в самой картинке (прозрачные), поэтому без своей рамки: тень идёт по форме экрана */
.gallery.is-phones .image-lightbox-drag__thumb, .gallery.is-phones .image-lightbox-drag__thumb:hover { overflow: visible; border-radius: 0; box-shadow: none; }
.gallery.is-phones .image-lightbox-drag__img { aspect-ratio: 402 / 874; object-fit: contain; background: none; filter: drop-shadow(0 2px 3px rgba(30, 45, 90, .08)) drop-shadow(0 14px 20px rgba(30, 45, 90, .18)); }
.gallery.is-phones .image-lightbox-drag__frame { background: none; box-shadow: none; border-radius: 0; }
.gallery .is-wide .image-lightbox-drag__img { aspect-ratio: auto; }

/* ---------- Было и стало: два кадра рядом ---------- */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.compare figure { display: grid; gap: 12px; align-content: start; }
.compare .chip { justify-self: start; }
.compare img { border-radius: var(--r); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }
.compare figcaption { font-size: 16px; line-height: 1.4; color: var(--muted); }

/* ---------- Итог ---------- */
.result { display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: start; }
.stats { display: grid; grid-template-columns: minmax(150px, auto) auto; gap: 8px 14px; align-items: baseline; }
.stats dt { font-size: 42px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; }
.stats dd { color: var(--muted); }
.result .note { rotate: -1deg; }
.result.is-solo { grid-template-columns: 1fr; }
.prose { display: grid; gap: 16px; max-width: 70ch; }
.btn { display: inline-flex; align-items: center; gap: 10px; justify-self: start; padding: 12px 20px; border-radius: var(--r-sm); background: var(--ink); color: #fff; font-size: 18px; font-weight: 600; text-decoration: none; transition: background-color .15s; }
.btn:hover { background: #000; }

/* ---------- Вывод и следующий кейс ---------- */
.quote .blk-body { padding-block: 72px; }
.quote .blk-body p { font-size: clamp(30px, 4vw, 48px); line-height: 1.1; font-weight: 700; letter-spacing: -.03em; max-width: 22ch; }
.next a { display: grid; grid-template-columns: 1fr 420px; gap: 40px; align-items: center; padding: 32px var(--pad); background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); text-decoration: none; transition: box-shadow .2s; }
.next a:hover { box-shadow: 0 0 0 2px var(--comp); }
.next .head span { font-size: 14px; font-weight: 600; color: var(--comp); }
.next img { border-radius: var(--r); aspect-ratio: 16 / 9; object-fit: cover; }

/* ---------- Нижняя панель ---------- */
.dock {
  position: fixed; left: calc(50% + 117px); bottom: 16px; translate: -50% 0; z-index: 15; display: flex; gap: 8px; padding: 6px;
  border-radius: var(--r); background: var(--panel); box-shadow: 0 0 0 1px var(--line), 0 10px 28px rgba(0, 0, 0, .08);
}
.dock a { display: inline-flex; align-items: center; gap: 8px; height: 40px; white-space: nowrap; padding: 0 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600; text-decoration: none; transition: background-color .15s; }
.dock a .lucide { width: 18px; height: 18px; }
.dock .back:hover { background: var(--hover); }
.dock .write { background: var(--accent); color: #fff; }
.dock .write:hover { background: #E8352B; }

/* ---------- Узкие экраны ---------- */
@media (max-width: 1100px) {
  .dec { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 759px) {
  :root { --pad: 20px; }
  body { font-size: 17px; }
  .layers { position: sticky; top: 0; left: auto; bottom: auto; width: auto; padding: 8px 12px; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .layers-h { display: none; }
  .layers ul { display: flex; gap: 4px; }
  .layers a { height: 36px; padding: 0 12px; }
  .page { padding: 24px 16px 120px; }
  .col { gap: 48px; }
  .lead, .note { font-size: 19px; }
  h3 { font-size: 21px; }
  .hidden, .result, .next a, .dec.is-wide .pairs, .compare { grid-template-columns: 1fr; }
  .gallery, .gallery.is-phones { grid-template-columns: 1fr 1fr; }
  .stats dt { font-size: 32px; }
  /* аннотации на телефоне: номера на экране, подписи списком под ним */
  .ann i, .ann b { display: none; }
  .ann::before { content: counter(ann); left: -10px; top: -10px; width: 20px; height: 20px; display: grid; place-items: center; color: #fff; font: 600 11px/1 "Golos Text", sans-serif; }
  .ann-legend { display: grid; gap: 6px; margin: 12px 0 0; padding-left: 22px; font-size: 15px; color: var(--muted); }
  .dock { left: 50%; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  body::after { display: none; }
  .js .blk { opacity: 1; translate: none; }
}
