/*
  DiMastro — global stylesheet
  ------------------------------------------------------------------
  Loaded on every page of the site, including /bias/. The :root block
  below is the single source of truth for the --tbc-* design tokens
  (palette, type, radii) — tube-bias-calculator.css consumes these
  same variables but no longer redeclares them, so the two can't drift
  out of sync the way two separate copies could.

  Site-wide/page chrome (this file) uses a "dm-" class prefix so it
  never collides with the calculator widget's own "tbc-" classes on
  the page that embeds both.
*/

:root {
  /* ---- Palette: dark chassis panel + amber tube-glow accent ---- */
  --tbc-bg:            #1c1712;
  --tbc-panel:         #221b15;
  --tbc-panel-raised:  #2a2119;
  --tbc-well:          #16110d;
  --tbc-border:        #3c2f22;
  --tbc-border-soft:   #2f261c;

  --tbc-ink:           #f3ead9;
  --tbc-ink-muted:     #dfd0bd;
  --tbc-ink-faint:     #cd9c60;

  --tbc-glow:          #ff9142;
  --tbc-glow-dim:      #c96a2c;
  --tbc-glow-soft:     rgba(255, 145, 66, 0.16);

  --tbc-cold:          #4da3ff;
  --tbc-safe:          #7cbf8e;
  --tbc-warn:          #e7b84f;
  --tbc-warn-soft:     rgba(231, 184, 79, 0.14);
  --tbc-danger:        #e0522e;
  --tbc-danger-soft:   rgba(224, 82, 46, 0.14);

  /* ---- Type ---- */
  --tbc-font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --tbc-font-body:    "IBM Plex Sans", "Segoe UI", sans-serif;
  --tbc-font-mono:    "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  /* ---- Rhythm ---- */
  --tbc-radius:    14px;
  --tbc-radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--tbc-bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--tbc-font-body);
  color: var(--tbc-ink);
  background:
    radial-gradient(120% 140% at 15% -10%, #2c2117 0%, transparent 55%),
    linear-gradient(175deg, var(--tbc-panel) 0%, var(--tbc-bg) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

p, li, .dm-callout span { text-align: justify; }

:focus-visible {
  outline: 2px solid var(--tbc-glow);
  outline-offset: 2px;
}

.dm-page {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 128px 24px 40px;
  animation: dm-page-fade-in 600ms ease-out;
}

@keyframes dm-page-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- tube watermark (subtle, site-wide background accent) ---------- */
body::after {
  content: '';
  position: fixed;
  top: 50%;
  right: -50px;
  transform: translateY(-50%);
  width: 260px;
  height: 680px;
  background: url('../images/tube-bg.png') no-repeat center right / contain;
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
}

/* ---------- hero / header ---------- */
.dm-hero {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 48px;
}

.dm-eyebrow {
  font-family: var(--tbc-font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tbc-glow);
  margin: 0 0 12px;
  text-align: center;
}

.dm-title {
  font-family: var(--tbc-font-display);
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0 0 14px;
  color: var(--tbc-ink);
}

.dm-gta-subtitle {
  font-family: var(--tbc-font-body);
  font-size: 18px;
  font-weight: 500;
  color: var(--tbc-ink-muted);
  letter-spacing: 0.01em;
  margin: 14px 0 22px;
  text-align: center;
}

.dm-gta-subtitle .gta-cap {
  font-family: var(--tbc-font-display);
  font-size: 46px;
  font-weight: 700;
  color: var(--tbc-glow);
  line-height: 0;
  vertical-align: -0.02em;
}

.dm-sub {
  font-size: 15px;
  color: var(--tbc-ink-muted);
  line-height: 1.65;
  margin: 0;
}

/* ---------- section label ---------- */
.dm-section-title {
  font-family: var(--tbc-font-display);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tbc-ink-muted);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tbc-border-soft);
}

.dm-story-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dm-story-summary::-webkit-details-marker { display: none; }
.dm-story-summary::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--tbc-ink-muted);
  border-bottom: 1.5px solid var(--tbc-ink-muted);
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}
.dm-story-details[open] .dm-story-summary::before { transform: rotate(45deg); }
.dm-story-summary .dm-section-title { margin: 0; border-bottom: none; padding-bottom: 0; }
.dm-story-details .dm-article-lede { margin-top: 16px; }

/* ---------- nav card grid ---------- */
.dm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.dm-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.dm-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  background: rgba(34, 27, 21, 0.8);
  border: 1px solid var(--tbc-border-soft);
  border-radius: var(--tbc-radius);
  padding: 22px;
  text-align: left;
  text-decoration: none;
  color: inherit;
  cursor: default;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

