/* The Gallery language on the web (brandkit/style_guide.md, DEV-1158):
   near-black ground, white text at three strengths, colorless chrome.
   The resonance field is the world layer and the page's only color. */

:root {
  --ground: #0a0a0c;
  --surface: #14141a;
  --text: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-tertiary: rgba(255, 255, 255, 0.45);
  --hairline: rgba(255, 255, 255, 0.1);
  --glass-edge: rgba(255, 255, 255, 0.18);

  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue",
    "Segoe UI", system-ui, sans-serif;

  --fs-hero: clamp(4rem, 1.8rem + 8vw, 8.5rem);
  --fs-micro: 0.75rem;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout root ------------------------------------------------------------
   Fixed to the viewport and laid out as an explicit two-row grid. The
   first row takes the slack, so the wordmark is centred without a flex item
   growing against a min-height — which is where WebKit and Blink disagreed.
   Every decorative layer is a child of this same box, so the canvas can never
   drift out of register with the type. */

.root {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.root__field,
.hero__img,
.root__scrim,
.root__grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* The world layer: a slow wash of the state atmospheres (sleep indigo,
   calm teal, wind-down ember — style_guide.md), the only color here. */
.root__field {
  z-index: 0;
  background:
    radial-gradient(ellipse 62% 52% at 18% 22%, rgba(26, 26, 71, 0.55), transparent 64%),
    radial-gradient(ellipse 52% 46% at 84% 18%, rgba(13, 77, 97, 0.30), transparent 66%),
    radial-gradient(ellipse 58% 60% at 56% 90%, rgba(148, 61, 36, 0.16), transparent 62%),
    linear-gradient(180deg, #0d0d13 0%, var(--ground) 70%);
  animation: field-drift 32s var(--ease-out-expo) infinite alternate;
}

/* The journey heroes: two stacked layers hero.js alternates between. The
   active layer drifts forward slowly — the world does the moving. */
.hero__img {
  z-index: 1;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 2.8s ease;
  will-change: opacity, transform;
}

.hero__img--active {
  opacity: 1;
  animation: hero-drift 36s linear both;
}

/* Grounds the type over any world, bright noon ocean included: a centre
   vignette behind the wordmark and the Gallery's bottom-weighted scrim. */
.root__scrim {
  z-index: 2;
  background:
    radial-gradient(ellipse 68% 56% at 50% 52%, rgba(5, 5, 18, 0.42), transparent 72%),
    linear-gradient(180deg, rgba(5, 5, 18, 0.30) 0%, rgba(5, 5, 18, 0) 30%, rgba(5, 5, 18, 0) 55%, rgba(5, 5, 18, 0.62) 100%);
}

/* Film grain. */
.root__grain {
  z-index: 3;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.95 0 0 0 0 0.95 0 0 0 0.08 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.5;
  mix-blend-mode: overlay;
}

/* Stage ------------------------------------------------------------------ */

.stage {
  position: relative;
  z-index: 4;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem 0;
  min-height: 0;
}

/* Chrome eyebrow: tracked caps, colorless (the app's TONOVERSE label). */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  animation: rise 1.8s var(--ease-out-expo) 0.3s both;
}

.eyebrow__dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  animation: dot-breathe 6s ease-in-out 2s infinite;
}

/* The brand-first moment: the serif wordmark, normal case (the display
   voice; chrome never sets it this large). */
.wordmark {
  margin-top: 1.25rem;
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--text);
  text-shadow:
    0 2px 24px rgba(5, 5, 18, 0.55),
    0 0 80px rgba(5, 5, 18, 0.4);
  animation: rise 2.2s var(--ease-out-expo) 0.5s both;
}

/* The player's voice: the display serif, italic. */
.line {
  margin-top: 1.4rem;
  max-width: 28rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 1rem + 0.8vw, 1.45rem);
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 16px rgba(5, 5, 18, 0.6);
  animation: rise 2.2s var(--ease-out-expo) 0.9s both;
}

/* Footer ----------------------------------------------------------------- */

.mark {
  position: relative;
  z-index: 4;
  grid-row: 2;
  text-align: center;
  padding: 1.75rem 1.5rem 2rem;
  border-top: 1px solid var(--hairline);
  margin: 0 clamp(1.5rem, 6vw, 6rem);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  animation: rise 2.2s var(--ease-out-expo) 1.3s both;
}

/* Motion ----------------------------------------------------------------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes field-drift {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(0, -1.5%, 0); }
}

@keyframes hero-drift {
  from { transform: scale(1); }
  to { transform: scale(1.07); }
}

@keyframes dot-breathe {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

/* Narrow and short viewports ---------------------------------------------
   The root is fixed with no scroll, so everything has to fit. Tighten the
   type rather than let it collide or clip. */

@media (max-width: 30rem) {
  .eyebrow {
    letter-spacing: 0.18em;
    font-size: 0.6875rem;
  }

  .line {
    font-size: 1.05rem;
    max-width: 20rem;
  }
}

@media (max-height: 34rem) {
  .stage {
    padding-top: 1.5rem;
  }

  .wordmark {
    margin-top: 0.75rem;
    font-size: clamp(2.4rem, 1rem + 6vw, 4rem);
  }

  .line {
    margin-top: 0.9rem;
  }

  .mark {
    padding: 0.9rem 1.5rem 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .root__field,
  .hero__img--active,
  .eyebrow,
  .eyebrow__dot,
  .wordmark,
  .line,
  .mark {
    animation: none;
  }

  .hero__img {
    transition: none;
  }
}
