/* The scroll story of Gece ve Altın (tmp/design, a prototype): one stage held in place while the reader scrolls,
   the phone and the orb moving on it. f.css gives the tokens and the phone's screens; this file the stage around
   them. Without the scripts the stage is an ordinary page: the opening, the four chapters and the end, one after
   another. */
:root {
  --gl: max(20px, env(safe-area-inset-left, 0px));
  --gr: max(20px, env(safe-area-inset-right, 0px));
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--night); overflow-x: clip; }
body { margin: 0; font-size: 16px; background: var(--night); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

.skip { position: absolute; z-index: 20; left: var(--gl); top: calc(var(--top) + 12px); padding: 10px 16px; border-radius: 999px; font-size: 15px; font-weight: 600;
  color: var(--gold-ink); background: var(--gold); transform: translateY(-300%); }
.skip:focus-visible { transform: none; }

/* The stage. */
.story { position: relative; overflow: hidden; isolation: isolate; height: 100vh; height: 100svh; }
.sky { position: absolute; inset: 0; z-index: 0; background: radial-gradient(90% 55% at 50% 32%, rgba(40, 86, 170, 0.16), rgba(40, 86, 170, 0) 72%), linear-gradient(180deg, #060b16 0%, #04070f 60%, #030509 100%); }
.glow { position: absolute; left: var(--gx, 50%); top: var(--gy, 30%); width: var(--gd, 600px); height: var(--gd, 600px); margin: calc(var(--gd, 600px) / -2) 0 0 calc(var(--gd, 600px) / -2);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(222, 170, 80, 0.2), rgba(222, 170, 80, 0.07) 55%, rgba(222, 170, 80, 0)); }
#stars { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% + 80px); }
#orb { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
.progress { position: absolute; z-index: 6; left: 0; right: 0; top: var(--top); height: 2px; background: var(--gold); transform: scaleX(0); transform-origin: 0 50%; }

/* The opening and the end: words under the orb. */
.hero, .finale { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; display: grid; justify-items: center; gap: 14px; text-align: center;
  padding-block: 0 calc(28px + var(--bottom)); padding-left: var(--gl); padding-right: var(--gr); }
.hero h1, .finale h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 7.2vw, 104px); line-height: 0.98; letter-spacing: -0.01em; text-wrap: balance; }
.hero h1 em { font-style: italic; color: var(--gold-hi); }
.hero > p:not(.hint), .finale p { margin: 0; max-width: 34ch; font-size: clamp(16px, 1.35vw, 19px); line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.hint { margin: 8px 0 0; display: grid; justify-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-3); }
.hint i { display: block; width: 1px; height: 34px; background: linear-gradient(var(--gold), rgba(216, 180, 108, 0)); transform-origin: 50% 0; animation: hint 2.4s ease-in-out infinite; }
@keyframes hint { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
.finale .f-primary { width: auto; padding: 0 30px; margin-top: 6px; }
.finale small { font-size: 13px; color: var(--ink-3); }

/* The chapters: on a phone above the phone, on a wide screen beside it. */
.chapters { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.chapter { position: absolute; left: var(--gl); right: var(--gr); top: calc(var(--top) + 18px); max-width: 520px; margin: 0 auto; text-align: center; }
.chapter .step { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--gold); }
.chapter h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3.9vw, 56px); line-height: 1.02; text-wrap: balance; }
.chapter > p:not(.step) { margin: 10px auto 0; max-width: 36ch; font-size: 15px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.said { display: grid; gap: 6px; margin-top: 12px; }
.said p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink); text-wrap: pretty; }
.said b { margin-right: 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.said p + p b { color: var(--gold); }
.steps { display: none; }

/* The phone: a dark bezel, the glass, and in it a slot for each screen. Its place and scale come from scroll.js. */
.device { position: absolute; z-index: 2; left: var(--bx, 0); top: var(--by, 0); width: var(--bw, 300px); height: var(--bh, 640px); padding: var(--bz, 8px);
  border-radius: var(--br, 48px); background: #090c13; box-shadow: inset 0 0 0 1px rgba(245, 240, 231, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.55), 0 50px 100px -30px rgba(0, 0, 0, 0.85); }
.frame { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: var(--sr, 40px); background: var(--night); isolation: isolate; }
.slot { position: absolute; inset: 0; overflow: hidden; }
.screen { position: absolute; left: 0; top: 0; width: 412px; height: 915px; overflow: hidden; isolation: isolate; color: var(--ink); transform: scale(var(--s, 0.6)); transform-origin: 0 0;
  --safe-top: 0px; --safe-bottom: 0px; }
.screen .layer { position: absolute; inset: 0; }
.screen img { max-width: none; }
.screen .orb { position: absolute; pointer-events: none; }
.screen .sb { position: absolute; left: 0; right: 0; top: 0; height: 36px; padding: 10px 22px 0 24px; display: flex; justify-content: space-between; align-items: center;
  font: 600 14px/1 -apple-system, system-ui, sans-serif; letter-spacing: 0.01em; z-index: 50; }
.screen .sb-i { display: flex; gap: 6px; align-items: center; }
.screen .sb-i svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.screen .nav { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; display: grid; place-items: center; z-index: 50; }
.screen .nav i { width: 108px; height: 4px; border-radius: 4px; background: currentColor; opacity: 0.55; }

@media (min-width: 860px) {
  .chapter { left: auto; right: calc(50% + 64px); top: 0; bottom: 0; width: min(440px, calc(50% - 64px - var(--gl))); max-width: none; margin: 0;
    display: flex; flex-direction: column; justify-content: center; text-align: left; }
  .chapter h2 { font-size: clamp(40px, 3.9vw, 58px); }
  .chapter > p:not(.step), .said p { margin-left: 0; font-size: 18px; }
  .said { margin-top: 18px; gap: 10px; }
  .chapter .step { font-size: 14px; margin-bottom: 10px; }
  .steps { position: absolute; z-index: 5; right: calc(50% + 64px); bottom: calc(40px + var(--bottom)); width: min(440px, calc(50% - 64px - var(--gl)));
    display: flex; flex-wrap: wrap; gap: 8px; }
  .steps button { height: 36px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-2); border: 1px solid var(--hair);
    transition: background-color 150ms ease-out, color 150ms ease-out; }
  .steps button:hover { background: var(--card-hi); }
  .steps [aria-current="step"] { color: var(--gold-ink); background: var(--ink); border-color: transparent; }
  .steps [aria-current="step"]:hover { background: var(--ink); }
}

.foot { padding-block: 28px calc(28px + var(--bottom)); padding-left: var(--gl); padding-right: var(--gr); text-align: center; border-top: 1px solid var(--hair); }
.foot p { margin: 0; font-size: 13px; color: var(--ink-3); }

/* Without the scripts: one ordinary page. */
html:not(.story-on) .story { height: auto; overflow: visible; display: grid; gap: 56px; padding-block: calc(var(--top) + 64px) 64px; }
html:not(.story-on) :is(.hero, .chapters, .chapter, .finale) { position: static; transform: none; }
html:not(.story-on) :is(.device, #orb, .progress, .hint, .steps, .finale .again) { display: none; }
html:not(.story-on) .chapters { display: grid; gap: 48px; }

@media (prefers-reduced-motion: reduce) {
  .hint i { animation: none; transform: none; }
  .steps button { transition: none; }
}