a.dm-card { cursor: pointer; }

a.dm-card:hover,
a.dm-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--tbc-glow-dim);
  background: rgba(42, 33, 25, 0.85);
}

.dm-card.is-upcoming { opacity: 0.7; }
.dm-card.is-upcoming:hover { border-color: var(--tbc-border); }

.dm-card-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--tbc-well);
  border: 1px solid var(--tbc-border);
  color: var(--tbc-glow);
}

.dm-card.is-upcoming .dm-card-icon { color: var(--tbc-ink-faint); }

.dm-card-body { flex: 1; }

.dm-card h3 {
  font-family: var(--tbc-font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--tbc-ink);
}

.dm-card p {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--tbc-ink-muted);
  margin: 0;
}

.dm-card-status {
  font-family: var(--tbc-font-mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--tbc-border);
  color: var(--tbc-ink-faint);
  white-space: nowrap;
}

.dm-card-status.is-live {
  color: #241a0f;
  background: var(--tbc-glow);
  border-color: var(--tbc-glow);
  font-weight: 600;
}

.dm-card-status.is-guide {
  color: #f3ead9;
  background: var(--tbc-glow-dim);
  border-color: var(--tbc-glow-dim);
  font-weight: 600;
}

.dm-card-status.is-diy {
  color: #16241a;
  background: var(--tbc-safe);
  border-color: var(--tbc-safe);
  font-weight: 600;
}

.dm-card-status.is-app {
  color: #0f2233;
  background: var(--tbc-cold);
  border-color: var(--tbc-cold);
  font-weight: 600;
}

.dm-card-status.is-manual {
  color: #241a0f;
  background: var(--tbc-warn);
  border-color: var(--tbc-warn);
  font-weight: 600;
}

.dm-card-status.is-restoration {
  color: #16241a;
  background: var(--tbc-safe);
  border-color: var(--tbc-safe);
  font-weight: 600;
}

/* ---------- large cards with photos, for restoration case studies ---------- */
.dm-grid-lg {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.dm-card-restoration {
  display: flex;
  flex-direction: column;
  background: rgba(34, 27, 21, 0.8);
  border: 1px solid var(--tbc-border-soft);
  border-radius: var(--tbc-radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

a.dm-card-restoration:hover,
a.dm-card-restoration:focus-visible {
  transform: translateY(-3px);
  border-color: var(--tbc-glow-dim);
  background: rgba(42, 33, 25, 0.85);
}

.dm-card-restoration.is-upcoming { opacity: 0.7; }
.dm-card-restoration.is-upcoming:hover { border-color: var(--tbc-border-soft); transform: none; }

.dm-card-restoration-photo {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--tbc-well);
}

.dm-card-restoration-photo-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tbc-well);
  color: var(--tbc-ink-faint);
}
.dm-card-restoration-photo-placeholder svg { width: 40px; height: 40px; }

.dm-card-restoration-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.dm-card-restoration-body h3 {
  font-family: var(--tbc-font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0;
  color: var(--tbc-ink);
}

.dm-card-restoration-body p {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--tbc-ink-muted);
  margin: 0;
  flex: 1;
}

.dm-card-restoration-body .dm-card-status { align-self: flex-start; }

@media (max-width: 640px) {
  .dm-grid-lg { grid-template-columns: 1fr; }
}

/* ---------- footer ---------- */
.dm-footer {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--tbc-border-soft);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: #8d7f6d;
  line-height: 1.6;
}

.dm-footer-left,
.dm-footer-center,
.dm-footer-right {
  margin: 0;
}
.dm-footer-left { text-align: left; }
.dm-footer-center { text-align: center; white-space: nowrap; }
.dm-footer-right { text-align: right; }

.dm-footer a {
  color: #8d7f6d;
  text-decoration: none;
}
.dm-footer a:hover { color: var(--tbc-glow); }

.dm-footer a.dm-credit-name {
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  .dm-footer {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 8px;
  }
  .dm-footer-left, .dm-footer-center, .dm-footer-right { text-align: center; }
}

/* ---------- compact hero (used on inner pages) ---------- */
.dm-hero-compact {
  margin-bottom: 28px;
}
.dm-hero-compact .dm-title { font-size: 30px; }
.dm-hero-link { text-decoration: none; display: block; }
.dm-hero-link:hover .dm-title,
.dm-hero-link:focus-visible .dm-title { color: var(--tbc-glow); }
.dm-title { transition: color 150ms ease; }

/* ---------- coming-soon page ---------- */
.dm-coming-soon {
  min-height: 46vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 24px 20px 48px;
}

.dm-coming-soon .dm-card-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
}

