/* D.O.M. — Kaplica Trójcy Świętej · redesign v2 */

:root {
  --paper: #f3eee4;
  --paper-deep: #e9e1d2;
  --ink: #16140f;
  --ink-2: #3f3a31;
  --muted: #7a7264;
  --line: rgba(22, 20, 15, .14);

  --night: #0f1011;
  --night-2: #17191b;

  --gold: #c19a4f;
  --gold-soft: #d9b874;
  --vermilion: #9f3f2b;
  --olive: #5b7a49;
  --amber: #a8731c;

  --f-display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;

  --wrap: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --radius: 4px;
}

/* ---------- Theming per section ---------- */
.paper, .paper-deep {
  --fg: var(--ink);
  --fg-2: var(--ink-2);
  --mut: var(--muted);
  --ln: var(--line);
  --ln-strong: rgba(22, 20, 15, .32);
  --surface: rgba(255, 255, 255, .42);
  --accent: var(--vermilion);
  --bg: var(--paper);
  color: var(--fg);
}
.paper { background: var(--paper); }
.paper-deep { background: var(--paper-deep); --bg: var(--paper-deep); }

.night, .ai-panel {
  --fg: #ece7dd;
  --fg-2: #c8c1b4;
  --mut: #948d80;
  --ln: rgba(255, 255, 255, .12);
  --ln-strong: rgba(255, 255, 255, .3);
  --surface: rgba(255, 255, 255, .035);
  --accent: var(--gold-soft);
  --bg: var(--night);
  color: var(--fg);
}
.night { background: var(--night); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  opacity: .05;
  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%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img, video { display: block; max-width: 100%; }
h1, h2, h3, h4, h5, p, ol, ul, dl, dd, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--gold-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); position: relative; }
.mono { font-family: var(--f-mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--mut); }
.label { color: var(--mut); margin: 0 0 6px; }

.skip {
  position: fixed; left: 16px; top: -60px; z-index: 200;
  background: var(--gold); color: var(--ink); padding: 10px 16px; border-radius: 99px;
  text-decoration: none; font-weight: 600; transition: top .2s;
}
.skip:focus { top: 16px; }

/* ---------- Progress + topbar ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 70; }
.progress span {
  display: block; height: 100%; background: var(--gold);
  transform-origin: left; transform: scaleX(var(--p, 0));
}

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: 68px; padding: 0 var(--gutter);
  color: #f3eee4;
  transition: background .4s, backdrop-filter .4s, border-color .4s;
  border-bottom: 1px solid transparent;
}
.topbar.is-scrolled {
  background: rgba(15, 16, 17, .72);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: rgba(255, 255, 255, .08);
}
.brand {
  font-family: var(--f-display); font-size: 1.3rem; font-weight: 650; letter-spacing: .02em;
  text-decoration: none; white-space: nowrap;
}
.brand i { font-style: normal; color: var(--gold); }
.brand.small { font-size: 1.1rem; }

.chapter-nav ol { display: flex; gap: 4px; }
.chapter-nav a {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 12px; border-radius: 99px;
  font-size: .86rem; text-decoration: none; color: rgba(243, 238, 228, .62);
  transition: color .3s, background .3s;
}
.chapter-nav a .mono { font-size: .68rem; color: rgba(243, 238, 228, .42); transition: color .3s; }
.chapter-nav a:hover { color: #fff; }
.chapter-nav a.is-active { color: #fff; background: rgba(255, 255, 255, .08); }
.chapter-nav a.is-active .mono { color: var(--gold); }

.lang {
  display: inline-flex; gap: 2px; padding: 4px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 99px;
  background: rgba(255, 255, 255, .06); cursor: pointer;
  font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em;
}
.lang span { padding: 6px 10px; border-radius: 99px; color: rgba(243, 238, 228, .55); transition: background .3s, color .3s; }
html[lang="pl"] .lang [data-lang="pl"],
html[lang="en"] .lang [data-lang="en"] { background: #f3eee4; color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 26px; border-radius: 99px; border: 1px solid transparent;
  font-weight: 500; font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: background .3s, color .3s, border-color .3s, transform .3s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { background: var(--gold-soft); }
.btn-ghost { border-color: rgba(255, 255, 255, .42); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); border-color: #fff; }
.paper .btn-primary, .paper-deep .btn-primary { background: var(--ink); color: var(--paper); }
.paper .btn-primary:hover, .paper-deep .btn-primary:hover { background: var(--vermilion); }
.btn-line {
  border-color: var(--ln-strong); color: var(--fg); background: transparent;
}
.btn-line:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh; min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  color: #f3eee4; overflow: hidden; background: var(--night);
}
@supports (min-height: 100svh) { .hero { min-height: 100svh; } }
.hero-media { position: absolute; inset: 0; }
.hero-media img {
  width: 100%; height: 100%; object-fit: cover;
  animation: kenburns 18s var(--ease) both;
}
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(12, 12, 10, .86) 0%, rgba(12, 12, 10, .62) 38%, rgba(12, 12, 10, .2) 70%, rgba(12, 12, 10, .1) 100%),
    linear-gradient(180deg, rgba(12, 12, 10, .55) 0%, rgba(12, 12, 10, 0) 26%, rgba(12, 12, 10, 0) 62%, rgba(12, 12, 10, .92) 100%);
}
.hero-inner { position: relative; z-index: 2; padding-top: 120px; padding-bottom: 160px; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 10px; color: rgba(243, 238, 228, .78); margin-bottom: 32px; }
.eyebrow .sep { color: var(--gold); }
.hero-title {
  font-family: var(--f-display); font-weight: 600; line-height: .96; letter-spacing: -.04em;
  font-size: clamp(3.2rem, 9vw, 8.4rem);
}
.hero-title span { display: block; }
.hero-inner { text-shadow: 0 1px 24px rgba(0, 0, 0, .35); }
.ht-a, .ht-c { font-weight: 500; font-size: .36em; letter-spacing: -.01em; color: #ead29b; }
.ht-a { margin-bottom: .3em; }
.ht-c { margin-top: .35em; }
.hero-lead {
  max-width: 34ch; margin-top: 36px;
  font-size: clamp(1.15rem, 1.8vw, 1.5rem); line-height: 1.45; color: rgba(243, 238, 228, .88);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 44px; }

.hero-foot {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 32px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 28px; color: rgba(243, 238, 228, .7); }
.hero-tags b { color: var(--gold); font-weight: 500; margin-right: 6px; }
.scroll-hint { display: flex; align-items: center; gap: 14px; color: rgba(243, 238, 228, .7); text-decoration: none; }
.scroll-hint i { position: relative; width: 1px; height: 44px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.scroll-hint i::after {
  content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%;
  background: var(--gold); animation: drip 2.2s var(--ease) infinite;
}

@keyframes kenburns { from { transform: scale(1.12); } to { transform: scale(1); } }
@keyframes drip { from { top: -40%; } to { top: 100%; } }

/* ---------- Chapters ---------- */
.chapter { position: relative; padding: clamp(96px, 13vw, 176px) 0; overflow: clip; }
.ch-head { position: relative; margin-bottom: clamp(56px, 8vw, 104px); }
.ch-numeral {
  position: absolute; right: 0; top: -.18em; z-index: 0;
  font-family: var(--f-display); font-weight: 300; line-height: .8; letter-spacing: -.04em;
  font-size: clamp(7rem, 22vw, 19rem);
  color: transparent; -webkit-text-stroke: 1px var(--ln-strong);
  opacity: .55; pointer-events: none; user-select: none;
}
.ch-kicker { position: relative; display: flex; align-items: center; gap: 14px; color: var(--accent); margin-bottom: 28px; }
.ch-kicker::before { content: ""; width: 36px; height: 1px; background: currentColor; }
.ch-title {
  position: relative;
  font-family: var(--f-display); font-weight: 600; letter-spacing: -.035em; line-height: 1.04;
  font-size: clamp(2.4rem, 5.2vw, 4.5rem); max-width: 16ch;
}
.ch-sub { position: relative; max-width: 58ch; margin-top: 28px; font-size: clamp(1.05rem, 1.4vw, 1.25rem); color: var(--fg-2); }

