/* Troop 777 — Design Tokens
   Three palettes selectable via Tweaks. Each is defined as a complete set of
   CSS variables under .palette-{name}; the body root carries one of these. */

:root {
  /* Type scale (modular ~1.2) */
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-md: 18px;
  --fs-lg: 22px;
  --fs-xl: 28px;
  --fs-2xl: 36px;
  --fs-3xl: 48px;
  --fs-4xl: 64px;
  --fs-5xl: 88px;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;
  --sp-10: 128px;

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Layout */
  --max-w: 1280px;
  --gutter: 24px;

  /* Type families (overridden by Tweaks) */
  --font-heading: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
}

/* ─── Palette A: Trail (default — deep navy + warm gold) ─── */
.palette-trail {
  --c-ink: #0c1a2b;          /* primary text / navy */
  --c-ink-soft: #36475f;
  --c-bg: #f1ead9;           /* warmer cream */
  --c-bg-elev: #faf4e4;
  --c-surface: #e6dcc0;      /* deeper warm surface */
  --c-line: #cfc09f;
  --c-primary: #07172b;      /* near-black navy */
  --c-primary-soft: #18345a;
  --c-accent: #b8821b;       /* rich amber */
  --c-accent-soft: #d9a73c;
  --c-success: #234c30;      /* deep forest */
  --c-muted: #6b6650;
  --c-on-primary: #f6efdb;
  --c-on-accent: #07172b;
}

/* ─── Palette B: Summit (cooler, more contrast) ─── */
.palette-summit {
  --c-ink: #08111a;
  --c-ink-soft: #2d3c4d;
  --c-bg: #e6e2d8;
  --c-bg-elev: #f5f1e6;
  --c-surface: #cfc9ba;
  --c-line: #b3ad9c;
  --c-primary: #0a1320;
  --c-primary-soft: #1a2c44;
  --c-accent: #c4612a;        /* brighter terracotta */
  --c-accent-soft: #e08a4a;
  --c-success: #1a3324;       /* pine */
  --c-muted: #545040;
  --c-on-primary: #e6e2d8;
  --c-on-accent: #f5f1e6;
}

/* ─── Palette C: Horizon (editorial / clay) ─── */
.palette-horizon {
  --c-ink: #0a1420;
  --c-ink-soft: #3a4759;
  --c-bg: #ece3d0;
  --c-bg-elev: #f6efdc;
  --c-surface: #d9cfb6;
  --c-line: #beb398;
  --c-primary: #152c40;        /* deeper steel teal */
  --c-primary-soft: #284862;
  --c-accent: #a23a23;         /* clay red */
  --c-accent-soft: #c45f44;
  --c-success: #2f5538;        /* sage */
  --c-muted: #5e5746;
  --c-on-primary: #ece3d0;
  --c-on-accent: #ece3d0;
}

/* ─── Palette D: Heritage (bold — matches troop logo: black, red, gold) ─── */
.palette-heritage {
  --c-ink: #0d0d0f;
  --c-ink-soft: #3a3a40;
  --c-bg: #f3ead3;             /* warm vintage cream */
  --c-bg-elev: #fbf4dd;
  --c-surface: #e3d6ad;
  --c-line: #c2b48a;
  --c-primary: #111114;        /* near-black */
  --c-primary-soft: #2a2a30;
  --c-accent: #b8231f;         /* flag red */
  --c-accent-soft: #d9522b;
  --c-success: #1d3a2a;
  --c-muted: #57523f;
  --c-on-primary: #f3ead3;
  --c-on-accent: #f3ead3;
}

/* ─── Type swap classes ─── */
.type-editorial {
  --font-heading: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
}
.type-geometric {
  --font-heading: "Space Grotesk", "Helvetica Neue", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
}
.type-slab {
  --font-heading: "Zilla Slab", "Rockwell", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
}

/* ─── Base reset ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
p { text-wrap: pretty; margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ─── Layout helpers ─── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; gap: var(--sp-3); align-items: center; }
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--c-muted);
}
.eyebrow .num {
  color: var(--c-accent);
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--c-primary);
  color: var(--c-on-primary);
}
.btn-primary:hover { background: var(--c-primary-soft); }
.btn-accent {
  background: var(--c-accent);
  color: var(--c-on-accent);
}
.btn-accent:hover { filter: brightness(0.96); }
.btn-ghost {
  background: transparent;
  color: var(--c-ink);
  border-color: var(--c-line);
}
.btn-ghost:hover { background: var(--c-surface); }
.btn-link {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--c-primary);
  font-weight: 600;
  font-size: var(--fs-sm);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
}
.btn-link:hover { color: var(--c-accent); }

/* ─── Cards ─── */
.card {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.card-flat {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

/* ─── Placeholder image (striped) ─── */
.ph {
  background:
    repeating-linear-gradient(
      135deg,
      color-mix(in oklab, var(--c-ink) 6%, var(--c-surface)) 0 8px,
      var(--c-surface) 8px 16px
    );
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 12px;
  color: var(--c-ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  overflow: hidden;
  position: relative;
}
.ph::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed color-mix(in oklab, var(--c-ink) 25%, transparent);
  border-radius: calc(var(--r-md) - 4px);
  pointer-events: none;
}

/* ─── Chips / tags ─── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--c-surface);
  color: var(--c-ink);
  border: 1px solid var(--c-line);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.chip.accent { background: var(--c-accent); color: var(--c-on-accent); border-color: transparent; }
.chip.primary { background: var(--c-primary); color: var(--c-on-primary); border-color: transparent; }
.chip.outline { background: transparent; }

/* ─── Section dividers ─── */
.divide-top { border-top: 1px solid var(--c-line); }
.divide-bot { border-bottom: 1px solid var(--c-line); }

/* ─── Selection ─── */
::selection { background: var(--c-accent); color: var(--c-on-accent); }

/* ─── Focus ─── */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── Utility ─── */
.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;
}
