/* ==========================================================================
   Start Small, Go Big Brain — design system
   Warm "field notebook" look: cream paper, field green, harvest gold, barn red.
   Fonts are bundled locally (works with no internet).
   ========================================================================== */
@import url("./fonts.css");

:root {
  color-scheme: light;
  --paper: #fbf6ea;
  --paper-2: #f3ead6;
  --paper-3: #eadfc6;
  --card: #fffdf7;
  --ink: #1e2b22;
  --ink-2: #4b5a4f;
  --ink-3: #7a857c;
  --line: #d9ccb0;

  --field: #2f6b3a;       /* 🌱 Spark */
  --field-2: #dcebd5;
  --harvest: #d98f1f;     /* 🔧 Build */
  --harvest-2: #fbe8c4;
  --plum: #6d4c9f;        /* 🧠 Big Brain */
  --plum-2: #e7def3;
  --barn: #b5412f;
  --barn-2: #f6dad3;
  --sky: #2f6ea5;
  --sky-2: #d9e6f2;
  --soil: #6b4a2b;

  --good: #2f7d43;
  --bad: #b5412f;

  --spark: var(--field);
  --build: var(--harvest);
  --bigbrain: var(--plum);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 0 rgba(30, 43, 34, 0.08), 0 6px 18px -8px rgba(30, 43, 34, 0.25);
  --shadow-press: 0 3px 0 rgba(30, 43, 34, 0.35);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121c16;
  --paper-2: #1a271f;
  --paper-3: #23342a;
  --card: #1c2a21;
  --ink: #f4efe2;
  --ink-2: #c3c9bd;
  --ink-3: #8f9a90;
  --line: #34473b;
  --field: #6fbf7d;
  --field-2: #1f3b27;
  --harvest: #f0b04a;
  --harvest-2: #3d2f14;
  --plum: #b69be0;
  --plum-2: #2e2542;
  --barn: #ee7a66;
  --barn-2: #3f211b;
  --sky: #7fb5e6;
  --sky-2: #1b2e40;
  --good: #72c886;
  --bad: #ee7a66;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 8px 22px -10px rgba(0, 0, 0, 0.7);
  --shadow-press: 0 3px 0 rgba(0, 0, 0, 0.6);
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { max-width: 100%; }
[hidden] { display: none !important; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 0.8em; text-wrap: pretty; }
a { color: var(--sky); text-underline-offset: 3px; }
code, kbd, pre, .mono { font-family: var(--font-mono); }
kbd {
  display: inline-block;
  padding: 0.05em 0.45em;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: var(--card);
  font-size: 0.85em;
}

/* ---------- Layout helpers ---------- */
.stack > * + * { margin-top: var(--gap, 1rem); }
.row { display: flex; flex-wrap: wrap; gap: var(--gap, 0.75rem); align-items: center; }
.grid { display: grid; gap: var(--gap, 1rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 240px)), 1fr)); }
.center { display: grid; place-items: center; text-align: center; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.wrap { max-width: 1100px; margin-inline: auto; padding-inline: max(16px, 4vw); }

/* ---------- Cards & chips ---------- */
.card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.chip.spark { background: var(--field-2); border-color: var(--field); color: var(--field); }
.chip.build { background: var(--harvest-2); border-color: var(--harvest); color: var(--soil); }
.chip.bigbrain { background: var(--plum-2); border-color: var(--plum); color: var(--plum); }
:root[data-theme="dark"] .chip.build { color: var(--harvest); }

/* A slightly rotated "seed packet" stamp label */
.stamp {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  padding: 0.25em 0.7em;
  border: 2px solid currentColor;
  border-radius: 6px;
  transform: rotate(-2deg);
  color: var(--barn);
}

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--card);
  --fg: var(--ink);
  --bd: var(--ink);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 48px;          /* big touch targets for phones */
  padding: 0.6em 1.15em;
  border: 2px solid var(--bd);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  font: 700 1rem/1.1 var(--font-body);
  cursor: pointer;
  box-shadow: var(--shadow-press);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: color-mix(in srgb, var(--bg) 88%, var(--ink)); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0, 0, 0, 0); }
.btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.primary { --bg: var(--field); --fg: #fff; --bd: var(--field); }
.btn.gold { --bg: var(--harvest); --fg: #1e1405; --bd: var(--harvest); }
.btn.red { --bg: var(--barn); --fg: #fff; --bd: var(--barn); }
.btn.plum { --bg: var(--plum); --fg: #fff; --bd: var(--plum); }
.btn.ghost { --bg: transparent; --bd: var(--line); box-shadow: none; }
.btn.small { min-height: 36px; padding: 0.35em 0.8em; font-size: 0.875rem; }
.btn.big { min-height: 64px; font-size: 1.25rem; padding: 0.7em 1.4em; }
:root[data-theme="dark"] .btn.primary,
:root[data-theme="dark"] .btn.plum,
:root[data-theme="dark"] .btn.red { --fg: #10170f; }

/* ---------- Forms ---------- */
input[type="text"], input[type="number"], input[type="search"], textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.6em 0.8em;
  min-height: 48px;
  width: 100%;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
label { font-weight: 700; }

/* ---------- The 🪞 "What just happened?" reveal card ---------- */
.reveal-card {
  position: relative;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  box-shadow: 8px 8px 0 var(--harvest);
}
.reveal-card .reveal-kicker {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--barn);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}
.reveal-card .steal { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 0.8rem; }
.reveal-card .steal > div { background: var(--paper-2); border-radius: 12px; padding: 0.7rem 0.9rem; }

/* ---------- Feedback states ---------- */
.is-correct { background: color-mix(in srgb, var(--good) 18%, var(--card)) !important; border-color: var(--good) !important; }
.is-wrong { background: color-mix(in srgb, var(--bad) 16%, var(--card)) !important; border-color: var(--bad) !important; }

@keyframes pop { 0% { transform: scale(0.9); opacity: 0; } 60% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.pop { animation: pop 0.35s ease both; }
.shake { animation: shake 0.3s ease; }

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