/* Never Graduate: shared styles for every page (theme, notebook paper, toggle, cookie banner, footer) */

/* ---------- Theme tokens ---------- */
:root {
  --paper: #FCFCF9;
  --rule: #D3DFF0;
  --margin: #E05A5F;
  --ink: #1D3FA0;
  --on-ink: #FCFCF9;
  --graphite: #24272C;
  --pencil: #5D636B;
  --highlight: #FFEE70;
  --ruler-fill: #FFF8D2;
  --line: 2rem;                         /* ruled-line spacing; text sits on this rhythm */
  --gutter: clamp(44px, 9vw, 120px);    /* space left of the red margin line */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151A2C;
    --rule: #232C47;
    --margin: #B9484F;
    --ink: #9FB6FF;
    --on-ink: #151A2C;
    --graphite: #ECEEF3;
    --pencil: #A3AAB8;
    --highlight: #E6D64A;
    --ruler-fill: #22283A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151A2C;
  --rule: #232C47;
  --margin: #B9484F;
  --ink: #9FB6FF;
  --on-ink: #151A2C;
  --graphite: #ECEEF3;
  --pencil: #A3AAB8;
  --highlight: #E6D64A;
  --ruler-fill: #22283A;
  color-scheme: dark;
}

/* ---------- Notebook paper ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--graphite);
  background-color: var(--paper);
  background-image:
    linear-gradient(to right,
      transparent var(--gutter),
      color-mix(in srgb, var(--margin) 75%, transparent) var(--gutter),
      color-mix(in srgb, var(--margin) 75%, transparent) calc(var(--gutter) + 2px),
      transparent calc(var(--gutter) + 2px)),
    repeating-linear-gradient(to bottom,
      transparent 0,
      transparent calc(var(--line) - 1px),
      var(--rule) calc(var(--line) - 1px),
      var(--rule) var(--line));
  background-attachment: local;
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.125rem;
  line-height: var(--line);
  overflow-x: hidden;
}
.page {
  max-width: 60rem;
  padding: calc(var(--line) * 2) 20px calc(var(--line) * 2) calc(var(--gutter) + 28px);
}
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.handwritten {
  font-family: "Kalam", "Comic Sans MS", cursive;
  color: var(--ink);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px 0 10px;
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--graphite);
  background: var(--paper);
  border: 2px solid var(--graphite);
  border-radius: 999px;
  cursor: pointer;
}
.theme-toggle svg { width: 20px; height: 20px; flex: 0 0 auto; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  height: 48px;
  padding: 0 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  border: 2px solid var(--ink);
  cursor: pointer;
}
.btn-solid { background: var(--ink); color: var(--on-ink); }
.btn-outline { background: var(--paper); color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { font-size: .9375rem; color: var(--pencil); }
.site-footer p { margin: 0 0 var(--line); }
.site-footer ul {
  list-style: none;
  margin: 0 0 var(--line);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}
.site-footer a {
  color: var(--graphite);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.site-footer a:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* ---------- Cookie consent: a small, quiet nudge in the corner ---------- */
.consent {
  position: fixed;
  z-index: 20;
  right: 16px;
  bottom: 16px;
  width: min(21rem, calc(100vw - 32px));
  padding: 12px 14px;
  background: var(--paper);
  color: var(--graphite);
  border: 1px solid color-mix(in srgb, var(--graphite) 25%, transparent);
  border-radius: 10px;
  box-shadow: 0 6px 20px -12px rgba(0,0,0,.35);
  font-size: .875rem;
  line-height: 1.45;
  animation: nudge-in .3s ease-out both;
}
@keyframes nudge-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.consent[hidden] { display: none; }
.consent p { margin: 0 0 10px; }
.consent .hand {
  font-family: "Kalam", "Comic Sans MS", cursive;
  font-size: 1.0625rem;
  color: var(--ink);
  margin-right: 2px;
}
.consent a { color: var(--pencil); }
.consent-options { margin: 0 0 10px; padding: 0; border: 0; }
.consent-options legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.consent-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 10px;
  align-items: start;
  padding: 6px 0;
  border-top: 1px solid var(--rule);
}
.consent-option input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--ink); }
.consent-option strong { font-weight: 600; }
.consent-option span { grid-column: 2; color: var(--pencil); font-size: .8125rem; }
.consent-actions { display: flex; align-items: center; gap: 6px; }
.consent .btn {
  height: 30px;
  padding: 0 12px;
  font-size: .8125rem;
  border-width: 1px;
  border-radius: 999px;
  border-color: color-mix(in srgb, var(--graphite) 45%, transparent);
  background: transparent;
  color: var(--graphite);
}
.consent .btn:hover { border-color: var(--ink); color: var(--ink); }
.consent .btn-link {
  margin-left: auto;
  border: 0;
  padding: 0 2px;
  color: var(--pencil);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 560px) {
  :root { --gutter: 28px; }
  .page { padding-left: calc(var(--gutter) + 18px); padding-top: calc(var(--line) * 3); }
  .theme-toggle { top: 12px; right: 12px; }
  .consent { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .consent { animation: none; }
}
