/* Scholars Bowl study guide — shared styles. No JavaScript anywhere on this site. */

:root {
  --bg: #fdfcf9;
  --fg: #1d1d1f;
  --muted: #5c5c66;
  --accent: #6b1d2a;      /* deep maroon */
  --rule: #ddd8cf;
  --table-stripe: #f6f3ee;
  --code-bg: #f1eee8;
  --max: 64rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --fg: #e8e6e3;
    --muted: #a3a3ad;
    --accent: #e39aa7;
    --accent-soft: #33242a;
    --rule: #34343a;
    --table-stripe: #1f1f23;
    --code-bg: #242429;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.55 Georgia, "Times New Roman", serif;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

/* ---------- site header / nav ---------- */
.site-header {
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
}
@media (prefers-color-scheme: dark) {
  .site-header { background: #3a1820; }
}
.site-header .inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.4rem;
}
.site-header .brand {
  color: #fff;
  font-weight: bold;
  font-size: 1.15rem;
  text-decoration: none;
}
.site-header nav a {
  color: #fff;
  margin-right: 1rem;
  text-decoration: none;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] { text-decoration: underline; }

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

h1 { font-size: 2rem; margin: 0.8rem 0 0.4rem; }
h2 {
  font-size: 1.55rem;
  margin-top: 2.6rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--accent);
}
h3 { font-size: 1.2rem; margin-top: 1.8rem; color: var(--accent); }
h4 { font-size: 1.05rem; margin: 1.2rem 0 0.3rem; }

.lede { color: var(--muted); font-style: italic; }

/* ---------- table of contents ---------- */
.toc {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 0.6rem 1.2rem 0.8rem;
  margin: 1rem 0 1.5rem;
}
.toc h2 { border: 0; margin: 0.3rem 0; font-size: 1.1rem; }
.toc ol { margin: 0.2rem 0; padding-left: 1.4rem; columns: 2 16rem; }
.toc li { break-inside: avoid; }

/* Highlight the section you jumped to via #anchor (pure CSS) */
section:target > h2,
[id]:target { background: var(--accent-soft); }

section { scroll-margin-top: 0.5rem; }

.top-link {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  float: right;
  margin-top: -2.1rem;
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0.8rem 0 1.2rem; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}
th, td {
  border: 1px solid var(--rule);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
th { background: var(--accent-soft); }
tbody tr:nth-child(even) { background: var(--table-stripe); }
td ul { margin: 0; padding-left: 1.1rem; }

/* ---------- callouts ---------- */
.tip, .trap {
  border-radius: 4px;
  padding: 0.5rem 0.9rem;
  margin: 0.9rem 0;
  font-size: 0.95rem;
}
.tip  { background: #e8f3ea; border-left: 4px solid #2e7d4a; }
.trap { background: #fdf0e1; border-left: 4px solid #c26a00; }
@media (prefers-color-scheme: dark) {
  .tip  { background: #1c2b21; }
  .trap { background: #2e2416; }
}
.tip::before  { content: "Buzzer tip: "; font-weight: bold; }
.trap::before { content: "Watch out: "; font-weight: bold; }

/* ---------- math-ish formatting ---------- */
.formula {
  font-family: "Cambria Math", "STIX Two Math", Cambria, Georgia, serif;
  background: var(--code-bg);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  white-space: nowrap;
}
.formula-block {
  font-family: "Cambria Math", "STIX Two Math", Cambria, Georgia, serif;
  background: var(--code-bg);
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  overflow-x: auto;
}
math { font-size: 1.05em; }
pre.pascal {
  font-family: Consolas, "Courier New", monospace;
  background: var(--code-bg);
  padding: 0.6rem 1rem;
  line-height: 1.35;
  overflow-x: auto;
}

/* "learn more" links — small, unobtrusive, with an outbound arrow */
a.more {
  font-family: system-ui, sans-serif;
  font-size: 0.78em;
  white-space: nowrap;
}
a.more::after { content: " ↗"; }
td a.more { display: inline-block; }

dl dt { font-weight: bold; margin-top: 0.6rem; }
dl dd { margin-left: 1.4rem; }

/* ---------- home page cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}
.card {
  border: 1px solid var(--rule);
  border-top: 4px solid var(--accent);
  padding: 0.6rem 1rem 1rem;
  background: var(--bg);
}
.card h2 { border: 0; margin: 0.3rem 0; font-size: 1.3rem; }
.card ul { padding-left: 1.2rem; margin: 0; }

footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--rule);
}

/* ---------- print: handy for practice packets ---------- */
@media print {
  .site-header, .top-link, footer { display: none; }
  body { font-size: 11pt; background: #fff; color: #000; }
  a { color: #000; text-decoration: none; }
  h2 { break-after: avoid; }
  tr, .tip, .trap { break-inside: avoid; }
}
