/* ==========================================================================
   DUNESCAPE JOURNEYS — GLOBAL
   Design tokens, reset, typography, utilities
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */

:root {
  /* --- Brand palette --- */
  --gold: #c9a962;
  --deep: #1a1510;
  --sand: #f5f0e8;
  --terracotta: #b85c38;
  --beige: #d4c5a9;
  --charcoal: #2d2926;
  --pearl: #fafaf8;

  /* --- Derived tones (warm, never cold) --- */
  --gold-soft: rgba(201, 169, 98, 0.16);
  --gold-line: rgba(201, 169, 98, 0.34);
  --gold-deep: #a8873f;
  --deep-80: rgba(26, 21, 16, 0.8);
  --deep-60: rgba(26, 21, 16, 0.6);
  --deep-45: rgba(26, 21, 16, 0.45);
  --deep-12: rgba(26, 21, 16, 0.12);
  --deep-06: rgba(26, 21, 16, 0.06);
  --sand-dim: #e8e0d3;
  --terracotta-deep: #9c4a2b;

  /* --- Semantic --- */
  --bg: #ffffff;
  --bg-raised: var(--pearl);
  --ink: var(--deep);
  --ink-soft: rgba(26, 21, 16, 0.62);
  --ink-faint: rgba(26, 21, 16, 0.4);
  --rule: rgba(26, 21, 16, 0.11);

  /* On dark sections */
  --ink-inv: #f3ede2;
  --ink-inv-soft: rgba(212, 197, 169, 0.72);
  --ink-inv-faint: rgba(212, 197, 169, 0.42);
  --rule-inv: rgba(212, 197, 169, 0.16);

  /* --- Typography --- */
  --font-display: "Space Grotesk", "Playfair Display", "Cormorant Garamond", Georgia, serif;
  --font-body: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-label: "Space Grotesk", "JetBrains Mono", ui-monospace, monospace;

  --fs-display: clamp(2.5rem, 5.2vw, 4.5rem);
  --fs-h1: clamp(2.125rem, 4.2vw, 3.5rem);
  --fs-h2: clamp(1.75rem, 3.2vw, 2.75rem);
  --fs-h3: clamp(1.375rem, 2vw, 1.75rem);
  --fs-h4: clamp(1.125rem, 1.35vw, 1.3125rem);
  --fs-lead: clamp(1rem, 1.05vw, 1.125rem);
  --fs-body: 1rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.8125rem;
  --fs-label: 0.75rem;

  --lh-display: 1.04;
  --lh-tight: 1.14;
  --lh-snug: 1.35;
  --lh-body: 1.65;

  --tr-display: -0.018em;
  --tr-label: 0.14em;

  /* --- Space --- */
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1.25rem;
  --space-md: 2rem;
  --space-lg: 3.5rem;
  --space-xl: 5.5rem;
  --space-2xl: 7.5rem;

  --section-y: 120px;
  --container: 1400px;
  --gutter: 24px;
  --pad-x: 40px;

  /* --- Surface --- */
  --radius: 0px;          /* editorial sharpness */
  --radius-ui: 4px;       /* subtle UI elements */
  --radius-pill: 999px;

  --shadow: 0 20px 60px rgba(26, 21, 16, 0.08);
  --shadow-lift: 0 32px 80px rgba(26, 21, 16, 0.14);
  --shadow-inset-hair: inset 0 0 0 1px rgba(26, 21, 16, 0.08);

  /* --- Motion --- */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);   /* ≈ gsap power2.out */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-inout: cubic-bezier(0.65, 0.05, 0.36, 1);
  --dur-fast: 0.25s;
  --dur: 0.4s;
  --dur-slow: 0.8s;

  --z-cursor: 9999;
  --z-nav-overlay: 200;
  --z-nav: 100;
}

@media (max-width: 991px) {
  :root {
    --section-y: 80px;
    --pad-x: 24px;
    --gutter: 16px;
  }
}

@media (min-width: 992px) and (max-width: 1200px) {
  :root {
    --section-y: 100px;
    --pad-x: 32px;
  }
}

/* --------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */

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

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto; /* Lenis owns scrolling */
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button { cursor: pointer; }

a {
  color: inherit;
  text-decoration: none;
}

ul, ol { list-style: none; }

table {
  border-collapse: collapse;
  width: 100%;
}

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

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-display);
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-display); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.26; }
h4 { font-size: var(--fs-h4); line-height: 1.35; letter-spacing: -0.01em; }

p { text-wrap: pretty; }

em, .italic {
  font-style: italic;
  font-variation-settings: "ital" 1;
}

/* Display — the largest editorial statement */
.display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  font-weight: 400;
}

