@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/assets/fonts/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --mango: #FFA92D;
  --mango-deep: #E99612;
  --mango-mid: #F6A122;
  --amber: #A46909;
  --cream: #FFF2DD;
  --ink: #16191C;
  --white: #FFFFFF;
  --on-ink: #F4F5F6;
  --gray: #5F6469;
  --display: "Plus Jakarta Sans", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --fade: 2.2s;
  --lx: 50%;
  --ly: 30%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--on-ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background-color var(--fade) ease, color var(--fade) ease;
  touch-action: none;
}
body.light { background: var(--white); color: var(--ink); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Light pool on the floor, following the light. Warm white, kept faint. */
.pool {
  position: fixed; z-index: -1; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--lx) var(--ly), rgba(255, 244, 230, 0.13), rgba(255, 244, 230, 0.04) 20%, transparent 44%);
  transition: opacity var(--fade) ease;
}
.grain {
  position: fixed; inset: -50%; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.9s steps(4) infinite;
  transition: opacity var(--fade) ease;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-1%, 3%); }
  100% { transform: translate(0, 0); }
}
body.light .pool, body.light .grain { opacity: 0; }

.no-anim, .no-anim * { transition: none !important; }

/* Lens: a circle of darkness that follows the cursor while the lights are on. The mark inside is unlit. */
.lens {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; visibility: hidden;
  background: var(--ink);
  --mx: 50%; --my: 40%; --mr: 0px;
  -webkit-mask-image: radial-gradient(circle var(--mr) at var(--mx) var(--my), #000 calc(100% - 1.5px), transparent 100%);
  mask-image: radial-gradient(circle var(--mr) at var(--mx) var(--my), #000 calc(100% - 1.5px), transparent 100%);
}
.lens-grain {
  position: absolute; inset: 0; opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.lens-mark { position: absolute; overflow: visible; }

/* The page inside the lens: dark, with the same warm-white backlight as the mark. */
.lens-ui { position: absolute; inset: 0; --rim: rgba(255, 244, 230, 0.95); --bloom: rgba(255, 244, 230, 0.26); }
.lens-ui, .lens-ui * { color: #1C2024 !important; }
.lens-ui h1, .lens-ui .hint, .lens-ui .word, .lens-ui .status, .lens-ui .listen,
.lens-ui .again, .lens-ui .notify button, .lens-ui .foot, .lens-ui .lights {
  /* Rim stays crisp at any size; the glow and bloom scale with the text. */
  text-shadow: 0 0 1px var(--rim), 0 0 0.07em rgba(255, 244, 230, 0.6), 0 0 0.4em var(--bloom);
}
.lens-ui .listen, .lens-ui .again, .lens-ui .notify button, .lens-ui .notify input {
  background: #1C2024 !important;
  border: 1px solid rgba(255, 244, 230, 0.6) !important;
  box-shadow: 0 0 6px rgba(255, 244, 230, 0.35), 0 0 26px var(--bloom) !important;
}
.lens-ui svg { filter: drop-shadow(0 0 1px var(--rim)) drop-shadow(0 0 5px rgba(255, 244, 230, 0.4)); }
.lens-ui .notify input::placeholder { color: #1C2024; }
.lens-body use, .lens-body circle { fill: var(--mango); }
/* Backlight in warm white, never an orange glow on black. */
.lcast use, .lcast circle { fill: #FFF4E6; }
.lcast.far { opacity: 0.36; }
.lcast.near { opacity: 0.92; }

/* Stage */
.stage {
  position: relative;
  height: 100vh; height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(56px, calc(env(safe-area-inset-bottom) + 40px));
}
.mark-wrap {
  position: relative; margin: 0; align-self: center;
  width: min(58vmin, 500px); aspect-ratio: 1;
  transition: transform 1.6s cubic-bezier(.2, .7, .1, 1);
}
.mark { width: 100%; height: 100%; display: block; overflow: visible; }
.body use, .body .dot { fill: var(--mango); }
.cast use, .cast circle { fill: #000; }
.cast { transition: opacity var(--fade) ease; }
.cast.far { opacity: 0.55; }
.cast.near { opacity: 0.5; }
/* Lit: warm shadows, the color a Mango object really casts on white. */
.cast use, .cast circle { transition: fill var(--fade) ease; }
body.light .cast use, body.light .cast circle { fill: #4A2C03; }
body.light .cast.far { opacity: 0.2; }
body.light .cast.near { opacity: 0.17; }
.dot { transform-box: fill-box; transform-origin: center; }
.dot.beat { animation: beat 0.42s cubic-bezier(.2, .8, .3, 1); }
@keyframes tick { 0% { transform: scale(1); } 25% { transform: scale(1.14); } 100% { transform: scale(1); } }
.dot.tick { animation: tick 0.6s cubic-bezier(.2, .8, .3, 1); }
@keyframes beat { 0% { transform: scale(1); } 30% { transform: scale(1.45); } 100% { transform: scale(1); } }

/* Sound rings close in on the ear */
.rings { position: absolute; left: 45.8%; top: 41%; width: 0; height: 0; pointer-events: none; }
.ring {
  position: absolute; left: 0; top: 0; width: 120vmax; height: 120vmax;
  border-radius: 50%; border: 1.5px solid rgba(255, 244, 230, 0.55);
  transform: translate(-50%, -50%) scale(1); opacity: 0;
  animation: inward 1.5s cubic-bezier(.3, .1, .2, 1) forwards;
}
body.light .ring { border-color: rgba(233, 150, 18, 0.55); }
.ring.faint { border-width: 1px; animation-duration: 2.6s; }
body.light .ring.faint { border-color: rgba(233, 150, 18, 0.22); }
@keyframes inward {
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.02); opacity: 0; }
}

/* Copy under the mark */
.copy { position: relative; display: grid; justify-items: center; text-align: center; min-height: 168px; width: 100%; }
/* Scene change: the outgoing text leaves fast, the room changes, then the incoming text arrives from a soft blur.
   Each rule's transition describes how an element ENTERS that state. */
.before, .after { grid-area: 1 / 1; display: grid; justify-items: center; align-content: start; gap: 18px; }
.before {
  transition: opacity 1s ease 0.9s, transform 1.2s cubic-bezier(.2, .7, .1, 1) 0.9s, filter 1s ease 0.9s;
}
body.revealed .before {
  opacity: 0; transform: translateY(-8px); filter: blur(6px); pointer-events: none;
  transition: opacity 0.55s ease, transform 0.55s ease, filter 0.55s ease;
}
.after {
  opacity: 0; transform: translateY(12px); filter: blur(8px); pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease, filter 0.5s ease;
}
body.revealed .after {
  opacity: 1; transform: none; filter: blur(0); pointer-events: auto;
  transition: opacity 1.1s ease 1.1s, transform 1.4s cubic-bezier(.2, .7, .1, 1) 1.1s, filter 1.1s ease 1.1s;
}

h1 {
  margin: 0;
  font-family: var(--display); font-weight: 800; letter-spacing: -0.045em; line-height: 1;
  font-size: clamp(30px, 5.4vw, 54px);
  color: rgba(244, 245, 246, 0.92);
}
.hint { margin: 0; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(244, 245, 246, 0.42); }

.listen {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 15px/1 var(--body); color: var(--on-ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px;
  padding: 13px 24px 13px 18px; cursor: pointer;
  box-shadow: 0 0 0 0 rgba(255, 169, 45, 0);
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .25s ease;
}
.listen svg { width: 18px; height: 18px; fill: currentColor; }
.listen:hover, .listen:focus-visible { background: var(--mango); color: var(--ink); border-color: var(--mango); outline: none; transform: translateY(-1px); }

/* The name assembles: Hear + original */
.word {
  margin: 0; display: inline-flex; align-items: baseline;
  font-family: var(--display); font-weight: 800; letter-spacing: -0.045em; line-height: 1;
  font-size: clamp(40px, 8vw, 84px);
}
/* Timing is driven from main.js, so no delays here. */
.w-hear { color: var(--ink); margin-right: 0.28em; transition: margin 1s cubic-bezier(.6, 0, .2, 1); }
.w-or { color: var(--ink); display: inline-block; overflow: hidden; max-width: 1.2em; white-space: nowrap;
  transition: max-width 1s cubic-bezier(.6, 0, .2, 1), opacity 0.6s ease; }
.w-iginal { color: var(--ink); transition: color 0.8s ease 0.7s; }
body.merged .w-hear { margin-right: 0; }
body.merged .w-or { max-width: 0; opacity: 0; }
/* Between Mango deep and Mango (60% toward Mango), chosen by Kevin for this page. */
body.merged .w-iginal { color: var(--mango-mid); }

.notify[hidden] { display: none; }
.notify { display: flex; gap: 8px; width: min(420px, 100%); }
.notify input {
  flex: 1; min-width: 0; font: 400 15px var(--body); color: var(--ink);
  padding: 13px 16px; border: 1px solid #D9DBDD; border-radius: 999px; background: var(--white);
}
.notify input:focus { outline: 2px solid var(--mango); outline-offset: 1px; border-color: transparent; }
.notify button {
  font: 600 15px var(--body); color: var(--ink); background: var(--mango); border: 0; border-radius: 999px;
  padding: 13px 20px; cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 18px -8px rgba(164, 105, 9, 0.55);
  transition: transform .2s ease, box-shadow .2s ease;
}
.notify button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(164, 105, 9, 0.6); }
.status { margin: 6px 0 0; font-size: 12px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gray); min-height: 1.4em; }
.again {
  display: inline-flex; align-items: center; gap: 9px;
  font: 600 14px/1 var(--body); color: var(--ink); background: var(--white);
  border: 1px solid rgba(22, 25, 28, 0.14); border-radius: 999px; padding: 11px 20px 11px 15px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(74, 44, 3, 0.06), 0 8px 24px -12px rgba(74, 44, 3, 0.28);
  transition: background-color .25s ease, border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.again svg { width: 16px; height: 16px; fill: currentColor; }
.again:hover, .again:focus-visible { background: var(--mango); border-color: var(--mango); outline: none; transform: translateY(-1px);
  box-shadow: 0 1px 2px rgba(74, 44, 3, 0.08), 0 12px 28px -12px rgba(164, 105, 9, 0.5); }
.lights { font: 500 13px var(--body); color: var(--gray); background: none; border: 0; cursor: pointer; padding: 6px; }
.lights:hover { color: var(--ink); }
.lights { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 16px; z-index: 2; text-decoration: none; letter-spacing: 0.12em; text-transform: uppercase; font-size: 11.5px; }

.foot {
  position: fixed; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); text-align: center;
  font-size: 12px; color: rgba(244, 245, 246, 0.32); transition: color var(--fade) ease; pointer-events: none;
}
body.light .foot { color: var(--gray); }

@media (max-height: 560px) {
  .mark-wrap { width: min(46vmin, 360px); }
  .copy { min-height: 140px; }
}

@media (max-height: 480px) { .foot { display: none; } }
@media (max-aspect-ratio: 3/4) { .mark-wrap { width: min(84vw, 50vh); } }

@media (prefers-reduced-motion: reduce) {
  :root { --fade: 0.01s; }
  .grain { animation: none; }
  .ring { display: none; }
  .lens { display: none; }
  .dot.beat, .dot.tick { animation: none; }
  .w-hear, .w-or, .w-iginal { transition-duration: 0.01s; transition-delay: 0s; }
}