.dm-coming-soon h2 {
  font-family: var(--tbc-font-display);
  font-size: 28px;
  font-weight: 700;
  margin: 4px 0 0;
  color: var(--tbc-ink);
}

.dm-coming-soon .dm-sub {
  max-width: 48ch;
}

.dm-return-btn {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--tbc-font-display);
  font-size: 14px;
  font-weight: 600;
  color: #241a0f;
  background: var(--tbc-glow);
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  text-decoration: none;
  transition: background-color 150ms ease, transform 150ms ease;
}

.dm-return-btn:hover,
.dm-return-btn:focus-visible {
  background: var(--tbc-glow-dim);
  transform: translateY(-2px);
}

/* ---------- cookie consent banner + policy modal ---------- */
.dm-cookie-banner {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
  background: var(--tbc-panel);
  border-top: 1px solid var(--tbc-border);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
  font-family: var(--tbc-font-body);
  transform: translateY(100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 220ms ease, opacity 220ms ease, visibility 220ms;
}

.dm-cookie-banner.is-visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.dm-cookie-banner p {
  margin: 0;
  font-size: 12.5px;
  color: var(--tbc-ink-muted);
}

.dm-cookie-link {
  color: var(--tbc-glow);
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: 8px;
}

.dm-cookie-btn {
  flex: none;
  font-family: var(--tbc-font-display);
  font-weight: 600;
  font-size: 13px;
  color: #241a0f;
  background: var(--tbc-glow);
  border: none;
  border-radius: 999px;
  padding: 9px 22px;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.dm-cookie-btn:hover { background: var(--tbc-glow-dim); }

.dm-cookie-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  overflow-y: auto;
  background: rgba(12, 9, 6, 0.6);
  backdrop-filter: blur(6px);
}
.dm-cookie-modal.is-open { display: block; }

.dm-cookie-modal-content {
  position: relative;
  margin: 6% auto;
  padding: 34px;
  width: 88%;
  max-width: 640px;
  background: var(--tbc-panel);
  border: 1px solid var(--tbc-border);
  border-radius: var(--tbc-radius);
  color: var(--tbc-ink-muted);
  line-height: 1.6;
  font-size: 13px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
}

.dm-cookie-modal-content h2 {
  font-family: var(--tbc-font-display);
  font-size: 19px;
  color: var(--tbc-ink);
  margin: 0 0 4px;
}

.dm-cookie-modal-date {
  font-family: var(--tbc-font-mono);
  font-size: 11px;
  color: var(--tbc-ink-faint);
  margin: 0;
}

.dm-cookie-modal-content hr {
  border: 0;
  border-top: 2px solid var(--tbc-glow);
  width: 70px;
  margin: 18px 0;
}

.dm-cookie-modal-content h3 {
  font-family: var(--tbc-font-display);
  font-size: 14px;
  color: var(--tbc-ink);
  margin: 18px 0 6px;
}

.dm-cookie-close {
  position: absolute;
  right: 18px;
  top: 14px;
  font-size: 26px;
  line-height: 1;
  color: var(--tbc-ink-faint);
  cursor: pointer;
}
.dm-cookie-close:hover { color: var(--tbc-ink); }

/* ---------- article / guide pages ---------- */
/* Shared by real guides (how-to-bias-an-amp, bias-probes, startup-guide,
   recapping-guide, current-limiter) AND the richer "coming soon" pages
   (restorations) — same component set either way, just swap the status
   pill and whether steps/sections describe a finished guide or a teaser. */

.dm-article {
  max-width: 720px;
  margin: 0 auto;
}

.dm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--tbc-font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--tbc-ink-faint);
  margin: 0 0 16px;
}

.dm-breadcrumb a {
  color: var(--tbc-ink-faint);
  text-decoration: none;
}
.dm-breadcrumb a:hover { color: var(--tbc-glow); }

.dm-article-hero { margin-bottom: 28px; }

.dm-article-hero .dm-card-status {
  display: inline-block;
  margin-bottom: 14px;
}

.dm-article-hero h1 {
  font-family: var(--tbc-font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--tbc-ink);
}

.dm-article-hero .dm-sub {
  font-size: 15px;
  max-width: 62ch;
}

