/* Миктера · «Объём»: липкая сцена истории.
   .story-on (JS и без reduced-motion) — сцена липкая, главы наложены и меняются по прогрессу;
   без неё главы идут обычными экранами друг под другом. */

.story { position: relative; --stage-bg: var(--orange); --stage-fg: var(--ink); --stage-glow: #ff9a52; --shift-x: 20%; --shift-y: 0%; --t: 0; }
.story-stage { position: relative; color: var(--stage-fg); }
.stage-bg, .stage-wipe { position: absolute; inset: 0; }
.stage-bg { background:
    radial-gradient(ellipse 46% 58% at calc(50% + var(--shift-x)) calc(48% - var(--shift-y)), var(--glow-a, #ff9a52) 0%, transparent 72%),
    linear-gradient(180deg, transparent 58%, rgba(0, 0, 0, 0.07) 100%),
    var(--bg-a, var(--orange)); }
.stage-wipe { background:
    radial-gradient(ellipse 46% 58% at calc(50% + var(--shift-x)) calc(48% - var(--shift-y)), var(--glow-b, #ff9a52) 0%, transparent 72%),
    linear-gradient(180deg, transparent 58%, rgba(0, 0, 0, 0.07) 100%),
    var(--bg-b, var(--orange));
  clip-path: inset(calc((1 - var(--w, 0)) * 100%) 0 0 0); }
.stage-wipe::before { content: ''; position: absolute; left: 0; right: 0; top: calc((1 - var(--w, 0)) * 100%); height: 1px; background: var(--orange); opacity: calc(min(1, var(--w, 0) * 8) * min(1, (1 - var(--w, 0)) * 8)); }
.stage-wipe::after, .stage-bg::after { content: ''; position: absolute; inset: 0; opacity: 0.35; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* чертёжные линии поверх фона */
.stage-lines { position: absolute; inset: 0; pointer-events: none; color: var(--stage-fg); }
.stage-lines i { position: absolute; display: block; }
.stage-lines .ln-h { left: 0; right: 0; height: 1px; background: currentColor; opacity: 0.13; transform-origin: 0 50%; animation: drawX 1.6s var(--ease) 0.2s backwards; }
.stage-lines .ln-h1 { top: 31%; }
.stage-lines .ln-h2 { top: 40%; }
.stage-lines .ln-v { top: 0; bottom: 0; width: 1px; background: currentColor; opacity: 0.12; transform-origin: 50% 0; animation: drawY 1.8s var(--ease) 0.35s backwards; }
.stage-lines .ln-v1 { left: 14%; }
.stage-lines .ln-v2 { left: 86%; }
.stage-lines .ring { left: calc(50% + var(--shift-x)); top: calc(50% - var(--shift-y)); border-radius: 50%; border: 1px solid currentColor; opacity: 0.17; transform: translate(-50%, -50%); }
.stage-lines .ring-1 { width: 66vh; height: 66vh; }
.stage-lines .ring-2 { width: 92vh; height: 92vh; border-style: dashed; opacity: 0.12; animation: spin 90s linear infinite; }
.stage-lines .diag { left: 14%; top: 40%; width: 60vh; height: 1px; background: currentColor; opacity: 0.12; transform-origin: 0 0; transform: rotate(-38deg); }
.stage-lines .cross { width: 15px; height: 15px; margin: -7px 0 0 -7px; opacity: 0.55; }
.stage-lines .cross::before, .stage-lines .cross::after { content: ''; position: absolute; background: currentColor; }
.stage-lines .cross::before { left: 7px; top: 0; width: 1px; height: 15px; }
.stage-lines .cross::after { top: 7px; left: 0; height: 1px; width: 15px; }
.stage-lines .c1 { left: 14%; top: 31%; }
.stage-lines .c2 { left: 86%; top: 31%; }
.stage-lines .c3 { left: 14%; top: 40%; }
.stage-lines .c4 { left: 86%; top: 40%; }
@keyframes drawX { from { transform: scaleX(0); } }
@keyframes drawY { from { transform: scaleY(0); } }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

#gl { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 2; display: block; pointer-events: none; }
.no-3d #gl { display: none; }

/* постер логотипа: пока сцена грузится и если 3D недоступно */
.stage-poster { position: absolute; z-index: 2; left: calc(50% + var(--shift-x)); top: calc(50% - var(--shift-y)); width: min(58vh, 46vw); transform: translate(-50%, -50%); transition: opacity 0.8s var(--ease); filter: drop-shadow(0 40px 40px rgba(0, 0, 0, 0.22)); pointer-events: none; }
.has-3d .stage-poster { opacity: 0; }
.story-on .stage-poster { opacity: calc(1 - min(1, max(0, (var(--t) - 1.1) * 3))); width: calc(min(58vh, 46vw) - min(var(--t), 1) * 14vh); }
.story-on.has-3d .stage-poster { opacity: 0; }

/* главы */
.ch { position: relative; z-index: 3; display: flex; }
.ch-in { position: relative; flex: 1; width: min(var(--max), 100%); margin-inline: auto; padding: clamp(112px, 15vh, 150px) var(--pad) clamp(28px, 5vh, 48px); }
.ch-label { display: block; }
.ln { display: block; overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.ln > span { display: block; will-change: transform; transform: translateY(calc((1 - var(--a, 1)) * 110% - var(--e, 0) * 40%)); }
.ln + .ln > span { transform: translateY(calc((1 - var(--a, 1)) * 150% - var(--e, 0) * 55%)); }
.ln + .ln + .ln > span { transform: translateY(calc((1 - var(--a, 1)) * 190% - var(--e, 0) * 70%)); }
.fig-note { position: absolute; opacity: 0.72; }
.ch-fig { display: none; }

/* 0 · герой */
.h1 { font: 500 clamp(2.7rem, 6vw, 5.8rem)/0.92 var(--display); letter-spacing: -0.05em; margin-top: 18px; max-width: 9.6em; }
.ch-hero .ch-label { opacity: 0.8; }
.hero-foot { position: absolute; left: var(--pad); bottom: clamp(40px, 8vh, 84px); width: min(470px, 40%); display: grid; gap: 22px; }
.lead { font-size: clamp(1.05rem, 1.35vw, 1.3rem); line-height: 1.42; font-weight: 500; letter-spacing: -0.01em; }
.hero-tags { display: grid; gap: 6px; }
.hero-tags li { display: flex; gap: 10px; align-items: baseline; }
.hero-tags li::before { content: '+'; font-weight: 500; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }
.ch a, .ch button { pointer-events: auto; }
.fig-hero { right: var(--pad); bottom: clamp(40px, 8vh, 84px); }
.js .ch-hero .ln > span { animation: lineUp 1.2s var(--ease) backwards; }
.js .ch-hero .ln:nth-child(2) > span { animation-delay: 0.08s; }
.js .ch-hero .ln:nth-child(3) > span { animation-delay: 0.16s; }
.js .ch-hero .hero-foot, .js .ch-hero .ch-label, .js .fig-hero { animation: fadeUp 1.2s var(--ease) 0.35s backwards; }
@keyframes lineUp { from { transform: translateY(110%); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } }

/* 1 · цифры */
.stats .st { position: absolute; display: flex; gap: 14px; align-items: flex-start; }
.stats b { font: 500 clamp(4.6rem, 10.4vw, 9.6rem)/0.78 var(--display); letter-spacing: -0.065em; font-variant-numeric: lining-nums; }
.stats span { max-width: 11.5rem; font-size: 1.02rem; line-height: 1.3; font-weight: 500; padding-top: 0.2em; }
.st-1 { left: var(--pad); top: 17%; }
.st-2 { left: var(--pad); top: 47%; }
.st-3 { right: var(--pad); top: 17%; }
.st-4 { right: var(--pad); top: 47%; }
.st-3, .st-4 { flex-direction: row; }
.clients { position: absolute; left: var(--pad); right: var(--pad); bottom: clamp(28px, 5vh, 48px); display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 24px; border-top: 1px solid rgba(21, 22, 24, 0.22); padding-top: 22px; }
.clients-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.client { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px 10px 10px; border-radius: 16px; background: rgba(255, 255, 255, 0.88); font-size: 0.8rem; line-height: 1.25; font-weight: 500; transition: transform 0.35s var(--ease), background-color 0.3s; }
.client:hover { transform: translateY(-3px); background: #fff; }
.client img { width: 44px; height: 44px; object-fit: contain; flex: none; filter: grayscale(1) contrast(1.05); transition: filter 0.3s; }
.client:hover img { filter: none; }

/* 2…5 · направления */
.dir-title { position: absolute; left: var(--pad); bottom: clamp(128px, 19vh, 170px); font: 500 clamp(2.5rem, 5.5vw, 5.3rem)/0.92 var(--display); letter-spacing: -0.05em; max-width: 44%; }
.dir-side { position: absolute; right: var(--pad); bottom: clamp(128px, 19vh, 170px); width: min(370px, 30%); display: grid; gap: 22px; justify-items: start; }
.dir-side p { font-size: 1.06rem; line-height: 1.45; }
.ch-dir .fig-note { right: var(--pad); top: clamp(112px, 15vh, 150px); }
.ch-dir .ch-label { max-width: 30rem; }
[data-tone='graphite'] .dir-side p { color: var(--dim-d); }

.dir-tabs { position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); bottom: clamp(24px, 4vh, 40px); width: min(var(--max), 100%); padding-inline: var(--pad); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.dir-tabs button { position: relative; min-height: 52px; padding: 0 0 14px; border: 0; background: none; color: inherit; text-align: left; font-size: 0.98rem; opacity: 0.5; transition: opacity 0.3s; }
.dir-tabs button::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; opacity: 0.35; }
.dir-tabs button i { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--orange); transform-origin: 0 50%; transform: scaleX(var(--fill, 0)); }
.story-stage.is-dark .dir-tabs button i { background: var(--orange-hi); }
[data-go='5'] i { background: var(--ink) !important; }
.dir-tabs button:hover, .dir-tabs button.on { opacity: 1; }

.scroll-cue { position: absolute; z-index: 4; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; }
.scroll-cue i { position: relative; width: 1px; height: 34px; background: currentColor; opacity: 0.35; overflow: hidden; }
.scroll-cue i::after { content: ''; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: currentColor; animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { to { top: 100%; } }

/* ---------- липкий режим ---------- */
.story-on .story { height: calc(100svh + 5 * 85svh); }
.story-on .story-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.story-on .ch { position: absolute; inset: 0; pointer-events: none; }

/* ---------- экраны друг под другом (без JS / reduced motion) ---------- */
html:not(.story-on) .stage-bg, html:not(.story-on) .stage-wipe, html:not(.story-on) .stage-lines, html:not(.story-on) .dir-tabs, html:not(.story-on) .scroll-cue { display: none; }
html:not(.story-on) #gl { height: 100svh; }
html:not(.story-on) .stage-poster { top: 50svh; left: 70%; }
html:not(.story-on) .ch { min-height: 100svh; }
html:not(.story-on) .ch-in { min-height: 100svh; }
html:not(.story-on) [data-tone='orange'] { background: var(--orange); color: var(--ink); }
html:not(.story-on) [data-tone='paper'] { background: var(--paper); color: var(--ink); }
html:not(.story-on) [data-tone='graphite'] { background: var(--graphite); color: var(--light); }
html:not(.story-on) .ch-hero { background: transparent; }
html:not(.story-on) .story-stage { background: var(--orange); }
html:not(.story-on) .ch-fig, .no-3d .ch-dir .ch-fig { display: block; position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%); font: 600 clamp(10rem, 34vh, 22rem)/0.8 var(--display); letter-spacing: -0.07em; color: transparent; -webkit-text-stroke: 1.5px rgba(128, 118, 110, 0.9); opacity: 0.55; }

@media (max-width: 1100px) {
  .stats span { max-width: 9rem; font-size: 0.92rem; }
  .client span { font-size: 0.72rem; }
}
@media (max-width: 720px) {
  .ch-in { padding-top: 96px; }
  .h1 { font-size: clamp(2.4rem, 10.6vw, 3.4rem); max-width: none; }
  .hero-foot { width: auto; right: var(--pad); gap: 16px; bottom: 28px; }
  .lead { font-size: 1rem; }
  .hero-tags { display: none; }
  .fig-note { display: none; }
  .scroll-cue { display: none; }
  .btns .btn { flex: 1 1 auto; }
  .stats b { font-size: 3.6rem; }
  .stats span { font-size: 0.8rem; max-width: 7.5rem; }
  .st { flex-direction: column !important; gap: 6px !important; }
  .st-1 { top: 14%; }
  .st-3 { top: 14%; text-align: right; align-items: flex-end !important; }
  .st-2 { top: auto; bottom: 170px; }
  .st-4 { top: auto; bottom: 170px; text-align: right; align-items: flex-end !important; }
  .clients { grid-template-columns: 1fr; gap: 10px; padding-top: 14px; }
  .clients-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .client { justify-content: center; padding: 8px; min-height: 56px; }
  .client span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dir-title { font-size: clamp(2.2rem, 10vw, 3.2rem); max-width: none; right: var(--pad); bottom: 250px; }
  .dir-side { width: auto; left: var(--pad); bottom: 36px; gap: 14px; }
  .dir-side p { font-size: 0.95rem; }
  .dir-tabs { display: none; }
  .ch-dir .ch-label { max-width: 15rem; }
  .stage-lines .ln-v1 { left: 6%; }
  .stage-lines .ln-v2 { left: 94%; }
  .stage-lines .ring-1 { width: 84vw; height: 84vw; }
  .stage-lines .ring-2 { width: 118vw; height: 118vw; }
  .stage-poster { width: 62vw; }
  .story-on .stage-poster { width: 62vw; top: 46%; left: 50%; }
  html:not(.story-on) .stage-poster { top: 50svh; left: 50%; width: 56vw; opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
  .ln > span { transform: none !important; }
}
