/* ================================================================
   DAA — shared deck theme
   Loaded after reveal.css + theme/black.css. Every unit deck links it.
   ================================================================ */

:root {
  --bg: #fafafa;
  --bg-elevated: #f8f9fa;
  --bg-card: #f8f9fa;
  --border: #e0e0e0;
  --border-strong: #b0b0b0;
  --text: #111111;
  --text-muted: #666666;
  --text-dim: #999999;
  --accent: #0d6efd;
  --accent-2: #6f42c1;
  --accent-3: #e83e8c;
  --green: #198142;
  --amber: #d29922;
  --red: #dc3545;

  --r-background: var(--bg);
  --r-background-color: var(--bg);
  --r-main-font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r-main-font-size: 40px;
  --r-main-color: var(--text);
  --r-heading-font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r-heading-color: #111111;
  --r-heading-font-weight: 750;
  --r-heading-letter-spacing: -0.02em;
  --r-heading-text-transform: none;
  --r-link-color: var(--accent);
  --r-link-color-hover: #9ccbff;
  --r-selection-background-color: rgba(13, 110, 253, 0.3);
  --r-code-font: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------------------------------------------------------------
   Base
   --------------------------------------------------------------- */
html,
body {
  background: var(--bg);
}

.reveal {
  color: var(--text);
  font-weight: 400;
}

.reveal .slides {
  text-align: left;
}

.reveal .slides section {
  box-sizing: border-box;
  padding: 0 2.2rem;
  overflow: hidden;
}

.reveal-viewport {
  background-color: var(--bg);
}

.reveal p,
.reveal li {
  line-height: 1.45;
}

.reveal p {
  font-size: 0.74em;
  margin: 0.35em 0;
  color: var(--text);
}

.reveal li {
  font-size: 0.72em;
  margin-bottom: 0.3em;
}

.reveal li::marker {
  color: var(--accent);
}

.reveal ul,
.reveal ol {
  display: block;
  margin-left: 1.1em;
}

.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4 {
  margin: 0 0 0.35em;
  line-height: 1.15;
}

.reveal h1 {
  font-size: 2.15em;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.reveal h2 {
  font-size: 1.42em;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.reveal h3 {
  font-size: 1.02em;
  font-weight: 700;
  color: var(--text);
}

.reveal h4 {
  font-size: 0.82em;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.reveal strong {
  color: var(--text);
  font-weight: 700;
}

.reveal em {
  color: #293442;
}

.reveal a {
  text-decoration: underline;
  text-decoration-color: rgba(88, 166, 255, 0.4);
  text-underline-offset: 3px;
}

.reveal code {
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 0.86em;
  color: #0b3c78;
  background: rgba(13, 110, 253, 0.08);
  padding: 0.08em 0.32em;
  border-radius: 5px;
}

/* Slide headings get a small accent bar */
.reveal section > h2:first-child,
.reveal section > .slide-head h2 {
  position: relative;
  padding-left: 0.55em;
}

.reveal section > h2:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.12em;
  bottom: 0.12em;
  width: 5px;
  border-radius: 3px;
  background: var(--accent);
}

/* ---------------------------------------------------------------
   Title slide
   --------------------------------------------------------------- */
.title-slide {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  max-width: 1100px;
}

.title-slide .course-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: flex-start;
  font-size: 0.36em;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.5em 0.95em;
  border: 1px solid rgba(13, 110, 253, 0.28);
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.08);
  margin-bottom: 0.8em;
}

.title-slide .course-tag .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.title-slide h1 {
  font-size: 2.9em;
  line-height: 1.02;
  color: var(--text);
  margin-bottom: 0.28em;
}

.title-slide .deck-sub {
  font-size: 0.62em;
  color: var(--text-muted);
  max-width: 30ch;
  margin-bottom: 1em;
  line-height: 1.4;
}

.title-slide .deck-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.36em;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.5em 0.85em;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
}

.meta-chip strong {
  color: var(--text);
}

/* ---------------------------------------------------------------
   Section opener
   --------------------------------------------------------------- */
