/* ============================================================
   AVALON PROJECT — Base Design Tokens
   Warm archival palette: parchment, espresso brown, rust, forest green
   ============================================================ */

:root {
  /* ---- Type Scale (fluid clamp) ---- */
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.84rem + 0.15vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.06rem + 0.3vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);
  --text-2xl: clamp(1.75rem, 1.5rem + 1.2vw, 2.375rem);
  --text-3xl: clamp(2.25rem, 1.85rem + 2vw, 3.25rem);
  --text-hero: clamp(2.75rem, 2.1rem + 3.2vw, 4.5rem);

  /* ---- Spacing (4px system) ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* ---- Content widths ---- */
  --content-narrow: 640px;
  --content-default: 780px;
  --content-wide: 1140px;
  --content-full: 100%;

  /* ---- Radius ---- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-xl: 22px;
  --radius-full: 999px;

  /* ---- Light Mode Palette (Archival Parchment) ---- */
  --color-bg: #f3ede2;
  --color-surface: #faf6ee;
  --color-surface-2: #eee3ce;
  --color-border: #d9c9a8;
  --color-text: #2a2015;
  --color-text-muted: #6b5a42;
  --color-text-faint: #a3927a;
  --color-primary: #8a3a22;
  --color-primary-hover: #6a2b18;
  --color-secondary: #3f5a41;
  --color-secondary-hover: #2f4531;
  --color-error: #a13544;
  --color-warning: #96551f;
  --color-success: #43592c;

  --shadow-sm: 0 1px 2px oklch(0.25 0.04 60 / 0.08), 0 2px 8px oklch(0.25 0.04 60 / 0.04);
  --shadow-md: 0 2px 6px oklch(0.25 0.04 60 / 0.10), 0 8px 24px oklch(0.25 0.04 60 / 0.08);
  --shadow-lg: 0 6px 16px oklch(0.25 0.04 60 / 0.12), 0 20px 48px oklch(0.25 0.04 60 / 0.10);

  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-body: "Source Sans 3", -apple-system, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --color-bg: #18130d;
  --color-surface: #201911;
  --color-surface-2: #2a2116;
  --color-border: #40331f;
  --color-text: #ecdfc6;
  --color-text-muted: #b6a582;
  --color-text-faint: #7d6c50;
  --color-primary: #d38860;
  --color-primary-hover: #e6a37c;
  --color-secondary: #8bab84;
  --color-secondary-hover: #a1c199;
  --color-error: #dd7a89;
  --color-warning: #d99a5f;
  --color-success: #8fb46e;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.30), 0 2px 8px oklch(0 0 0 / 0.20);
  --shadow-md: 0 2px 6px oklch(0 0 0 / 0.35), 0 8px 24px oklch(0 0 0 / 0.28);
  --shadow-lg: 0 6px 16px oklch(0 0 0 / 0.40), 0 20px 48px oklch(0 0 0 / 0.32);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 var(--space-4);
  color: var(--color-text);
}

p { margin: 0 0 var(--space-4); }

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--color-primary-hover); }

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

.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.container-narrow {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  z-index: 200;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}