.sub-title {
  font-family: var(--f-display); font-weight: 600; font-size: clamp(1.35rem, 2.1vw, 1.8rem);
  letter-spacing: -.02em; margin: clamp(64px, 8vw, 104px) 0 32px;
}

.block { margin-top: clamp(96px, 12vw, 168px); }
.block-head { max-width: 760px; margin-bottom: 48px; }
.block-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.block-kicker { color: var(--accent); margin-bottom: 14px; }
.block-head h3 {
  font-family: var(--f-display); font-weight: 600; letter-spacing: -.03em; line-height: 1.1;
  font-size: clamp(1.75rem, 3vw, 2.6rem);
}
.block-head p { margin-top: 18px; color: var(--fg-2); font-size: 1.08rem; }

/* ---------- Reveal ---------- */
.js .reveal {
  opacity: 0; transform: translateY(26px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- I. Archiwum ---------- */
.statement {
  font-family: var(--f-display); font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 3.4rem); line-height: 1.16; letter-spacing: -.03em;
  max-width: 22ch; margin-bottom: clamp(72px, 10vw, 128px);
}
.problem-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(40px, 7vw, 112px); align-items: start; }
.problem-list li {
  display: grid; grid-template-columns: 56px 1fr; gap: 8px;
  padding: 30px 0; border-top: 1px solid var(--ln);
}
.problem-list li:last-child { border-bottom: 1px solid var(--ln); }
.problem-list .mono { color: var(--accent); padding-top: .4em; }
.problem-list p { font-size: clamp(1.15rem, 1.6vw, 1.35rem); line-height: 1.45; }
.metric-stack > div { padding: 24px 0 26px; border-top: 1px solid var(--ln); }
.metric-stack > div:last-child { border-bottom: 1px solid var(--ln); }
.metric-stack dt {
  font-family: var(--f-display); font-weight: 300; line-height: 1;
  font-size: clamp(3rem, 6vw, 5rem); letter-spacing: -.03em; font-variant-numeric: lining-nums tabular-nums;
}
.metric-stack dt.is-void { color: var(--accent); }
.metric-stack dd { margin-top: 10px; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }

