/* ==========================================================================
   Varun Reddy · made of starlight
   Phone first: the phone is the controller (tilt, hold, tap, shake, scroll).
   Breakpoints: 760px (tablet), 1000px (desktop).
   ========================================================================== */

@property --hue { syntax: "<number>"; inherits: true; initial-value: 210; }

:root {
  --bg: #05060a;
  --ink: #f2f4f8;
  --ink-2: rgba(242, 244, 248, .7);
  --ink-3: rgba(242, 244, 248, .44);
  --line: rgba(242, 244, 248, .15);
  --accent: hsl(var(--hue) 92% 76%);

  --f-d: "Unbounded", "Arial Black", sans-serif;
  --f-b: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-m: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --g: 20px;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .7, .1, 1);
  transition: --hue 1.4s var(--ease);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15.5px/1.55 var(--f-b);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
/* a long press is a gesture here, not a text selection */
.live body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.live .mail, .live .tools dd { -webkit-user-select: text; user-select: text; }
.is-locked, .is-locked body, .menu-open, .menu-open body { overflow: hidden; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, dl, dd { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.only-mouse { display: none !important; }
.is-mouse .only-mouse { display: inline-flex !important; }
.is-mouse .only-touch { display: none !important; }

/* ---------- sky and stars ---------- */
.sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(95% 52% at 50% 27%, hsl(var(--hue) 75% 17% / .85), transparent 72%),
    radial-gradient(80% 40% at 50% 100%, hsl(calc(var(--hue) + 50) 60% 11% / .7), transparent 72%),
    var(--bg);
}
#stars {
  position: fixed; left: 0; top: 0; z-index: 1; pointer-events: none;
  width: 100%; height: 100vh; height: 100lvh; display: none;
}
.live #stars { display: block; }
main { position: relative; z-index: 2; }
.live main { transition: opacity 1.2s var(--ease); }
.live:not(.ready) main { opacity: 0; }

