/* ============================================================
   pick-four course — shared stylesheet
   Palette is semantic and drawn from Pokémon type colors:
     Electric = highlight · Water = links/info · Grass = success
     Psychic = pitfalls/war stories · Fighting = strength/metrics
   Faces: Avenir Next (display) · Charter (body) · Menlo (data)
   ============================================================ */

:root {
  --field:    #e9eff5;   /* page background — pale battle-field blue    */
  --panel:    #ffffff;   /* cards, content panels                        */
  --ink:      #1b2733;   /* deep navy text                               */
  --dim:      #5a6b7c;   /* secondary text                               */
  --line:     #c9d6e2;   /* hairlines, borders                           */
  --electric: #f5b31b;   /* highlight, marks, active states              */
  --water:    #2f7fc1;   /* links, info                                  */
  --grass:    #3f9e52;   /* success, wins, "this worked"                 */
  --psychic:  #d94f80;   /* pitfalls, failures, war stories              */
  --fighting: #c2452f;   /* strength numbers, hard warnings              */

  --display: "Avenir Next", "Avenir", "Trebuchet MS", "Segoe UI", sans-serif;
  --body: "Charter", "Iowan Old Style", "Palatino", Georgia, serif;
  --mono: "SF Mono", "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.65;
}

/* ---------- layout: sticky sidebar + content column ---------- */

.layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  max-width: 1200px;
  margin: 0 auto;
  gap: 0 48px;
  padding: 0 24px;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 28px 0 28px;
  border-right: 1px solid var(--line);
}

main {
  padding: 44px 0 96px;
  max-width: 720px;
}

/* ---------- sidebar nav ---------- */

.toc { display: flex; flex-direction: column; }

.toc .home {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 6px;
  padding: 4px 12px 4px 0;
}
.toc .home .ball {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: linear-gradient(to bottom, var(--psychic) 46%, var(--ink) 46%, var(--ink) 54%, var(--panel) 54%);
  border: 1.5px solid var(--ink);
  margin-right: 7px;
  vertical-align: baseline;
}

.toc .part {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 18px 0 4px;
}

.toc a:not(.home) {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  padding: 5px 10px 5px 12px;
  margin-left: -12px;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
}
.toc a:not(.home):hover { background: rgba(47, 127, 193, 0.08); }
.toc a.active {
  border-left-color: var(--electric);
  background: rgba(245, 179, 27, 0.14);
  font-weight: 600;
}

/* ---------- chapter header ---------- */

.eyebrow {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--water);
  margin: 0 0 10px;
}

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}

.lede {
  font-size: 21px;
  line-height: 1.5;
  color: var(--dim);
  margin: 0 0 8px;
}

.you-will {
  font-family: var(--display);
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 26px 0 0;
}
.you-will strong {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  color: var(--grass);
  display: block;
  margin-bottom: 6px;
}
.you-will ul { margin: 0; padding-left: 20px; }
.you-will li { margin: 3px 0; }

/* ---------- prose ---------- */

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.2;
  margin: 52px 0 14px;
  padding-top: 18px;
  border-top: 2px solid var(--line);
}

h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  margin: 34px 0 8px;
}

p { margin: 0 0 18px; }

a { color: var(--water); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--electric);
  outline-offset: 2px;
  border-radius: 2px;
}

strong { font-weight: 700; }

code, .mono {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(27, 39, 51, 0.06);
  border-radius: 4px;
  padding: 1px 5px;
}

pre {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
  background: var(--ink);
  color: #dce7f0;
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 18px;
}
pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

ul, ol { margin: 0 0 18px; padding-left: 26px; }
li { margin: 5px 0; }

/* glossary term link */
.term {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px dotted var(--water);
}
.term:hover { background: rgba(47, 127, 193, 0.1); }

/* ---------- tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--display);
  font-size: 14.5px;
  margin: 0 0 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); }
th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
  background: rgba(201, 214, 226, 0.25);
}
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 13.5px; }

/* ---------- didactic boxes ---------- */