/* ---------- II. Metoda ---------- */
.pillars { --gap: clamp(20px, 2.4vw, 32px); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.pillar {
  position: relative; container-type: inline-size; display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--ln); border-radius: 8px;
  box-shadow: 0 1px 2px rgba(22, 20, 15, .05), 0 22px 44px -28px rgba(22, 20, 15, .45);
}
.pillar + .pillar::before {
  content: "→"; position: absolute; z-index: 3; top: calc(100cqw / 3 - 19px); left: calc(var(--gap) / -2 - 19px);
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--vermilion); color: #fff; font-size: 1.05rem; box-shadow: 0 0 0 5px var(--paper-deep);
}
.pillar-media { position: relative; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 8px 8px 0 0; }
.pillar-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.pillar:hover .pillar-media img { transform: scale(1.04); }
.pillar-letter {
  position: absolute; left: 20px; bottom: 20px; display: grid; place-items: center;
  width: 58px; height: 58px; border-radius: 6px; background: var(--paper); color: var(--vermilion);
  font-family: var(--f-display); font-weight: 650; font-size: 2rem; line-height: 1;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .55);
}
.pillar-body { flex: 1; display: flex; flex-direction: column; padding: 32px clamp(22px, 2.4vw, 32px) 32px; }
.pillar h3 { font-family: var(--f-display); font-weight: 600; font-size: 1.65rem; letter-spacing: -.025em; margin-bottom: 20px; }
.pillar-body p:not(.label) { color: var(--fg-2); }
.pillar-body p:nth-of-type(2) { min-height: 4.8em; margin-bottom: 24px; }
.pillar-body p:nth-of-type(3) { padding-top: 22px; border-top: 1px solid var(--ln); }
.pillar .purpose { font-family: var(--f-display); font-weight: 500; font-size: 1.1rem; line-height: 1.45; color: var(--fg); }

/* ---------- III. Pomiar ---------- */
figcaption.mono, figure figcaption .mono { color: var(--mut); }

.workflow-wrap {
  padding: clamp(36px, 5vw, 64px) clamp(20px, 4vw, 56px) clamp(28px, 4vw, 40px);
  border: 1px solid var(--ln); border-radius: 8px; background: var(--surface);
}
.workflow { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; }
.workflow::before, .workflow::after { content: ""; position: absolute; top: 36px; left: 10%; right: 10%; height: 1px; }
.workflow::before { background: var(--ln-strong); }
.workflow::after { background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 2s var(--ease) .4s; }
.workflow-wrap.is-in .workflow::after { transform: scaleX(1); }
.workflow li { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }
.wf-icon {
  position: relative; z-index: 1; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%;
  background: #1a1b1d; border: 1px solid var(--ln-strong); color: var(--accent);
}
.wf-icon svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wf-icon .fill { fill: currentColor; stroke: none; opacity: .9; }
.workflow li:last-child .wf-icon { background: var(--accent); border-color: var(--accent); color: var(--night); }
.wf-num { margin-top: 20px; color: var(--mut); }
.workflow h3 { margin-top: 8px; font-family: var(--f-display); font-weight: 600; font-size: 1.12rem; line-height: 1.25; letter-spacing: -.015em; }
.workflow p { margin-top: 6px; max-width: 20ch; font-size: .9rem; line-height: 1.45; color: var(--fg-2); }
.workflow-cap { margin-top: 36px; text-align: center; color: var(--mut); }

