/* ---------- Design tokens ---------- */
:root,
[data-theme='light'] {
  /* Surfaces — warm parchment / stone */
  --color-bg: #f5f1e8;
  --color-surface: #fbf8f1;
  --color-surface-2: #efe9da;
  --color-surface-offset: #e6dfce;
  --color-divider: #d9d0ba;
  --color-border: #cdc2a8;

  /* Text — deep ink with warm undertone */
  --color-text: #201e17;
  --color-text-muted: #5b5746;
  --color-text-faint: #9c967f;
  --color-text-inverse: #f6f2e8;

  /* Primary — botanical deep green */
  --color-primary: #3d4a2a;
  --color-primary-hover: #2a3419;
  --color-primary-tint: #eae7d8;

  /* Accent — warm terracotta, used sparingly */
  --color-accent: #b86d45;

  /* Type scale (fluid) */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);
  --text-hero: clamp(2.75rem, 1rem + 5.5vw, 6.5rem);

  /* Spacing (4px base) */
  --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;

  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  --transition-interactive: 220ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 600ms cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-sm: 0 1px 2px rgba(32, 30, 23, 0.06);
  --shadow-md: 0 6px 18px rgba(32, 30, 23, 0.08);
  --shadow-lg: 0 18px 48px rgba(32, 30, 23, 0.16);

  --content-narrow: 640px;
  --content-default: 1040px;
  --content-wide: 1280px;

  --font-display: 'Fraunces', 'Times New Roman', Georgia, serif;
  --font-body: 'Inter', 'Helvetica Neue', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme='dark'] {
  --color-bg: #161814;
  --color-surface: #1c1f1a;
  --color-surface-2: #232620;
  --color-surface-offset: #2c2f28;
  --color-divider: #343730;
  --color-border: #40443b;

  --color-text: #ece8dc;
  --color-text-muted: #a4a191;
  --color-text-faint: #6d6b60;
  --color-text-inverse: #1b1e18;

  --color-primary: #a4b982;
  --color-primary-hover: #c0d5a0;
  --color-primary-tint: #2b3226;

  --color-accent: #d8926a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5);
}

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

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

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

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 400;
  text-wrap: balance;
  line-height: 1.08;
  letter-spacing: -0.015em;
}

p,
li {
  text-wrap: pretty;
  max-width: 65ch;
}

::selection {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

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

@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;
  }
}

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

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

a,
button,
[role='button'],
input,
textarea,
select {
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    transform var(--transition-interactive),
    box-shadow var(--transition-interactive);
}

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

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