@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Jost"; src: url("../fonts/jost-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/plexmono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/plexmono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --paper: #fbfaf6;
  --ink: #0f0f0f;
  --ink-soft: #55524b;
  --rule: #d8d2c2;
  --gold: #b98a2e;
  --gold-hi: #f0dcab;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Jost", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --pad: clamp(24px, 5vw, 72px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 19px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.82em; background: #efeadb; padding: 1px 6px; border-radius: 3px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 99; }
.skip:focus { left: 8px; }

/* ---------- libro ---------- */
.book { display: grid; grid-template-columns: 300px minmax(0, 1fr); }

.index { border-right: 1px solid var(--rule); }
.index-in { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 32px 28px; }
.back { font-family: var(--mono); font-size: 13px; text-decoration: none; color: var(--ink-soft); }
.back:hover { color: var(--ink); }
.mark { margin-top: 44px; font-family: var(--serif); font-size: 44px; line-height: 0.95; letter-spacing: -0.01em; }
.mark span { display: block; margin-top: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }

.toc { margin-top: auto; margin-bottom: auto; display: flex; flex-direction: column; }
.toc a { display: flex; align-items: baseline; text-decoration: none; padding: 9px 0; font-size: 17px; color: var(--ink-soft); }
.toc a i { flex: 1; margin: 0 8px; border-bottom: 2px dotted var(--rule); transform: translateY(-4px); transition: border-color 0.2s; }
.toc-n { font-family: var(--mono); font-size: 13px; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--ink); font-weight: 500; }
.toc a.on i { border-color: var(--gold); }
.toc a.on .toc-n { color: var(--gold); }

