/* Porsche 911 GT3 cinematic scroll site. Fixed WebGL stage, page scrolls underneath. */
:root {
  --ink: #0b0f14;
  --paper: #f2f1ed;
  --paper-70: rgba(242, 241, 237, 0.7);
  --paper-45: rgba(242, 241, 237, 0.45);
  --paper-25: rgba(242, 241, 237, 0.25);
  --red: #d5001c;
  --red-hot: #ff2a3c;
  --display: "Anton", "Arial Narrow", "Be Vietnam Pro", sans-serif;
  --body: "Be Vietnam Pro", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: clamp(24px, 6vw, 96px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-io: cubic-bezier(0.83, 0, 0.17, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: auto; scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
html, body { margin: 0; background: var(--ink); }
body {
  color: var(--paper);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
i { font-style: normal; display: inline-block; }
button:focus-visible, a:focus-visible { outline: 1px solid var(--paper); outline-offset: 6px; }

/* Type */
.t-label { font-family: var(--body); font-size: 10px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; line-height: 1.6; }
.t-mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; }
.t-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--paper-45); }
.t-title { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 3.4vw, 48px); line-height: 1.02; letter-spacing: 0.01em; text-transform: uppercase; margin: 0; }
.t-body { font-family: var(--body); font-size: 14px; line-height: 22px; font-weight: 400; color: var(--paper-70); }
.logo-mark { font-family: var(--display); font-weight: 400; font-size: 24px; letter-spacing: 0.16em; text-transform: uppercase; line-height: 1; }
.logo-mark--lg { font-size: 42px; }

/* Scroll track: real page height, invisible */
.scroller { position: relative; width: 100%; pointer-events: none; }

/* Fixed app shell */
.app { position: fixed; inset: 0; overflow: hidden; z-index: 1; }
.stage { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.grain {
  position: absolute; inset: -20%; pointer-events: none; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.9s steps(4) infinite;
}
@keyframes grain { 0% { transform: translate(0, 0); } 25% { transform: translate(-4%, 3%); } 50% { transform: translate(3%, -5%); } 75% { transform: translate(-2%, -2%); } 100% { transform: translate(0, 0); } }
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 45%, transparent 45%, rgba(4, 6, 10, 0.6) 100%); }

/* Leader lines live inside the stage so they sway with the picture */
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.leader { fill: none; stroke: rgba(242, 241, 237, 0.75); stroke-width: 1; }
.leader__dot { fill: var(--red-hot); }
.leader__num { fill: var(--paper); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; opacity: 0; }
.leader__ring { fill: none; stroke: rgba(242, 241, 237, 0.6); stroke-width: 1; transform-box: fill-box; transform-origin: center; animation: ring 2.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(0.35); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.15); opacity: 0; } }

/* Callout labels: two columns, rows by --slot */
.callouts { position: absolute; inset: 0; z-index: 9; pointer-events: none; }
.callout {
  position: absolute; top: calc(30% + var(--slot, 0) * 13.5%); width: 220px;
  opacity: 0; transform: translateY(8px); transition: opacity 0.5s, transform 0.7s var(--ease-out);
}
.callout.is-visible { opacity: 1; transform: translateY(0); }
.callout.is-left { left: var(--gutter); text-align: right; }
.callout.is-right { right: calc(var(--gutter) + 28px); text-align: left; }
.callout__label { display: block; font-family: var(--body); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; line-height: 22px; }
.callout__text { display: block; color: var(--paper-45); font-size: 12px; line-height: 18px; margin-top: 2px; }

/* Chapter copy: small block under the header */
.slides { position: absolute; inset: 0; z-index: 10; pointer-events: none; will-change: transform, opacity; }
.slide { position: absolute; inset: 0; display: none; }
.slide.is-active { display: block; }
.slide__content { position: absolute; left: var(--gutter); top: clamp(88px, 13vh, 130px); max-width: 420px; }
.slide__eyebrow { display: block; margin-bottom: 10px; }
.slide__title .w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.22em 0 0.08em; margin: -0.22em 0 -0.08em; }
.slide__title .w > span { display: inline-block; transform: translateY(110%); transition: transform 0.8s var(--ease-out); }
.slide.is-in .slide__title .w > span { transform: translateY(0); }
.slide__title.is-blink { animation: blink 0.9s steps(1) 0.35s both; }
@keyframes blink { 0% { opacity: 1; } 20% { opacity: 0.15; } 30% { opacity: 1; } 55% { opacity: 0.4; } 60% { opacity: 1; } 78% { opacity: 0.2; } 84% { opacity: 1; } }
.slide__desc { max-width: 340px; margin: 12px 0 0; }
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s, transform 0.8s var(--ease-out); transition-delay: var(--d, 0ms); }
.slide.is-in .reveal { opacity: 1; transform: translateY(0); }
.slide.is-out .reveal { opacity: 0; transform: translateY(-10px); transition: opacity 0.3s var(--ease-in), transform 0.4s var(--ease-in); transition-delay: 0ms; }
.slide.is-out .slide__title .w > span { transform: translateY(-110%); transition: transform 0.4s var(--ease-in); }
.slide--home .slide__content { max-width: 640px; }
.slide--home .slide__title { font-size: clamp(48px, 6.2vw, 88px); }

/* Stats: one quiet row at the bottom left */
.stats { list-style: none; margin: 0; padding: 0; position: absolute; left: var(--gutter); bottom: clamp(48px, 8vh, 84px); display: flex; gap: clamp(18px, 3vw, 44px); flex-wrap: wrap; opacity: 0; transform: translateY(12px); transition: opacity 0.6s 0.6s, transform 0.8s 0.6s var(--ease-out); }
.slide.is-in .stats { opacity: 1; transform: translateY(0); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__v { font-family: var(--display); font-size: 28px; line-height: 1; display: flex; align-items: baseline; gap: 4px; }
.stat__v i { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--red-hot); }
.stat__l { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--paper-45); }