.scrolly { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(40px, 6vw, 96px); margin-top: clamp(96px, 12vw, 160px); }
.scrolly-media { position: sticky; top: 96px; align-self: start; height: min(calc(100vh - 128px), 780px); }
.sm-layer {
  position: absolute; inset: 52px 0 0 0; counter-reset: shot;
  display: flex; flex-direction: column; justify-content: center; gap: 12px;
  opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .8s var(--ease), transform 1.1s var(--ease);
}
.sm-layer.is-active { opacity: 1; transform: none; pointer-events: auto; }
.sm-row { display: flex; gap: 12px; }
.sm-shot.g-item { flex: var(--ar) 1 0%; min-width: 0; aspect-ratio: var(--ar); border: 0; background: #000; }
.sm-layer > .sm-shot.g-item { flex: none; width: 100%; }
.sm-row-split > .sm-shot.g-item { flex: 0 0 44%; }
.sm-shot::before {
  counter-increment: shot; content: counter(shot, upper-alpha);
  position: absolute; top: 10px; left: 10px; z-index: 1; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(10, 10, 9, .65); color: #fff; font-family: var(--f-mono); font-size: .7rem;
}
.sm-layer figcaption { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; font-size: .92rem; color: var(--fg-2); }
.sm-row-split figcaption { flex: 1; justify-content: flex-end; padding: 0 0 4px 8px; }
.sm-cap-line { display: flex; gap: 10px; align-items: baseline; }
.sm-cap-line b { color: var(--accent); font-weight: 500; }
.sm-zoom { margin-top: 10px; color: var(--mut); }
.sm-hud {
  position: absolute; top: 0; left: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; border-radius: 99px;
  background: rgba(10, 10, 9, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #f3eee4;
}
.sm-hud-bar { width: 64px; height: 2px; background: rgba(255, 255, 255, .2); }
.sm-hud-bar i { display: block; height: 100%; background: var(--gold); transform-origin: left; transform: scaleX(var(--s, .3333)); transition: transform .8s var(--ease); }

.step {
  min-height: 86vh; display: flex; flex-direction: column; justify-content: center;
  padding: 8vh 0; opacity: .22; transition: opacity .7s var(--ease);
}
.step.is-active { opacity: 1; }
.step-idx { color: var(--mut); margin-bottom: 20px; }
.step-stat {
  font-family: var(--f-display); font-weight: 300; line-height: .95; letter-spacing: -.03em;
  font-size: clamp(4rem, 8vw, 7.2rem); color: var(--accent); font-variant-numeric: lining-nums tabular-nums;
}
.step-stat-label { color: var(--mut); margin-top: 10px; }
.step h3 { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.6rem, 2.5vw, 2.1rem); line-height: 1.15; margin: 40px 0 16px; letter-spacing: -.025em; }
.step p:not([class]) { color: var(--fg-2); font-size: 1.08rem; }
.step-figs { display: none; }

.video video {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  background: #000; border-radius: var(--radius);
}
.video figcaption { margin-top: 14px; }
.has-toggle { position: relative; }
.v-toggle {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .3); background: rgba(10, 10, 9, .5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: .75; transition: opacity .3s, background .3s;
}
.v-toggle:hover, .v-toggle:focus-visible { opacity: 1; background: rgba(10, 10, 9, .75); }
.v-toggle::before, .v-toggle::after {
  content: ""; position: absolute; top: 50%; width: 3px; height: 12px; margin-top: -6px; background: #fff; border-radius: 1px;
}
.v-toggle::before { left: 14px; }
.v-toggle::after { right: 14px; }
.v-toggle.is-paused::before {
  left: 15px; width: 0; height: 0; margin-top: -7px; border-radius: 0; background: none;
  border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent #fff;
}
.v-toggle.is-paused::after { display: none; }
.vscrolly { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, .7fr); gap: clamp(32px, 5vw, 72px); }
.vs-stage { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; align-items: center; padding-top: 34px; }
.vs-frame { position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--ln); border-radius: 8px; background: #060606; }
.vs-frame video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--vbg, #060606);
  opacity: 0; transition: opacity .7s var(--ease);
}
.vs-frame video.is-active { opacity: 1; }
.vs-step {
  min-height: 80vh; display: flex; flex-direction: column; justify-content: center;
  opacity: .25; transition: opacity .6s var(--ease);
}
.vs-step:first-child, .vs-step:last-child { min-height: 100vh; padding-top: 34px; }
.vs-step.is-active { opacity: 1; }
.vs-idx { color: var(--mut); }
.vs-step.is-active .vs-idx { color: var(--accent); }
.vs-step h4 { margin: 16px 0 12px; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.4rem, 2.2vw, 1.9rem); line-height: 1.2; letter-spacing: -.025em; }
.vs-kind { color: var(--mut); }
.vs-bar { display: block; width: 100%; max-width: 220px; height: 2px; margin-top: 24px; background: var(--ln); }
.vs-bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .3s linear; }
.video-feature { max-width: 980px; margin: 0 auto clamp(64px, 8vw, 104px); }
.video-feature video { aspect-ratio: 16 / 9; }

.deliverables { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 48px; margin-bottom: 56px; }
.deliverables li { display: flex; gap: 18px; padding: 18px 0; border-top: 1px solid var(--ln); font-size: 1.05rem; }
.deliverables .mono { color: var(--accent); padding-top: .25em; }

.model-duo { display: flex; align-items: flex-start; gap: 24px; margin-top: 48px; }
.model-duo figure { flex: var(--ar) 1 0%; min-width: 0; }
.model-duo img, .model-duo video { width: 100%; aspect-ratio: var(--ar); object-fit: cover; border-radius: var(--radius); }
.model-duo figcaption { margin-top: 14px; }

/* ---------- Galleries ---------- */
.gallery { display: grid; gap: 16px; }
.g-1 { grid-template-columns: minmax(0, 720px); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-item {
  position: relative; display: block; width: 100%; padding: 0; overflow: hidden;
  aspect-ratio: 4 / 3; border: 1px solid var(--ln); border-radius: var(--radius);
  background: var(--surface); cursor: zoom-in;
}
.g-1 .g-item { aspect-ratio: auto; }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease), filter .6s; }
.g-item:hover img, .g-item:focus-visible img { transform: scale(1.045); }
.g-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 12px 10px; text-align: left;
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .72));
  opacity: 0; transform: translateY(6px); transition: opacity .4s, transform .4s var(--ease);
}
.g-item:hover .g-cap, .g-item:focus-visible .g-cap { opacity: 1; transform: none; }
@media (hover: none) { .g-cap { opacity: 1; transform: none; } }
.g-item.is-hidden { display: none; }
.g-just { display: flex; flex-direction: column; gap: 16px; }
.g-row { display: flex; gap: 16px; }
.g-just .g-item { flex: var(--ar) 1 0%; min-width: 0; aspect-ratio: var(--ar); }
.g-item.drawing { background: #fff; }
.g-item.drawing img { object-fit: contain; }
.g-item.drawing:hover img, .g-item.drawing:focus-visible img { transform: scale(1.02); }
.g-more { grid-column: 1 / -1; justify-self: center; margin-top: 12px; }

/* ---------- IV. Diagnoza ---------- */
.ai-panel {
  position: relative; overflow: hidden;
  background: var(--night-2); border-radius: 6px;
  padding: clamp(32px, 6vw, 88px);
}
.ai-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at 85% 0%, #000 0%, transparent 60%);
  -webkit-mask-image: radial-gradient(ellipse at 85% 0%, #000 0%, transparent 60%);
}
.ai-panel > * { position: relative; }
.badge { color: var(--accent); margin-bottom: 18px; display: inline-flex; align-items: center; gap: 10px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); }
.ai-intro h3 { font-family: var(--f-display); font-weight: 600; font-size: clamp(2.1rem, 4.2vw, 3.4rem); line-height: 1.05; letter-spacing: -.035em; margin-bottom: 32px; }
.ai-what { max-width: 62ch; font-size: clamp(1.1rem, 1.5vw, 1.3rem); line-height: 1.55; }
.ai-why { max-width: 62ch; margin-top: 24px; padding-left: 22px; border-left: 2px solid var(--accent); color: var(--fg-2); }