.index-foot { display: flex; justify-content: space-between; align-items: center; }
.lang { font: 500 12px var(--mono); letter-spacing: 0.08em; background: none; border: 1px solid var(--ink); color: var(--ink); padding: 5px 12px; cursor: pointer; }
.lang:hover { background: var(--ink); color: var(--paper); }
.ver { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

/* ---------- páginas ---------- */
.page { padding: clamp(70px, 10vw, 130px) var(--pad); border-bottom: 1px solid var(--rule); max-width: 1080px; }
.page:last-child { border-bottom: 0; }
.label { font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin-bottom: 1.6rem; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; }
h1 { font-size: clamp(50px, 6.6vw, 98px); line-height: 0.98; max-width: 14ch; }
h2 { font-size: clamp(36px, 4.4vw, 62px); line-height: 1.02; max-width: 17ch; }
em { font-style: italic; background: linear-gradient(transparent 60%, var(--gold-hi) 60% 92%, transparent 92%); padding: 0 0.06em; }
.lede { margin-top: 1.8rem; font-size: clamp(19px, 1.7vw, 22px); color: var(--ink-soft); max-width: 40em; }
.cover { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }
.cover-links { margin-top: 2.6rem; display: flex; align-items: center; flex-wrap: wrap; gap: 14px 28px; }
.btn { display: inline-block; background: var(--ink); color: var(--paper); text-decoration: none; padding: 14px 26px; font-weight: 500; letter-spacing: 0.02em; border: 1px solid var(--ink); transition: background 0.2s, color 0.2s; }
.btn:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.ghost { font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
.ghost:hover { color: var(--gold); border-color: var(--gold); }

.two { margin-top: 2.2rem; display: grid; grid-template-columns: 1fr 1fr; gap: 2rem 3rem; color: var(--ink-soft); }

/* ficha técnica */
.plate { margin-top: 3.4rem; background: var(--ink); color: #f1ede1; padding: clamp(22px, 3vw, 38px); }
.plate-h { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-hi); margin-bottom: 14px; }
.plate dl div { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 16px; padding: 11px 0; border-top: 1px solid #333; font-size: 17px; }
.plate dt { color: #a9a496; }
.plate dd { color: #fff; }

/* wireframe + notas */
.spread { margin-top: 3rem; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.wf { background: #fff; border: 1.5px solid var(--ink); padding: 0 0 14px; font-size: 0; box-shadow: 8px 8px 0 var(--gold-hi); position: sticky; top: 28px; }
.wf-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1.5px solid var(--ink); margin-bottom: 12px; }
.wf-bar b { width: 22px; height: 10px; background: var(--ink); margin-right: 10px; }
.wf-bar span { width: 34px; height: 5px; background: #ddd7c6; }
.wf-bar em { margin-left: auto; width: 46px; height: 12px; background: var(--ink); }
.wf [data-z] { position: relative; transition: outline-color 0.2s, background-color 0.2s; outline: 2px solid transparent; outline-offset: 3px; }
.wf [data-z].on { outline-color: var(--gold); background-color: #faf1d6; }
.wf s { position: absolute; top: -8px; right: -4px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; font: 500 11px/20px var(--mono); text-align: center; text-decoration: none; }
.wf-top, .wf-status, .wf-grid, .wf-split { margin: 0 12px 14px; }
.wf-top { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; }
.wf-hero, .wf-access { padding: 14px; background: #f4f0e3; }
.wf-hero i, .wf-access i { display: block; height: 9px; background: #cfc8b4; margin-bottom: 8px; }
.wf-hero .l1 { width: 90%; height: 16px; background: var(--ink); }
.wf-hero .l2 { width: 70%; height: 16px; background: var(--ink); }
.wf-hero .l3 { width: 55%; margin-top: 12px; }
.wf-btns { display: flex; gap: 8px; margin-top: 14px; }
.wf u { display: block; height: 18px; width: 64px; background: var(--ink); text-decoration: none; }
.wf u.gold { background: var(--gold); }
.wf u.full { width: 100%; margin-top: 4px; }
.wf-access .a1 { width: 60%; height: 12px; background: var(--ink); }
.field { height: 16px; border: 1.5px solid #bdb59f; background: #fff; margin-bottom: 8px; }
.wf-status { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wf-status div { height: 34px; border: 1.5px dashed #bdb59f; }
.wf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wf-grid div { height: 52px; background: #f4f0e3; border-top: 4px solid var(--ink); }
.wf-plans div { border-top-color: var(--gold); height: 46px; }
.wf-plans div.dark, .wf-split div.dark { background: var(--ink); border-top-color: var(--ink); }
.wf-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 0; }
.wf-split div { height: 54px; background: #f4f0e3; }

.notes { list-style: none; counter-reset: n; display: grid; }
.notes li { counter-increment: n; display: grid; grid-template-columns: 38px 1fr; padding: 16px 0 16px 0; border-top: 1px solid var(--rule); cursor: default; transition: background 0.2s, padding-left 0.2s; }
.notes li:last-child { border-bottom: 1px solid var(--rule); }
.notes li::before { content: counter(n); grid-row: span 2; font-family: var(--mono); font-size: 13px; color: var(--gold); padding-top: 4px; }
.notes b { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.1; }
.notes span { color: var(--ink-soft); font-size: 17px; line-height: 1.5; margin-top: 2px; }
.notes li.on { background: #faf1d6; padding-left: 10px; }

/* contenidos */
.contents { list-style: none; margin-top: 2.6rem; max-width: 760px; }
.contents li { display: flex; align-items: baseline; padding: 13px 0; font-family: var(--serif); font-size: clamp(26px, 3vw, 38px); line-height: 1.1; }
.contents i { flex: 1; margin: 0 12px; border-bottom: 2px dotted var(--rule); transform: translateY(-5px); }
.contents em { background: none; font-family: var(--mono); font-style: normal; font-size: 13px; letter-spacing: 0.02em; color: var(--ink-soft); text-align: right; max-width: 16em; }

/* instalación */
.steps { list-style: none; margin-top: 2.4rem; max-width: 740px; display: grid; }
.steps li { display: grid; grid-template-columns: 64px 1fr; align-items: baseline; padding: 20px 0; border-top: 1px solid var(--rule); font-size: 21px; }
.steps li:last-child { border-bottom: 1px solid var(--rule); }
.steps b { font-family: var(--serif); font-weight: 400; font-size: 54px; line-height: 0.8; color: var(--gold); }

.docs { margin-top: 1.6rem; font-family: var(--mono); font-size: 13px; }
.colophon { margin-top: 90px; padding-top: 22px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .book { grid-template-columns: 1fr; }
  .index { border-right: 0; border-bottom: 1px solid var(--rule); }
  .index-in { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px 24px; padding: 20px var(--pad); }
  .mark { margin: 0; font-size: 30px; }
  .mark span { margin-top: 4px; }
  .toc { display: none; }
  .back { order: 3; }
  .index-foot { margin-left: auto; gap: 14px; }
  .spread { grid-template-columns: 1fr; }
  .wf { position: static; }
  .two { grid-template-columns: 1fr; }
  .cover { min-height: auto; }
}
@media (max-width: 520px) {
  body { font-size: 18px; }
  .plate dl div { grid-template-columns: 1fr; gap: 0; }
  .contents li { flex-wrap: wrap; }
  .contents i { display: none; }
  .contents em { flex-basis: 100%; text-align: left; margin-top: 2px; }
  .steps li { grid-template-columns: 48px 1fr; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