/* CTA at the end of the last chapter */
.cta { position: absolute; inset: 0; z-index: 12; display: grid; place-items: end start; padding: 0 var(--gutter) clamp(56px, 10vh, 100px); pointer-events: none; opacity: 0; transition: opacity 0.6s; }
.app.is-cta .cta { opacity: 1; pointer-events: auto; }
.app.is-cta .slides { opacity: 0 !important; }
.cta__inner { position: relative; max-width: 520px; }
.cta__title { font-size: clamp(36px, 4.6vw, 64px); transform: translateY(20px); transition: transform 1s var(--ease-out); }
.app.is-cta .cta__title { transform: translateY(0); }
.cta__desc { max-width: 380px; margin: 12px 0 0; opacity: 0; transition: opacity 0.7s 0.2s; }
.app.is-cta .cta__desc { opacity: 1; }
.cta__actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; opacity: 0; transform: translateY(10px); transition: opacity 0.6s 0.35s, transform 0.8s 0.35s var(--ease-out); }
.app.is-cta .cta__actions { opacity: 1; transform: translateY(0); }
.btn { display: inline-flex; align-items: center; height: 46px; padding: 0 22px; font-family: var(--body); font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.4s var(--ease-out); }
.btn--solid { background: var(--paper); color: var(--ink); }
.btn--solid:hover { background: var(--red); color: var(--paper); }
.btn--line { border: 1px solid var(--paper-25); }
.btn--line:hover { border-color: var(--paper); }
.btn:active { transform: scale(0.97); }

/* Header */
.header { position: absolute; left: var(--gutter); right: 22px; top: clamp(24px, 4.5vh, 48px); z-index: 30; display: flex; align-items: center; justify-content: space-between; mix-blend-mode: difference; }
.header__logo { display: inline-flex; align-items: baseline; gap: 12px; }
.logo-model { color: var(--paper-70); }
.header__chapter { display: flex; align-items: center; gap: 16px; }
.header__num b { font-weight: 500; font-size: 13px; }
.header__num i { color: var(--paper-45); margin-left: 6px; }
.header__name { color: var(--paper-70); }

/* Vertical rail on the right */
.rail { position: absolute; right: 22px; bottom: clamp(40px, 7vh, 72px); z-index: 30; display: flex; flex-direction: column; gap: 10px; }
.rail__tick { display: flex; align-items: center; gap: 8px; opacity: 0.4; transition: opacity 0.4s; }
.rail__tick:hover, .rail__tick.is-active { opacity: 1; }
.rail__num { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; width: 18px; text-align: right; }
.rail__bar { position: relative; width: 2px; height: 18px; background: var(--paper-25); overflow: hidden; }
.rail__bar::after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: var(--red-hot); transform: scaleY(var(--fill, 0)); transform-origin: top; }
.rail__tick:not(.is-active) .rail__bar::after { transform: scaleY(0); }

/* Scroll hint */
.hint { position: absolute; left: var(--gutter); bottom: 30px; z-index: 30; display: flex; align-items: center; gap: 14px; opacity: 0; transition: opacity 0.6s 1.2s; }
.app.is-ready .hint { opacity: 1; }
.app.is-scrolled .hint { opacity: 0; transition-delay: 0s; }
.hint__label { color: var(--paper-70); }
.hint__line { position: relative; width: 56px; height: 1px; background: var(--paper-25); overflow: hidden; }
.hint__line i { position: absolute; left: 0; top: 0; width: 22px; height: 100%; background: var(--paper); animation: hint 1.6s var(--ease-io) infinite; }
@keyframes hint { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* Loader */
.loader { position: absolute; inset: 0; z-index: 50; background: #f4f3f0; color: #131313; display: grid; place-items: center; transition: opacity 0.8s var(--ease-io), visibility 0.8s; }
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.loader .logo-mark { color: #131313; }
.loader__model { color: #747474; }
.loader__bar { width: 200px; height: 1px; background: #d9d9d9; position: relative; overflow: hidden; margin-top: 10px; }
.loader__bar i { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--red); transition: width 0.3s; }
.loader__pct { color: #747474; }

/* Responsive */
@media (max-width: 960px) {
  .header__name { display: none; }
  .callout { width: 180px; }
  .rail__num { display: none; }
}
@media (max-width: 640px) {
  .t-title { font-size: 28px; }
  .slide--home .slide__title { font-size: clamp(40px, 12vw, 56px); }
  .slide__content { top: 84px; right: 24px; max-width: none; }
  .slide__desc { max-width: none; }
  /* Callouts stack in one list under the subject */
  .callout { width: auto; left: var(--gutter) !important; right: var(--gutter) !important; text-align: left !important; top: calc(62% + var(--slot, 0) * 8.5%); }
  .callout__text { display: inline; margin-left: 6px; }
  .callout__label { display: inline; }
  .callout__label::before { content: var(--n) " "; color: var(--red-hot); font-family: var(--mono); font-weight: 400; font-size: 11px; margin-right: 4px; }
  .stats { gap: 14px 20px; bottom: 28px; }
  .stat__v { font-size: 22px; }
  .hint { display: none; }
  .rail { bottom: 24px; }
  .cta { padding-bottom: 72px; }
  .btn { height: 42px; padding: 0 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .grain, .leader__ring, .hint__line i { animation: none; }
  .stage { transform: none !important; }
  .slides { transform: none !important; }
}
