/* =========================================================
   Evergrain Photobooth — Master Stylesheet
   Design tokens, base reset, typography, layout primitives
   ========================================================= */

:root {
  /* Brand palette */
  --evergreen: #1F4332;
  --evergreen-dark: #163024;
  --brass: #A47A2A;
  --brass-light: #C49649;
  --linen: #F4EDE0;
  --linen-warm: #ECE2D0;
  --char: #1A1410;
  --bark: #5C4A35;
  --sage-mist: #9DAA9A;
  --champagne: #D9C9A8;
  --white: #FFFFFF;

  /* Type system */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-eyebrow: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Type scale (clamp for fluid responsive) */
  --fs-hero: clamp(2.75rem, 7vw, 6rem);
  --fs-display: clamp(2.25rem, 5vw, 4rem);
  --fs-h1: clamp(2rem, 4vw, 3.25rem);
  --fs-h2: clamp(1.625rem, 3vw, 2.25rem);
  --fs-h3: clamp(1.25rem, 2vw, 1.5rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-eyebrow: 0.75rem;

  /* Spacing scale */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --space-3xl: 9rem;

  /* Layout */
  --max-width: 1280px;
  --content-width: 1080px;
  --reading-width: 680px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur-med: 320ms;
  --dur-slow: 600ms;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(26, 20, 16, 0.06), 0 2px 8px rgba(26, 20, 16, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 20, 16, 0.08), 0 12px 32px rgba(26, 20, 16, 0.06);
  --shadow-lg: 0 12px 40px rgba(26, 20, 16, 0.12), 0 32px 80px rgba(26, 20, 16, 0.10);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--char);
  background: var(--linen);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

a {
  color: var(--evergreen);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--brass); }
a:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ----- Typography ----- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--char);
  margin: 0 0 var(--space-md);
  font-variation-settings: "opsz" 144, "SOFT" 50;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0 0 var(--space-md); max-width: 65ch; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-eyebrow);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--brass);
  margin-bottom: var(--space-md);
}
.eyebrow--light { color: var(--champagne); }
.eyebrow--bark { color: var(--bark); }

.display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-weight: 300;
}

.lede {
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--bark);
  max-width: 60ch;
}

.serif-italic {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
}

/* ----- Layout primitives ----- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 3rem);
}

.container--narrow {
  max-width: var(--content-width);
}

.container--reading {
  max-width: var(--reading-width);
}

.section {
  padding-block: clamp(4rem, 9vw, 9rem);
}

.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }

.section--linen-warm { background: var(--linen-warm); }
.section--sage { background: var(--sage-mist); }
.section--champagne { background: var(--champagne); }
.section--evergreen { background: var(--evergreen); color: var(--linen); }
.section--evergreen h1,
.section--evergreen h2,
.section--evergreen h3 { color: var(--linen); }
.section--char { background: var(--char); color: var(--linen); }
.section--char h1,
.section--char h2,
.section--char h3 { color: var(--linen); }

.divider-rule {
  height: 1px;
  background: currentColor;
  opacity: 0.15;
  border: 0;
  margin-block: var(--space-lg);
}

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

/* Topographic line background — subtle organic curves */
.topo-bg {
  position: relative;
  isolation: isolate;
}
.topo-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../assets/img/topographic-bg.svg");
  background-size: 140% auto;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: normal;
}
.topo-bg--strong::before { opacity: 0.12; }
.topo-bg > * { position: relative; z-index: 1; }

.topo-bg--inverted::before {
  filter: invert(1);
  opacity: 0.05;
}

/* Film grain overlay — SVG noise filter via data URI */
.film-grain {
  position: relative;
  isolation: isolate;
}
.film-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.5 0'/></filter><rect width='240' height='240' filter='url(%23n)' opacity='0.55'/></svg>");
  background-size: 240px;
  opacity: 0.18;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: multiply;
}
.film-grain > * { position: relative; z-index: 1; }

/* Woodgrain accent strip */
.woodgrain {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(92, 74, 53, 0.05) 0px,
      rgba(92, 74, 53, 0.08) 2px,
      rgba(92, 74, 53, 0.02) 4px,
      rgba(92, 74, 53, 0.06) 7px,
      rgba(92, 74, 53, 0.03) 11px
    ),
    linear-gradient(180deg, #6b5337 0%, #4a3a26 100%);
}

/* ----- Utility helpers ----- */
.text-center { text-align: center; }
.text-balance { text-wrap: balance; }
.mx-auto { margin-inline: auto; }
.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: 0;
  left: 0;
  transform: translateY(-200%); /* fully off-screen regardless of element height */
  background: var(--evergreen);
  color: var(--linen);
  padding: var(--space-sm) var(--space-md);
  z-index: 1000;
  font-family: var(--font-eyebrow);
  font-size: var(--fs-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  transition: transform 200ms var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

/* ----- Grid systems used across pages ----- */
.grid {
  display: grid;
  gap: var(--space-lg);
}
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

@media (min-width: 900px) {
  .grid--2-fixed { grid-template-columns: 1fr 1fr; }
  .grid--3-fixed { grid-template-columns: 1fr 1fr 1fr; }
}

.split {
  display: grid;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split--media-right > :first-child { order: 1; }
  .split--media-right > :last-child { order: 2; }
}

/* ----- Page hero wrapper ----- */
.page-hero {
  background: var(--evergreen);
  color: var(--linen);
  padding-block: clamp(6rem, 14vw, 10rem) clamp(3rem, 6vw, 5rem);
  position: relative;
}
.page-hero h1 { color: var(--linen); margin-bottom: var(--space-md); }
.page-hero .lede { color: var(--champagne); }
.page-hero .eyebrow { color: var(--champagne); }

/* Reveal-on-scroll initial state */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