.box {
  border-radius: 12px;
  padding: 18px 20px 14px;
  margin: 0 0 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 5px;
}
.box .box-tag {
  display: block;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.box p:last-child { margin-bottom: 4px; }

.box.analogy  { border-left-color: var(--water); }
.box.analogy  .box-tag { color: var(--water); }

.box.war      { border-left-color: var(--psychic); background: #fdf3f7; }
.box.war      .box-tag { color: var(--psychic); }

.box.keypoint { border-left-color: var(--grass); background: #f2f9f3; }
.box.keypoint .box-tag { color: var(--grass); }

.box.detail   { border-left-color: var(--dim); }
.box.detail   .box-tag { color: var(--dim); }

/* ---------- concept cards ("move cards") ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}

.card {
  background: var(--panel);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 14px 16px 12px;
  box-shadow: 3px 3px 0 rgba(27, 39, 51, 0.14);
}
.card h4 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card p { font-size: 15px; line-height: 1.5; margin: 0; color: var(--ink); }
.card .file { display: block; margin-top: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--dim); }

.type-badge {
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}
.type-badge.algorithm { background: var(--water); }
.type-badge.mechanic  { background: var(--grass); }
.type-badge.pitfall   { background: var(--psychic); }
.type-badge.metric    { background: var(--fighting); }
.type-badge.tool      { background: var(--dim); }
.type-badge.data      { background: var(--electric); color: var(--ink); }

/* ---------- figures ---------- */

figure {
  margin: 26px 0 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 20px 14px;
}
figure svg { display: block; width: 100%; height: auto; }
figcaption {
  font-family: var(--display);
  font-size: 13.5px;
  color: var(--dim);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  line-height: 1.5;
}
figcaption strong { color: var(--ink); }

/* ---------- quiz ("check yourself") ---------- */

.quiz {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 40px 0 22px;
}
.quiz > .box-tag {
  display: block;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--electric);
  -webkit-text-stroke: 0.2px var(--ink);
  margin-bottom: 10px;
}
.quiz details {
  border-top: 1px dashed var(--line);
  padding: 10px 0;
}
.quiz details:first-of-type { border-top: none; }
.quiz summary {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15.5px;
  cursor: pointer;
  color: var(--ink);
}
.quiz summary:hover { color: var(--water); }
.quiz details p {
  margin: 10px 0 4px;
  font-size: 16px;
  padding-left: 14px;
  border-left: 3px solid var(--grass);
}

/* ---------- prev / next footer ---------- */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 22px;
  border-top: 2px solid var(--line);
  font-family: var(--display);
}
.pager a {
  text-decoration: none;
  color: var(--ink);
  background: var(--panel);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 12px 16px;
  max-width: 46%;
  box-shadow: 3px 3px 0 rgba(27, 39, 51, 0.14);
}
.pager a:hover { background: rgba(245, 179, 27, 0.16); }
.pager .dir {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 3px;
}
.pager .spacer { flex: 1; }

/* ---------- index page extras ---------- */

.hero {
  background: var(--panel);
  border: 1.5px solid var(--ink);
  border-radius: 16px;
  padding: 30px 32px 26px;
  margin: 0 0 40px;
  box-shadow: 5px 5px 0 rgba(27, 39, 51, 0.12);
}
.hero h1 { font-size: 44px; }
.hero .lede { margin-bottom: 0; }

.chapter-list { list-style: none; padding: 0; margin: 0 0 26px; }
.chapter-list li { margin: 0 0 10px; }
.chapter-list a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 16px;
}
.chapter-list a:hover { border-color: var(--ink); box-shadow: 3px 3px 0 rgba(27, 39, 51, 0.12); }
.chapter-list .n {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--water);
  min-width: 24px;
  text-align: right;
}
.chapter-list .t { font-family: var(--display); font-weight: 600; font-size: 16.5px; }
.chapter-list .d { font-size: 14.5px; color: var(--dim); display: block; }

/* ---------- glossary ---------- */

.gloss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin: 0 0 30px;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 18px 0 12px;
  }
  .toc { flex-direction: row; flex-wrap: wrap; gap: 2px 10px; align-items: center; }
  .toc .part { margin: 4px 0; width: auto; }
  .toc .home { width: 100%; }
  .toc a:not(.home) { border-left: none; border-bottom: 3px solid transparent; border-radius: 6px; margin-left: 0; padding: 4px 8px; }
  .toc a.active { border-bottom-color: var(--electric); }
  main { padding-top: 28px; }
  h1 { font-size: 32px; }
  .hero h1 { font-size: 34px; }
  body { font-size: 17px; }
}
