/* ==========================================================================
   ELAUR — temporary landing page
   Tokens follow the ELAUR design system (design system.txt).
   ========================================================================== */

@font-face {
  font-family: "DM Serif Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/dm-serif-display-normal-latin.woff2") format("woff2");
}
@font-face {
  font-family: "DM Serif Display";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/dm-serif-display-italic-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url("assets/fonts/jost-normal-latin.woff2") format("woff2");
}

:root {
  /* Colour */
  --ivory-100: #F7F3EC;
  --white: #FFFFFF;
  --ink-900: #1A1714;
  --stone-200: #E4DDD2;
  --gold-300: #DCC398;   /* light gold for eyebrows on dark photography */
  --gold-500: #B48F5B;
  --gold-700: #7C5C33;
  --status-error-on-dark: #F2BBA9;

  --color-text-on-photo: var(--ivory-100);
  --color-text-on-photo-muted: rgb(247 243 236 / 0.78);
  --color-photo-protect: rgb(26 23 20 / 0.62);

  /* Type */
  --font-display: "DM Serif Display", "Times New Roman", serif;
  --font-body: "Jost", "Futura", "Century Gothic", system-ui, sans-serif;
  --label-size: 0.75rem;     /* 12px */
  --label-tracking: 0.14em;

  /* Space */
  --gutter: clamp(16px, 3.2vw, 40px);
  --edge-block: clamp(16px, 4.5dvh, 44px);

  /* Motion */
  --ease-molten: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-hover: 160ms;
  --dur-reveal: 600ms;
  --dur-film-fade: 1800ms;
  --ease-film: cubic-bezier(0.37, 0, 0.2, 1);
}

/* ---------- Base ---------- */

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

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;           /* single-screen site: no scrolling, by design */
  overscroll-behavior: none;
}

body {
  background: var(--ink-900);
  color: var(--color-text-on-photo);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img,
video,
svg { display: block; max-width: 100%; }

button,
input { font: inherit; color: inherit; }

/* Touch: no 300ms tap delay or double-tap zoom on controls, and no grey tap flash. */
button,
input,
.sound {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

p,
h1,
h2 { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--ivory-100);
  outline-offset: 2px;
}

/* ---------- Page frame: exactly one viewport ---------- */

.page {
  position: fixed;
  inset: 0;
  height: 100vh;              /* fallback */
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "head  head"
    ".     ."
    "intro controls";
  column-gap: var(--gutter);
  padding:
    max(var(--edge-block), env(safe-area-inset-top))
    max(var(--gutter), env(safe-area-inset-right))
    max(var(--edge-block), env(safe-area-inset-bottom))
    max(var(--gutter), env(safe-area-inset-left));
  overflow: hidden;
  isolation: isolate;
}

/* ---------- Hero films ---------- */

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--ink-900) url("assets/img/poster-final.webp?v=17") center / cover no-repeat;
}
/* Phones held upright get the portrait poster, matching the portrait film. */
@media (max-width: 820px) and (orientation: portrait) {
  .hero-media {
    background-image: url("assets/img/poster-final-mobile.webp?v=17");
  }
}

.film {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--film-position, 50% 50%);
}

/* Bottom-weighted ink protection for ivory type, plus a light top veil for the logo. */
.scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgb(26 23 20 / 0.38) 0%, rgb(26 23 20 / 0) 26%),
    linear-gradient(to top,
      var(--color-photo-protect) 0%,
      rgb(26 23 20 / 0.42) 30%,
      rgb(26 23 20 / 0.12) 55%,
      rgb(26 23 20 / 0) 70%);
}

/* ---------- Masthead ---------- */

.masthead {
  grid-area: head;
  display: flex;
  justify-content: center;
}

.masthead__logo img {
  width: auto;
  height: clamp(48px, 8.2dvh, 80px);
}

/* ---------- Intro / sign-up ---------- */

.intro {
  grid-area: intro;
  align-self: end;
  max-width: 40rem;
  display: grid;
  gap: clamp(10px, 1.8dvh, 18px);
}

.eyebrow,
.sound__label,
.reel__hint,
.legal,
.signup__button {
  font-size: var(--label-size);
  font-weight: 500;
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}

.eyebrow { color: var(--gold-300); }

.headline {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 1rem + 7vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.headline em { font-style: italic; }

.lede {
  max-width: 30rem;
  color: var(--color-text-on-photo-muted);
  font-weight: 300;
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.0625rem);
  text-wrap: pretty;
}

.signup { margin-top: clamp(4px, 1dvh, 10px); }

