/* ============================================================
   Math Circle — Shared Lecture Stylesheet
   ============================================================
   Used by all HTML lecture outputs.  Link from each HTML file:
     <link rel="stylesheet" href="math-circle.css">
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --bg: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --code-bg: #f1f5f9;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- Body ---------- */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  font-size: 16px;
}

/* ---------- Headings ---------- */
h1 {
  font-size: 2em;
  margin-bottom: 0.2em;
  color: var(--accent);
  border-bottom: 3px solid var(--accent);
  padding-bottom: 12px;
}
h2 {
  font-size: 1.45em;
  margin-top: 2.2em;
  margin-bottom: 0.6em;
  color: var(--accent);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
h3 {
  font-size: 1.15em;
  margin-top: 1.5em;
  margin-bottom: 0.4em;
  color: #334155;
}

/* ---------- Subtitle (metadata line below h1) ---------- */
.subtitle {
  color: var(--muted);
  font-size: 0.95em;
  margin-bottom: 2em;
}

/* ---------- Paragraphs & lists ---------- */
p { margin-bottom: 0.9em; }
ul, ol { margin: 0.5em 0 1em 1.5em; }
li { margin-bottom: 0.3em; }

/* ---------- Block-quotes (puzzle statements, key insights) ---------- */
blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  padding: 12px 18px;
  margin: 1em 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}
blockquote em { font-style: normal; }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.95em;
}
th {
  background: var(--accent);
  color: white;
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
}
th:first-child { border-radius: 8px 0 0 0; }
th:last-child  { border-radius: 0 8px 0 0; }
td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
tr:nth-child(even) td { background: #f8fafc; }
tr:hover td { background: var(--accent-light); }

/* ---------- Coloured boxes ---------- */
.highlight-box {
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 1.2em 0;
}
.answer-box {
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 1.2em 0;
}
.impossible-box {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 1.2em 0;
}

/* ---------- Collapsible sections (answers / hints) ---------- */
details {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 18px;
  margin: 0.8em 0;
}
summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}
details[open] summary { margin-bottom: 0.6em; }

/* ---------- Horizontal rules ---------- */
hr {
  border: none;
  border-top: 2px dashed var(--border);
  margin: 2.5em 0;
}

/* ---------- Difficulty badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
  color: white;
}
.badge-bronze  { background: #b45309; }
.badge-silver  { background: #64748b; }
.badge-gold    { background: #ca8a04; }
.badge-diamond { background: #7c3aed; }

/* ---------- Diagram containers (SVG, images) ---------- */
.diagram-container {
  text-align: center;
  margin: 1.5em 0;
}
.diagram-container svg {
  max-width: 100%;
  height: auto;
}

/* ---------- Code blocks ---------- */
pre, code {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  overflow-x: auto;
  margin: 1em 0;
}
code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
}
pre code {
  background: none;
  padding: 0;
}

/* ---------- Emoji sizing ---------- */
.emoji { font-size: 1.1em; }

/* ---------- Page-break helper ---------- */
.page-break { page-break-before: always; }

/* ---------- Print styles ---------- */
@media print {
  body { padding: 20px; font-size: 11pt; max-width: 100%; }
  h1  { font-size: 1.6em; }
  h2  { page-break-after: avoid; font-size: 1.25em; }
  table, blockquote, .diagram-container { page-break-inside: avoid; }
  details { break-inside: avoid; }
  .no-print { display: none; }
}
