/* Shared chrome for both pages: colour tokens, form controls, cards, nav.
   Anything specific to one page stays in that page's own <style>.

   The look is painted: gouache on cream paper. Boxes have a brush-ink edge
   with the slight wobble of a hand-drawn line (uneven border radii), a hard
   offset shadow like a paper cut-out, and a handwritten face for labels and
   buttons. The sentence itself stays in a plain face, since that is the
   thing being read. */

@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@400;700&display=swap');

:root {
  color-scheme: light dark;
  --bg: #f3e9d6;
  --panel: #fbf5e8;
  --sunk: #ecdfc6;
  --ink: #2b2118;
  --muted: #6b5a49;
  --faint: #9c8a75;
  --line: #2b2118;
  --accent: #c1552f;
  --accent-soft: #f6d9c4;
  --mark: #f3d98a;
  --bad: #a83a2a;
  --teal: #2f6f73;
  --ochre: #d9a441;
  --radius: 10px;
  /* The wobble: two radius pairs that never quite match. */
  --wobble: 255px 14px 225px 16px / 16px 225px 14px 255px;
  --wobble-small: 120px 8px 110px 9px / 9px 110px 8px 120px;
  --hand: 'Kalam', 'Segoe Print', 'Comic Sans MS', cursive;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1a16;
    --panel: #2a231d;
    --sunk: #241e19;
    --ink: #f1e6d2;
    --muted: #b7a48c;
    --faint: #8a7962;
    --line: #f1e6d2;
    --accent: #e8865f;
    --accent-soft: #4a2f22;
    --mark: #5a4a22;
    --bad: #f08a7a;
    --teal: #6fb2b6;
    --ochre: #e6b85a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1.5rem 1.25rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Paper grain over everything, light enough to feel rather than see. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.2 0 0 0 0.18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  body::before {
    opacity: 0.25;
  }
}

main {
  max-width: 46rem;
  margin: 0 auto;
}

/* Site header ------------------------------------------------------------ */

.site-nav {
  max-width: 46rem;
  margin: 0 auto 2rem;
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0.75rem;
}

/* The brand: a drawn potato and a lowercase wordmark, in the same hand as
   the chest on the learn page. */
.site-nav .brand {
  --spud: #d9a566;
  --spud-line: #7c4a2d;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  /* On a narrow screen the brand gives way; the links never wrap. */
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.site-nav .brand .mark {
  flex: 0 0 auto;
  transition: transform 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.site-nav .brand:hover .mark {
  transform: rotate(-12deg) scale(1.08);
}

@media (prefers-color-scheme: dark) {
  .site-nav .brand {
    --spud: #c98f55;
    --spud-line: #3a2617;
  }
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current='page'] {
  color: var(--accent);
  font-weight: 600;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

.lede {
  margin: 0 0 1.75rem;
  color: var(--muted);
}

/* Form controls ---------------------------------------------------------- */

form {
  display: grid;
  gap: 0.85rem;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

textarea,
input,
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--wobble);
  box-shadow: 3px 3px 0 var(--line);
}

textarea {
  min-height: 7.5rem;
  resize: vertical;
}

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

.row {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.row > * {
  flex: 1 1 12rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

/* Buttons are paper cut-outs: ink edge, hard shadow, and they press down. */
button {
  padding: 0.55rem 1.3rem;
  font: inherit;
  font-family: var(--hand);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--panel);
  background: var(--accent);
  border: 2px solid var(--line);
  border-radius: var(--wobble-small);
  box-shadow: 3px 3px 0 var(--line);
  cursor: pointer;
  transition:
    transform 0.08s ease-out,
    box-shadow 0.08s ease-out;
}

button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--line);
}

button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--line);
}

button.ghost {
  color: var(--ink);
  background: var(--panel);
  font-weight: 700;
}

button.ghost:hover {
  color: var(--ink);
  background: var(--sunk);
}

button:disabled,
button:disabled:hover {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: 3px 3px 0 var(--line);
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Shared blocks ---------------------------------------------------------- */

.card {
  padding: 1.1rem 1.25rem;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--wobble);
  box-shadow: 5px 5px 0 var(--line);
}

label,
h1,
h2,
.lede {
  font-family: var(--hand);
}

h1 {
  font-size: 1.9rem;
  font-weight: 700;
}

.status {
  margin: 1.5rem 0 0;
  color: var(--muted);
}

.status.error {
  color: var(--bad);
}
