/* ==========================================================================
   ClubEngine Design System — base.css
   Design tokens, reset, typography, and layout utilities.
   All visual decisions live here. Components reference these tokens.
   ========================================================================== */

/* ---- DESIGN TOKENS ---------------------------------------------------- */
:root {
  /* — Color: Neutrals — */
  --ink:          #07090F;
  --ink-2:        #1C2338;
  --ink-3:        #3B4260;
  --muted:        #697290;
  --muted-2:      #9EA5BE;
  --muted-3:      #C4C9D8;

  /* — Color: Light surfaces — */
  --paper:        #FAF9F6;
  --surface:      #F3F2EE;
  --surface-2:    #ECEAE4;
  --border:       #E4E1D9;
  --border-2:     #D5D0C5;

  /* — Color: Dark surfaces — */
  --dark-bg:      #07090F;
  --dark-s1:      #0D1020;
  --dark-s2:      #141828;
  --dark-s3:      #1C2136;
  --dark-border:  #242A40;
  --dark-muted:   #5A6280;
  --dark-text:    #E8EAF2;
  --dark-text-2:  #A8ADC4;

  /* — Color: Brand — */
  --brand:        #1B48CC;
  --brand-dark:   #163DA8;
  --brand-hover:  #1440B5;
  --brand-light:  #EBF0FF;
  --brand-mid:    #C0CFFA;

  /* — Color: Amber (hospitality warmth) — */
  --amber:        #C96A00;
  --amber-2:      #E07B00;
  --amber-light:  #FFF4E0;
  --amber-mid:    #FDDDA0;

  /* — Color: Utility — */
  --green:        #057A55;
  --green-light:  #ECFDF5;
  --red:          #C42B2B;
  --red-light:    #FEF2F2;
  --white:        #FFFFFF;

  /* — Typography — */
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --weight-light:   300;
  --weight-normal:  400;
  --weight-medium:  500;
  --weight-semi:    600;
  --weight-bold:    700;

  /* Type scale */
  --text-xs:   0.6875rem;  /* 11px */
  --text-sm:   0.8125rem;  /* 13px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */
  --text-5xl:  3rem;       /* 48px */
  --text-6xl:  3.75rem;    /* 60px */
  --text-7xl:  4.5rem;     /* 72px */
  --text-8xl:  5.5rem;     /* 88px */
  --text-9xl:  7rem;       /* 112px */

  /* Line heights */
  --leading-none:   1;
  --leading-tight:  1.1;
  --leading-snug:   1.25;
  --leading-normal: 1.5;
  --leading-relaxed:1.7;

  /* Letter spacing */
  --tracking-tight:  -0.03em;
  --tracking-snug:   -0.02em;
  --tracking-normal:  0;
  --tracking-wide:    0.04em;
  --tracking-wider:   0.08em;
  --tracking-widest:  0.12em;

  /* — Spacing — */
  --sp-1:   0.25rem;
  --sp-2:   0.5rem;
  --sp-3:   0.75rem;
  --sp-4:   1rem;
  --sp-5:   1.25rem;
  --sp-6:   1.5rem;
  --sp-8:   2rem;
  --sp-10:  2.5rem;
  --sp-12:  3rem;
  --sp-14:  3.5rem;
  --sp-16:  4rem;
  --sp-20:  5rem;
  --sp-24:  6rem;
  --sp-28:  7rem;
  --sp-32:  8rem;
  --sp-40:  10rem;
  --sp-48:  12rem;

  /* — Layout — */
  --max-w:      1320px;
  --content-w:  980px;
  --narrow-w:   720px;
  --tight-w:    560px;
  --section-x:  clamp(1.5rem, 5vw, 5rem);
  --section-y:  clamp(4rem, 8vw, 9rem);

  /* — Radius — */
  --r-sm:   4px;
  --r:      8px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-2xl:  28px;
  --r-full: 9999px;

  /* — Shadows — */
  --shadow-xs:  0 1px 2px rgba(7,9,15,0.04);
  --shadow-sm:  0 1px 3px rgba(7,9,15,0.06), 0 2px 8px rgba(7,9,15,0.04);
  --shadow:     0 2px 8px rgba(7,9,15,0.06), 0 8px 24px rgba(7,9,15,0.06);
  --shadow-md:  0 4px 16px rgba(7,9,15,0.08), 0 12px 40px rgba(7,9,15,0.07);
  --shadow-lg:  0 8px 32px rgba(7,9,15,0.10), 0 24px 64px rgba(7,9,15,0.08);
  --shadow-xl:  0 20px 60px rgba(7,9,15,0.14), 0 40px 100px rgba(7,9,15,0.10);

  /* Brand glow */
  --glow-brand: 0 0 0 3px rgba(27,72,204,0.18);

  /* — Transitions — */
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:   cubic-bezier(0.5, 0, 1, 0.5);
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast:    150ms var(--ease);
  --t:         250ms var(--ease);
  --t-slow:    400ms var(--ease-out);
  --t-slower:  600ms var(--ease-out);

  /* — Z-index — */
  --z-below:  -1;
  --z-base:    0;
  --z-raised:  10;
  --z-nav:     100;
  --z-overlay: 200;
  --z-modal:   300;
  --z-toast:   400;
}


