/* ─────────────────────────────────────────────────────────────
   Basta — base.css
   Design tokens, reset, typography, layout primitives.
   Used by every page in the site.
   ───────────────────────────────────────────────────────────── */

/* ─── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Brand colors */
  --cream:        #F5F0E8;
  --cream-dark:   #EDE6D6;
  --olive:        #5C6B3A;
  --olive-light:  #7A8C4E;
  --olive-muted:  #A4AF88;
  --terracotta:   #C4673A;
  --gold:         #C4A870;
  --bark:         #2A2318;
  --bark-light:   #4A3F2F;
  --warm-grey:    #8A8070;

  /* Typography */
  --font-serif:   'Playfair Display', Georgia, serif;
  --font-sans:    'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'SF Mono', Menlo, monospace;

  /* Type scale (mobile-first, scales up at breakpoints) */
  --fs-xs:   11px;
  --fs-sm:   13px;
  --fs-base: 15px;
  --fs-md:   17px;
  --fs-lg:   22px;
  --fs-xl:   28px;
  --fs-2xl:  38px;
  --fs-3xl:  52px;
  --fs-4xl:  68px;

  /* Spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;
  --space-9:  88px;
  --space-10: 120px;

  /* Page max widths */
  --max-prose:    640px;
  --max-content:  1080px;
  --max-wide:     1280px;

  /* Section padding */
  --section-py:   var(--space-9);
  --section-px:   var(--space-7);

  /* Misc */
  --radius-sm:  2px;
  --radius-md:  4px;
  --radius-lg:  8px;
  --transition: 0.25s ease;
}

/* Larger type scale on desktop */
@media (min-width: 768px) {
  :root {
    --fs-base: 16px;
    --fs-md:   18px;
    --fs-lg:   24px;
    --fs-xl:   32px;
    --fs-2xl:  44px;
    --fs-3xl:  60px;
    --fs-4xl:  76px;
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--cream);
  color: var(--bark);
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: var(--fs-base);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle grain overlay across the whole site */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.35;
}

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

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

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

/* ─── TYPOGRAPHY ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.1;
  color: var(--bark);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--terracotta);
}

em, .italic {
  font-style: italic;
  color: var(--olive);
}

/* Headlines */
.hed-display {
  font-family: var(--font-serif);
  font-size: var(--fs-4xl);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em;
}
.hed-display em { font-style: italic; color: var(--olive); }

.hed-section {
  font-family: var(--font-serif);
  font-size: var(--fs-3xl);
  font-weight: 600;
  line-height: 1.1;
}
.hed-section em { font-style: italic; color: var(--olive); }

.hed-sub {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.2;
}

.hed-tag {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--fs-lg);
  color: var(--warm-grey);
  line-height: 1.4;
}

/* Body text */
.body-lg {
  font-size: var(--fs-md);
  line-height: 1.75;
  color: var(--bark-light);
}
.body {
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--bark-light);
}
.body-sm {
  font-size: var(--fs-sm);
  line-height: 1.65;
  color: var(--bark-light);
}

/* ─── LAYOUT PRIMITIVES ─────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
  padding-left: var(--section-px);
  padding-right: var(--section-px);
}

.container-prose {
  width: 100%;
  max-width: var(--max-prose);
  margin: 0 auto;
}

.container-wide {
  width: 100%;
  max-width: var(--max-wide);
  margin: 0 auto;
  padding-left: var(--section-px);
  padding-right: var(--section-px);
}

section {
  position: relative;
  padding-top: var(--section-py);
  padding-bottom: var(--section-py);
}

/* Divider line, used between sections when needed */
.divider {
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(164,175,136,0.4),
    transparent);
  margin-left: var(--section-px);
  margin-right: var(--section-px);
}

/* ─── UTILITY ───────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-olive  { color: var(--olive); }
.text-bark   { color: var(--bark); }
.text-muted  { color: var(--warm-grey); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-7 { margin-bottom: var(--space-7); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-7 { margin-top: var(--space-7); }
.mt-8 { margin-top: var(--space-8); }

/* Accessibility: respect reduced motion */
@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;
  }
}

/* Skip link for keyboard nav */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--bark);
  color: var(--cream);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  z-index: 9999;
}
.skip-link:focus { left: 16px; }

/* Mobile responsive: reduce section padding */
@media (max-width: 768px) {
  :root {
    --section-py: var(--space-7);
    --section-px: var(--space-5);
  }
  .divider {
    margin-left: var(--space-5);
    margin-right: var(--space-5);
  }
}