.signup__row {
  display: flex;
  gap: 8px;
}

.signup__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  background: rgb(26 23 20 / 0.45);
  border: 1px solid rgb(247 243 236 / 0.6);
  border-radius: 2px;
  color: var(--ivory-100);
  font-size: 1rem;           /* ≥16px stops iOS from zooming on focus */
  transition: border-color var(--dur-hover) var(--ease-standard),
              background-color var(--dur-hover) var(--ease-standard);
}
.signup__input::placeholder { color: rgb(247 243 236 / 0.72); opacity: 1; }
.signup__input:hover { border-color: var(--ivory-100); }
.signup__input:focus-visible {
  border-color: var(--ivory-100);
  background: rgb(26 23 20 / 0.6);
}
/* Error only after interaction (blur or submit attempt) — never on load or mid-typing. */
.signup__input[aria-invalid="true"] {
  border-color: var(--status-error-on-dark);
  box-shadow: inset 0 0 0 1px var(--status-error-on-dark);
}

.signup__button {
  flex: 0 0 auto;
  height: 52px;
  padding: 0 28px;
  border: 1px solid var(--ivory-100);
  border-radius: 0;
  background: var(--ivory-100);
  color: var(--ink-900);
  cursor: pointer;
  transition: background-color var(--dur-hover) var(--ease-standard),
              color var(--dur-hover) var(--ease-standard);
}
.signup__button:hover { background: var(--white); }
.signup__button:disabled { cursor: progress; opacity: 0.75; }
.signup[aria-busy="true"] .signup__label::after {
  content: "…";
}

.signup__error {
  min-height: 0;
  color: var(--status-error-on-dark);
  font-size: 0.875rem;
}
.signup__error:empty { display: none; }
.signup__error:not(:empty) { margin-top: 8px; }

.signup__note {
  margin-top: 10px;
  color: var(--color-text-on-photo-muted);
  font-size: 0.8125rem;
  font-weight: 300;
}

.signup__done { outline: none; }
.signup__done-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.1rem + 1vw, 2rem);
  line-height: 1.1;
}
.signup__done:not([hidden]) {
  animation: reveal var(--dur-reveal) var(--ease-molten) both;
}

/* ---------- Catalog link ---------- */

.catalog-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: var(--gold-300);
  font-size: var(--label-size);
  font-weight: 500;
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid rgb(220 195 152 / 0.5);
  transition: color var(--dur-hover) var(--ease-standard),
              border-color var(--dur-hover) var(--ease-standard);
}
.catalog-link:hover { color: var(--ivory-100); border-color: var(--ivory-100); }
.catalog-link .icon { width: 14px; height: 14px; }

/* ---------- Film controls ---------- */

.controls {
  grid-area: controls;
  align-self: end;
  display: grid;
  justify-items: end;
  gap: 14px;
}