/* ---- MODERN RESET ----------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  hanging-punctuation: first last;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-relaxed);
  color: var(--ink-2);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

ul, ol {
  list-style: none;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

table {
  border-collapse: collapse;
}

/* Remove animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}


/* ---- BASE TYPOGRAPHY -------------------------------------------------- */

/* Display — used for major section headlines (editorial feel) */
.display {
  font-family: var(--font-display);
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.display-xl {
  font-family: var(--font-display);
  font-weight: var(--weight-light);
  font-size: clamp(var(--text-6xl), 8vw, var(--text-9xl));
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-none);
}

/* Headings */
h1, .h1 {
  font-family: var(--font-display);
  font-size: clamp(var(--text-5xl), 6vw, var(--text-8xl));
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--ink);
}

h2, .h2 {
  font-family: var(--font-display);
  font-size: clamp(var(--text-4xl), 5vw, var(--text-7xl));
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--ink);
}

h3, .h3 {
  font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl));
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-snug);
  line-height: var(--leading-snug);
  color: var(--ink);
}

h4, .h4 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-snug);
  line-height: var(--leading-snug);
  color: var(--ink);
}

h5, .h5 {
  font-size: var(--text-base);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-normal);
  color: var(--ink);
}

p {
  line-height: var(--leading-relaxed);
}

/* Label — small uppercase category labels */
.label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--muted);
}

.label-brand {
  color: var(--brand);
}

/* Lead — larger intro paragraph */
.lead {
  font-size: clamp(var(--text-lg), 2vw, var(--text-2xl));
  line-height: var(--leading-relaxed);
  color: var(--ink-3);
  font-weight: var(--weight-light);
}

/* Body */
.body-lg {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

.body-sm {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}


/* ---- LAYOUT UTILITIES ------------------------------------------------- */

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

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

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

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

/* Section wrapper — every component section uses this */
.section {
  padding-block: var(--section-y);
}

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

.section--lg {
  padding-block: clamp(6rem, 12vw, 14rem);
}

/* Grid utilities */
.grid {
  display: grid;
  gap: var(--sp-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

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

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

/* Flex utilities */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

/* Text alignment */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* Spacing helpers */
.mt-2  { margin-top: var(--sp-2); }
.mt-3  { margin-top: var(--sp-3); }
.mt-4  { margin-top: var(--sp-4); }
.mt-6  { margin-top: var(--sp-6); }
.mt-8  { margin-top: var(--sp-8); }
.mt-10 { margin-top: var(--sp-10); }
.mt-12 { margin-top: var(--sp-12); }
.mt-16 { margin-top: var(--sp-16); }

/* Color utilities */
.text-muted  { color: var(--muted); }
.text-brand  { color: var(--brand); }
.text-amber  { color: var(--amber); }
.text-white  { color: var(--white); }
.text-ink    { color: var(--ink); }

/* Visibility */
.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;
}


/* ---- SCROLL ANIMATION BASE -------------------------------------------- */

/* Elements with .reveal are hidden until JS adds .visible */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity var(--t-slower), transform var(--t-slower);
  will-change: opacity, transform;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for children */
.reveal-group .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-group .reveal:nth-child(2) { transition-delay: 80ms; }
.reveal-group .reveal:nth-child(3) { transition-delay: 160ms; }
.reveal-group .reveal:nth-child(4) { transition-delay: 240ms; }
.reveal-group .reveal:nth-child(5) { transition-delay: 320ms; }
.reveal-group .reveal:nth-child(6) { transition-delay: 400ms; }
.reveal-group .reveal:nth-child(7) { transition-delay: 480ms; }
.reveal-group .reveal:nth-child(8) { transition-delay: 560ms; }


/* ---- THEME: DARK --------------------------------------------------------
   Applied via data-theme="dark" on any section element.
   All components read these overrides automatically.
   ----------------------------------------------------------------------- */

[data-theme="dark"] {
  --paper:    var(--dark-bg);
  --surface:  var(--dark-s1);
  --surface-2:var(--dark-s2);
  --border:   var(--dark-border);
  --ink:      var(--dark-text);
  --ink-2:    var(--dark-text-2);
  --ink-3:    var(--dark-muted);
  --muted:    var(--dark-muted);
  background-color: var(--dark-bg);
  color: var(--dark-text-2);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5 {
  color: var(--dark-text);
}

[data-theme="dark"] .label {
  color: var(--dark-muted);
}


/* ---- FOCUS STYLES (accessibility) ------------------------------------- */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}


/* ---- SELECTION -------------------------------------------------------- */
::selection {
  background: var(--brand-light);
  color: var(--brand-dark);
}


/* ---- SCROLLBAR (subtle, premium) -------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
