/* ==========================================================================
   Base — reset, typography, form controls, utilities
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: 'tnum' 1, 'cv01' 1;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--fs-2xl); font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-md); font-weight: 700; }
a { color: var(--green-600); text-decoration-thickness: 1px; text-underline-offset: 3px; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }

:focus-visible { outline: 2px solid var(--green-500); outline-offset: 2px; border-radius: 4px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 1000; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r-sm); }
.skip-link:focus { top: 12px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px;
  font: 600 var(--fs-sm)/1 var(--font);
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--green-600); color: var(--green-700); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.btn-primary:hover { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.btn-accent { background: var(--maroon-600); border-color: var(--maroon-600); color: #fff; }
.btn-accent:hover { background: var(--maroon-700); border-color: var(--maroon-700); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--green-50); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: var(--fs-xs); }
.btn-lg { min-height: 46px; padding: 0 20px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.icon-btn { width: 38px; padding: 0; }

/* ── Form controls ───────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field > span { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.input, .select {
  width: 100%; min-height: 40px; padding: 8px 12px;
  font: 500 var(--fs-md)/1.3 var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(0, 92, 54, .14); }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6b62' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select-sm, .input-sm { min-height: 34px; font-size: var(--fs-sm); padding-top: 5px; padding-bottom: 5px; }
.checkbox { display: inline-flex; gap: 8px; align-items: center; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--green-600); }

/* ── Small helpers ───────────────────────────────────── */
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack { display: grid; gap: var(--s-4); }
.stack-sm { display: grid; gap: var(--s-2); }
.grow { flex: 1 1 auto; min-width: 0; }
.text-right { text-align: right; }

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