/* Estilos compartidos de la bitácora y del tablero de features */
/* Layout: una columna de lectura (~72ch) con figuras que se abren a ancho completo; hallazgos como fichas con banda de severidad */
:root {
  --bg: #f7f8f6;
  --surface: #ffffff;
  --fg: #1d2421;
  --muted: #5a6661;
  --line: #dde3df;
  --accent: #2a5bd7;          /* azul de la ECM degradada, el color del paper */
  --code-bg: #eef1ee;
  --sev-alto: #c62f2f;
  --sev-medio: #c98a06;
  --sev-bajo: #6b7a73;
  --paper: #6a3fb5;
  --ok: #1f8a4c;
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --surface: #1a201d; --fg: #e4ebe7; --muted: #9aa8a1; --line: #2c3531;
    --accent: #7c9dff; --code-bg: #222a26; --sev-alto: #ff6b6b; --sev-medio: #f2b43a; --sev-bajo: #93a39b;
    --paper: #b394ff; --ok: #4fc485; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --surface: #1a201d; --fg: #e4ebe7; --muted: #9aa8a1; --line: #2c3531;
  --accent: #7c9dff; --code-bg: #222a26; --sev-alto: #ff6b6b; --sev-medio: #f2b43a; --sev-bajo: #93a39b;
  --paper: #b394ff; --ok: #4fc485; color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  padding-block: 40px 80px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 56px; }
.prose { max-width: 72ch; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0; }
section { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.eyebrow { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 68ch; }
code, .mono { font-family: var(--font-mono); font-size: 0.86em; }
code { background: var(--code-bg); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
a { color: var(--accent); }
header { display: flex; flex-direction: column; gap: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.9rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgba(0,0,0,.25); display: inline-block; }

figure { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
figure img { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
figcaption { font-size: 0.88rem; color: var(--muted); }
figcaption b { color: var(--fg); font-weight: 600; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .pair { grid-template-columns: 1fr; } }

.diffs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.diff { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.diff .tag { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tag.same { color: var(--ok); } .tag.differs { color: var(--sev-medio); }

.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.count { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.findings { display: flex; flex-direction: column; gap: 12px; }
.finding {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--sev, var(--line));
  border-radius: 6px; padding: 14px 18px; display: grid; grid-template-columns: 1fr; gap: 8px; min-width: 0;
}
.finding.alto { --sev: var(--sev-alto); } .finding.medio { --sev: var(--sev-medio); } .finding.bajo { --sev: var(--sev-bajo); }
.finding.paper { --sev: var(--paper); }
.f-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.chip { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sev); border: 1px solid var(--sev); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.where { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.f-body { display: grid; grid-template-columns: 9.5em 1fr; gap: 4px 14px; font-size: 0.95rem; }
.f-body dt { color: var(--muted); font-size: 0.85rem; padding-top: 2px; }
.f-body dd { margin: 0; min-width: 0; }
@media (max-width: 560px) { .f-body { grid-template-columns: 1fr; } .f-body dt { padding-top: 6px; } }

.formula { font-family: var(--font-mono); font-size: 0.88rem; background: var(--code-bg); border-radius: 6px; padding: 10px 12px; overflow-x: auto; white-space: pre; }
ol.plan { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 10px; max-width: 72ch; }
ol.plan li::marker { font-family: var(--font-mono); color: var(--muted); }
.note { font-size: 0.9rem; color: var(--muted); max-width: 72ch; }
footer { font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.9rem; }
.topbar a { text-decoration: none; }
nav.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
nav.toc ol { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; }
nav.toc .date { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); margin-left: 6px; }
.entry { display: flex; flex-direction: column; gap: 40px; border-top: 2px solid var(--fg); padding-top: 24px; }
.entry-head { display: flex; flex-direction: column; gap: 10px; }
.entry-head h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
.pcr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .pcr { grid-template-columns: 1fr; } }
.pcr div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pcr .k { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.narrow-fig { max-width: 640px; }

/* --- Tablero (acordeón) --- */
.board { gap: 28px; }
.board-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.board-tools button { font: inherit; font-size: 0.85rem; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px; cursor: pointer; }
.board-tools button:hover { border-color: var(--muted); }
.board-tools button:focus-visible, details.finding > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.summary-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.summary-bar .status { font-size: 0.8rem; padding: 3px 10px; }
.summary-bar b { font-variant-numeric: tabular-nums; margin-left: 4px; }
.group { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.group > .group-head h3 { font-size: 1.25rem; }
h3.subgroup { font-size: 0.95rem; color: var(--muted); font-family: var(--font-body); font-weight: 600; margin-top: 6px; }
.findings { gap: 8px; }
details.finding { padding: 0; display: block; }
details.finding > summary {
  list-style: none; cursor: pointer; display: grid; align-items: center;
  grid-template-columns: 5.2em 3.2em minmax(0, 1fr) auto 1em; gap: 10px; padding: 11px 16px;
}
details.finding > summary::-webkit-details-marker { display: none; }
details.finding > summary::after { content: "›"; color: var(--muted); font-size: 1.2rem; line-height: 1; transition: transform .15s ease; justify-self: end; }
details.finding[open] > summary::after { transform: rotate(90deg); }
details.finding[open] > summary { border-bottom: 1px solid var(--line); }
details.finding > summary .chip { justify-self: start; }
.fid { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.ftitle { font-weight: 600; font-size: 0.98rem; min-width: 0; }
.f-content { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.status { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; border-radius: 4px; padding: 2px 8px; white-space: nowrap; color: var(--st); background: color-mix(in srgb, var(--st) 14%, transparent); }
.status.backlog { --st: var(--sev-bajo); } .status.decidir { --st: var(--paper); } .status.progreso { --st: var(--sev-medio); } .status.hecho { --st: var(--ok); }
details.finding[data-status="hecho"] .ftitle { color: var(--muted); }
details.finding:target { box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 600px) {
  details.finding > summary { grid-template-columns: auto auto minmax(0, 1fr) 1em; }
  details.finding > summary .status { grid-column: 2 / 4; grid-row: 2; justify-self: start; }
}
.evidence { display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed var(--line); padding-top: 12px; }
.evidence .commit { font-family: var(--font-mono); font-size: 0.85rem; }
.toc-board { font-weight: 600; text-decoration: none; }

/* En código se ven los caracteres tal cual (=> no se vuelve flecha) */
code, .formula, .mono, .fid, .where, .commit { font-variant-ligatures: none; }
