/* LLM 301 — "the menu"
   Chowly brand tokens (brand-guidelines skill) live on :root. Light by default, dark via prefers-color-scheme. */

:root {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --text: #0a1628;
  --text-muted: #3b4563;
  --accent: #1B51A4;
  --accent-ink: #ffffff;
  --border: #e2e8f0;
  --focus: #3B82F6;
  --tag-bg: #f0f3fa;
  --tag-text: #114191;
  --max-width: 760px;
  --radius: 10px;
  --radius-sm: 8px;
  --tap-min: 44px;
  --font-heading: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020817;
    --bg-elev: #0c1a33;
    --text: #f3f6fb;
    --text-muted: #a9b8d6;
    --accent: #6ea8f0;
    --accent-ink: #020817;
    --border: #233355;
    --focus: #6ea8f0;
    --tag-bg: #11244a;
    --tag-text: #cfe0ff;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-weight: 700;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px 48px;
}

a {
  color: var(--accent);
}

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

/* Visually hidden but present for screen readers / page structure. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button {
  font-family: inherit;
}

/* Header */

.menu-header {
  padding: 28px 16px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.menu-header .eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.menu-header .sitemark {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 900;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}

.menu-header .byline {
  font-family: var(--font-body);
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 14px;
}

.how-it-works {
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--tag-bg);
  color: var(--tag-text);
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-family: var(--font-body);
}

.top-nav a {
  text-decoration: none;
  font-size: 14px;
  padding: 10px 14px;
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.top-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.top-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.top-nav a[aria-current="page"]:hover {
  color: var(--accent-ink);
}

/* Non-menu views: the "pick 2" framing and byline are stale context */
body[data-view="topic"] .how-it-works,
body[data-view="topic"] .byline,
body[data-view="results"] .how-it-works,
body[data-view="results"] .byline {
  display: none;
}

/* Deep in a topic, the topic's own h1 should be the star — shrink the site chrome.
   (Extra specificity so this beats the >=640px .sitemark size bump below.) */
body[data-view="topic"] .menu-header .sitemark {
  font-size: 20px;
}

/* Category sections */

.category {
  margin: 32px 0;
}

.category h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-family: var(--font-body);
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
  margin: 0 0 14px;
}

.cards {
  display: grid;
  gap: 14px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
}

.card .num {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
}

.card .body h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.card .body a.title-link {
  text-decoration: none;
  color: var(--text);
}

.card .body a.title-link:hover {
  color: var(--accent);
}

.card .blurb {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font-body);
}

.vote-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
}

.vote-btn {
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.vote-btn:hover {
  background: var(--tag-bg);
}

.vote-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.vote-btn[aria-pressed="true"]:hover {
  opacity: 0.85;
}

/* At the 2-vote cap: still tappable (so the status message is reachable),
   just visually de-emphasized. See app.js Votes.toggle() reason "max".
   Border/text color instead of opacity — opacity on an active control
   tanks contrast (was 1.86:1 at .4). */
.vote-btn[data-at-cap="true"] {
  border-color: var(--text-muted);
  color: var(--text-muted);
  background: transparent;
}

.vote-count {
  font-size: 12px;
  color: var(--text-muted);
}

.vote-status {
  font-family: var(--font-body);
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 2px;
  /* On the menu view, space is always reserved so the message appearing/disappearing never
     shifts the cards below it. Opacity (not display/visibility) keeps it
     in the accessibility tree for the aria-live announcement. */
  opacity: 0;
  transition: opacity 0.15s ease;
}

body[data-view="menu"] .vote-status {
  min-height: 20px;
}

.vote-status.is-visible {
  opacity: 1;
}

/* Bonus */

.bonus-card {
  background: var(--tag-bg);
  border: 1px dashed var(--tag-text);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.bonus-card .tag {
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tag-text);
}

.bonus-card h3 {
  margin: 4px 0 0;
}

.bonus-card a.title-link {
  color: var(--text);
  text-decoration: none;
}

/* Topic page */

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  font-family: var(--font-body);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 8px;
}

.topic-category {
  font-family: var(--font-body);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.topic-page h1 {
  margin: 4px 0 12px;
  font-size: 28px;
}

.topic-intro {
  color: var(--text);
  font-size: 17px;
}

.block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg-elev);
}

.block h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.prompt-block pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.copy-btn {
  min-height: var(--tap-min);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.copy-btn:hover {
  background: var(--tag-bg);
}

.copy-btn[data-copied="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.block ul {
  margin: 0;
  padding-left: 20px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  display: grid;
  gap: 6px;
}

.block .links-list {
  list-style: none;
  padding-left: 0;
}

.topic-extras {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

/* Inline SVG diagrams (topic 5) — currentColor/var() inherited straight
   from the page, so they track light/dark automatically. */
.diagrams {
  display: grid;
  gap: 16px;
  margin: 16px 0 8px;
}

@media (min-width: 640px) {
  .diagrams {
    grid-template-columns: 1fr 1fr;
  }
}

.diagram-card {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg-elev);
  color: var(--text);
  text-align: center;
}

.diagram-card svg {
  width: 100%;
  height: auto;
  display: block;
}

.diagram-card figcaption {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Blackboard diagrams (topic: Agent teams) — each mount is a single diagram,
   so force one column (the 640px+ .diagrams rule above would otherwise
   squeeze it) and give it room since it's being enlarged/animated. */
.diagrams.blackboard-diagram {
  grid-template-columns: 1fr;
}

.blackboard-diagram .diagram-card {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Generic mount point for a visual module (extras/<key>.js, window.Visuals). */
.visual-mount {
  margin: 16px 0 24px;
}

/* "Try it" — bottom-of-page prompt blocks (replaces the old stage tabs). */
.try-it {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.try-it h3 {
  font-size: 18px;
  margin: 0;
}

/* Bonus page alias snippets */
.alias-list {
  display: grid;
  gap: 14px;
}

.alias-item pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 4px 0 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.alias-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  margin: 0;
}

.alias-note {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.slot-item {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Results */

#view-results h1 {
  font-size: 24px;
  margin: 0 0 8px;
}

.results-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.results-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 18px;
}

.results-list li.is-leader {
  border-left-color: var(--accent);
}

.results-list .rcount {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.results-list li.is-leader .rcount {
  font-size: 24px;
}

.results-empty {
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-body);
  padding: 24px 16px;
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.results-note {
  font-family: var(--font-body);
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 20px;
}

.hidden {
  display: none !important;
}

footer.note {
  text-align: center;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 40px;
}

@media (max-width: 639px) {
  .menu-header {
    padding: 18px 16px 12px;
  }

  .menu-header .byline {
    display: none;
  }

  .top-nav {
    margin-top: 10px;
  }
}

@media (min-width: 640px) {
  .menu-header .sitemark {
    font-size: 38px;
  }

  .topic-page h1 {
    font-size: 34px;
  }
}

/* Menu: one column per category so the whole menu fits on one screen */
:root { --max-width: 1280px; }
body[data-view="topic"] .wrap { max-width: 760px; }
#view-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0 20px;
  align-items: start;
}
#view-menu > .category:last-child { grid-column: 1 / -1; }
.category { margin: 8px 0; }
.cards { padding: 0; margin: 0; list-style: none; gap: 8px; }
.card { padding: 10px 12px; gap: 8px; align-items: center; }
.card .body h3 { font-size: 15px; margin: 0 0 2px; }
.card .blurb { font-size: 12.5px; line-height: 1.35; }
@media (min-width: 640px) {
  .menu-header { padding-top: 16px; padding-bottom: 10px; }
  .menu-header .sitemark { font-size: 28px; }
}