.ai-metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(48px, 6vw, 80px); border-top: 1px solid var(--ln); border-bottom: 1px solid var(--ln); }
.ai-metrics > div { padding: 28px 20px 28px 0; }
.ai-metrics > div + div { padding-left: 24px; border-left: 1px solid var(--ln); }
.ai-metrics dt { font-family: var(--f-display); font-weight: 300; font-size: clamp(2.4rem, 4.5vw, 3.8rem); line-height: 1; letter-spacing: -.03em; }
.ai-metrics dt.accent { color: var(--accent); }
.ai-metrics dd { margin-top: 10px; font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }

.pipeline { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; }
.pipeline::before, .pipeline::after {
  content: ""; position: absolute; top: 20px; left: 20px; right: 20px; height: 1px; background: var(--ln-strong);
}
.pipeline::after { background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 2s var(--ease) .3s; }
.pipeline.is-in::after { transform: scaleX(1); }
.pipeline li { position: relative; }
.pl-dot {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--accent); background: var(--night-2); color: var(--accent);
  transition: background .5s, color .5s;
}
.pipeline.is-in .pl-dot { background: var(--accent); color: var(--night); }
.pipeline.is-in li:nth-child(1) .pl-dot { transition-delay: .3s; }
.pipeline.is-in li:nth-child(2) .pl-dot { transition-delay: .7s; }
.pipeline.is-in li:nth-child(3) .pl-dot { transition-delay: 1.1s; }
.pipeline.is-in li:nth-child(4) .pl-dot { transition-delay: 1.5s; }
.pipeline.is-in li:nth-child(5) .pl-dot { transition-delay: 1.9s; }
.pipeline h5 { font-size: 1rem; font-weight: 600; margin: 22px 0 8px; line-height: 1.3; }
.pipeline p { font-size: .9rem; color: var(--fg-2); line-height: 1.55; }

.figure-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: clamp(56px, 7vw, 88px); }
.sheet { background: #fbf9f4; padding: 12px; border-radius: var(--radius); }
.sheet img { width: 100%; border-radius: 2px; }
.sheet figcaption { margin-top: 10px; color: #6f685b; }

.insight { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(40px, 7vw, 112px); margin-top: clamp(96px, 12vw, 160px); align-items: start; }
.insight blockquote { position: relative; padding-top: 24px; }
.insight blockquote::before {
  content: "“"; position: absolute; left: -.04em; top: -.3em;
  font-family: var(--f-display); font-weight: 600; font-size: 8rem; line-height: 1; color: var(--accent); opacity: .25;
}
.insight-text { font-family: var(--f-display); font-weight: 450; font-size: clamp(1.4rem, 2.4vw, 2rem); line-height: 1.34; letter-spacing: -.02em; }
.timeline-wrap .sub-title { margin-top: 24px; }
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: var(--ln-strong); }
.timeline li { position: relative; padding-bottom: 30px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -30px; top: .35em; width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid var(--accent); background: var(--bg);
}
.timeline li.is-key::before { background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.tl-date { display: block; color: var(--accent); margin-bottom: 4px; }
.timeline p { font-size: 1.05rem; color: var(--fg-2); }
.timeline .is-key p { color: var(--fg); font-weight: 500; }

.findings { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 40px; }
.findings li { display: grid; grid-template-columns: 44px 1fr; padding: 26px 0; border-top: 1px solid var(--ln); }
.findings .mono { color: var(--accent); padding-top: .3em; }
.findings p { font-size: 1.02rem; line-height: 1.5; }

.condition { border-top: 1px solid var(--ln-strong); }
.cond-row {
  display: grid; grid-template-columns: minmax(180px, 240px) 150px 1fr; gap: 24px; align-items: center;
  padding: 22px 0; border-bottom: 1px solid var(--ln);
}
.cond-el { font-family: var(--f-display); font-size: 1.2rem; font-weight: 600; letter-spacing: -.015em; }
.cond-desc { color: var(--fg-2); }
.pill {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: 99px; border: 1px solid currentColor;
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--olive); }
.pill.warn { color: var(--amber); }
.pill.bad { color: var(--vermilion); }

.monitor-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.monitor { display: flex; flex-direction: column; padding: 28px 24px 24px; border: 1px solid var(--ln); border-radius: var(--radius); background: var(--surface); }
.mon-freq { color: var(--accent); }
.monitor h5 { font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; letter-spacing: -.02em; margin: 10px 0 8px; }
.monitor p:not(.mon-freq) { font-size: .93rem; color: var(--fg-2); flex: 1; }
.track { position: relative; height: 30px; margin-top: 28px; border-bottom: 1px solid var(--ln-strong); }
.track span {
  position: absolute; bottom: 0; width: 2px; height: 16px; margin-left: -1px; background: var(--accent);
  transform-origin: bottom; transform: scaleY(0); transition: transform .5s var(--ease);
}
.track span.yr { height: 6px; width: 1px; background: var(--ln-strong); transform: none; }
.monitor.is-in .track span { transform: scaleY(1); }

.tab-list { display: flex; gap: 4px; border-bottom: 1px solid var(--ln); overflow-x: auto; scrollbar-width: none; }
.tab {
  flex: none; padding: 14px 18px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--mut); cursor: pointer; font-size: .98rem; transition: color .3s, border-color .3s;
}
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tab-panel { padding-top: 32px; }