.section-opener {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

.section-opener .section-num {
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 0.9em;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.35em;
}

.section-opener h2 {
  font-size: 2.3em;
  padding-left: 0;
  max-width: 18ch;
}

.section-opener h2::before {
  display: none;
}

.section-opener .lede {
  margin-top: 0.5em;
}

/* ---------------------------------------------------------------
   Typography helpers
   --------------------------------------------------------------- */
.kicker {
  font-size: 0.32em;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5em;
}

.lede {
  font-size: 0.8em;
  color: var(--text-muted);
  max-width: 46ch;
  line-height: 1.5;
}

.small {
  font-size: 0.62em;
  color: var(--text-muted);
}

.footnote {
  font-size: 0.5em;
  color: var(--text-dim);
  margin-top: 0.8em;
}

.center {
  text-align: center;
}

.mt-1 { margin-top: 0.5em; }
.mt-2 { margin-top: 1em; }
.mb-0 { margin-bottom: 0; }

/* ---------------------------------------------------------------
   Layout grids
   --------------------------------------------------------------- */
.cols-2,
.cols-3,
.cols-4 {
  display: grid;
  gap: 0.8em;
  align-items: start;
}

.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.cols-2.align-center { align-items: center; }
.cols-2.wide-left { grid-template-columns: 1.25fr 1fr; }
.cols-2.wide-right { grid-template-columns: 1fr 1.25fr; }

/* ---------------------------------------------------------------
   Cards
   --------------------------------------------------------------- */
.card {
  padding: 0.75em 0.85em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.card h3 {
  font-size: 0.78em;
  margin-bottom: 0.3em;
  color: #1c2b42;
}

.card p,
.card li {
  font-size: 0.62em;
  color: var(--text-muted);
}

.card.accent {
  border-color: rgba(13, 110, 253, 0.3);
  background: var(--bg-card);
}

.card.violet {
  border-color: rgba(111, 66, 193, 0.3);
  background: var(--bg-card);
}

.card.green {
  border-color: rgba(63, 185, 80, 0.3);
  background: var(--bg-card);
}

.card-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55em;
  height: 1.55em;
  margin-bottom: 0.35em;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 0.62em;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid rgba(13, 110, 253, 0.3);
  border-radius: 7px;
  background: rgba(13, 110, 253, 0.1);
}

/* ---------------------------------------------------------------
   Callouts
   --------------------------------------------------------------- */
.callout {
  margin: 0.55em 0;
  padding: 0.6em 0.9em 0.6em 1em;
  font-size: 0.62em;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg-elevated);
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
}

.callout b,
.callout strong {
  color: inherit;
}

.callout.is-info {
  border-left-color: var(--accent);
  background: rgba(13, 110, 253, 0.08);
}

.callout.is-warn {
  border-left-color: var(--amber);
  background: rgba(210, 153, 34, 0.09);
}

.callout.is-good {
  border-left-color: var(--green);
  background: rgba(63, 185, 80, 0.09);
}

.callout.is-bad {
  border-left-color: var(--red);
  background: rgba(248, 81, 73, 0.09);
}

/* ---------------------------------------------------------------
   Pills / tags
   --------------------------------------------------------------- */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em;
  margin: 0.4em 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.5em;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  padding: 0.32em 0.65em;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
}

.pill.accent {
  color: var(--accent);
  border-color: rgba(13, 110, 253, 0.3);
  background: rgba(13, 110, 253, 0.08);
}

.pill.green {
  color: #1a7f37;
  border-color: rgba(63, 185, 80, 0.3);
  background: var(--bg-card);
}

.pill.amber {
  color: #9a6700;
  border-color: rgba(210, 153, 34, 0.3);
  background: var(--bg-card);
}

.pill.red {
  color: #cf222e;
  border-color: rgba(248, 81, 73, 0.3);
  background: var(--bg-card);
}

/* ---------------------------------------------------------------
   Tables
   --------------------------------------------------------------- */
.reveal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.58em;
  margin: 0.4em 0;
  line-height: 1.4;
}

