/* Shared look for the algorithm explainers: the presentation deck's ink palette, light and dark. */

:root {
  --ground: #0b0f14;
  --panel: #121821;
  --panel-2: #1a2230;
  --rule: #263041;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #4ade80;
  --accent-dim: #1f6f43;
  --amber: #f5b041;
  --red: #f87171;
  --blue: #7aa2ff;
  --sans: "IBM Plex Sans", "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --ground: #fbfaf7;
    --panel: #f1efe9;
    --panel-2: #e6e3da;
    --rule: #d3cfc4;
    --text: #1a1f26;
    --muted: #5d6673;
    --accent: #15803d;
    --accent-dim: #bfe3cb;
    --amber: #a15c00;
    --red: #b91c1c;
    --blue: #1d4ed8;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 16px 4rem;
}

h1 { font-size: 2rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.4rem; }
h2 { font-size: 1.25rem; margin: 2.4rem 0 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--rule); }
p, li { margin: 0.6rem 0; }
a { color: var(--blue); }
strong { font-weight: 650; }
em { color: var(--amber); font-style: normal; }
code { font-family: var(--mono); font-size: 0.88em; color: var(--accent); overflow-wrap: anywhere; }

.kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede { color: var(--muted); font-size: 1.08rem; }

pre.cobol {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  max-width: 100%;
}

.rule {
  background: var(--panel);
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: nowrap;
}


table.state {
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.8rem;
  margin: 0.4rem 0;
  width: 100%;
}

table.state th, table.state td {
  text-align: left;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

table.state th { color: var(--muted); font-weight: 500; }
table.state td:first-child { white-space: nowrap; }
.current { background: var(--accent-dim); }
.changed { color: var(--amber); font-weight: 650; }
.dim { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; font-family: var(--mono); font-size: 0.78rem; }
.chip { border: 1px solid var(--rule); border-radius: 999px; padding: 0.05rem 0.55rem; }


nav.back { font-size: 0.9rem; margin-bottom: 1.2rem; }

.bytes {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 3px;
  margin: 0.8rem 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-align: center;
}

.bytes .byte-index { color: var(--muted); }
.bytes .span { border: 1px solid var(--rule); border-radius: 4px; background: var(--panel-2); padding: 0.1rem 0; }
.bytes .byte { border: 1px solid var(--rule); border-radius: 4px; padding: 0.45rem 0; }
.bytes .byte.read { outline: 2px solid var(--blue); outline-offset: -2px; }
.bytes .byte.w0 { background: rgba(122, 162, 255, 0.18); }
.bytes .byte.w1 { background: rgba(245, 176, 65, 0.24); }

ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 1rem 0; }
ol.steps > li {
  counter-increment: step;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0 0 0.8rem;
  overflow-x: auto;
}
ol.steps > li::before {
  content: "Step " counter(step);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
ol.steps .note { margin: 0.3rem 0 0.5rem; }
ol.steps > li.before { counter-increment: none; }
ol.steps > li.before::before { content: "Before step 1"; }

nav.toc { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 0.4rem 1rem; margin: 1.2rem 0; font-size: 0.95rem; }
nav.toc p { margin: 0.3rem 0; }
nav.toc ol { margin: 0.2rem 0 0.4rem; padding-left: 1.4rem; }
nav.toc li { margin: 0.15rem 0; }
h2 { scroll-margin-top: 1rem; }

details.walk { border: 1px solid var(--rule); border-radius: 8px; margin: 1rem 0; background: var(--panel); }
details.walk > summary { cursor: pointer; padding: 0.6rem 0.8rem; font-weight: 600; color: var(--accent); }
details.walk[open] > summary { border-bottom: 1px solid var(--rule); }
details.walk > ol.steps { margin: 0.8rem; }
details.walk ol.steps > li { background: var(--ground); }
