/* Максим Костенко — портфолио. Тёмная «студия» + одна бумажная глава (книги).
   Акцент один: корректорский красный. Углы прямые везде, кроме узлов ComfyUI (копия интерфейса). */

@font-face { font-family: 'Geologica'; src: url(../fonts/geologica-cyrillic-full-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Geologica'; src: url(../fonts/geologica-latin-full-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Literata'; src: url(../fonts/literata-cyrillic-standard-normal.woff2) format('woff2'); font-weight: 200 900; font-display: swap; unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Literata'; src: url(../fonts/literata-latin-standard-normal.woff2) format('woff2'); font-weight: 200 900; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Literata'; font-style: italic; src: url(../fonts/literata-cyrillic-standard-italic.woff2) format('woff2'); font-weight: 200 900; font-display: swap; unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Literata'; font-style: italic; src: url(../fonts/literata-latin-standard-italic.woff2) format('woff2'); font-weight: 200 900; font-display: swap; unicode-range: U+0000-00FF,U+2000-206F; }
@font-face { font-family: 'JetBrains Mono'; src: url(../fonts/jetbrains-mono-cyrillic-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0400-045F; }
@font-face { font-family: 'JetBrains Mono'; src: url(../fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF,U+2000-206F; }
@font-face { font-family: 'JetBrains Mono'; src: url(../fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF,U+2000-206F; }

:root {
  --bg: #fdfdfc;
  --bg-2: #f0f0ee;
  --bg-3: #e4e4e1;
  --ink: #121315;
  --ink-2: #3b3d42;
  --mute: #6b6d72;
  --line: rgba(18, 19, 21, .13);
  --accent: #ef3b1d;          /* корректорский красный */
  --accent-ink: #ffffff;
  --paper: #f3f3f1;
  --paper-ink: #121315;
  --paper-mute: #55575c;
  --paper-line: rgba(18, 19, 21, .12);
  --screen: #111215;          /* тёмный «экран» ComfyUI */
  --pad: clamp(16px, 4vw, 64px);
  --max: 1680px;
  --nav-h: 64px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sans: 'Geologica', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.55 var(--sans); font-variation-settings: 'SHRP' 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, ol, ul, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; transition: top .2s; }
.skip:focus { top: 12px; }

/* зерно плёнки — только на фиксированном слое */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em; white-space: nowrap;
  height: 52px; padding: 0 26px; font-weight: 500; font-size: 16px; letter-spacing: .01em;
  border: 1px solid var(--line); transition: background .35s var(--ease), color .35s var(--ease), border-color .35s, transform .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-small { height: 40px; padding: 0 18px; font-size: 15px; }

/* ---------- навигация ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 var(--pad);
  transition: transform .5s var(--ease), background .4s, color .4s;
}
.nav.solid { background: rgba(253,253,252, .84); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); }
.nav.hide { transform: translateY(-100%); }
.nav-name { font-weight: 600; letter-spacing: -.01em; font-size: 17px; }
.nav-links { display: flex; gap: 28px; font-size: 15px; color: var(--ink-2); }
.nav-links a { position: relative; transition: color .25s; }
.nav-links a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease); }
.nav-links a:hover, .nav-links a.on { color: var(--ink); }
.nav-links a:hover::after, .nav-links a.on::after { transform: scaleX(1); }
body.on-paper .nav.solid { background: rgba(243, 243, 241, .88); color: var(--paper-ink); }
body.on-paper .nav.solid .nav-links { color: var(--paper-mute); }
body.on-paper .nav.solid .nav-links a:hover, body.on-paper .nav.solid .nav-links a.on { color: var(--paper-ink); }
body.on-paper .nav.solid .btn { border-color: var(--paper-line); }
@media (max-width: 900px) { .nav-links { display: none; } }

.section-title {
  font-weight: 600; font-size: clamp(36px, 5.6vw, 88px); line-height: 1.02; letter-spacing: -.035em;
  font-variation-settings: 'SHRP' 0; text-wrap: balance;
}
.lead { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.55; color: var(--ink-2); max-width: 62ch; text-wrap: pretty; }

/* ---------- 1. портрет ---------- */
.hero { position: relative; height: clamp(560px, 82svh, 980px); overflow: hidden; isolation: isolate; }
.hero-photo { position: absolute; inset: 0; z-index: -1; }
.hero-photo picture, .hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 72% 30%; }
.hero-photo img { transform-origin: 70% 40%; will-change: transform, filter; }
.hero-photo::after { /* текстовая сторона темнее, низ уходит в фон страницы */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(253,253,252,.92) 0%, rgba(253,253,252,.5) 38%, rgba(253,253,252,0) 58%),
              linear-gradient(0deg, var(--bg) 0%, rgba(253,253,252,0) 24%);
}
.hero-key { /* «рисующий свет» за курсором: лёгкий подсвет */
  position: absolute; inset: 0; mix-blend-mode: soft-light; opacity: .5; pointer-events: none;
  background: radial-gradient(560px 560px at var(--kx, 70%) var(--ky, 35%), rgba(255, 250, 240, .9), transparent 70%);
}
.hero-copy {
  position: absolute; left: var(--pad); bottom: clamp(40px, 9svh, 110px); width: min(46vw, 760px);
}
.hero-role { color: var(--ink-2); font-size: 16px; margin-bottom: 18px; }
.hero-title {
  font-weight: 700; font-size: clamp(56px, 8.4vw, 150px); line-height: .9; letter-spacing: -.05em;
  font-variation-settings: 'SHRP' 0; margin-left: -.04em;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: .06em; }
.hero-sub { margin-top: 26px; font-size: clamp(18px, 1.5vw, 21px); color: var(--ink-2); max-width: 34ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
@media (max-width: 767px) {
  .hero { height: auto; min-height: 92svh; }
  .hero-photo img { object-position: 50% 18%; }
  .hero-photo::after { background: linear-gradient(0deg, var(--bg) 8%, rgba(253,253,252,.8) 42%, rgba(253,253,252,0) 70%); }
  .hero-copy { position: relative; width: auto; padding: 52svh var(--pad) 40px; left: 0; bottom: 0; }
}

/* ---------- 2. цифры ---------- */
.facts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; max-width: var(--max); margin: 0 auto;
  padding: clamp(40px, 7vw, 96px) var(--pad);
}
.fact { padding: 0 24px 0 0; border-left: 1px solid var(--line); padding-left: 22px; }
.fact b { display: block; font-weight: 300; font-size: clamp(56px, 7.5vw, 128px); line-height: .9; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.fact span { display: block; margin-top: 14px; color: var(--mute); font-size: 15px; max-width: 24ch; }
@media (max-width: 900px) { .facts { grid-template-columns: 1fr 1fr; row-gap: 40px; } }

/* ---------- 3. бренды ---------- */
.brands { padding: clamp(64px, 10vw, 160px) 0 clamp(48px, 8vw, 120px); overflow: hidden; }
.brands .section-title { padding: 0 var(--pad); max-width: var(--max); margin: 0 auto 48px; }
.brand-rows { border-top: 1px solid var(--line); }
.brand-row {
  position: relative; display: grid; grid-template-columns: clamp(96px, 13vw, 220px) 1fr auto; align-items: center; gap: clamp(16px, 2.4vw, 40px);
  padding: 12px var(--pad) 12px; border-bottom: 1px solid var(--line); cursor: default; overflow: hidden;
}
.brand-row .bl { height: clamp(44px, 6vw, 104px); display: flex; align-items: center; }
.brand-row .bl img { max-height: 100%; max-width: 100%; width: auto; height: auto; object-fit: contain; transition: filter .4s, transform .6s var(--ease); }
.brand-row:hover .bl img { filter: brightness(0) invert(1); transform: scale(1.04); }
.brand-row .bn {
  font-weight: 700; font-size: clamp(44px, 9.6vw, 190px); line-height: .92; letter-spacing: -.055em; white-space: nowrap; min-width: 0;
  font-variation-settings: 'SHRP' 0; transition: color .4s, font-variation-settings .6s var(--ease); will-change: transform;
}
.brand-row .bm { text-align: right; color: var(--mute); font-size: 15px; width: 30ch; transition: color .3s; }
.brand-row .bm i { display: block; font-style: normal; color: var(--ink); font-variant-numeric: tabular-nums; }
.brand-row::before { content: ''; position: absolute; inset: 0; background: var(--accent); transform: scaleY(0); transform-origin: bottom; transition: transform .55s var(--ease); z-index: -1; }
.brand-row { isolation: isolate; }
.brand-row:hover::before { transform: scaleY(1); }
.brand-row:hover .bn { color: var(--accent-ink); font-variation-settings: 'SHRP' 100; }
.brand-row:hover .bm, .brand-row:hover .bm i { color: var(--accent-ink); }
@media (max-width: 767px) { .brand-row { grid-template-columns: 88px 1fr; gap: 6px 16px; } .brand-row .bm { grid-column: 1 / -1; text-align: left; width: auto; padding-bottom: 6px; } }
.brand-peek {
  position: fixed; left: 0; top: 0; z-index: 40; width: 300px; pointer-events: none; opacity: 0;
  transform: translate(-50%, -50%) scale(.85) rotate(-4deg); transition: opacity .25s, transform .45s var(--ease);
  box-shadow: 0 30px 80px rgba(20,20,24,.25);
}
.brand-peek.on { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
.brand-peek img { width: 100%; height: auto; }
@media (hover: none) { .brand-peek { display: none; } }

.brand-logos {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: var(--max); margin: clamp(56px, 8vw, 110px) auto 0; padding: 0 var(--pad);
}
.brand-logos .lg { aspect-ratio: 2 / 1; display: grid; place-items: center; border: 1px solid var(--line); margin: -1px 0 0 -1px; padding: 9% 14%; background: #fff; overflow: hidden; min-width: 0; }
.brand-logos .lg img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(1) contrast(1.1); opacity: .8; transition: filter .45s, opacity .45s, transform .6s var(--ease); }
.brand-logos .lg:hover img { filter: none; opacity: 1; transform: scale(1.06); }
@media (max-width: 767px) { .brand-logos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.brand-more { max-width: var(--max); margin: 36px auto 0; padding: 0 var(--pad); color: var(--mute); font-size: 15px; line-height: 1.9; }
.brand-more b { color: var(--ink-2); font-weight: 500; }

/* ---------- 4. доска работ ---------- */
.works { position: relative; padding-top: clamp(64px, 9vw, 140px); }
.works-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; padding: 0 var(--pad) 28px; max-width: var(--max); margin: 0 auto; }
.works-hint { color: var(--mute); margin-top: 14px; max-width: 46ch; }
.works-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 720px; }
.chip { height: 34px; padding: 0 14px; border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); transition: all .25s; }
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip sup { font-size: 10px; margin-left: 3px; opacity: .6; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); }
.view-toggle button { height: 34px; padding: 0 16px; font-size: 14px; color: var(--mute); }
.view-toggle button[aria-pressed='true'] { background: var(--bg-3); color: var(--ink); }
@media (max-width: 767px) { .works-tools { align-items: flex-start; } .chips { justify-content: flex-start; } }

.board { position: relative; height: 100svh; min-height: 560px; overflow: hidden; cursor: grab; touch-action: pan-y; background: var(--bg); }
.board.dragging { cursor: grabbing; }
.board canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.board::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(var(--bg), transparent 14%, transparent 86%, var(--bg)); }
.board-tip {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; padding: 10px 14px; background: var(--ink); color: #fdfdfc;
  font-size: 14px; line-height: 1.3; max-width: 280px; opacity: 0; transform: translate(14px, 14px); transition: opacity .2s;
}
.board-tip.on { opacity: 1; }
.board-tip b { display: block; font-weight: 600; }
.board-tip span { color: #a9abb0; }
.board-count { position: absolute; right: var(--pad); bottom: 28px; z-index: 3; font: 400 13px/1 var(--mono); color: var(--mute); pointer-events: none; }
.board.no-gl { display: none; }

.grid { padding: 0 var(--pad) 40px; max-width: var(--max); margin: 0 auto; columns: 5 260px; column-gap: 14px; }
.grid .gc { break-inside: avoid; margin-bottom: 14px; display: block; width: 100%; text-align: left; }
.grid .gc img { width: 100%; height: auto; background: var(--bg-2); transition: transform .5s var(--ease), opacity .3s; }
.grid .gc:hover img { transform: scale(1.02); }
.grid .gc b { display: block; font-weight: 500; font-size: 15px; margin-top: 8px; }
.grid .gc span { display: block; color: var(--mute); font-size: 13px; }

/* ---------- 5. книги — бумажная глава ---------- */
.books { background: var(--paper); isolation: isolate; color: var(--paper-ink); padding: clamp(80px, 12vw, 180px) 0 clamp(80px, 10vw, 160px); position: relative; }
.books .lead { color: var(--paper-mute); }
.books-intro { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); display: grid; gap: 28px; }
.books-intro .section-title { max-width: 14ch; }
.books-intro .lead { font-size: clamp(19px, 1.7vw, 24px); color: #33353a; max-width: 52ch; }

.fan { height: 280svh; position: relative; margin-top: clamp(56px, 8vw, 120px); }
.fan-sticky { position: sticky; top: 0; height: 100svh; display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; align-items: center; gap: 4vw; padding: 0 var(--pad); max-width: var(--max); margin: 0 auto; overflow: hidden; }
.fan-copy h3 { font-weight: 600; font-size: clamp(28px, 3.2vw, 48px); line-height: 1.05; letter-spacing: -.03em; margin-bottom: 18px; }
.fan-copy p { color: #3b3d42; font-size: 18px; max-width: 40ch; }
.fan-deck { position: relative; height: min(70svh, 640px); }
.fan-deck img { position: absolute; left: 50%; top: 50%; width: auto; height: 78%; transform: translate(-50%, -50%); filter: drop-shadow(0 24px 30px rgba(20, 20, 24, .22)); will-change: transform; cursor: pointer; }
@media (max-width: 767px) { .fan { height: 220svh; } .fan-sticky { grid-template-columns: 1fr; align-content: center; gap: 24px; } .fan-deck { height: 48svh; } }

.shelf { margin-top: clamp(56px, 8vw, 120px); overflow: hidden; }
.shelf h3 { max-width: var(--max); margin: 0 auto 28px; padding: 0 var(--pad); font-weight: 600; font-size: clamp(24px, 2.4vw, 36px); letter-spacing: -.02em; }
.shelf-rows { display: grid; gap: 14px; }
.shelf-row { display: flex; gap: 14px; width: max-content; will-change: transform; }
.shelf-row button { flex: none; height: clamp(150px, 15vw, 230px); background: transparent; transition: transform .45s var(--ease); }
.shelf-row button:hover { transform: translateY(-8px); }
.shelf-row img { height: 100%; width: auto; mix-blend-mode: multiply; }

/* листаемая книга */
.flip { max-width: var(--max); margin: clamp(48px, 7vw, 100px) auto 0; padding: 0 var(--pad); }
.flip-books { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: clamp(24px, 3vw, 40px); }
.flip-books button { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border: 1px solid var(--paper-line); background: rgba(255,255,255,.6); font-size: 14px; color: var(--paper-mute); transition: border-color .3s, color .3s, background .3s; }
.flip-books button img { width: 30px; height: 42px; object-fit: cover; box-shadow: 0 2px 6px rgba(20,20,24,.18); }
.flip-books button:hover { color: var(--paper-ink); border-color: var(--paper-ink); }
.flip-books button[aria-selected='true'] { background: var(--paper-ink); border-color: var(--paper-ink); color: #fff; }
.flip-stage { position: relative; display: grid; place-items: center; min-height: min(78svh, 760px); perspective: 2200px; outline: none; }
.flip-stage { padding-block: 24px; }
.flip-holder { position: relative; z-index: 1; width: 100%; transform-style: preserve-3d; }
.flip-holder .stf__parent { margin: 0 auto; }
.flip-holder > .flip-pages { position: relative; z-index: 2; }
/* переплёт под страницами: крышки цвета обложки с фактурой ткани, корешок, торцы блока */
.book-case, .book-edge { position: absolute; z-index: 0; pointer-events: none; transition: left .75s var(--ease), top .75s var(--ease), width .75s var(--ease), height .75s var(--ease), opacity .5s; }
.flip-holder:not(.fitted) .book-case, .flip-holder:not(.fitted) .book-edge { opacity: 0 !important; }
.flip-holder.instant .book-case, .flip-holder.instant .book-edge, .flip-holder.instant .book-spine { transition: none !important; }
.book-case { border-radius: 4px; background: var(--case, #333); box-shadow: 0 46px 70px -30px rgba(20, 20, 24, .55), 0 14px 26px -10px rgba(20, 20, 24, .3); }
.book-case::before { content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 1px, transparent 1px 3px), repeating-linear-gradient(-45deg, rgba(0,0,0,.07) 0 1px, transparent 1px 3px),
              linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.12)); }
.book-case::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.12); }
.book-spine { position: absolute; top: 0; bottom: 0; left: 50%; width: 4%; transform: translateX(-50%); transition: opacity .4s;
  background: linear-gradient(90deg, rgba(0,0,0,.42), rgba(0,0,0,.08) 35%, rgba(255,255,255,.06) 50%, rgba(0,0,0,.08) 65%, rgba(0,0,0,.42)); }
.book-edge { z-index: 1; z-index: 1; box-shadow: 0 1px 2px rgba(20,20,24,.18); }
.book-edge.side { background: repeating-linear-gradient(90deg, #fbfaf6 0 1px, #dad6cd 1px 2px); }
.book-edge.bottom { background: repeating-linear-gradient(180deg, #fbfaf6 0 1px, #d6d2c8 1px 2px); }
.flip-bar { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 18px; }
.flip-btn { width: 52px; height: 52px; border: 1px solid var(--paper-line); font-size: 20px; transition: background .3s, color .3s, border-color .3s; }
.flip-btn:hover { background: var(--paper-ink); color: #fff; border-color: var(--paper-ink); }
.flip-btn:disabled { opacity: .3; pointer-events: none; }
.flip-count { min-width: 22ch; text-align: center; font-size: 13px; color: var(--paper-mute); }
.flip-cap { text-align: center; margin: 14px auto 0; max-width: 70ch; color: var(--paper-mute); font-size: 15px; }
.flip-cap button { text-decoration: underline; text-underline-offset: 3px; color: var(--paper-ink); }
@media (max-width: 767px) {
  .flip-books { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin-inline: calc(var(--pad) * -1); padding: 0 var(--pad) 4px; scrollbar-width: none; }
  .flip-books::-webkit-scrollbar { display: none; }
  .flip-books button { flex: none; white-space: nowrap; }
  .flip-stage { min-height: auto; }
}

/* ---------- 6. панорама ---------- */
.pano { position: relative; background: var(--bg); }
.pano-pin { height: 100svh; overflow: hidden; display: flex; align-items: center; }
.pano-track { display: flex; align-items: center; gap: clamp(20px, 3vw, 48px); padding: 0 var(--pad); will-change: transform; }
.pano-intro { flex: none; width: min(480px, 80vw); }
.pano-intro p { color: var(--ink-2); margin-top: 22px; font-size: 18px; max-width: 34ch; }
.pano-item { flex: none; position: relative; height: min(72svh, 760px); }
.pano-frame { height: 100%; overflow: hidden; background: var(--bg-2); }
.pano-frame img, .pano-frame video { height: 100%; width: auto; max-width: none; transform: scale(1.1); will-change: transform; }
.pano-item figcaption { position: absolute; left: 0; top: calc(100% + 12px); font-size: 14px; color: var(--mute); width: 100%; max-width: 46ch; }
.pano-item button { position: absolute; inset: 0; }
@media (max-width: 767px) { .pano-item { height: 56svh; } }

/* ---------- 7. нейросети ---------- */
.neuro { padding: clamp(80px, 12vw, 180px) 0 clamp(60px, 8vw, 120px); }
.neuro-intro { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); display: grid; gap: 28px; }
.graph-pin { height: 100svh; position: relative; display: grid; place-items: center; overflow: hidden; }
.graph-screen { position: absolute; left: var(--pad); right: var(--pad); top: 50%; height: calc(var(--gh, 70svh) + 56px); max-height: calc(100svh - var(--nav-h) - 64px); transform: translateY(-50%); background: var(--screen); background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px); background-size: 22px 22px; box-shadow: 0 40px 100px rgba(20,20,24,.25); }
.graph-wrap { width: 100%; height: 100%; display: grid; place-items: center; }
.graph { position: relative; width: 1360px; height: 720px; transform-origin: center; flex: none; }
.graph svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.graph .wire { fill: none; stroke-width: 2.4; }
.graph .wire-flow { fill: none; stroke-width: 2.4; stroke-dasharray: 2 26; stroke-linecap: round; opacity: 0; }
.node {
  position: absolute; width: 230px; background: #2a2b30; border: 1px solid #3a3b42; border-radius: 8px;
  font: 400 11.5px/1.35 var(--mono); color: #c9cbd1; box-shadow: 0 14px 40px rgba(0,0,0,.45);
}
.node-h { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px 8px 0 0; background: #36373d; color: #e7e8ec; font-weight: 500; }
.node-h::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #7d8089; }
.node.run .node-h::before { background: #6ee36e; box-shadow: 0 0 10px #6ee36e; }
.node-b { padding: 6px 10px 8px; display: grid; gap: 4px; }
.node-row { display: flex; justify-content: space-between; gap: 8px; background: #1e1f23; padding: 3px 8px; border-radius: 10px; white-space: nowrap; overflow: hidden; }
.node-row span:last-child { color: #e9eaee; text-overflow: ellipsis; overflow: hidden; }
.node-io { display: flex; justify-content: space-between; color: #9ea1aa; font-size: 10.5px; }
.node-io i { font-style: normal; }
.node-txt { background: #1e1f23; border-radius: 6px; padding: 6px 8px; color: #d7d9de; white-space: normal; max-height: 92px; overflow: hidden; }
.node.green .node-h { background: #2f4a2f; }
.node.purple .node-h { background: #3f3456; }
.node.blue .node-h { background: #2e3f55; }
.node.brown .node-h { background: #4d3b2a; }
.node.out { width: 300px; }
.node.out .node-b { padding: 8px; }
.out-img { position: relative; aspect-ratio: 3 / 4; background: #111; overflow: hidden; border-radius: 4px; }
.out-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.out-img canvas { position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: normal; }
.node .bar { height: 4px; background: #1e1f23; border-radius: 2px; overflow: hidden; }
.node .bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.graph-cap { position: absolute; left: var(--pad); bottom: 22px; color: var(--mute); font-size: 13px; }
.proof { max-width: var(--max); margin: clamp(40px, 6vw, 80px) auto 0; padding: 0 var(--pad); }
.proof img { width: 100%; height: auto; border: 1px solid var(--line); }
.proof figcaption { margin-top: 14px; color: var(--mute); font-size: 13px; }
.ai-strip { display: flex; gap: 14px; margin-top: clamp(56px, 8vw, 110px); padding: 0 var(--pad); overflow-x: auto; scrollbar-width: none; }
.ai-strip::-webkit-scrollbar { display: none; }
.ai-strip button { flex: none; width: clamp(200px, 22vw, 340px); text-align: left; perspective: 900px; }
.ai-strip .tilt { overflow: hidden; aspect-ratio: 3 / 4; background: var(--bg-2); transition: transform .5s var(--ease); transform-style: preserve-3d; }
.ai-strip img { width: 100%; height: 100%; object-fit: cover; }
.ai-strip b { display: block; margin-top: 10px; font-weight: 500; font-size: 15px; }
.ai-strip span { display: block; color: var(--mute); font-size: 13px; }

/* ---------- 8. подход: стопка карточек ---------- */
.approach { padding: clamp(80px, 12vw, 180px) var(--pad) clamp(40px, 6vw, 80px); max-width: var(--max); margin: 0 auto; }
.approach .section-title { margin-bottom: clamp(32px, 5vw, 64px); }
.stack { display: grid; gap: 0; }
.stack-card {
  position: sticky; top: calc(var(--nav-h) + 24px); min-height: 52svh; display: grid; grid-template-columns: 120px 1fr; column-gap: 32px; align-content: start;
  padding: clamp(28px, 4vw, 56px); background: #ffffff; border: 1px solid var(--line); margin-bottom: 18svh; transform-origin: 50% 0;
  box-shadow: 0 -20px 60px rgba(20, 20, 24, .06);
}
.stack-card:nth-child(2) { top: calc(var(--nav-h) + 44px); }
.stack-card:nth-child(3) { top: calc(var(--nav-h) + 64px); }
.stack-card:nth-child(4) { top: calc(var(--nav-h) + 84px); margin-bottom: 0; }
.stack-n { grid-row: span 2; font-weight: 200; font-size: clamp(64px, 8vw, 128px); line-height: .85; color: var(--accent); }
.stack-card h3 { font-weight: 600; font-size: clamp(28px, 3.4vw, 54px); line-height: 1.04; letter-spacing: -.03em; }
.stack-card p { margin-top: 20px; color: var(--ink-2); font-size: clamp(17px, 1.4vw, 20px); max-width: 52ch; }
@media (max-width: 767px) { .stack-card { grid-template-columns: 1fr; } .stack-n { grid-row: auto; margin-bottom: 12px; } }

/* ---------- 9. путь ---------- */
.path { padding: clamp(80px, 12vw, 180px) var(--pad) clamp(60px, 8vw, 120px); max-width: var(--max); margin: 0 auto; }
.path-head { display: grid; gap: 22px; margin-bottom: clamp(40px, 6vw, 80px); }
.path-edu { color: var(--ink-2); max-width: 54ch; font-size: 18px; }
.path-body { display: grid; grid-template-columns: minmax(200px, 0.9fr) 2fr; gap: 4vw; }
.path-year { position: relative; }
.path-year span { position: sticky; top: calc(50svh - .5em); display: block; font-weight: 200; font-size: clamp(80px, 13vw, 240px); line-height: 1; letter-spacing: -.06em; font-variant-numeric: tabular-nums; color: var(--ink); }
.path-list li { display: grid; grid-template-columns: 120px 1fr; gap: 24px; padding: 26px 0; border-top: 1px solid var(--line); opacity: .38; transition: opacity .5s; }
.path-list li.on { opacity: 1; }
.path-list .yr { font: 400 14px/1.6 var(--mono); color: var(--mute); }
.path-list h3 { font-weight: 600; font-size: clamp(20px, 1.8vw, 26px); letter-spacing: -.015em; line-height: 1.2; }
.path-list .rl { color: var(--accent); font-size: 15px; margin-top: 4px; }
.path-list p { color: var(--ink-2); margin-top: 10px; max-width: 60ch; }
@media (max-width: 900px) { .path-body { grid-template-columns: 1fr; } .path-year { display: none; } .path-list li { grid-template-columns: 1fr; gap: 6px; opacity: 1; } }

.refs { margin-top: clamp(64px, 9vw, 130px); border-top: 1px solid var(--line); padding-top: 32px; display: grid; grid-template-columns: minmax(200px, 0.9fr) 2fr; gap: 4vw; }
.refs h3 { font-weight: 600; font-size: 22px; }
.refs-list { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 32px; }
.refs-list b { display: block; font-weight: 500; font-size: 18px; }
.refs-list span { color: var(--mute); font-size: 15px; }
.refs-note { grid-column: 2; color: var(--mute); font-size: 14px; }
@media (max-width: 900px) { .refs { grid-template-columns: 1fr; } .refs-list { grid-template-columns: 1fr; } .refs-note { grid-column: 1; } }

/* ---------- 10. контакт ---------- */
.contact { padding: clamp(80px, 12vw, 180px) var(--pad) 32px; max-width: var(--max); margin: 0 auto; }
.contact-title { font-weight: 700; font-size: clamp(56px, 11vw, 210px); line-height: .9; letter-spacing: -.055em; }
.contact-links { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: clamp(40px, 6vw, 90px); border-top: 1px solid var(--line); }
.contact-big { display: block; padding: 26px 24px 30px 0; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.contact-big span { display: block; color: var(--mute); font-size: 14px; }
.contact-big b { display: block; font-weight: 500; font-size: clamp(20px, 2vw, 30px); margin-top: 8px; letter-spacing: -.01em; transition: color .3s; }
.contact-big::after { content: ''; position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); }
.contact-big:hover::after { transform: scaleX(1); }
.contact-big:hover b { color: var(--accent); }
@media (max-width: 900px) { .contact-links { grid-template-columns: 1fr; } }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: clamp(64px, 9vw, 130px); color: var(--mute); font-size: 14px; }
.foot a:hover { color: var(--ink); }

/* ---------- просмотр работы ---------- */
.viewer { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-columns: 1fr 380px; background: rgba(253,253,252, .985); }
.viewer[hidden] { display: none; }
.viewer-media { position: relative; overflow: hidden; display: grid; place-items: center; padding: 72px 32px 32px; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: calc(100svh - 104px); width: auto; height: auto; object-fit: contain; box-shadow: 0 30px 90px rgba(20,20,24,.18); }
.viewer-media .vm-prev, .viewer-media .vm-next { position: absolute; top: 0; bottom: 0; width: 30%; z-index: 2; }
.viewer-media .vm-prev { left: 0; cursor: w-resize; }
.viewer-media .vm-next { right: 0; cursor: e-resize; }
.viewer-side { border-left: 1px solid var(--line); padding: 84px 28px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.viewer-kind { color: var(--accent); font-size: 14px; }
.viewer-side h2 { font-weight: 600; font-size: 30px; line-height: 1.08; letter-spacing: -.02em; }
.viewer-client { color: var(--ink); font-size: 17px; }
.viewer-role { color: var(--ink-2); font-size: 15px; }
.viewer-note { color: var(--ink-2); font-size: 15px; }
.viewer-pos { color: var(--mute); font-size: 13px; margin-top: 8px; }
.viewer-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.viewer-thumbs button { aspect-ratio: 1; overflow: hidden; background: var(--bg-2); opacity: .5; transition: opacity .2s; outline-offset: 1px; }
.viewer-thumbs button[aria-current='true'] { opacity: 1; outline: 1px solid var(--ink); }
.viewer-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.viewer-nav { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 16px; }
.viewer-nav button { height: 44px; border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.viewer-nav button:hover { border-color: var(--ink); color: var(--ink); }
.viewer-close { position: absolute; right: 20px; top: 16px; height: 40px; padding: 0 16px; border: 1px solid var(--line); font-size: 14px; z-index: 3; background: var(--bg); }
.viewer-close:hover { border-color: var(--ink); }
@media (max-width: 900px) {
  .viewer { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .viewer-media { padding: 64px 12px 12px; }
  .viewer-media img, .viewer-media video { max-height: 58svh; }
  .viewer-side { border-left: 0; border-top: 1px solid var(--line); padding: 18px 16px; max-height: 40svh; }
  .viewer-side h2 { font-size: 22px; }
  .viewer-thumbs { grid-template-columns: repeat(6, 1fr); }
}

/* появление при прокрутке (включается из JS) */
.js [data-reveal] { opacity: 0; transform: translateY(28px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .fan { height: auto; } .fan-sticky { position: relative; height: auto; padding-block: 40px; }
  .fan-deck { height: auto; display: flex; flex-wrap: wrap; gap: 10px; }
  .fan-deck img { position: static; transform: none; height: 220px; }
  .stack-card { position: relative; top: 0; margin-bottom: 16px; }
}