.dm-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--tbc-danger-soft);
  border: 1px solid rgba(224, 82, 46, 0.35);
  border-radius: var(--tbc-radius-sm);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #f0d3c8;
  margin: 0 0 28px;
}
.dm-callout svg { flex: none; margin-top: 3px; color: var(--tbc-danger); }
.dm-callout strong { color: #fff; }

.dm-callout.is-warn {
  background: var(--tbc-warn-soft);
  border-color: rgba(231, 184, 79, 0.35);
  color: var(--tbc-ink-muted);
}
.dm-callout.is-warn svg { color: var(--tbc-warn); }
.dm-callout.is-warn strong { color: var(--tbc-warn); }

.dm-callout.is-info {
  background: rgba(77, 163, 255, 0.1);
  border-color: rgba(77, 163, 255, 0.35);
  color: var(--tbc-ink-muted);
  flex-direction: column;
  gap: 6px;
}
.dm-callout.is-info svg { color: var(--tbc-cold); }
.dm-callout.is-info strong { color: var(--tbc-cold); }
.dm-callout-eyebrow {
  font-family: var(--tbc-font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tbc-cold);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dm-callout-links { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.dm-callout-links a {
  color: var(--tbc-ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(77, 163, 255, 0.4);
}
.dm-callout-links a:hover { color: var(--tbc-cold); border-color: var(--tbc-cold); }

.dm-table-wrap { overflow-x: auto; margin: 0 0 20px; border-radius: var(--tbc-radius-sm); border: 1px solid var(--tbc-border-soft); }
.dm-table { width: 100%; border-collapse: collapse; font-size: 13px; background: rgba(34, 27, 21, 0.8); }
.dm-table th, .dm-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--tbc-border-soft); }
.dm-table th {
  font-family: var(--tbc-font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tbc-ink-faint);
  background: rgba(42, 33, 25, 0.9);
}
.dm-table td { color: var(--tbc-ink-muted); }
.dm-table tr:last-child td { border-bottom: none; }
.dm-table td:first-child, .dm-table th:first-child { color: var(--tbc-ink); font-weight: 600; }

.dm-article h2[id],
#toc {
  scroll-margin-top: 100px;
}

.dm-toc {
  background: rgba(34, 27, 21, 0.8);
  border: 1px solid var(--tbc-border-soft);
  border-radius: var(--tbc-radius-sm);
  padding: 18px 22px;
  margin: 0 0 28px;
}
.dm-toc-title {
  font-family: var(--tbc-font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tbc-glow);
  margin: 0 0 12px;
}
.dm-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 28px;
}
.dm-toc li { margin: 0 0 9px; break-inside: avoid; }
.dm-toc a {
  color: var(--tbc-ink-muted);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.4;
}
.dm-toc a:hover { color: var(--tbc-glow); text-decoration: underline; }

.dm-toc-backlink { margin: 0 0 10px; }
.dm-toc-backlink a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--tbc-font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ff9142;
  background: rgba(255, 145, 66, 0.12);
  border: 1px solid rgba(255, 145, 66, 0.45);
  border-radius: 999px;
  padding: 5px 12px;
  text-decoration: none;
}
.dm-article .dm-toc-backlink a:hover {
  color: #1c1712;
  background: #ff9142;
  border-color: #ff9142;
}

@media (max-width: 640px) {
  .dm-toc ol { columns: 1; }
}

.dm-article-lede {
  font-size: 16px;
  line-height: 1.75;
  color: var(--tbc-ink-muted);
  margin: 0 0 8px;
}

.dm-article section + section { margin-top: 6px; }

.dm-article h2 {
  font-family: var(--tbc-font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--tbc-ink);
  margin: 36px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--tbc-border-soft);
}

.dm-article h3 {
  font-family: var(--tbc-font-display);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--tbc-glow);
  margin: 20px 0 8px;
}

.dm-article p {
  font-size: 14px;
  line-height: 1.75;
  color: var(--tbc-ink-muted);
  margin: 0 0 14px;
}

.dm-pullquote {
  font-family: var(--tbc-font-display);
  font-style: italic;
  font-size: 21px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--tbc-glow);
  border-left: 3px solid var(--tbc-glow);
  padding: 4px 0 4px 20px;
  margin: 32px 0;
}

.dm-article .dm-signature {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--tbc-border-soft);
  font-family: 'Homemade Apple', cursive;
  font-size: 22px;
  font-weight: 400;
  color: var(--tbc-ink-muted);
}

.dm-article ul,
.dm-article ol {
  margin: 0 0 16px;
  padding-left: 0;
  list-style: none;
  color: var(--tbc-ink-muted);
  font-size: 14px;
  line-height: 1.65;
}

.dm-article ul li,
.dm-article ol li {
  position: relative;
  padding: 10px 14px 10px 40px;
  margin-bottom: 6px;
  background: rgba(34, 27, 21, 0.8);
  border: 1px solid var(--tbc-border-soft);
  border-radius: var(--tbc-radius-sm);
}

.dm-article ul li::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tbc-glow);
}

