/* ============================================
   esgi.eco — Base Stylesheet
   Tannengrün / Sand / Kupfer
   Instrument Serif (Display) + DM Sans (Body)
   ============================================ */

:root {
  /* ---- Type Scale ---- */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  --text-md: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  --text-lg: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --text-xl: clamp(1.75rem, 1.4rem + 1vw, 2.25rem);
  --text-2xl: clamp(2.25rem, 1.6rem + 2vw, 3.25rem);
  --text-3xl: clamp(2.75rem, 1.5rem + 4vw, 5rem);
  --text-hero: clamp(3rem, 1.5rem + 5.5vw, 6rem);

  /* ---- 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;

  /* ---- Forest / Sand Palette (light, default) ---- */
  --forest: #1E3A2E;
  --forest-2: #16291F;
  --forest-soft: #284A3B;
  --sand: #F4EFE2;
  --sand-2: #ECE5D2;
  --paper: #FAF7EE;
  --bone: #FFFDF7;
  --copper: #B5642A;
  --copper-soft: #C2864B;
  --ink: #1A1A1A;
  --ink-2: #2A2A2A;
  --muted: #6B6B6B;
  --faint: #A5A097;
  --line: #C9C2AD;
  --line-soft: #DCD5BE;

  --color-bg: var(--paper);
  --color-surface: var(--bone);
  --color-surface-2: var(--sand);
  --color-surface-dark: var(--forest);
  --color-text: var(--ink-2);
  --color-text-muted: var(--muted);
  --color-text-faint: var(--faint);
  --color-text-inverse: var(--paper);
  --color-primary: var(--forest);
  --color-primary-hover: var(--forest-2);
  --color-accent: var(--copper);
  --color-accent-hover: #94521e;
  --color-border: var(--line);
  --color-divider: var(--line-soft);

  /* ---- Radius ---- */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;

  /* ---- Transitions ---- */
  --transition-quick: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 480ms cubic-bezier(0.16, 1, 0.3, 1);

  /* ---- Content widths ---- */
  --content-narrow: 640px;
  --content-text: 760px;
  --content-default: 1120px;
  --content-wide: 1280px;

  /* ---- Fonts ---- */
  --font-display: "Instrument Serif", "Source Serif Pro", Georgia, serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

/* ---- Dark mode ---- */
[data-theme="dark"] {
  --color-bg: #0E1814;
  --color-surface: #14201A;
  --color-surface-2: #1B2A22;
  --color-surface-dark: #0A1310;
  --color-text: #E8E3D2;
  --color-text-muted: #9B958B;
  --color-text-faint: #6B665D;
  --color-text-inverse: #14201A;
  --color-primary: #C8B58A;
  --color-primary-hover: #DCC9A0;
  --color-accent: #D49467;
  --color-accent-hover: #E0A77E;
  --color-border: #2A3A30;
  --color-divider: #1F2D26;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

body {
  min-height: 100dvh;
  line-height: 1.55;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  font-weight: 400;
  letter-spacing: -0.005em;
}

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

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

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

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

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-quick), border-color var(--transition-quick);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--forest);
  color: var(--paper);
}

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

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