/* ---------- V. Karta ---------- */
.card-spread-text { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 32px; margin-bottom: 36px; }
.card-spread-text h3 { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.7rem, 2.8vw, 2.4rem); line-height: 1.12; letter-spacing: -.03em; }
.card-spread-text p { color: var(--mut); }
.sheets { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(20px, 3vw, 40px); }
.sheet-page .g-item {
  aspect-ratio: 1339 / 950; background: #fff; border: 0; border-radius: 3px;
  box-shadow: 0 1px 3px rgba(22, 20, 15, .1), 0 22px 44px -22px rgba(22, 20, 15, .45);
  transition: transform .5s var(--ease), box-shadow .5s;
}
.sheet-page .g-item img { object-fit: contain; }
.sheet-page .g-item:hover, .sheet-page .g-item:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 1px 3px rgba(22, 20, 15, .1), 0 34px 60px -24px rgba(22, 20, 15, .55);
}
.sheet-page .g-item:hover img { transform: none; }
.sheet-page figcaption { margin-top: 12px; }

.toc { border-top: 1px solid var(--ln-strong); }
.toc-item { border-bottom: 1px solid var(--ln); }
.toc-item summary {
  display: grid; grid-template-columns: 64px 1fr 28px; align-items: center;
  padding: 24px 0; cursor: pointer; list-style: none;
  font-family: var(--f-display); font-size: clamp(1.1rem, 1.7vw, 1.35rem); font-weight: 500; letter-spacing: -.015em;
  transition: color .3s;
}
.toc-item summary::-webkit-details-marker { display: none; }
.toc-item summary .mono { color: var(--accent); }
.toc-item summary:hover { color: var(--accent); }
.toc-item summary i { position: relative; width: 16px; height: 16px; justify-self: end; }
.toc-item summary i::before, .toc-item summary i::after {
  content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: currentColor;
  transition: transform .4s var(--ease);
}
.toc-item summary i::after { transform: rotate(90deg); }
.toc-item[open] summary i::after { transform: rotate(0deg); }
.toc-body { padding: 0 0 36px 64px; }
.toc-body > p { color: var(--fg-2); margin-bottom: 20px; }

/* ---------- VI. Skala ---------- */
.ledger { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ln-strong); }
.ledger > div { padding: 40px 24px 40px 0; border-bottom: 1px solid var(--ln); }
.ledger > div:not(:nth-child(3n + 1)) { padding-left: 32px; border-left: 1px solid var(--ln); }
.ledger dt {
  font-family: var(--f-display); font-weight: 300; line-height: 1; letter-spacing: -.03em;
  font-size: clamp(2.8rem, 5.6vw, 4.8rem); color: var(--accent); font-variant-numeric: lining-nums tabular-nums;
}
.ledger dd { margin-top: 12px; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }

.shift {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: clamp(24px, 4vw, 64px);
  padding: clamp(36px, 5vw, 64px) clamp(20px, 4vw, 56px);
  border: 1px solid var(--ln); border-radius: 8px; background: var(--surface);
}
.shift-side { display: flex; flex-direction: column; align-items: center; text-align: center; }
.dots { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; max-width: 252px; min-height: 52px; }
.dots i {
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  transition: transform .45s var(--ease); transition-delay: calc(var(--i) * 22ms + .3s);
}
.js .shift:not(.is-in) .dots i { transform: scale(0); }
.shift-side:first-child .dots i { box-shadow: 0 0 0 6px rgba(217, 184, 116, .18); }
.shift-num {
  margin-top: 24px; font-family: var(--f-display); font-weight: 300; line-height: 1; letter-spacing: -.04em;
  font-size: clamp(3.5rem, 7vw, 6rem); color: var(--accent); font-variant-numeric: lining-nums tabular-nums;
}
.shift-label { margin-top: 12px; font-size: 1.1rem; color: var(--fg); }
.shift-role { margin-top: 10px; color: var(--mut); }
.shift-link { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--mut); }
.shift-model {
  position: relative; padding: 12px 20px; border: 1px solid var(--ln-strong); border-radius: 99px;
  font-family: var(--f-display); font-weight: 650; font-size: 1.3rem; letter-spacing: .02em; color: var(--fg);
}
.shift-model i { font-style: normal; color: var(--accent); }
.shift-model::before, .shift-model::after {
  content: ""; position: absolute; top: 50%; width: clamp(24px, 4vw, 64px); height: 1px; background: var(--ln-strong);
}
.shift-model::before { right: 100%; }
.shift-model::after { left: 100%; }
.scope { display: flex; justify-content: center; margin-bottom: clamp(40px, 5vw, 56px); }
.scope span {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 99px; text-align: center;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); background: rgba(217, 184, 116, .07); color: var(--accent);
}
.scope span::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.volume { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ln); border-radius: var(--radius); }
.volume > div { padding: clamp(32px, 4vw, 56px); text-align: center; }
.volume > div + div { border-left: 1px solid var(--ln); }
.volume-num { font-family: var(--f-display); font-weight: 300; font-size: clamp(3rem, 6vw, 5rem); line-height: 1.05; letter-spacing: -.03em; color: var(--accent); margin: 10px 0 6px; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
.chart { padding: clamp(28px, 3.5vw, 48px); border: 1px solid var(--ln); border-radius: var(--radius); background: var(--surface); }
.chart .sub-title { margin: 0 0 32px; font-size: clamp(1.25rem, 1.8vw, 1.55rem); }
.bar + .bar { margin-top: 24px; }
.bar-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 10px; font-size: .95rem; color: var(--fg-2); }
.bar-head b { color: var(--fg); font-weight: 500; font-size: .85rem; }
.bar-track { height: 6px; border-radius: 99px; background: var(--ln); overflow: hidden; }
.bar-track i {
  display: block; height: 100%; width: calc(var(--v) * 100%); border-radius: 99px; background: var(--accent);
  transform-origin: left; transition: transform 1.6s var(--ease) .2s;
}
.js .chart:not(.is-in) .bar-track i { transform: scaleX(0); }

