/* Shared by index.html and guide.html: tokens, top bar, buttons, toast, motion.
   One light paper tone, one green accent, a color dot per course area. Page layouts live in each page. */
:root {
  color-scheme: light;
  --serif: Newsreader, "Iowan Old Style", Georgia, serif;
  --sans: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ink: #15241d; --ink-soft: #3b4d44; --muted: #66756e;
  --bg: #f3f5f0; --card: #fcfdfb; --surface: #ffffff; --surface-alt: #f7f9f5; --glass: rgba(255, 255, 255, .7);
  --green: #0b6b4f; --green-hover: #085a42; --green-ink: #064b39; --on-green: #ffffff;
  --tint: #e9f1eb; --tint-strong: #d9e9de;
  --gold-bg: #f4ecd9; --gold-ink: #7a5818;
  --ob-bg: #ece8f6; --ob-ink: #4a3f7a;
  --joint: #b98a2e; --ent: #0b6b4f; --ob: #6b5cb3;
  --red: #b94a3e; --right-bg: #e3f1e7; --wrong-bg: #fbe8e5;
  --track: #e6e9e1; --line: #dde1d8; --line-soft: #e8ebe4;
  --rule: #c9d7ea; --margin: #d9675d;
  --shadow-sm: 0 1px 2px rgba(21, 45, 34, .05);
  --shadow: 0 1px 2px rgba(21, 45, 34, .04), 0 10px 28px -12px rgba(21, 45, 34, .14);
  --shadow-lg: 0 2px 6px rgba(21, 45, 34, .05), 0 28px 56px -20px rgba(21, 45, 34, .24);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --topbar: 61px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #e6eee9; --ink-soft: #c3d1c9; --muted: #93a59b;
    --bg: #0e1613; --card: #131e19; --surface: #17241e; --surface-alt: #15211c; --glass: rgba(255, 255, 255, .04);
    --green: #4fbf92; --green-hover: #6fd0a8; --green-ink: #8fdcb8; --on-green: #06231a;
    --tint: #1a2e26; --tint-strong: #21392f;
    --gold-bg: #3a3120; --gold-ink: #e9c57a; --ob-bg: #2a2640; --ob-ink: #c7bdf2;
    --joint: #d9ae5a; --ent: #4fbf92; --ob: #a597e6;
    --red: #e07a6d; --right-bg: #17362a; --wrong-bg: #3a1f1b;
    --track: #24332c; --line: #2a3a33; --line-soft: #22312a;
    --rule: #26364a; --margin: #8a3a34;
    --shadow-sm: none;
    --shadow: 0 12px 32px -14px rgba(0, 0, 0, .6);
    --shadow-lg: 0 30px 60px -24px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar) + 20px); }
body {
  margin: 0;
  background: radial-gradient(1200px 500px at 15% -10%, var(--tint), transparent 70%) no-repeat, var(--bg);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
}
a { color: var(--green-ink); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--green); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1200px; margin: 0 auto; padding-block: 10px;
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--green); color: var(--on-green); font-weight: 800; font-size: 12px; letter-spacing: -.02em; box-shadow: var(--shadow-sm); }
.brand strong { display: block; font-size: 14px; line-height: 1.2; }
.brand .sub { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.nav { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line-soft); border-radius: 999px; background: var(--glass); }
.nav a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px;
  color: var(--ink-soft); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.nav a:hover { background: var(--tint); color: var(--green-ink); }
.nav a[aria-current="page"] { background: var(--green); color: var(--on-green); }
@media (max-width: 560px) {
  .nav { scrollbar-width: none; }
  .nav a { padding: 0 11px; font-size: 13.5px; }
}
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--green); transform: scaleX(0); transform-origin: 0 50%; }

/* Buttons */
.primary, .secondary, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 700; font-size: 15px; text-decoration: none;
  transition: transform .15s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.primary { border: 1px solid var(--green); background: var(--green); color: var(--on-green); box-shadow: var(--shadow-sm); }
.primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.secondary, .btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.secondary:hover, .btn:hover { border-color: var(--green); color: var(--green-ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn.primary:hover { background: var(--green-hover); color: var(--on-green); }
.primary:active, .secondary:active, .btn:active { transform: scale(.97); }
.primary:disabled, .btn:disabled { cursor: not-allowed; opacity: .45; transform: none; }

/* Area labels */
.area, .tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--tint); color: var(--green-ink); }
.area::before, .tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.area-ob, .tag.ob { background: var(--ob-bg); color: var(--ob-ink); }
.area-joint, .tag.joint { background: var(--gold-bg); color: var(--gold-ink); }
.tag.session { background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.tag.session::before { display: none; }

/* Toast */
.toast {
  position: fixed; z-index: 40; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translate(-50%, 10px) scale(.98); pointer-events: none;
  transition: opacity .2s var(--ease), transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Motion */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { 40% { transform: scale(1.015); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
:root { interpolate-size: allow-keywords; }
details::details-content { height: 0; overflow: clip; transition: height .3s var(--ease), content-visibility .3s allow-discrete; }
details[open]::details-content { height: auto; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after, ::details-content { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print {
  .topbar, .toast { display: none; }
  .reveal { opacity: 1; transform: none; }
}