.reel {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Film state, set by main.js:
     loading  the page is deciding whether to play, so no controls yet (their text would be a guess)
     on       playing
     idle     waiting for a tap (slow connection, Data Saver, Reduce Motion, blocked autoplay) */
.reel > * { transition: opacity 400ms var(--ease-standard); }
.reel[data-film="loading"] > * { opacity: 0; pointer-events: none; }
.reel__hint {
  display: none;
  color: var(--color-text-on-photo-muted);
  white-space: nowrap;
}
.reel[data-film="idle"] .reel__hint { display: inline; }
.reel[data-film="idle"] .sound { display: none; }

.reel__toggle,
.sound__icon {
  display: grid;
  place-items: center;
  flex: none;                 /* never squeezed narrower than tall on small screens */
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgb(247 243 236 / 0.6);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: border-color var(--dur-hover) var(--ease-standard),
              color var(--dur-hover) var(--ease-standard);
}
.reel__toggle:hover,
.sound:hover .sound__icon { border-color: var(--ivory-100); color: var(--gold-300); }

/* Sound control: a label that says what will happen, beside a round icon button. */
.sound {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.sound__label {
  color: var(--color-text-on-photo-muted);
  white-space: nowrap;
  transition: color var(--dur-hover) var(--ease-standard);
}
.sound:hover .sound__label { color: var(--ivory-100); }
.sound .icon--off { display: none; }
.sound[data-state="off"] .icon--on,
.sound[data-state="blocked"] .icon--on { display: none; }
.sound[data-state="off"] .icon--off,
.sound[data-state="blocked"] .icon--off { display: block; }
/* Sound is wanted but the browser is waiting for a first tap: draw the eye gently. */
.sound[data-state="blocked"] .sound__icon { border-color: var(--ivory-100); animation: sound-hint 2.4s var(--ease-standard) infinite; }
@keyframes sound-hint {
  0%, 100% { box-shadow: 0 0 0 0 rgb(247 243 236 / 0); }
  50% { box-shadow: 0 0 0 6px rgb(247 243 236 / 0.16); }
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--play { fill: currentColor; stroke-width: 1; }
.reel__toggle .icon--play { display: none; }
.reel__toggle[aria-pressed="true"] .icon--pause { display: none; }
.reel__toggle[aria-pressed="true"] .icon--play { display: block; }

.legal {
  color: rgb(247 243 236 / 0.6);
  font-size: 0.6875rem;
  white-space: nowrap;
}

/* ---------- Entrance ---------- */

/* Movement only, no fade: the words are visible from the very first paint, which is what
   page-speed tools (and impatient visitors) measure. */
@keyframes reveal {
  from { transform: translateY(10px); }
  to   { transform: none; }
}

.masthead,
.intro > *,
.controls {
  animation: reveal var(--dur-reveal) var(--ease-molten) both;
}
.intro > :nth-child(2) { animation-delay: 40ms; }
.intro > :nth-child(3) { animation-delay: 80ms; }
.intro > :nth-child(4) { animation-delay: 120ms; }
.controls { animation-delay: 160ms; }

/* ---------- Responsive ---------- */

/* Phones & narrow tablets: stack everything, controls sit under the form. */
@media (max-width: 760px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "."
      "intro"
      "controls";
    row-gap: clamp(14px, 2.6dvh, 24px);
  }
  .intro { max-width: none; }
  .controls {
    grid-template-columns: 1fr auto;
    align-items: center;
    justify-items: stretch;
  }
  .reel { order: 0; }
  .legal { order: 1; text-align: right; }
  /* Text sits over a moving film that can be bright, so phones get a deeper shade
     behind it and a soft glow of shadow on the words themselves. */
  .scrim {
    background:
      linear-gradient(to bottom, rgb(26 23 20 / 0.4) 0%, rgb(26 23 20 / 0) 22%),
      linear-gradient(to top,
        rgb(26 23 20 / 0.8) 0%,
        rgb(26 23 20 / 0.64) 38%,
        rgb(26 23 20 / 0.3) 66%,
        rgb(26 23 20 / 0) 84%);
  }
  .eyebrow,
  .headline,
  .lede,
  .signup__note { text-shadow: 0 1px 14px rgb(26 23 20 / 0.5); }
}

/* Touch screens: controls at least 44px, the size Apple and Google recommend for fingers. */
@media (pointer: coarse), (max-width: 760px) {
  .reel__toggle,
  .sound__icon { width: 44px; height: 44px; }
  .sound { min-height: 44px; }
  .reel { gap: 10px; }
  .reel__hint { margin-right: 2px; }
}

/* Phones (up to 440px wide): the copyright line drops under the controls, so
   "Tap for sound" never has to share a row with it. */
@media (max-width: 440px) {
  .controls {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .legal { order: 2; text-align: left; }
}

@media (max-width: 420px) {
  .signup__row { flex-direction: column; }
  .signup__button { width: 100%; }
  .signup__input,
  .signup__button { height: 50px; }
}

/* Short viewports (landscape phones, small laptops with toolbars): tighten so nothing is clipped. */
@media (max-height: 720px) {
  .headline { font-size: clamp(1.875rem, 0.9rem + 4.4dvh, 3.25rem); }
  .signup__input,
  .signup__button { height: 48px; }
}

@media (max-height: 600px) {
  .masthead__logo img { height: clamp(40px, 11dvh, 56px); }
}

/* Only landscape phones are too short for the sentence; upright phones keep it. */
@media (max-height: 600px) and (orientation: landscape) {
  .lede { display: none; }
}

@media (max-height: 600px) and (max-width: 420px) {
  .signup__row { flex-direction: row; }
  .signup__button { width: auto; padding: 0 18px; }
}

@media (max-height: 460px) {
  .signup__note { display: none; }
  .legal { display: none; }   /* keyboard open or landscape phone: room is for the form */
  .headline { font-size: clamp(1.5rem, 0.5rem + 5.5dvh, 2.25rem); }
  .page { --edge-block: 14px; }
  .intro { gap: 8px; }
}

/* Landscape phones: put intro and controls side by side again. */
@media (max-height: 520px) and (min-width: 560px) and (max-width: 760px) {
  .page {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "head  head"
      ".     ."
      "intro controls";
  }
  .controls { grid-template-columns: none; justify-items: end; }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