.stack { display: flex; gap: 3px; height: 18px; border-radius: 99px; overflow: hidden; margin-bottom: 28px; }
.stack i { flex: 0 0 calc(var(--w) * 1% - 3px); transform-origin: left; transition: transform 1.2s var(--ease); }
.js .chart:not(.is-in) .stack i { transform: scaleX(0); }
.stack i:nth-child(2) { transition-delay: .15s; }
.stack i:nth-child(3) { transition-delay: .3s; }
.stack i:nth-child(4) { transition-delay: .45s; }
.s1 { background: var(--gold-soft); }
.s2 { background: #8f7b55; }
.s3 { background: #b4573d; }
.s4 { background: #6a8796; }
.stack-legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--ln); font-size: .95rem; color: var(--fg-2); }
.stack-legend i { width: 10px; height: 10px; border-radius: 2px; }
.stack-legend b { color: var(--fg); font-weight: 500; }

/* ---------- VII. Epilog ---------- */
#epilog { padding-bottom: 0; }
.conclusions { display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(32px, 6vw, 96px); }
.conclusions li { display: grid; grid-template-columns: 72px 1fr; padding: 36px 0; border-top: 1px solid var(--ln-strong); }
.c-num { font-family: var(--f-display); font-weight: 300; font-size: 3.2rem; line-height: .9; color: var(--accent); }
.conclusions p { font-family: var(--f-display); font-weight: 500; font-size: clamp(1.2rem, 1.9vw, 1.5rem); line-height: 1.34; letter-spacing: -.02em; }

.closing { position: relative; height: clamp(380px, 70vh, 720px); margin-top: clamp(96px, 12vw, 160px); display: grid; place-items: center; overflow: hidden; }
.closing img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 80%; transform: scale(1.06); }
.closing::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, var(--paper) 0%, rgba(15, 16, 17, .55) 30%, rgba(15, 16, 17, .78) 100%); }
.closing-text {
  position: relative; z-index: 1; max-width: 20ch; padding: 0 var(--gutter); text-align: center; color: #f6f1e7;
  font-family: var(--f-display); font-weight: 600; font-size: clamp(2rem, 4.6vw, 4rem); line-height: 1.1; letter-spacing: -.035em;
}

/* ---------- Zespół + kontakt ---------- */
.team { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 40px; }
.person { display: grid; grid-template-columns: 104px 1fr; grid-template-rows: auto 1fr; column-gap: 22px; padding: 28px 0; border-top: 1px solid var(--ln); }
.person img {
  grid-row: 1 / span 2; width: 104px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius);
}
.person h3 { font-family: var(--f-display); font-weight: 600; font-size: 1.12rem; line-height: 1.25; letter-spacing: -.015em; margin: 2px 0 8px; }
.person p { font-size: .9rem; color: var(--fg-2); line-height: 1.5; }

.contact { display: grid; grid-template-columns: 1fr 1.1fr; gap: 32px clamp(40px, 7vw, 112px); align-items: end; margin-top: clamp(96px, 12vw, 160px); padding-top: clamp(56px, 7vw, 88px); border-top: 1px solid var(--ln-strong); }
.contact address { font-style: normal; color: var(--fg-2); line-height: 1.75; margin-bottom: 28px; }
.contact address strong { color: var(--fg); font-weight: 600; }
.mail {
  font-family: var(--f-display); font-size: clamp(1.4rem, 2.4vw, 2rem); text-decoration: none;
  color: var(--accent); border-bottom: 1px solid currentColor; padding-bottom: 2px;
}
.mail:hover { color: var(--fg); }

