/* ==========================================================================
   Go + Keycloak — estilos del curso
   Tokens en :root; modo oscuro por preferencia del sistema o data-theme.
   ========================================================================== */

:root {
  --bg: #fbfaf7;
  --bg-side: #f3f1ec;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5f6670;
  --border: #e2ded6;
  --accent: #00758f;          /* azul petróleo (Go) */
  --accent-soft: #e3f3f6;
  --accent-2: #b5452f;        /* acento cálido para diagramas */
  --code-bg: #f4f2ed;
  --code-text: #24292f;
  --note: #2f6fb3;   --note-bg: #eaf2fb;
  --tip: #2e7d4f;    --tip-bg: #e8f5ec;
  --warn: #a15c00;   --warn-bg: #fdf3e2;
  --danger: #b3261e; --danger-bg: #fbeceb;

  /* resaltado de sintaxis */
  --hl-keyword: #a626a4;
  --hl-string: #2e7d32;
  --hl-number: #b35900;
  --hl-comment: #7a7f87;
  --hl-title: #0b6bcb;
  --hl-type: #8a5a00;
  --hl-attr: #0b6bcb;
  --hl-meta: #6b6f76;

  --radius: 10px;
  --side-w: 290px;
  --content-w: 780px;
  --content-w-wide: 920px;     /* ancho del contenido con el índice plegado */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a;
    --bg-side: #1b1e22;
    --surface: #1e2226;
    --text: #e6e6e3;
    --muted: #a0a6ad;
    --border: #30353b;
    --accent: #4cc3db;
    --accent-soft: #15333a;
    --accent-2: #f08a6c;
    --code-bg: #1a1d21;
    --code-text: #e1e4e8;
    --note: #7fb2ec;   --note-bg: #182636;
    --tip: #7fcf9c;    --tip-bg: #16291f;
    --warn: #f0b860;   --warn-bg: #2d2414;
    --danger: #f28b82; --danger-bg: #331b1a;
    --hl-keyword: #d79bf0;
    --hl-string: #9ad49a;
    --hl-number: #f0b27a;
    --hl-comment: #8b929a;
    --hl-title: #79b8ff;
    --hl-type: #e8c27a;
    --hl-attr: #79b8ff;
    --hl-meta: #a0a6ad;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #15171a;
  --bg-side: #1b1e22;
  --surface: #1e2226;
  --text: #e6e6e3;
  --muted: #a0a6ad;
  --border: #30353b;
  --accent: #4cc3db;
  --accent-soft: #15333a;
  --accent-2: #f08a6c;
  --code-bg: #1a1d21;
  --code-text: #e1e4e8;
  --note: #7fb2ec;   --note-bg: #182636;
  --tip: #7fcf9c;    --tip-bg: #16291f;
  --warn: #f0b860;   --warn-bg: #2d2414;
  --danger: #f28b82; --danger-bg: #331b1a;
  --hl-keyword: #d79bf0;
  --hl-string: #9ad49a;
  --hl-number: #f0b27a;
  --hl-comment: #8b929a;
  --hl-title: #79b8ff;
  --hl-type: #e8c27a;
  --hl-attr: #79b8ff;
  --hl-meta: #a0a6ad;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0;
  flex: 0 0 auto; width: var(--side-w);
  height: 100vh; overflow: hidden;
  background: var(--bg-side);
  border-right: 1px solid var(--border);
}
/* Ancho fijo: al plegar la barra (animando su width) el contenido se recorta
   en lugar de recolocarse. */
