/* Rotproof — rotproof.app */

/* Self-hosted Google Fonts, latin subset. Inter Tight and JetBrains Mono are variable. */
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/assets/fonts/InterTight-var.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/InstrumentSerif-400.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url(/assets/fonts/InstrumentSerif-400i.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap; src: url(/assets/fonts/JetBrainsMono-var.woff2) format("woff2"); }
@font-face { font-family: "Sora"; font-style: normal; font-weight: 800; font-display: swap; src: url(/assets/fonts/Sora-800.woff2) format("woff2"); }

:root {
  --night: #07060d;
  --ink: #120f1f;
  --cream: #f7efe6;
  --paper: #fbf6f0;
  --pink: #ff6b93;
  --pink-soft: #ffb3c7;
  --coral: #ff8a5b;
  --gold: #ffc567;
  --mute: rgba(18, 15, 31, .55);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter Tight", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --gutter: clamp(16px, 4vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0; background: var(--night); color: #fff;
  font-family: var(--sans); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, video, canvas { display: block; max-width: 100%; }
a { color: inherit; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }

/* ---------- Film grain over everything ---------- */
.grain {
  position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .06;
  background: url(/assets/grain.png); will-change: transform;
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 14px;
  color: #fff; pointer-events: none; transition: color .4s;
}
.nav.light { color: var(--ink); }
.nav a { pointer-events: auto; }
.wordmark { font-family: "Sora", var(--sans); font-weight: 800; font-size: 22px; letter-spacing: -.04em; text-decoration: none; }
.nav-cta {
  font-size: 14px; font-weight: 600; text-decoration: none; padding: 9px 16px; border-radius: 99px;
  border: 1px solid currentColor; transition: background .3s, color .3s;
}
.nav-cta:hover { background: #fff; color: #000; }
.nav.light .nav-cta:hover { background: var(--ink); color: #fff; }

.kicker { margin: 0 0 22px; color: rgba(255,255,255,.8); }
.kicker.dark { color: var(--mute); }

/* Masked line reveal */
.line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.line > * { display: inline-block; }

/* ---------- 01 · Hero ---------- */
.hero { position: relative; height: 100svh; min-height: 620px; overflow: hidden; background: #6b4a6e; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22vh; background: linear-gradient(transparent, var(--night)); pointer-events: none; z-index: 2; }
.hero-media { position: absolute; inset: 0; transform-origin: 50% 60%; }
.hero-poster, .hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 75%; }
.hero-video { opacity: 0; transition: opacity .8s ease; }
.hero-video.playing { opacity: 1; }
.hero-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 50%, rgba(7,6,13,.5) 100%),
    linear-gradient(180deg, rgba(36,18,64,.5) 0%, rgba(36,18,64,.12) 40%, rgba(7,6,13,0) 68%, rgba(7,6,13,.55) 100%);
}
.hero-copy {
  position: absolute; left: 0; right: 0; top: 15svh; padding: 0 var(--gutter);
  text-align: center; display: grid; justify-items: center;
}
.hero-title {
  margin: 0; font-family: var(--sans); font-weight: 600; letter-spacing: -.045em; line-height: .95;
  font-size: clamp(48px, 8.4vw, 140px); text-shadow: 0 2px 40px rgba(40,10,60,.3);
}
.hero-title em { font-size: 1.1em; letter-spacing: -.015em; color: #ffe9da; }
.hero-sub { max-width: 28em; margin: 28px 0 0; font-size: clamp(17px, 1.45vw, 21px); color: rgba(255,255,255,.92); text-shadow: 0 1px 20px rgba(40,10,60,.55); }

.hud { position: absolute; z-index: 3; color: rgba(255,255,255,.8); display: flex; align-items: center; gap: 8px; }
.hud-tl { left: var(--gutter); top: 80px; }
.hud-tr { right: var(--gutter); top: 80px; }
.hud-bl { left: var(--gutter); bottom: 28px; }
.hud-br { right: var(--gutter); bottom: 28px; }
.hud b { font-weight: 500; color: #fff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #7dff9a; box-shadow: 0 0 10px #7dff9a; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.hud-bars { display: inline-flex; gap: 2px; }
.hud-bars i { width: 5px; height: 10px; border-radius: 1px; background: rgba(255,255,255,.25); animation: bar 3s linear infinite; }
.hud-bars i:nth-child(2) { animation-delay: .3s; } .hud-bars i:nth-child(3) { animation-delay: .6s; }
.hud-bars i:nth-child(4) { animation-delay: .9s; } .hud-bars i:nth-child(5) { animation-delay: 1.2s; }
@keyframes bar { 0%, 8% { background: rgba(255,255,255,.25); } 12%, 85% { background: var(--gold); } 90%, 100% { background: rgba(255,255,255,.25); } }

.scroll-cue { position: absolute; left: 50%; bottom: 26px; translate: -50% 0; display: grid; justify-items: center; gap: 10px; color: rgba(255,255,255,.75); z-index: 3; }
.scroll-cue i { width: 1px; height: 44px; background: linear-gradient(rgba(255,255,255,.9), transparent); transform-origin: top; animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- 02 · The rot ---------- */
.rot { position: relative; height: 560vh; background: var(--night); }
.rot-pin { position: sticky; top: 0; height: 100svh; overflow: hidden; display: grid; place-items: center; }
.rot-bg { position: absolute; inset: 0; opacity: 0; }
.rot-bg img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.08); will-change: transform; }
.rot-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 70% at 50% 50%, rgba(7,6,13,.25), rgba(7,6,13,.9)); }
.rot-echo { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.rot-echo span {
  position: absolute; white-space: nowrap; font-family: var(--serif); font-style: italic; color: rgba(150,175,255,.13);
  font-size: clamp(24px, 3.6vw, 60px); translate: -50% -50%; opacity: 0;
}

.rot-time {
  position: absolute; top: calc(84px + env(safe-area-inset-top)); left: 50%; translate: -50% 0; z-index: 4;
  font-size: clamp(14px, 1.2vw, 16px); letter-spacing: .2em; color: #ff5c5c; text-shadow: 0 0 18px rgba(255,60,60,.8);
  display: flex; gap: 6px; align-items: baseline;
}
.rot-time small { font-size: .75em; }

.phone { position: relative; z-index: 2; width: min(290px, 60vw); aspect-ratio: 9 / 19.5; }
/* Bezel and screen glow live on their own layer so the screen itself can be clipped hard. */
.phone::before {
  content: ""; position: absolute; inset: 0; border-radius: 15% / 7%; background: #000;
  box-shadow:
    0 0 0 2px #2b2838, 0 0 0 9px #0d0c14, 0 0 0 10px #3a3650,
    0 40px 120px rgba(80,120,255,calc(.2 + var(--glow, 0) * .45)),
    0 0 calc(60px + var(--glow, 0) * 180px) rgba(110,150,255,calc(.12 + var(--glow, 0) * .4));
}
.phone-frame {
  position: absolute; inset: 0; border-radius: 15% / 7%; overflow: hidden; background: #000;
  /* Safari ignores overflow clipping on composited children (canvas, backdrop-filter) without a mask. */
  isolation: isolate; -webkit-mask-image: -webkit-radial-gradient(white, black); clip-path: inset(0 round 15% / 7%);
}
.feed, .phone-glare, .phone-lock { border-radius: 15% / 7%; }
.feed { width: 100%; height: 100%; }
.phone-island { position: absolute; top: 2.4%; left: 50%; translate: -50% 0; width: 32%; height: 4.4%; border-radius: 99px; background: #000; }
.phone-glare { position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 32%); pointer-events: none; }
.phone-lock {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center;
  background: rgba(16,12,30,.5);
  opacity: 0; color: #fff;
}
.phone-lock svg { width: 76px; height: 76px; fill: var(--pink); stroke: var(--pink); filter: drop-shadow(0 0 22px rgba(255,107,147,.8)); }
.phone-lock b { font-size: 22px; letter-spacing: -.02em; }
.phone-lock span { color: rgba(255,255,255,.6); font-size: 9.5px; }

.rot-lines { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.rot-line {
  position: absolute; left: 50%; top: 50%; margin: 0; width: min(92vw, 1200px); translate: -50% -50%; text-align: center;
  font-weight: 600; letter-spacing: -.045em; line-height: 1; font-size: clamp(40px, 7.6vw, 124px);
  opacity: 0; color: #fff; text-shadow: 0 6px 60px rgba(0,0,0,.65);
}
.rot-line em { color: #c3cfff; }
.rot-line.big { font-size: clamp(56px, 11vw, 180px); color: #ff6b6b; }
.rot-line.lock-line { top: auto; bottom: 9svh; translate: -50% 0; font-size: clamp(30px, 4vw, 64px); }

.rot-hud {
  position: absolute; z-index: 4; left: var(--gutter); right: var(--gutter); bottom: 30px;
  display: flex; justify-content: space-between; gap: 16px; color: rgba(255,255,255,.5);
}
.rot-hud div { display: grid; gap: 6px; }
.rot-hud div:nth-child(2) { text-align: center; }
.rot-hud div:nth-child(3) { text-align: right; }
.rot-hud b { font-family: var(--mono); font-weight: 500; font-size: clamp(16px, 1.8vw, 24px); letter-spacing: 0; text-transform: none; color: #fff; font-variant-numeric: tabular-nums; }
.rot-hud b.bad { color: #ff6b6b; }

/* ---------- Night → morning ---------- */
.dawn {
  position: relative; height: 90vh; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(180deg, var(--night) 0%, #1d1538 22%, #5b3a6e 44%, #e07a7a 64%, #ffc59a 80%, var(--cream) 100%);
}
.dawn::before {
  content: ""; position: absolute; left: 50%; bottom: -30vh; width: 70vh; height: 70vh; translate: -50% 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,236,190,.95), rgba(255,200,140,.4) 40%, rgba(255,200,140,0) 70%);
  transform: translateY(var(--sun, 30vh));
}
.dawn::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40%; background: linear-gradient(rgba(247,239,230,0), var(--cream) 85%); }
.dawn-line { position: relative; z-index: 1; margin: 0; font-size: clamp(40px, 6vw, 96px); letter-spacing: -.02em; color: #fff; text-shadow: 0 4px 40px rgba(60,20,60,.35); }

/* ---------- 03 · Charge ---------- */
.charge { position: relative; height: 680vh; background: var(--cream); color: var(--ink); }
.charge-pin { position: sticky; top: 0; height: 100svh; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.charge-pin::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(55% 55% at 50% 60%, rgba(255,197,103,calc(.16 + var(--heat, 0) * .4)), transparent 70%);
}
.charge-head { position: relative; z-index: 5; text-align: center; padding: calc(80px + env(safe-area-inset-top)) var(--gutter) 0; }
.charge-title {
  position: relative; margin: 0 auto; height: 1.05em; font-weight: 600; letter-spacing: -.045em; line-height: 1;
  font-size: clamp(36px, 5.6vw, 92px);
}
.charge-title em { color: var(--pink); }
.swap { position: absolute; left: 0; right: 0; top: 0; }
.swap .w { display: inline-block; opacity: 0; }

.charge-stage { position: relative; z-index: 2; }
.cell {
  position: absolute; left: 50%; top: 50%; translate: -50% -44%; z-index: 2;
  width: min(250px, 40vw, 29svh); aspect-ratio: 1 / 1.75;
}
.cell-canvas { position: absolute; left: -30%; top: -12%; width: 160%; height: 124%; max-width: none; }
.cell-readout {
  position: absolute; left: 0; right: 0; top: 52%; translate: 0 -50%; text-align: center; z-index: 2;
  color: var(--ink);
}
.cell-min { font-weight: 600; font-size: clamp(44px, 4.4vw, 70px); letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.cell-unit { font-family: var(--serif); font-style: italic; font-size: clamp(20px, 1.9vw, 28px); margin-left: 3px; }
.cell-label { position: absolute; left: -50%; right: -50%; bottom: -42px; text-align: center; color: var(--mute); }
.cell-x2 {
  position: absolute; top: -4%; right: -34%; font-family: var(--serif); font-style: italic; font-size: clamp(44px, 5vw, 72px); color: var(--coral);
  opacity: 0; transform: scale(.4) rotate(-12deg);
}

.moments { position: absolute; inset: 0; z-index: 3; }
.moment {
  position: absolute; margin: 0; width: min(360px, 27vw); padding: 10px 10px 14px; background: #fff; border-radius: 18px;
  box-shadow: 0 30px 70px rgba(70,30,40,.18), 0 2px 8px rgba(70,30,40,.08);
  opacity: 0; will-change: transform, opacity;
}
.moment img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; }
.moment figcaption { margin-top: 12px; padding: 0 4px; color: var(--mute); display: flex; gap: 10px; align-items: baseline; }
.moment figcaption b { color: var(--pink); font-weight: 500; font-size: 13px; letter-spacing: .04em; }
.moment[data-i="0"] { left: 7%; top: 6%; }
.moment[data-i="1"] { right: 7%; top: 2%; }
.moment[data-i="2"] { left: 10%; bottom: 12%; }
.moment[data-i="3"] { right: 9%; bottom: 15%; }

.pill {
  position: absolute; left: 50%; bottom: 4.5%; translate: -50% 0; z-index: 4;
  display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 10px; border-radius: 99px;
  background: #0d0b16; color: #fff; box-shadow: 0 20px 50px rgba(20,10,40,.3); opacity: 0; min-width: 380px; padding: 12px 22px 12px 12px;
}
.pill-app { width: 40px; height: 40px; border-radius: 50%; background: conic-gradient(var(--pink) calc(var(--left, 1) * 360deg), rgba(255,255,255,.12) 0); position: relative; flex: none; }
.pill-app::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #0d0b16; }
.pill-text { display: grid; line-height: 1.25; flex: 1; }
.pill-text b { font-size: 16px; font-weight: 600; }
.pill-text small { font-size: 9px; color: rgba(255,255,255,.5); }
.pill-time { font-size: 24px; letter-spacing: 0; color: var(--pink); font-variant-numeric: tabular-nums; }

.charge-progress { position: absolute; z-index: 4; left: var(--gutter); right: var(--gutter); bottom: 22px; height: 2px; background: rgba(18,15,31,.08); border-radius: 2px; overflow: hidden; }
.charge-progress i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--p, 0)); background: var(--ink); }

/* ---------- 04 · Manifesto ---------- */
.manifesto { background: var(--paper); color: var(--ink); padding: 24vh var(--gutter) 28vh; }
.manifesto .kicker { text-align: center; }
.manifesto-text {
  margin: 0 auto; max-width: 1180px; text-align: center; font-weight: 500; letter-spacing: -.035em; line-height: 1.1;
  font-size: clamp(30px, 4.4vw, 70px);
}
.manifesto-text .w { color: rgba(18,15,31,.12); transition: color .35s linear; }
.manifesto-text .w.lit { color: var(--ink); }
.manifesto-text em .w.lit { color: var(--pink); }

/* ---------- 05 · Finale ---------- */
.finale { position: relative; height: 100svh; min-height: 640px; overflow: hidden; display: grid; align-items: end; justify-items: end; text-align: right; }
.finale-media { position: absolute; inset: -6% 0; }
.finale-media img { width: 100%; height: 100%; object-fit: cover; object-position: 40% 50%; }
.finale-shade { position: absolute; inset: 0; background: radial-gradient(80% 70% at 100% 100%, rgba(7,6,13,.7), rgba(7,6,13,0) 70%), linear-gradient(180deg, rgba(7,6,13,.3), transparent 25%); }
.finale-copy { position: relative; z-index: 2; display: grid; justify-items: end; gap: 30px; padding: 0 var(--gutter) 12svh; }
.finale-title { margin: 0; font-weight: 600; letter-spacing: -.05em; line-height: .9; font-size: clamp(60px, 9.4vw, 160px); text-shadow: 0 4px 60px rgba(0,30,60,.45); }
.finale-title em { color: #fff3c9; letter-spacing: -.02em; }
.finale-note { color: rgba(255,255,255,.8); margin: -14px 0 0; }

.store {
  display: inline-flex; align-items: center; gap: 12px; padding: 14px 26px 14px 22px; border-radius: 16px;
  background: #fff; color: #000; text-decoration: none; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  transition: box-shadow .4s var(--ease);
}
.store:hover { box-shadow: 0 26px 80px rgba(255,107,147,.55); }
.store-dark { background: #0b0a10; color: #fff; box-shadow: 0 18px 50px rgba(30,10,50,.35); }
.hero-cta { margin-top: 34px; }
.store svg { width: 26px; height: 26px; fill: currentColor; }
.store span { display: grid; text-align: left; font-weight: 600; font-size: 21px; line-height: 1.05; letter-spacing: -.02em; }
.store small { font-size: 11px; font-weight: 500; letter-spacing: 0; }

/* ---------- Footer ---------- */
.footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 18px;
  padding: 30px var(--gutter) calc(30px + env(safe-area-inset-bottom)); background: var(--night); color: rgba(255,255,255,.6);
}
.footer .wordmark { color: #fff; font-size: 18px; }
.footer nav { display: flex; gap: 24px; font-size: 14px; }
.footer a { text-decoration: none; transition: color .2s; }
.footer a:hover { color: #fff; }

/* ---------- Phone layout ---------- */
@media (max-width: 760px) {
  .hud-bl, .hud-tr { display: none; }
  .hud-tl { top: calc(64px + env(safe-area-inset-top)); }
  .hero-copy { top: calc(15svh + env(safe-area-inset-top)); }
  .hero-title { font-size: clamp(40px, 11.6vw, 60px); }
  .hero-sub { font-size: 15px; margin-top: 18px; max-width: 22em; }
  .hero-cta { margin-top: 24px; padding: 11px 20px 11px 16px; border-radius: 13px; }
  .hero-cta svg { width: 22px; height: 22px; }
  .hero-cta span { font-size: 18px; }
  .hero-cta small { font-size: 10px; }
  .hero-poster, .hero-video { object-position: 16% 70%; }
  .grain { animation: none; inset: 0; }
  .hud-br { right: auto; left: var(--gutter); }
  .scroll-cue { left: auto; right: var(--gutter); translate: 0 0; }

  .phone { width: min(220px, 56vw); }
  .rot-line { font-size: clamp(36px, 11vw, 56px); width: 90vw; }
  .rot-line.big { font-size: clamp(50px, 16vw, 80px); }
  .rot-hud { font-size: 9px; bottom: 22px; }
  .rot-hud b { font-size: 15px; }

  .charge-head { padding-top: calc(68px + env(safe-area-inset-top)); }
  .charge-title { font-size: clamp(30px, 8.4vw, 42px); height: 2.1em; }
  .cell { width: min(132px, 34vw, 22svh); translate: -50% -54%; }
  .cell-min { font-size: 40px; }
  .cell-unit { font-size: 20px; }
  .cell-x2 { right: -50%; }
  .moment { width: 42vw; padding: 6px 6px 9px; border-radius: 12px; }
  .moment img { border-radius: 7px; }
  .moment figcaption { margin-top: 7px; font-size: 8.5px; letter-spacing: .08em; flex-direction: column; gap: 2px; }
  .moment figcaption b { font-size: 11px; }
  .moment[data-i="0"] { left: 3%; top: 1%; }
  .moment[data-i="1"] { right: 3%; top: 6%; }
  .moment[data-i="2"] { left: 3%; bottom: 3%; }
  .moment[data-i="3"] { right: 3%; bottom: 7%; }
  .pill { min-width: 0; width: calc(100% - 2 * var(--gutter)); bottom: 7%; }

  .manifesto { padding: 16vh var(--gutter) 20vh; }
  .finale-media img { object-position: 46% 40%; }
  .finale { justify-items: center; text-align: center; }
  .finale-shade { background: linear-gradient(180deg, rgba(7,6,13,.25), transparent 30%, transparent 45%, rgba(7,6,13,.75) 100%); }
  .finale-copy { justify-items: center; padding-bottom: 10svh; }
  .rot-line.lock-line { font-size: clamp(26px, 7.4vw, 36px); bottom: 12svh; }
  .footer { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .dot, .hud-bars i, .scroll-cue i { animation: none; }
}