.reveal table th,
.reveal table td {
  padding: 0.48em 0.65em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.reveal table thead th {
  font-size: 0.85em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.reveal table tbody tr:hover {
  background: transparent;
}

.reveal table td.num,
.reveal table td.mono {
  font-family: 'Fira Code', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reveal table td.num {
  color: var(--accent);
}

.reveal table.compact th,
.reveal table.compact td {
  padding: 0.34em 0.55em;
}

/* ---------------------------------------------------------------
   Code
   --------------------------------------------------------------- */
.reveal pre {
  width: 100%;
  margin: 0.45em 0;
  box-shadow: none;
  font-size: 0.52em;
  line-height: 1.42;
}

.reveal pre code {
  display: block;
  padding: 0.85em 1em;
  max-height: 620px;
  overflow: auto;
  font-family: 'Fira Code', ui-monospace, monospace;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: #33506b;
  tab-size: 2;
}

.reveal pre code::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.reveal pre code::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

/* Inline "algorithm" panel without syntax highlighting */
.algo {
  margin: 0.45em 0;
  padding: 0.75em 0.9em;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 0.5em;
  line-height: 1.5;
  color: #1f2328;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  white-space: pre-wrap;
}

.algo .kw { color: #cf222e; }
.algo .fn { color: #8250df; }
.algo .cm { color: #6e7781; font-style: italic; }
.algo .num { color: #0550ae; }

/* ---------------------------------------------------------------
   Formula
   --------------------------------------------------------------- */
.formula {
  margin: 0.5em 0;
  padding: 0.55em 0.8em;
  text-align: center;
  background: rgba(13, 110, 253, 0.05);
  border: 1px solid rgba(13, 110, 253, 0.16);
  border-radius: 10px;
  overflow-x: auto;
}

.reveal .katex {
  font-size: 0.9em;
}

.reveal .katex-display {
  margin: 0.25em 0;
}

/* ---------------------------------------------------------------
   Steps / numbered lists
   --------------------------------------------------------------- */
ol.steps {
  list-style: none;
  margin-left: 0;
  counter-reset: step;
}

ol.steps > li {
  position: relative;
  padding-left: 1.9em;
  margin-bottom: 0.45em;
  counter-increment: step;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 1.4em;
  height: 1.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 0.62em;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid rgba(13, 110, 253, 0.3);
  border-radius: 50%;
  background: rgba(13, 110, 253, 0.08);
}

/* ---------------------------------------------------------------
   Compare / definition blocks
   --------------------------------------------------------------- */
.compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7em;
}

.compare-col {
  padding: 0.7em 0.8em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.compare-col h4 {
  font-size: 0.62em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.35em;
}

.compare-col.b h4 {
  color: var(--accent-2);
}

.compare-col ul {
  margin-left: 0.9em;
}

.compare-col li {
  font-size: 0.6em;
  color: var(--text-muted);
}

.definition {
  padding: 0.65em 0.85em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 0.64em;
  line-height: 1.5;
}

.definition .term {
  color: var(--accent);
  font-weight: 700;
}

/* ---------------------------------------------------------------
   Checkpoint / question slide
   --------------------------------------------------------------- */
.checkpoint {
  padding: 0.9em 1.1em;
  background: var(--bg-card);
  border: 1px solid rgba(111, 66, 193, 0.3);
  border-radius: 14px;
}

.checkpoint .label {
  display: inline-block;
  font-size: 0.42em;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 0.35em;
}

.checkpoint p {
  font-size: 0.78em;
  color: #0f1011;
}

.checkpoint .answer {
  margin-top: 0.6em;
  padding-top: 0.55em;
  border-top: 1px dashed rgba(111, 66, 193, 0.35);
  font-size: 0.64em;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------
   Summary grid
   --------------------------------------------------------------- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6em;
}

.summary-item {
  display: flex;
  gap: 0.65em;
  padding: 0.6em 0.7em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.summary-num {
  flex: 0 0 1.6em;
  height: 1.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 0.58em;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid rgba(13, 110, 253, 0.28);
  border-radius: 6px;
  background: rgba(13, 110, 253, 0.08);
}

.summary-item h4 {
  font-size: 0.62em;
  color: var(--text);
  margin-bottom: 0.15em;
}

.summary-item p {
  font-size: 0.55em;
  color: var(--text-muted);
  margin: 0;
}

/* ---------------------------------------------------------------
   Figures
   --------------------------------------------------------------- */
.figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35em;
  padding: 0.6em;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.figure svg {
  width: 100%;
  height: auto;
  max-height: 470px;
}

.figure figcaption {
  font-size: 0.48em;
  color: var(--text-dim);
  text-align: center;
}

/* ---------------------------------------------------------------
   Refs / end slide
   --------------------------------------------------------------- */
.refs {
  list-style: none;
  margin-left: 0;
  counter-reset: ref;
}

.refs li {
  position: relative;
  padding-left: 2em;
  margin-bottom: 0.55em;
  font-size: 0.62em;
  color: var(--text-muted);
  counter-increment: ref;
}

.refs li::before {
  content: "[" counter(ref) "]";
  position: absolute;
  left: 0;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 0.9em;
  color: var(--accent);
}

.end-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.end-slide h2 {
  font-size: 2em;
  padding-left: 0;
}

.end-slide h2::before {
  display: none;
}

.end-slide .next {
  margin-top: 1.2em;
  font-size: 0.55em;
  color: var(--text-muted);
}

.end-slide .next strong {
  color: var(--accent);
}

/* ---------------------------------------------------------------
   Progress / slide number polish
   --------------------------------------------------------------- */
.reveal .progress {
  height: 3px;
  color: var(--accent);
}

.reveal .slide-number {
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 14px;
  color: var(--text-dim);
  background: transparent;
}

.reveal .controls {
  color: var(--accent);
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 900px) {
  .cols-3,
  .cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reveal .slides section {
    padding: 0 1.1rem;
  }
}

@media (max-width: 620px) {
  .cols-2,
  .cols-3,
  .cols-4,
  .compare,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------
   Print / PDF
   --------------------------------------------------------------- */
@media print {
  .reveal .slides section::after {
    display: none;
  }

  .reveal pre code {
    max-height: none;
    overflow: visible;
    white-space: pre-wrap;
  }
}