.sidebar-inner {
  width: var(--side-w); height: 100%; overflow-y: auto;
  padding: 1.25rem 1rem 2rem;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none;
  margin-bottom: 1.25rem;
}
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent); color: var(--bg);
  font: 700 .8rem var(--mono);
}
.brand-logo { width: 34px; height: 34px; flex: 0 0 34px; }
.nav-module {
  margin: 1.1rem 0 .35rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a, .nav-list .soon {
  display: flex; gap: .55rem; align-items: baseline;
  padding: .32rem .55rem; border-radius: 7px;
  font-size: .92rem; line-height: 1.35; color: var(--text); text-decoration: none;
}
.nav-list a:hover { background: var(--accent-soft); }
.nav-list a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-list .soon { color: var(--muted); cursor: default; }
.nav-num { flex: 0 0 1.6rem; font: .78rem var(--mono); color: var(--muted); }
.badge-soon {
  margin-left: auto; font-size: .66rem; padding: .05rem .4rem; border-radius: 99px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}

.main { flex: 1; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1.5rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .crumb { font-size: .88rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.icon-btn {
  display: inline-grid; place-items: center;
  min-width: 36px; height: 36px; padding: 0 .6rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: .85rem; cursor: pointer; white-space: nowrap;
}
.icon-btn:hover { border-color: var(--accent); }
.menu-btn { font-size: 1rem; }

/* Índice plegado (escritorio). La animación la hace app.js con Motion; estas
   reglas son el estado final, y el estado al cargar si se plegó antes. */
@media (min-width: 901px) {
  html.sidebar-collapsed .sidebar { width: 0; border-right-width: 0; visibility: hidden; }
  html.sidebar-collapsed .content { max-width: var(--content-w-wide); }
}

/* Entrada de la página: el <head> añade html.anim-in y app.js lo anima. */
.anim-in .content > :nth-child(-n+6) { opacity: 0; }

.content {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ---------- tipografía ---------- */
h1, h2, h3, h4 { line-height: 1.25; margin: 2.2rem 0 .8rem; }
h1 { font-size: 2.1rem; margin-top: .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.5rem; padding-top: .6rem; border-top: 1px solid var(--border); }
h3 { font-size: 1.15rem; }
h2 + h3 { margin-top: 1rem; }
.kicker {
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.lead { font-size: 1.12rem; color: var(--muted); margin-top: 0; }
p, ul, ol { margin: 0 0 1rem; }
li + li { margin-top: .25rem; }
strong { font-weight: 650; }
kbd {
  font: .85em var(--mono); padding: .05rem .35rem;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface);
}

.meta-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 1.5rem; }
.chip {
  font-size: .8rem; padding: .2rem .65rem; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}

/* objetivos / índice de la lección */
.goals {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin: 1.5rem 0;
}
.goals h4 { margin: 0 0 .5rem; font-size: .95rem; }
.goals ul { margin: 0; }

/* ---------- código ---------- */
code {
  font: .88em var(--mono);
  background: var(--code-bg); color: var(--code-text);
  padding: .1rem .35rem; border-radius: 5px;
  overflow-wrap: anywhere;
}
pre {
  position: relative;
  margin: 0 0 1.25rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
pre code {
  display: block; padding: 1rem 1.1rem; overflow-x: auto;
  background: none; border-radius: 0;
  font-size: .85rem; line-height: 1.6; overflow-wrap: normal; white-space: pre;
}
pre[data-file]::before {
  content: attr(data-file);
  display: block; padding: .45rem 1.1rem;
  border-bottom: 1px solid var(--border);
  font: .78rem var(--mono); color: var(--muted);
  background: color-mix(in srgb, var(--code-bg) 70%, var(--border));
}
.copy-btn {
  position: absolute; top: .4rem; right: .4rem;
  padding: .2rem .55rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font: .72rem var(--font); cursor: pointer; opacity: 0; transition: opacity .15s;
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn.ok { color: var(--tip); border-color: var(--tip); opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }

.hljs-keyword, .hljs-built_in, .hljs-selector-tag, .hljs-literal { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition { color: var(--hl-string); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--hl-number); }
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-title, .hljs-title.function_, .hljs-section { color: var(--hl-title); }
.hljs-type, .hljs-title.class_ { color: var(--hl-type); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-property { color: var(--hl-attr); }
.hljs-meta, .hljs-params { color: var(--hl-meta); }
.hljs-deletion { color: var(--danger); }

/* ---------- callouts ---------- */
.callout {
  margin: 1.25rem 0; padding: .85rem 1.1rem;
  border-left: 4px solid var(--note); border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--note-bg);
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { display: block; font-weight: 700; margin-bottom: .25rem; color: var(--note); }
.callout.tip  { border-color: var(--tip);  background: var(--tip-bg); }
.callout.tip  .callout-title { color: var(--tip); }
.callout.warn { border-color: var(--warn); background: var(--warn-bg); }
.callout.warn .callout-title { color: var(--warn); }
.callout.danger { border-color: var(--danger); background: var(--danger-bg); }
.callout.danger .callout-title { color: var(--danger); }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
th, td { text-align: left; vertical-align: top; padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg-side); }
tr:last-child td { border-bottom: 0; }
td:first-child code { white-space: nowrap; overflow-wrap: normal; }

/* ---------- pasos numerados ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 2.6rem; margin-bottom: 1.1rem; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: .05rem;
  display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--accent); color: var(--bg); font: 700 .85rem var(--font);
}

/* ---------- diagramas ---------- */
figure.diagram {
  margin: 1.5rem 0; padding: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto;
}
figure.diagram svg { display: block; margin: 0 auto; min-width: 560px; height: auto; }
figure.diagram figcaption { margin-top: .6rem; font-size: .85rem; color: var(--muted); text-align: center; }
.d-text   { fill: var(--text); font: 13px var(--font); }
.d-small  { fill: var(--muted); font: 11.5px var(--font); }
.d-mono   { fill: var(--text); font: 11.5px var(--mono); }
.d-box    { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.d-actor  { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.d-kc     { fill: var(--warn-bg); stroke: var(--accent-2); stroke-width: 1.5; }
.d-life   { stroke: var(--border); stroke-width: 1.5; stroke-dasharray: 4 4; }
.d-arrow  { stroke: var(--accent); stroke-width: 1.6; fill: none; }
.d-return { stroke: var(--muted); stroke-width: 1.4; fill: none; stroke-dasharray: 5 4; }
.d-hot    { stroke: var(--accent-2); stroke-width: 1.8; fill: none; }
.d-head   { fill: var(--accent); }
.d-head-muted { fill: var(--muted); }
.d-head-hot { fill: var(--accent-2); }
.d-step   { fill: var(--accent); }
.d-step-t { fill: var(--bg); font: 700 10.5px var(--font); }
.d-zone   { fill: var(--bg-side); stroke: var(--border); stroke-dasharray: 5 4; }

/* ---------- ejercicios ---------- */
.exercise {
  margin: 1.25rem 0; padding: 1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.exercise h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.exercise h3 .lvl { font-size: .72rem; font-weight: 600; color: var(--muted); margin-left: .4rem; }
details.solution { margin-top: .75rem; border-top: 1px dashed var(--border); padding-top: .6rem; }
details.solution > summary {
  cursor: pointer; font-weight: 600; color: var(--accent); list-style: none;
}
details.solution > summary::-webkit-details-marker { display: none; }
details.solution > summary::before { content: "▸ "; }
details.solution[open] > summary::before { content: "▾ "; }
details.solution[open] > summary { margin-bottom: .6rem; }

/* ---------- errores comunes ---------- */
.errors { margin: 1rem 0; }
.errors details {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin-bottom: .6rem;
}
.errors summary {
  cursor: pointer; padding: .7rem 1rem; font-weight: 600; list-style: none;
  display: flex; gap: .6rem; align-items: baseline;
}
.errors summary::-webkit-details-marker { display: none; }
.errors summary .sym { font: .8rem var(--mono); color: var(--danger); background: var(--danger-bg); padding: .05rem .4rem; border-radius: 5px; }
.errors .body { padding: 0 1rem .8rem; }
.errors .body > :last-child { margin-bottom: 0; }

/* ---------- tarjetas (inicio) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; margin: 1.25rem 0; }
.card {
  display: block; padding: 1rem 1.1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
a.card:hover { border-color: var(--accent); }
.card .card-k { font: .75rem var(--mono); color: var(--accent); }
.card h4 { margin: .2rem 0 .35rem; font-size: 1rem; }
.card p { margin: 0; font-size: .88rem; color: var(--muted); }
.card.soon { opacity: .7; }

/* ---------- navegación anterior / siguiente ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-top: 3rem; }
.pager a {
  display: block; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; color: var(--text);
}
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--muted); font-size: .78rem; }
.pager .next { text-align: right; grid-column: 2; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 30; left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgb(0 0 0 / .25);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .35); }
  .topbar { padding: .6rem 1rem; }
  .content { padding: 1.75rem 1rem 3rem; }
  h1 { font-size: 1.7rem; }
}
@media (max-width: 560px) {
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}

@media print {
  .sidebar, .topbar, .copy-btn, .pager { display: none !important; }
}

/* bloques largos sin espacios (tokens): partir líneas */
pre.wrap code { white-space: pre-wrap; word-break: break-all; }

/* ---------- capturas de pantalla ---------- */
figure.shot { margin: 1.5rem 0; }
figure.shot a { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: 0 6px 24px rgb(0 0 0 / .08); }
figure.shot img { display: block; width: 100%; height: auto; }
figure.shot figcaption { margin-top: .55rem; font-size: .85rem; color: var(--muted); text-align: center; }
.shot-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.shot-pair figure.shot { margin: 0; }
@media (max-width: 700px) { .shot-pair { grid-template-columns: 1fr; } }

/* ---------- portada ---------- */
/* El logo tiene fondo transparente y texto oscuro: lo ponemos siempre sobre
   fondo claro para que se lea también en el tema oscuro. */
.hero {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.75rem; margin: 0 0 1.75rem;
}
.hero img { display: block; width: 100%; height: auto; }

/* ---------- páginas «Qué cambió» (tools/diffs.py) ---------- */
.content.content-wide { max-width: var(--content-w-wide); }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.diff-file { margin: 0 0 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); }
.diff-file > summary { cursor: pointer; padding: .6rem .9rem; display: flex; gap: .75rem; flex-wrap: wrap; align-items: baseline; }
.diff-file > summary code { font-weight: 600; }
.diff-meta { color: var(--muted); font-size: .85rem; }
.diff-file pre.diff { margin: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
pre.diff code { font-size: .8rem; line-height: 1.5; }
pre.diff span { display: inline-block; min-width: 100%; }
.diff-add  { background: var(--tip-bg);    color: var(--tip); }
.diff-del  { background: var(--danger-bg); color: var(--danger); }
.diff-hunk { color: var(--note); }

/* Recuadro «En este capítulo» al inicio de cada lección. */
.chapter { border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius);
  background: var(--accent-soft); padding: .9rem 1.1rem; margin: 0 0 1.5rem; }
.chapter h4 { margin: 0 0 .5rem; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.chapter dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.chapter dt { font-weight: 600; }
.chapter dd { margin: 0; }
@media (max-width: 600px) { .chapter dl { grid-template-columns: 1fr; } .chapter dd { margin-bottom: .4rem; } }

/* ---------- ruta rápida ---------- */
.badge-extra { display: inline-block; margin-left: .5rem; padding: .05rem .45rem; border-radius: 999px;
  font-size: .68rem; font-weight: 600; letter-spacing: .03em; vertical-align: middle;
  color: var(--warn); background: var(--warn-bg); border: 1px solid currentColor; text-transform: uppercase; }
.nav-list .badge-extra { margin-left: auto; font-size: .6rem; }
html.fast-path .is-extra { display: none; }
.fast-note { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; padding: .5rem .8rem;
  border-radius: var(--radius); background: var(--warn-bg); color: var(--text); font-size: .9rem; }
.fast-note[hidden] { display: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* ---------- buscador ---------- */
.search { position: relative; margin: .25rem 0 1rem; }
.search input { width: 100%; box-sizing: border-box; padding: .5rem .7rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg, #fff); color: var(--text); font: inherit; font-size: .9rem; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-results { list-style: none; margin: .4rem 0 0; padding: 0; max-height: 60vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-side); }
.search-results[hidden] { display: none; }
.search-results li + li { border-top: 1px solid var(--border); }
.search-results a { display: block; padding: .5rem .7rem; color: var(--text); text-decoration: none; font-size: .82rem; line-height: 1.35; }
.search-results a:hover, .search-results a:focus { background: var(--accent-soft); }
.search-results small { display: block; color: var(--muted); font-size: .72rem; }
.search-results strong { display: block; margin: .1rem 0; }
.search-results span { color: var(--muted); }
.search-results mark { background: var(--warn-bg); color: inherit; padding: 0 .1rem; border-radius: 3px; }
.search-empty { padding: .5rem .7rem; color: var(--muted); font-size: .85rem; }

/* ---------- imprimir / guardar como PDF ---------- */
@media print {
  .sidebar, .topbar, .scrim, .pager, .copy-btn, .fast-note, .search { display: none !important; }
  .layout, .main { display: block !important; margin: 0 !important; }
  .content { max-width: none !important; padding: 0 !important; }
  html.fast-path .is-extra { display: revert; }
  pre, figure, table, .callout, .exercise, .chapter { break-inside: avoid; }
  pre code { white-space: pre-wrap !important; }
  h2, h3 { break-after: avoid; }
  a { color: inherit; }
  body { background: #fff !important; color: #000 !important; }
}

/* ---------- diagramas paso a paso (assets/diagram-steps.js) ---------- */
.diagram-player { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; margin: .8rem 0 .2rem; }
.dp-btn { font: inherit; font-size: .85rem; padding: .3rem .7rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.dp-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.dp-btn:disabled { opacity: .45; cursor: default; }
.dp-play { font-weight: 600; }
.dp-status { flex: 1 1 16rem; font-size: .85rem; color: var(--muted); min-height: 1.3em; }
.dp-bar { flex: 1 0 100%; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.dp-fill { display: block; height: 100%; width: 100%; background: var(--accent); }
@media print { .diagram-player { display: none; } }

/* ---------- vídeo de presentación (portada) ---------- */
figure.video { margin: 0 0 1.5rem; }
figure.video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9;
  border-radius: var(--radius); border: 1px solid var(--border); background: #15171a; pointer-events: none; }
figure.video figcaption { margin-top: .5rem; font-size: .85rem; color: var(--muted); text-align: center; }
@media print { figure.video { display: none; } }

/* ---------- capturas ampliadas (modal) ---------- */
html.lightbox-open { overflow: hidden; }
dialog.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh;
  width: 100vw; height: 100vh; margin: 0; }
dialog.lightbox::backdrop { background: rgba(10, 12, 14, .82); backdrop-filter: blur(3px); }
.lightbox-figure { margin: 0; width: 100%; height: 100%; box-sizing: border-box; padding: 3.5rem 2rem 2rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; cursor: zoom-out; }
.lightbox-figure img { max-width: min(96vw, 1800px); max-height: calc(100vh - 9rem); width: auto; height: auto;
  object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.45); background: #fff; cursor: default; }
.lightbox-figure figcaption { color: #e8e6e1; font-size: .9rem; text-align: center; max-width: 70ch; }
.lightbox-close { position: fixed; top: .9rem; right: 1rem; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.35); color: #fff; font-size: 1.1rem; cursor: pointer; }
.lightbox-close:hover, .lightbox-close:focus-visible { background: rgba(255,255,255,.15); }
.shot a, a > img { cursor: zoom-in; }
@media print { dialog.lightbox { display: none; } }