.footer { background: var(--night); color: #948d80; padding: 32px 0; font-size: .9rem; }
.footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.footer .brand { color: #ece7dd; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--gold); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: grid; grid-template-columns: 72px 1fr 72px; align-items: center;
  background: rgba(10, 10, 9, .95); color: #ece7dd;
  animation: fade .3s var(--ease);
}
.lightbox[hidden] { display: none; }
.lb-figure { display: grid; justify-items: center; gap: 16px; padding: 64px 0 24px; }
.lb-figure img { max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; border-radius: 2px; }
.lb-figure figcaption { display: flex; gap: 20px; align-items: baseline; }
.lb-cap { font-family: var(--f-display); font-size: 1.15rem; }
.lb-count { color: #948d80; }
.lb-close, .lb-nav {
  display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .22); border-radius: 50%;
  background: transparent; color: #fff; cursor: pointer; transition: background .3s, border-color .3s;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .1); border-color: #fff; }
.lb-close { position: absolute; top: 16px; right: 16px; width: 48px; height: 48px; font-size: 1.6rem; line-height: 1; }
.lb-nav { width: 52px; height: 52px; justify-self: center; font-size: 1.8rem; line-height: 1; }
.lb-nav[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .chapter-nav a span:not(.mono) { display: none; }
  .chapter-nav a { padding: 8px 10px; }
  .chapter-nav a .mono { font-size: .74rem; }
}
@media (max-width: 1100px) {
  .pipeline { grid-template-columns: 1fr; gap: 28px; padding-left: 0; }
  .pipeline::before, .pipeline::after { top: 20px; bottom: 20px; left: 20px; right: auto; width: 1px; height: auto; }
  .pipeline::after { transform-origin: top; transform: scaleY(0); }
  .pipeline.is-in::after { transform: scaleY(1); }
  .pipeline li { display: grid; grid-template-columns: 40px 1fr; column-gap: 24px; }
  .pipeline li .pl-dot { grid-row: 1 / span 2; }
  .pipeline h5 { margin-top: 8px; }
  .monitor-grid { grid-template-columns: repeat(2, 1fr); }
  .findings { grid-template-columns: repeat(2, 1fr); }
  .team { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .chapter-nav { display: none; }
  .problem-grid, .insight, .contact, .charts { grid-template-columns: 1fr; }
  .pillars { grid-template-columns: 1fr; --gap: 40px; }
  .pillar + .pillar::before { content: "↓"; top: calc(var(--gap) / -2 - 19px); left: calc(50% - 19px); }

  .workflow { grid-template-columns: 1fr; gap: 28px; }
  .workflow::before, .workflow::after { top: 36px; bottom: 36px; left: 36px; right: auto; width: 1px; height: auto; }
  .workflow::after { transform-origin: top; transform: scaleY(0); }
  .workflow-wrap.is-in .workflow::after { transform: scaleY(1); }
  .workflow li { display: grid; grid-template-columns: 72px 1fr; column-gap: 24px; align-items: center; text-align: left; }
  .workflow li .wf-icon { grid-row: 1 / span 3; }
  .wf-num { margin-top: 0; }
  .workflow p { max-width: none; }

  .scrolly { grid-template-columns: 1fr; }
  .scrolly-media { display: none; }
  .step { min-height: 0; opacity: 1; padding: 40px 0; border-top: 1px solid var(--ln); }
  .step-figs { display: flex; gap: 12px; margin-top: 28px; }
  .step-figs img { flex: var(--ar) 1 0%; min-width: 0; aspect-ratio: var(--ar); object-fit: cover; border-radius: var(--radius); }
  .step-figs.is-stacked { flex-direction: column; }
  .step-figs.is-stacked img { flex: none; width: 100%; }
  .step-figs.is-stacked img + img { width: 60%; }

  .vscrolly { grid-template-columns: 1fr; gap: 0; }
  .vs-stage { top: 60px; z-index: 2; height: auto; padding: 12px 0; background: var(--bg); }
  .vs-frame { aspect-ratio: 4 / 3; }
  .vs-step, .vs-step:first-child, .vs-step:last-child { min-height: 55vh; padding-top: 0; }

  .shift { grid-template-columns: 1fr; }
  .shift-model::before, .shift-model::after { display: none; }

  .deliverables { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: repeat(2, 1fr); }
  .ai-metrics { grid-template-columns: repeat(2, 1fr); }
  .ai-metrics > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .ai-metrics > div:nth-child(n + 3) { border-top: 1px solid var(--ln); }
  .ledger { grid-template-columns: repeat(2, 1fr); }
  .ledger > div:not(:nth-child(3n + 1)) { padding-left: 0; border-left: 0; }
  .ledger > div:nth-child(even) { padding-left: 24px; border-left: 1px solid var(--ln); }
  .cond-row { grid-template-columns: 1fr auto; row-gap: 8px; }
  .cond-desc { grid-column: 1 / -1; }
  .conclusions { grid-template-columns: 1fr; }
  .toc-body { padding-left: 0; }
  .hero-tags { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .topbar { height: 60px; }
  .hero-inner { padding-bottom: 120px; }
  .figure-duo, .volume, .monitor-grid, .findings, .team, .sheets { grid-template-columns: 1fr; }
  .model-duo { flex-direction: column; }
  .model-duo figure { flex: none; width: 100%; }
  .g-row { flex-wrap: wrap; }
  .g-just .g-item { flex: var(--ar) 1 calc(var(--ar) * 140px); }
  .volume > div + div { border-left: 0; border-top: 1px solid var(--ln); }
  .g-2 { grid-template-columns: 1fr; }
  .toc-item summary { grid-template-columns: 44px 1fr 24px; }
  .lightbox { grid-template-columns: 1fr; }
  .lb-figure { grid-row: 1; padding: 72px 12px 96px; }
  .lb-nav { position: absolute; bottom: 24px; }
  .lb-prev { left: calc(50% - 64px); }
  .lb-next { right: calc(50% - 64px); }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .js .reveal { opacity: 1; transform: none; }
}
