/* ==========================================================================
   Solitaire Grove — base layer
   Tokens, reset, typography, layout primitives
   ========================================================================== */

:root {
  /* Brand palette */
  --ink: #14231c;
  --ink-soft: #42574b;
  --ink-faint: #5c6e63;
  --cream: #f7f0e3;
  --parchment: #efe3cf;
  --paper: #fffaf0;
  --pine: #0f3d2e;
  --pine-deep: #0a2c21;
  --pine-soft: #1a5741;
  --moss: #6f8f5f;
  --gold: #c8a253;
  --gold-soft: #e4cf9c;
  --terracotta: #c96f4a;
  --blush: #f3d9c8;
  --line: #d8c9ae;
  --line-soft: #e6dac6;
  --white: #ffffff;

  /* Semantic */
  --bg: var(--cream);
  --surface: var(--paper);
  --text: var(--ink);
  --muted: var(--ink-soft);
  --accent: var(--gold);
  --danger: var(--terracotta);

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ui: "DM Sans", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, monospace;

  /* Shape & motion */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 2px 8px rgba(20, 35, 28, 0.06);
  --shadow-md: 0 12px 30px rgba(20, 35, 28, 0.1);
  --shadow-lg: 0 28px 70px rgba(20, 35, 28, 0.18);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 160ms;

  /* Layout */
  --page-max: 1240px;
  --header-h: 112px; /* 64px top bar + 46px game shelf + border */
  --gutter: clamp(18px, 4vw, 44px);

  /* Game board */
  --cw: 96px;
  --card-radius: calc(var(--cw) * 0.075);
  --felt-1: #124534;
  --felt-2: #0a2c21;
}

*,
*::before,
*::after { box-sizing: border-box; }

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

/* Anchors land below the sticky two-row header instead of underneath it. */
:where(h1, h2, h3, h4, section[id], div[id]) {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(200, 162, 83, 0.09), transparent 26rem),
    radial-gradient(circle at 88% 0%, rgba(15, 61, 46, 0.06), transparent 30rem);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* Icon default size; component styles override as needed. */
.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  display: inline-block;
  vertical-align: -0.14em;
}
img { height: auto; }

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  font-family: var(--font-display);
  font-weight: 560;
  line-height: 1.12;
  letter-spacing: -0.012em;
  color: var(--ink);
  font-variation-settings: "SOFT" 40, "WONK" 0;
}

h1 { font-size: clamp(2.1rem, 4.2vw, 3.6rem); }
h2 { font-size: clamp(1.55rem, 2.6vw, 2.25rem); }
h3 { font-size: clamp(1.18rem, 1.8vw, 1.45rem); }
h4 { font-size: 1.05rem; letter-spacing: 0; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--pine);
  text-decoration-color: rgba(200, 162, 83, 0.6);
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}
a:hover { color: var(--pine-soft); text-decoration-color: var(--gold); }

ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin: 0.3em 0; }
li::marker { color: var(--gold); }

strong { font-weight: 650; }
small { font-size: 0.82rem; }

hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 2rem 0;
}

::selection { background: var(--gold-soft); color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 999;
  padding: 10px 16px;
  background: var(--gold);
  color: var(--ink);
  border-radius: var(--radius-sm);
  font-weight: 650;
  transition: top 160ms var(--ease);
}
.skip-link:focus { top: 16px; }

/* Layout helpers */
.page {
  width: min(100% - (var(--gutter) * 2), var(--page-max));
  margin-inline: auto;
}

.page--wide { width: min(100% - (var(--gutter) * 2), 1440px); }

.section { padding: clamp(40px, 6vw, 84px) 0; }
.section--tight { padding: clamp(26px, 4vw, 52px) 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pine);
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--gold);
}
.eyebrow--light { color: var(--gold-soft); }
.eyebrow--light::before { background: var(--gold); }

.lede { font-size: 1.12rem; color: var(--ink-soft); line-height: 1.65; }

.muted { color: var(--muted); }
.center { text-align: center; }
.stack-sm > * + * { margin-top: 10px; }
.stack > * + * { margin-top: 20px; }
.stack-lg > * + * { margin-top: 36px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

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

.hidden { display: none !important; }

/* Decorative rule */
.ornament-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gold);
}
.ornament-rule::before,
.ornament-rule::after {
  content: "";
  height: 1px;
  background: currentColor;
  opacity: 0.5;
  flex: 1;
}
.ornament-rule svg { width: 18px; height: 18px; flex: none; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1179px) {
  :root { --header-h: 65px; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  :root { --header-h: 65px; }
}

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