/* ============================================================
   Xavier-Walton Design System — Colors & Typography
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   COLOR TOKENS
   ============================================================ */

:root {
  /* --- Base (60%) --- */
  --color-bg:            #F9F9F7;
  --color-bg-subtle:     #F2F2F0;
  --color-bg-card:       #FFFFFF;
  --color-bg-nav:        rgba(249, 249, 247, 0.92);

  --color-text:          #111110;
  --color-text-secondary:#6B7280;
  --color-text-tertiary: #9CA3AF;
  --color-text-inverse:  #F9F9F7;

  /* --- Secondary (30%) --- */
  --color-grey-50:       #F9FAFB;
  --color-grey-100:      #F3F4F6;
  --color-grey-200:      #E5E5E3;
  --color-grey-300:      #D1D5DB;
  --color-grey-400:      #9CA3AF;
  --color-grey-500:      #6B7280;
  --color-grey-600:      #4B5563;
  --color-grey-700:      #374151;
  --color-grey-800:      #1F2937;
  --color-grey-900:      #111827;

  /* --- Accent (10%) --- */
  --color-accent:        #8ACE00;
  --color-accent-dark:   #6FA800;
  --color-accent-light:  #A8E040;
  --color-accent-muted:  rgba(138, 206, 0, 0.12);

  /* --- Borders --- */
  --color-border:        #E5E5E3;
  --color-border-medium: #D1D5DB;
  --color-border-strong: #9CA3AF;

  /* --- Semantic --- */
  --color-fg-primary:    var(--color-text);
  --color-fg-secondary:  var(--color-text-secondary);
  --color-fg-tertiary:   var(--color-text-tertiary);
  --color-fg-accent:     var(--color-accent);
  --color-surface:       var(--color-bg-card);
  --color-surface-subtle:var(--color-bg-subtle);

  /* ============================================================
     TYPOGRAPHY TOKENS
     ============================================================ */

  /* --- Font Families --- */
  --font-display:  'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:     'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* --- Font Weights --- */
  --fw-light:      300;
  --fw-regular:    400;
  --fw-medium:     500;
  --fw-semibold:   600;
  --fw-bold:       700;

  /* --- Type Scale --- */
  --text-xs:       0.75rem;    /* 12px */
  --text-sm:       0.875rem;   /* 14px */
  --text-base:     1rem;       /* 16px */
  --text-lg:       1.25rem;    /* 20px */
  --text-xl:       1.5rem;     /* 24px */
  --text-2xl:      2rem;       /* 32px */
  --text-3xl:      3rem;       /* 48px */
  --text-4xl:      4rem;       /* 64px */
  --text-5xl:      5rem;       /* 80px */

  /* --- Line Heights --- */
  --lh-tight:      1.2;
  --lh-snug:       1.4;
  --lh-normal:     1.6;
  --lh-relaxed:    1.75;

  /* --- Letter Spacing --- */
  --ls-tight:      -0.02em;
  --ls-normal:     0;
  --ls-wide:       0.04em;
  --ls-wider:      0.08em;

  /* ============================================================
     SPACING TOKENS
     ============================================================ */

  --space-1:    4px;
  --space-2:    8px;
  --space-3:    12px;
  --space-4:    16px;
  --space-6:    24px;
  --space-8:    32px;
  --space-12:   48px;
  --space-16:   64px;
  --space-24:   96px;
  --space-32:   128px;

  --max-width:  1100px;

  /* ============================================================
     BORDER RADIUS
     ============================================================ */

  --radius-sm:   2px;
  --radius-md:   4px;
  --radius-lg:   8px;
  --radius-full: 9999px;

  /* ============================================================
     SHADOWS
     ============================================================ */

  --shadow-1: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-2: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-3: 0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);

  /* ============================================================
     TRANSITIONS
     ============================================================ */

  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:  0.15s;
  --duration-base:  0.25s;
  --duration-slow:  0.5s;

  --transition-base: var(--duration-fast) var(--ease-in-out);
  --transition-reveal: var(--duration-slow) var(--ease-out);
}

/* ============================================================
   SEMANTIC ELEMENT STYLES
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--color-fg-primary);
  background-color: var(--color-bg);
  margin: 0;
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  margin: 0 0 var(--space-6);
}

h2, .h2 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  margin: 0 0 var(--space-4);
}

h3, .h3 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  margin: 0 0 var(--space-4);
}

h4, .h4 {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  margin: 0 0 var(--space-3);
}

h5, .h5 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  margin: 0 0 var(--space-2);
}

h6, .h6 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--color-fg-secondary);
  margin: 0 0 var(--space-2);
}

p {
  margin: 0 0 var(--space-4);
  line-height: var(--lh-normal);
}

.lead {
  font-size: var(--text-lg);
  line-height: var(--lh-relaxed);
  color: var(--color-fg-secondary);
}

.display {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
}

.label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--color-fg-secondary);
}

code, .code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-subtle);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

pre, .pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
  overflow-x: auto;
  line-height: 1.6;
}

a {
  color: var(--color-text);
  text-decoration-color: var(--color-border-medium);
  transition: color var(--transition-base), text-decoration-color var(--transition-base);
}

a:hover {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}

/* ============================================================
   SCROLL REVEAL UTILITY
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

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

/* Stagger children */
.reveal-group > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal-group.is-visible > *:nth-child(1) { transition-delay: 0s; }
.reveal-group.is-visible > *:nth-child(2) { transition-delay: 0.08s; }
.reveal-group.is-visible > *:nth-child(3) { transition-delay: 0.16s; }
.reveal-group.is-visible > *:nth-child(4) { transition-delay: 0.24s; }
.reveal-group.is-visible > *:nth-child(5) { transition-delay: 0.32s; }
.reveal-group.is-visible > * { opacity: 1; transform: translateY(0); }