.dm-article ol { counter-reset: dm-step; }
.dm-article ol li { counter-increment: dm-step; }
.dm-article ol li::before {
  content: counter(dm-step);
  position: absolute;
  left: 10px;
  top: 9px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--tbc-glow-soft);
  color: var(--tbc-glow);
  font-family: var(--tbc-font-mono);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Table of Contents must not inherit the chapter step-list badge/card styling above */
.dm-toc ol { counter-reset: dm-toc-num; }
.dm-toc ol li {
  position: static;
  padding: 0;
  margin: 0 0 9px;
  background: none;
  border: none;
  border-radius: 0;
  counter-increment: dm-toc-num;
}
.dm-toc ol li::before {
  content: counter(dm-toc-num) ". ";
  position: static;
  display: inline;
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  color: var(--tbc-glow);
  font-family: var(--tbc-font-mono);
  font-size: 12px;
  font-weight: 600;
}

.dm-article ul ul,
.dm-article ol ul {
  margin: 8px 0 0;
}
.dm-article ul ul li,
.dm-article ol ul li {
  background: var(--tbc-well);
}

.dm-article li strong { color: var(--tbc-ink); font-weight: 600; }
.dm-article li em { color: var(--tbc-ink-muted); }

.dm-article a {
  color: var(--tbc-glow);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.dm-article a:hover { color: var(--tbc-glow-dim); }

/* .dm-return-btn keeps its own pill styling even when nested inside
   .dm-article (guide/restorations pages) — .dm-article a would
   otherwise win on specificity and paint the button's label the same
   orange as its own background, making the text invisible. */
.dm-article a.dm-return-btn,
.dm-article a.dm-return-btn:hover,
.dm-article a.dm-return-btn:focus-visible {
  color: #241a0f;
  text-decoration: none;
}

.dm-article-figure {
  margin: 8px 0 24px;
  padding: 18px;
  background: var(--tbc-well);
  border: 1px solid var(--tbc-border);
  border-radius: var(--tbc-radius-sm);
  text-align: center;
}
.dm-article-figure svg { width: 100%; height: auto; max-width: 560px; }
.dm-article-figure img { display: inline-block; width: 100%; height: auto; max-width: 640px; }
.dm-article-figure figcaption {
  margin-top: 12px;
  font-size: 12px;
  color: var(--tbc-ink-faint);
  font-style: italic;
}

.dm-article-outro {
  margin-top: 8px;
  padding: 16px 18px;
  background: rgba(34, 27, 21, 0.8);
  border: 1px dashed var(--tbc-border);
  border-radius: var(--tbc-radius-sm);
  font-size: 13.5px;
  color: var(--tbc-ink-faint);
  font-style: italic;
}

.dm-article-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--tbc-border-soft);
}

.dm-article-actions .dm-sub { margin: 0; font-size: 13px; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .dm-page { padding: 108px 18px 32px; }
  .dm-title { font-size: 32px; }
  .dm-hero { margin-bottom: 36px; }
  .dm-grid { grid-template-columns: 1fr; }
  .dm-grid-2col { grid-template-columns: 1fr; }
  .dm-cookie-banner { flex-direction: column; text-align: center; gap: 10px; }
  .dm-article-hero h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dm-page { animation: none; }
  .dm-card { transition: none; }
  .dm-cookie-banner { transition: none; }
}

/* ---------- photo lightbox (auto-injected by site.js, any .dm-gallery) ---------- */
.dm-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(10, 8, 6, 0.94);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px 20px;
}
.dm-lightbox.is-open { display: flex; }
.dm-lightbox-img-wrap {
  position: relative;
  max-width: 1100px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.dm-lightbox img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--tbc-radius-sm);
  border: 1px solid var(--tbc-border);
  transition: opacity 180ms ease;
}
.dm-lightbox-counter {
  font-family: var(--tbc-font-mono);
  font-size: 11px;
  color: var(--tbc-ink-faint);
  margin: 6px 0 0;
}
.dm-lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tbc-panel);
  border: 1px solid var(--tbc-border);
  color: var(--tbc-ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.dm-lightbox-close:hover { border-color: var(--tbc-glow-dim); color: var(--tbc-glow); }
.dm-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--tbc-panel);
  border: 1px solid var(--tbc-border);
  color: var(--tbc-ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.dm-lightbox-nav:hover { border-color: var(--tbc-glow-dim); color: var(--tbc-glow); }
.dm-lightbox-prev { left: 12px; }
.dm-lightbox-next { right: 12px; }
@media (min-width: 1220px) {
  .dm-lightbox-prev { left: calc(50% - 610px); }
  .dm-lightbox-next { right: calc(50% - 610px); }
}