/* ---------- opening ---------- */
.intro { display: none; }
.live .intro {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 0 var(--g) calc(17svh + var(--sb)); text-align: center; pointer-events: none;
  transition: opacity .9s var(--ease), visibility 0s linear .9s;
}
.live .intro.is-done { opacity: 0; visibility: hidden; }
.intro__label { font: 500 11px/1 var(--f-m); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
.intro__count { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.intro__count b { font: 300 clamp(44px, 13vw, 96px)/1 var(--f-d); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.intro__count span { font: 400 11px/1 var(--f-m); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.intro__skip {
  margin-top: 34px; pointer-events: auto; padding: 10px 16px;
  font: 500 10.5px/1 var(--f-m); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3);
}

/* ---------- top bar, rail ---------- */
.bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + var(--st)) var(--g) 12px;
  background: linear-gradient(rgba(5, 6, 10, .78), rgba(5, 6, 10, 0));
  transition: opacity .8s var(--ease);
}
.live:not(.ready) .bar, .live:not(.ready) .rail { opacity: 0; }
.bar__brand { font: 500 12.5px/1 var(--f-d); letter-spacing: .01em; }
.bar__right { display: flex; gap: 6px; }
.bar__btn {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(242, 244, 248, .04); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font: 500 10.5px/1 var(--f-m); letter-spacing: .12em; text-transform: uppercase;
}
.bar__sound[aria-pressed="true"] { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.rail {
  position: fixed; right: 7px; top: 50%; z-index: 20; width: 1px; height: 30svh;
  transform: translateY(-50%); background: var(--line); transition: opacity .8s var(--ease);
}
.rail i {
  position: absolute; left: -2px; top: 0; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.motion {
  position: fixed; left: 50%; bottom: calc(18px + var(--sb)); z-index: 25; translate: -50% 0;
  padding: 13px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(242, 244, 248, .09); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font: 500 10.5px/1.2 var(--f-m); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
}
.motion[hidden] { display: none; }
.asking .scrollcue { opacity: 0; }
.menu-open .motion { display: none; }
.static .only-live { display: none; }

/* ---------- chapters menu ---------- */
.menu {
  position: fixed; inset: 0; z-index: 19; overflow-y: auto;
  background: rgba(5, 6, 10, .95); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: calc(76px + var(--st)) var(--g) calc(34px + var(--sb));
  display: flex; flex-direction: column;
}
.menu[hidden] { display: none; }
.menu__list { list-style: none; margin: 0; padding: 0; }
.menu__list a {
  display: flex; align-items: baseline; gap: 14px; padding: 12px 0 10px; border-bottom: 1px solid var(--line);
  font: 300 clamp(26px, 7.4vw, 52px)/1.05 var(--f-d); letter-spacing: -.02em;
}
.menu__list span { font: 400 11px/1 var(--f-m); color: var(--ink-3); letter-spacing: .1em; min-width: 22px; }
.menu__foot {
  margin-top: auto; padding-top: 30px; display: flex; flex-wrap: wrap; gap: 14px 22px;
  font: 500 11px/1 var(--f-m); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
}

/* ---------- steps and cards ---------- */
.step {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 calc(var(--g) + 6px) calc(80px + var(--sb)) var(--g);
}
.step--short { min-height: 42svh; padding-bottom: 12svh; }
.step--work { min-height: 92svh; }
.step--mid { min-height: 72svh; }
.card {
  max-width: 560px;
  text-shadow: 0 1px 22px rgba(5, 6, 10, .95), 0 0 2px rgba(5, 6, 10, .6);
  will-change: opacity;
}
.kicker { font: 500 10.5px/1.4 var(--f-m); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.title { margin: 12px 0 14px; font: 300 clamp(42px, 12.4vw, 112px)/.95 var(--f-d); letter-spacing: -.035em; }
.lede { font: 500 17.5px/1.42 var(--f-b); color: var(--ink); max-width: 30ch; }
.head { margin: 12px 0 12px; font: 400 clamp(28px, 8.4vw, 64px)/1.04 var(--f-d); letter-spacing: -.025em; }
.head--sm { font-size: clamp(22px, 6.2vw, 40px); }
.card p:not(.kicker):not(.lede):not(.lang):not(.tags):not(.fine) { color: var(--ink-2); max-width: 44ch; }
.note { margin-top: 10px; font-size: 14px; color: var(--ink-3) !important; }
.tags { margin-top: 12px; font: 400 11.5px/1.6 var(--f-m); color: var(--ink-3); letter-spacing: .02em; }

.lang { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; }
.lang b { font: 500 14px/1 var(--f-d); letter-spacing: .06em; text-transform: uppercase; }
.lang i { font: 400 13px/1 var(--f-m); font-style: normal; color: var(--ink-2); }
.lang__word { flex-basis: 100%; font-size: 44px; line-height: 1.35; font-weight: 800; }
.live .lang__word { display: none; }
.lang__word[lang="te"] { font-family: "Noto Sans Telugu", sans-serif; }
.lang__word[lang="hi"], .lang__word[lang="mr"] { font-family: "Noto Sans Devanagari", sans-serif; }
.lang__word[lang="ta"] { font-family: "Noto Sans Tamil", sans-serif; }
.lang__word[lang="kn"] { font-family: "Noto Sans Kannada", sans-serif; }
.lang__word[lang="ml"] { font-family: "Noto Sans Malayalam", sans-serif; }
.lang__word[lang="bn"] { font-family: "Noto Sans Bengali", sans-serif; }
.lang__word[lang="gu"] { font-family: "Noto Sans Gujarati", sans-serif; }
.lang__word[lang="pa"] { font-family: "Noto Sans Gurmukhi", sans-serif; }
.lang__word[lang="or"] { font-family: "Noto Sans Oriya", sans-serif; }
.lang__word[lang="ur"] { font-family: "Noto Nastaliq Urdu", serif; font-weight: 700; line-height: 1.9; text-align: left; }
.lang__word[lang="en"] { font-family: var(--f-d); }

.try { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.try li {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 13px 0 11px;
  border-radius: 999px; border: 1px solid var(--line);
  background: rgba(242, 244, 248, .04); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font: 500 10.5px/1 var(--f-m); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
}
.ico { position: relative; width: 14px; height: 14px; flex: none; color: var(--accent); }
.ico--tilt::before, .ico--shake::before {
  content: ""; position: absolute; left: 3px; top: 0; width: 8px; height: 14px; border: 1.3px solid currentColor; border-radius: 2.5px;
}
.ico--tilt::before { animation: tilt 2.6s ease-in-out infinite; }
.ico--shake::before { animation: shake 1.6s ease-in-out infinite; }
.ico--hold::before { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: currentColor; animation: hold 1.8s ease-in-out infinite; }
.ico--tap::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: currentColor; }
.ico--tap::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.2px solid currentColor; animation: tap 1.6s ease-out infinite; }
@keyframes tilt { 0%, 100% { transform: rotate(-18deg); } 50% { transform: rotate(18deg); } }
@keyframes hold { 0%, 100% { transform: scale(.5); opacity: .7; } 50% { transform: scale(1); opacity: 1; } }
@keyframes tap { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes shake {
  0%, 55%, 100% { transform: none; } 62% { transform: translateX(-2px) rotate(-9deg); } 69% { transform: translateX(2px) rotate(9deg); }
  76% { transform: translateX(-2px) rotate(-9deg); } 83% { transform: translateX(2px) rotate(9deg); } 90% { transform: none; }
}

.scrollcue {
  position: absolute; left: 50%; bottom: calc(22px + var(--sb)); translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font: 500 10px/1 var(--f-m); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3);
}
.scrollcue::after { content: ""; width: 1px; height: 22px; background: linear-gradient(var(--ink-2), transparent); animation: cue 2.2s var(--ease) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 55% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

.tools { margin-top: 14px; display: grid; }
.tools div { display: grid; grid-template-columns: 78px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); align-items: baseline; }
.tools dt { font: 500 10px/1.5 var(--f-m); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.tools dd { font: 400 13.5px/1.45 var(--f-b); color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(242, 244, 248, .05); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font: 500 11.5px/1 var(--f-m); letter-spacing: .1em; text-transform: uppercase; color: var(--ink);
  transition: background .3s, color .3s, border-color .3s;
}
.btn--solid { background: var(--ink); color: var(--bg); border-color: var(--ink); text-shadow: none; }
.card .btn { margin-top: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.actions .btn { margin-top: 0; }
@media (hover: hover) {
  .btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .menu__list a:hover { color: var(--accent); }
}
.mail { display: block; margin-top: 16px; font: 400 min(5.1vw, 38px)/1.15 var(--f-d); letter-spacing: -.02em; overflow-wrap: anywhere; }
.fine { margin-top: 28px; font: 400 10.5px/1.6 var(--f-m); letter-spacing: .06em; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: calc(76px + var(--sb)); z-index: 40; pointer-events: none;
  transform: translate(-50%, 14px); opacity: 0; transition: opacity .4s var(--ease), transform .5s var(--ease);
  padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); white-space: nowrap;
  font: 500 11px/1 var(--f-m); letter-spacing: .1em; text-transform: uppercase;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- static cut: no WebGL, or reduced motion ---------- */
.still { display: none; }
.static .still {
  display: block; position: absolute; top: 0; left: 50%; translate: -50% 0; width: max(118vw, 64svh); max-width: none;
  -webkit-mask-image: linear-gradient(#000 45%, transparent 88%); mask-image: linear-gradient(#000 45%, transparent 88%);
}
.static .step--hero .card { position: relative; }
.static .step:not(.step--hero) { min-height: 0; padding-top: 56px; padding-bottom: 56px; }
.static .step--short { padding-top: 18px !important; padding-bottom: 18px !important; }
.static .scrollcue { display: none; }

/* ==========================================================================
   Tablet
   ========================================================================== */
@media (min-width: 760px) {
  :root { --g: 34px; }
  .lede { font-size: 19px; }
  .card p:not(.kicker):not(.lede):not(.lang):not(.tags):not(.fine) { font-size: 16.5px; }
}

/* ==========================================================================
   Desktop: the stars take the right, the story reads on the left
   ========================================================================== */
@media (min-width: 1000px) {
  :root { --g: 6vw; }
  .sky {
    background:
      radial-gradient(55% 75% at 70% 48%, hsl(var(--hue) 75% 16% / .85), transparent 72%),
      radial-gradient(50% 50% at 15% 100%, hsl(calc(var(--hue) + 50) 60% 10% / .6), transparent 72%),
      var(--bg);
  }
  .bar { padding: calc(22px + var(--st)) var(--g) 18px; }
  .bar__brand { font-size: 14px; }
  .rail { right: 26px; }
  .step { justify-content: center; padding: 0 var(--g); min-height: 100vh; }
  .step--short { min-height: 58vh; padding-bottom: 0; }
  .step--work { min-height: 100vh; }
  .step--mid { min-height: 82vh; }
  .card { width: min(470px, 36vw); }
  .title { font-size: clamp(56px, 6.4vw, 108px); }
  .head { font-size: clamp(38px, 3.6vw, 60px); }
  .head--sm { font-size: clamp(28px, 2.6vw, 40px); }
  .mail { font-size: clamp(22px, 2vw, 32px); }
  .static .still { left: auto; right: 0; translate: none; width: min(100vh, 56vw); -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%); mask-image: linear-gradient(90deg, transparent, #000 40%); }
  .scrollcue { left: var(--g); translate: none; align-items: flex-start; }
}
