/* ==========================================================================
   localizedae — landing page
   Tokens come from DESIGN.MD. Layout of the opening (hero → film) lives here;
   motion values live in js/config.js.
   ========================================================================== */

:root {
  --obsidian: #181818;
  --shadow: #0E0C0B;
  --terracotta: #9E472A;
  --teal: #08847D;
  --ochre: #D18917;
  --limestone: #E6DCCB;
  --alabaster: #F3F2F0;
  --kraft: #C9965B;
  --ease-arch: cubic-bezier(0.22, 1, 0.36, 1);

  --margin: 32px;
  --opening-len: 350svh;             /* overwritten from js/config.js */

  /* Hero size of the logo. The 3D logo and the PNG fallback both follow this box. */
  --slot-h: min(44svh, 58vw);
  --wm-size: min(calc(var(--slot-h) * 0.24), 7.2vw);
  --wm-gap: calc(var(--slot-h) * 0.07);
  --headline-size: clamp(56px, 8.6vw, 168px);
}

@media (max-width: 767px) {
  :root {
    --margin: 24px;
    --opening-len: 260svh;
    --slot-h: min(34svh, 62vw);
    --headline-size: clamp(36px, 12vw, 56px);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  background: var(--shadow);
  color: var(--alabaster);
  font-family: 'Montserrat', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { display: block; }

/* --------------------------------------------------------------------------
   Opening: one tall section with a sticky full-screen stage inside
   -------------------------------------------------------------------------- */
.opening {
  position: relative;
  height: var(--opening-len);
}

.opening__stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: clip;              /* clip, not hidden: hidden would break sticky */
  isolation: isolate;
  background: var(--shadow);
}

.film,
.scrim,
.bg-fallback,
.stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.film {
  object-fit: cover;
  background: var(--shadow);
}

/* Scrims sit between the film and the canvas, so they only ever dim the film. */
.scrim {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
.scrim--center {
  background: radial-gradient(ellipse 60% 55% at 50% 50%,
    rgba(14, 12, 11, 0.62) 0%,
    rgba(14, 12, 11, 0.38) 50%,
    rgba(14, 12, 11, 0) 100%);
}
.scrim--top {
  background: linear-gradient(to bottom,
    rgba(14, 12, 11, 0.62) 0px,
    rgba(14, 12, 11, 0.3) 120px,
    rgba(14, 12, 11, 0) 240px);
}

/* CSS version of the background. Covers the film while loading, and is the
   whole background when WebGL is unavailable. Hidden once the shader renders. */
.bg-fallback {
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 30% 75%, rgba(158, 71, 42, 0.32) 0%, rgba(158, 71, 42, 0) 70%),
    radial-gradient(ellipse 60% 50% at 75% 30%, rgba(74, 46, 31, 0.55) 0%, rgba(74, 46, 31, 0) 70%),
    radial-gradient(ellipse 90% 80% at 50% 45%, #1d1916 0%, var(--shadow) 75%);
}

.stage-canvas {
  display: block;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Headlines — "FROM THE UAE" top-left, "LOCALIZED FOR THE UAE" bottom-right
   -------------------------------------------------------------------------- */
.headline-wrap {
  position: absolute;
  z-index: 2;
  will-change: transform, opacity;
}
.headline-wrap--from { top: var(--margin); left: var(--margin); }
.headline-wrap--for  { right: var(--margin); bottom: var(--margin); text-align: right; }

.headline {
  margin: 0;
  font-size: var(--headline-size);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--alabaster);
  font-kerning: none;           /* SplitText: avoid kerning shift when lines split */
  visibility: hidden;           /* shown by JS once split, so there's no flash */
}

/* --------------------------------------------------------------------------
   Lockup — logo slot + LOCALIZED.AE. GSAP moves both from centre to top.
   -------------------------------------------------------------------------- */
.lockup {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.lockup__logo-slot {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - var(--slot-h) / 2);
  margin: 0 auto;
  height: var(--slot-h);
  width: calc(var(--slot-h) * 102 / 129);   /* the SVG's aspect ratio */
  transform-origin: 50% 0;
  will-change: transform;
}

.lockup__logo-fallback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.lockup__logo-fallback[hidden] { display: none; }

.lockup__wordmark {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + var(--slot-h) / 2 + var(--wm-gap));
  text-align: center;
  white-space: nowrap;
  font-size: var(--wm-size);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--alabaster);
  transform-origin: 50% 0;
  will-change: transform;
  font-kerning: none;
}

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */
.sound-toggle {
  position: absolute;
  z-index: 3;
  right: var(--margin);
  bottom: var(--margin);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--alabaster);
  color: var(--obsidian);
  font: 700 12px/1 'Montserrat', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: scale 0.3s var(--ease-arch), background-color 0.3s var(--ease-arch);
}
.sound-toggle::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--obsidian);
  opacity: 0.35;
}
.sound-toggle[aria-pressed='true']::before {
  background: var(--teal);
  opacity: 1;
}
.sound-toggle:hover { scale: 1.02; }
.sound-toggle:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.scroll-cue {
  position: absolute;
  z-index: 2;
  left: var(--margin);
  bottom: var(--margin);
  pointer-events: none;
}
.scroll-cue__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 700 11px/1 'Montserrat', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(243, 242, 240, 0.7);
}
.scroll-cue__inner i {
  display: block;
  width: 1px;
  height: 36px;
  background: rgba(243, 242, 240, 0.7);
  transform-origin: 50% 0;
  animation: cue 2.2s var(--ease-arch) infinite;
}
@keyframes cue {
  0%   { transform: scaleY(0); transform-origin: 50% 0; }
  50%  { transform: scaleY(1); transform-origin: 50% 0; }
  51%  { transform: scaleY(1); transform-origin: 50% 100%; }
  100% { transform: scaleY(0); transform-origin: 50% 100%; }
}

.loader {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-content: center;
  font: 700 11px/1 'Montserrat', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(243, 242, 240, 0.7);
  pointer-events: none;
}
body:not(.is-loading) .loader { opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0.4s; }

/* --------------------------------------------------------------------------
   Placeholder for Chapter 2 (Manifesto)
   -------------------------------------------------------------------------- */
.next-placeholder {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  place-content: center;
  gap: 24px;
  padding: 120px var(--margin);
  background: var(--alabaster);
  color: var(--obsidian);
}
.next-placeholder__eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta);
}
.next-placeholder__text {
  margin: 0;
  max-width: 30ch;
  font-size: clamp(24px, 3vw, 40px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

@media (max-width: 767px) {
  .scroll-cue { display: none; }   /* bottom-left is taken by the headline on phones */
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue__inner i { animation: none; }
}