/* Eyebrow / label — mono, uppercase, tracked out. Used sparingly. */
.eyebrow {
  font-family: var(--font-label);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--gold-deep);
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  line-height: 1;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
  flex: none;
}

.eyebrow--plain::before { display: none; }
.eyebrow--inv { color: var(--gold); }

/* Lead paragraph */
.lead {
  font-size: var(--fs-lead);
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 62ch;
}

.text-muted { color: var(--ink-soft); }
.text-gold { color: var(--gold-deep); }
.text-serif { font-family: var(--font-display); }

/* Gold hairline accent under headings */
.rule-gold {
  width: 56px;
  height: 2px;
  background: var(--gold);
  border: 0;
}

/* --------------------------------------------------------------------------
   4. LAYOUT PRIMITIVES
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.container--narrow { max-width: 900px; }

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section--tight { padding-block: calc(var(--section-y) * 0.62); }

/* 12-column grid */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gutter); }

@media (max-width: 991px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* Dark surface */
.surface-dark {
  background: var(--deep);
  color: var(--ink-inv);
}

.surface-dark h1,
.surface-dark h2,
.surface-dark h3,
.surface-dark h4 { color: var(--ink-inv); }

.surface-dark .lead,
.surface-dark .text-muted { color: var(--ink-inv-soft); }

.surface-pearl { background: var(--pearl); }
.surface-sand { background: var(--sand); }

/* Section heading block */
.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 62ch;
  margin-bottom: var(--space-lg);
}

.section-head--center {
  align-items: center;
  text-align: center;
  margin-inline: auto;
}

.section-head--split {
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  max-width: none;
  gap: var(--space-lg);
}

@media (max-width: 767px) {
  .section-head--split { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   5. ATMOSPHERE — grain, vignette, texture
   -------------------------------------------------------------------------- */

/* Fixed film grain over the whole page. Disabled for a flat white background. */
.grain {
  display: none;
}

/* Warm light bloom used behind hero / dark sections. Disabled for a flat white background. */
.bloom {
  display: none;
}

/* --------------------------------------------------------------------------
   6. IMAGE FRAMES
   -------------------------------------------------------------------------- */

.frame {
  position: relative;
  overflow: hidden;
  background: var(--sand-dim);
}

.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
  transition: transform 0.9s var(--ease-expo);
}

.frame--3-4 { aspect-ratio: 3 / 4; }
.frame--4-3 { aspect-ratio: 4 / 3; }
.frame--1-1 { aspect-ratio: 1 / 1; }
.frame--16-9 { aspect-ratio: 16 / 9; }
.frame--tall { aspect-ratio: 2 / 3; }

/* Warm duotone-ish wash so stock photos read as one palette */
.frame--wash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26, 21, 16, 0) 42%, rgba(26, 21, 16, 0.62) 100%);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   7. REVEAL PRIMITIVES (GSAP drives these; CSS sets the pre-state)
   -------------------------------------------------------------------------- */

[data-reveal] { will-change: transform, opacity; }

/* Mask wipe: child slides up out of a clipped parent */
.mask {
  display: block;
  overflow: hidden;
}

.mask > * { display: block; }

/* JS hides pre-animation state once GSAP has taken control; prevents FOUC */
.js-anim [data-reveal],
.js-anim [data-reveal-lines],
.js-anim [data-reveal-stagger] {
  opacity: 0;
}

.js-anim [data-reveal].is-revealed,
.js-anim [data-reveal-lines].is-revealed,
.js-anim [data-reveal-stagger].is-revealed {
  opacity: 1;
}

/* Word masks produced by DS.splitWords() — the negative margin keeps
   descenders (g, y, p) from being clipped by the overflow. */
.word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.16em;
  margin-bottom: -0.16em;
}

.word__i {
  display: inline-block;
  will-change: transform;
}

/* --------------------------------------------------------------------------
   8. UTILITIES
   -------------------------------------------------------------------------- */

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

.stack { display: flex; flex-direction: column; }
.stack-xs { gap: var(--space-xs); }
.stack-sm { gap: var(--space-sm); }
.stack-md { gap: var(--space-md); }
.stack-lg { gap: var(--space-lg); }

.row { display: flex; align-items: center; }
.row-gap-sm { gap: var(--space-sm); }
.row-gap-md { gap: var(--space-md); }
.wrap { flex-wrap: wrap; }

.hairline { height: 1px; background: var(--rule); border: 0; width: 100%; }
.hairline--inv { background: var(--rule-inv); }

.no-scroll { overflow: hidden; }

@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
  .show-mobile { display: none !important; }
}

/* --------------------------------------------------------------------------
   9. REDUCED MOTION
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js-anim [data-reveal],
  .js-anim [data-reveal-lines],
  .js-anim [data-reveal-stagger] { opacity: 1 !important; transform: none !important; }

  .grain { display: none; }
}
