/* ==========================================================================
   LUCKY YOU base
   Reset, type, the one grid, grounds and textures, and the reveal system.

   Depends on tokens.css. Load order is tokens, base, components, page.
   Every value below is a token. If one is missing, add it to tokens.css.
   ========================================================================== */

/* ------------------------------------------------------------------- reset */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--stout);
}

body {
  margin: 0;
  background: var(--stout);
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* The page never scrolls sideways. Wide strips scroll or clip inside
     their own container. */
  overflow-x: clip;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--r-inner);
}

::selection { background: var(--gold); color: var(--ink); }

/* -------------------------------------------------------------------- type */

.display,
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--fw-black);
  letter-spacing: var(--track-display);
  text-transform: uppercase;
}

h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); text-wrap: balance; }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); }

.h4 {
  font-family: var(--font-sans);
  font-size: var(--fs-h4);
  line-height: var(--lh-h4);
  font-weight: var(--fw-semi);
}

.label {
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  line-height: var(--lh-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.micro {
  font-size: var(--fs-micro);
  line-height: var(--lh-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--on-ground-dim, var(--cream-dim));
  text-wrap: pretty;
}

.dim { color: var(--on-ground-dim, var(--cream-dim)); }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

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

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: calc(var(--z-modal) + 1);
  padding: var(--sp-3) var(--sp-4);
  background: var(--gold);
  color: var(--ink);
  font-weight: var(--fw-bold);
  border-radius: var(--r-inner);
}
.skip-link:focus { top: var(--sp-4); }

/* -------------------------------------------------------------------- grid

   ONE grid. Every section's content is one .wrap. No section sets its own
   max-width, padding-inline or margin-inline, so every left edge on the page
   is the same x. Only photographs, the ticker, the bar marquee and the reel
   break out, and they are siblings of .wrap, never children.
   -------------------------------------------------------------------------- */

.wrap {
  width: min(100% - 2 * var(--grid-margin), var(--grid-max));
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  column-gap: var(--grid-gap);
  row-gap: var(--grid-row-gap);
  position: relative;
  z-index: 2;
}

.wrap > * { grid-column: var(--span-full); min-width: 0; }

/* A nested grid that lands on the same column lines as its .wrap. */
.cols {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  column-gap: var(--grid-gap);
  row-gap: var(--grid-gap);
}

/* Equal-height card rows. Cards are flex columns with the action pinned to
   the bottom, so every card in a row ends on the same line. */
[data-equal] { grid-auto-rows: 1fr; }

.span-full    { grid-column: var(--span-full); }
.span-half    { grid-column: var(--span-half); }
.span-third   { grid-column: var(--span-third); }
.span-quarter { grid-column: var(--span-quarter); }
.span-text    { grid-column: var(--span-text); }
.span-aside   { grid-column: var(--span-aside); }

/* ?grid on the URL overlays the columns, built from the same tokens. */
.show-grid .wrap {
  background-image: repeating-linear-gradient(
    90deg,
    var(--grid-tint) 0 calc((100% - (var(--grid-cols) - 1) * var(--grid-gap)) / var(--grid-cols)),
    transparent 0 calc((100% - (var(--grid-cols) - 1) * var(--grid-gap)) / var(--grid-cols) + var(--grid-gap))
  );
}

/* ------------------------------------------------------------- sections */

.section {
  position: relative;
  isolation: isolate;
  overflow: clip;
  padding-block: var(--sp-section);
  background: var(--ground);
  color: var(--on-ground);
}

/* Section heads are identical everywhere: eyebrow, h2, optional lead, then
   --sp-7 to the content. */
.head { display: block; margin-bottom: var(--sp-7); }
.head .eyebrow { margin-bottom: var(--sp-3); }
.head h2 { margin-bottom: var(--sp-5); }
.head h2:last-child { margin-bottom: 0; }
.head .lead + .lead { margin-top: var(--sp-4); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--lh-label);
  color: var(--on-ground-dim);
}

/* --------------------------------------------------------- textures */

/* Grain on every dark ground, fibre on foam. Pseudo-elements, never content. */
[data-ground="stout"]::after,
[data-ground="bottle"]::after,
[data-ground="moss"]::after,
[data-ground="foam"]::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: var(--tex-grain);
}
[data-ground="foam"]::after { background-image: var(--tex-fibre); }

/* Photo plates: a photograph laid under a ground as a luminance layer, so it
   always lands on palette. Oversized by the parallax range so no edge shows. */
.plate {
  position: absolute;
  inset: 0;
  z-index: 0;
  /* clip, not hidden: hidden would make this a scroll container and the
     scroll-linked drift would track it instead of the page. */
  overflow: clip;
  pointer-events: none;
  background: var(--ground);
}
.plate img {
  position: absolute;
  left: 0;
  width: 100%;
  top: calc(-1.5 * var(--parallax-range));
  height: calc(100% + 3 * var(--parallax-range));
  max-width: none;
  object-fit: cover;
  object-position: var(--plate-pos);
  mix-blend-mode: luminosity;
  opacity: var(--plate-opacity);
}
.plate--land img { object-position: var(--plate-pos-land); }

/* --------------------------------------------------------------- reveal

   CONTRACT: every hidden start state below is gated on html.js-motion, which
   is added only after IntersectionObserver is confirmed and the visitor has
   not asked for reduced motion. With JS broken, absent or reduced motion on,
   none of these apply and the page renders fully visible.
   -------------------------------------------------------------------- */

.js-motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, var(--reveal-rise), 0);
  transition:
    opacity var(--dur-reveal) var(--ease-entrance),
    transform var(--dur-reveal) var(--ease-entrance);
}
.js-motion [data-reveal="fade"] { transform: none; }
.js-motion [data-reveal].is-in { opacity: 1; transform: none; }

/* Split headings: each word in its own mask. The split only exists once
   motion.js has run, so with JS off the heading is plain text. */
.split-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}
.split-word > span { display: inline-block; }
.js-motion [data-split] .split-word > span {
  transform: translate3d(0, 105%, 0);
  transition: transform var(--dur-reveal) var(--ease-entrance);
  transition-delay: calc(var(--w, 0) * var(--stagger-word));
}
.js-motion [data-split].is-in .split-word > span { transform: none; }

/* ------------------------------------------------------------- utilities */

.nowrap { white-space: nowrap; }

@media (max-width: 699.98px) {
  .hide-phone { display: none !important; }
}
@media (min-width: 700px) {
  .only-phone { display: none !important; }
}

/* Reduced motion: no smooth scrolling, nothing moves, nothing loops. The
   tokens already zero every duration; this also removes infinite loops so a
   near-zero duration can never strobe. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
