/* ───────── Lienzo 16:9 (1920×1080 lógicos) escalado a la ventana ───────── */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #070A16; overflow: hidden; }
body { font-family: var(--font-body); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
.mono, code, pre { font-family: var(--font-code); }
code { font-size: .92em; }
b { font-weight: 700; }

.viewport { position: fixed; inset: 0; }
.stage {
  position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px;
  transform: translate(-50%, -50%) scale(var(--scale, 1)); transform-origin: center;
  background: var(--amber); overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

/* ───────── Slides y transiciones ───────── */
.slide {
  position: absolute; inset: 0; padding: 64px 104px 92px;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; pointer-events: none;
}
.slide.active { opacity: 1; visibility: visible; pointer-events: auto; }
.slide.enter-fwd { animation: enterFwd var(--dur) var(--ease) both; }
.slide.enter-back { animation: enterBack var(--dur) var(--ease) both; }
.slide.leave-fwd { visibility: visible; animation: leaveFwd var(--dur) var(--ease) both; }
.slide.leave-back { visibility: visible; animation: leaveBack var(--dur) var(--ease) both; }
@keyframes enterFwd { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
@keyframes enterBack { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: none; } }
@keyframes leaveFwd { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(-60px); } }
@keyframes leaveBack { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(60px); } }

/* Entradas escalonadas automáticas al llegar al slide */
.slide.active .stagger > * { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 110ms + 150ms); }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

/* Fragmentos que el expositor revela con → */
.frag { opacity: 0; transform: translateY(24px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.frag.visible { opacity: 1; transform: none; }

/* ───────── Tipografía ───────── */
header { margin-bottom: 30px; }
.kicker {
  margin: 0 0 10px; font: 700 24px/1 var(--font-body);
  letter-spacing: .28em; text-transform: uppercase; color: var(--ink);
}
.title {
  margin: 0; font: 700 66px/1.08 var(--font-title); color: var(--indigo); letter-spacing: -.01em;
}
.lead { font-size: 36px; line-height: 1.35; margin: 0 0 28px; }
.sublead { font-size: 30px; margin: 34px 0 16px; }
.muted { color: var(--ink-soft); font-weight: 500; }
.card-dark .muted { color: var(--muted); }
.tmp { color: var(--cyan); }
.kw { color: var(--gold); }
.lbl { color: var(--coral); }
.reg { color: var(--violet); }
.ok-text { color: var(--green); }
.warn-text { color: var(--coral); }

.foot {
  position: absolute; left: 104px; right: 104px; bottom: 30px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 20px; font-weight: 500; color: var(--ink-soft);
}
.slide-num { font: 700 22px var(--font-code); color: var(--indigo); }

/* ───────── Tarjetas ───────── */
.card-dark {
  background: var(--navy); color: var(--paper); border-radius: var(--radius); padding: 30px 34px;
  box-shadow: 0 14px 30px rgba(15, 20, 40, .22);
}
.card-dark code { color: var(--paper); }
.card-label {
  font: 700 20px/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 18px;
}

/* ───────── Portadas ───────── */
.cover { padding: 0; align-items: center; justify-content: center; }
.cover-center { text-align: center; display: flex; flex-direction: column; align-items: center; }
.cover .kicker { font-size: 26px; margin-bottom: 26px; }
.brace-wrap { display: flex; align-items: center; gap: 44px; }
.brace { font: 700 250px/1 var(--font-title); color: var(--indigo); transform: translateY(-12px); }
.cover h1 { margin: 0; font: 700 104px/1.08 var(--font-title); color: var(--indigo); letter-spacing: -.015em; }
.cover-code {
  margin: 56px 0 0; display: flex; gap: 26px; align-items: center;
  background: var(--navy); color: var(--paper); padding: 22px 38px; border-radius: 999px; font-size: 30px;
}
.cover-code .arrow { color: var(--gold); }
.cover-sub { margin: 44px 0 0; font-size: 36px; max-width: 1200px; line-height: 1.35; color: var(--ink); }
.cover-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 88px; background: var(--indigo);
  display: grid; place-items: center; color: var(--paper); font-size: 30px; font-weight: 500;
}
.corner { position: absolute; background: var(--indigo); }
.corner-tr { top: 0; right: 0; width: 290px; height: 140px; border-bottom-left-radius: 28px; }
.corner-bl { bottom: 0; left: 0; width: 290px; height: 180px; border-top-right-radius: 28px; }
#s-portada .corner-bl, #s-gracias .corner-bl { bottom: 88px; width: 200px; height: 110px; }

/* ───────── Agenda ───────── */
.agenda { list-style: none; margin: 16px 0 60px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 34px 56px; flex: 1; }
.agenda li { display: flex; gap: 30px; align-items: center; background: var(--amber-soft); border-radius: 26px; padding: 30px 36px; }
.agenda .num { font: 700 64px var(--font-title); color: var(--indigo); min-width: 84px; }
.agenda b { display: block; font-size: 40px; color: var(--ink); }
.agenda small { display: block; font-size: 30px; color: var(--ink-soft); margin-top: 6px; }

/* ───────── Ventajas / desventajas ───────── */
.proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; flex: 1; }
.pc-col { border-radius: var(--radius); padding: 34px 40px; display: flex; flex-direction: column; }
.pc-col h3 { margin: 0 0 22px; font: 700 42px var(--font-title); display: flex; align-items: center; gap: 18px; }
.pc-icon { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; font: 700 38px/1 var(--font-body); }
.pros { background: var(--amber-soft); color: var(--ink); }
.pros h3 { color: var(--indigo); }
.pros .pc-icon { background: var(--indigo); color: var(--paper); }
.cons { background: var(--navy); color: var(--paper); }
.cons h3 { color: var(--coral); }
.cons .pc-icon { background: var(--coral); color: var(--navy); }
.pc-col ul { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-rows: 1fr; gap: 20px; flex: 1; }
.pc-col li { display: flex; flex-direction: column; justify-content: center; }
.pc-col li { padding: 16px 22px; border-radius: 18px; border-left: 8px solid currentColor; }
.pros li { background: rgba(255, 255, 255, .45); border-color: var(--indigo); }
.cons li { background: var(--navy-2); border-color: var(--coral); }
.pc-col li b { display: block; font-size: 31px; }
.pc-col li span { display: block; font-size: 26px; margin-top: 4px; line-height: 1.3; }
.pros li span { color: var(--ink-soft); }
.cons li span { color: var(--muted); }
.pc-col li.current { box-shadow: 0 0 0 4px var(--indigo); }
.cons li.current { box-shadow: 0 0 0 4px var(--coral); }

/* ───────── Tipos de IR ───────── */
.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; flex: 1; max-height: 560px; }
.type-card { display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; padding: 30px 30px 34px; }
.type-card h3 { margin: 0; font: 700 46px var(--font-title); color: var(--gold); }
.type-card > .muted { margin: 6px 0 14px; font-size: 27px; }
.type-ex { margin: 14px 0 0; font-size: 30px; }
.mini-tree, .mini-cfg { width: 390px; height: 247px; }
.mini-tree line { stroke: var(--muted); stroke-width: 3; }
.mini-tree .op { fill: var(--gold); }
.mini-tree .leaf { fill: var(--cyan); }
.mini-tree text, .mini-cfg text { font: 700 22px var(--font-code); fill: var(--navy); text-anchor: middle; dominant-baseline: central; }
.mini-cfg rect { fill: var(--navy-2); stroke: var(--cyan); stroke-width: 3; }
.mini-cfg text { fill: var(--paper); }
.mini-cfg path { stroke: var(--coral); stroke-width: 3; fill: none; color: var(--coral); }
.two-code { display: flex; gap: 20px; height: 247px; align-items: flex-start; }
.two-code > div { text-align: left; background: var(--navy-2); border-radius: 16px; padding: 12px 18px; }
.two-code small { display: block; font-size: 18px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
.two-code pre { margin: 0; font-size: 27px; line-height: 1.3; color: var(--paper); }

.spectrum { display: flex; align-items: center; gap: 26px; margin-top: 40px; }
.sp-end { font: 700 26px var(--font-body); color: var(--ink); white-space: nowrap; }
.sp-end small { display: block; font-size: 20px; font-weight: 500; color: var(--ink-soft); }
.sp-end.right { text-align: right; }
.sp-bar {
  flex: 1; display: flex; justify-content: space-around; padding: 14px 20px; border-radius: 999px;
  background: linear-gradient(90deg, var(--indigo), var(--navy));
  color: var(--paper); font: 700 26px var(--font-code);
}
.real { display: flex; align-items: center; gap: 18px; margin-top: 30px; flex-wrap: wrap; }
.real-label { font-size: 26px; font-weight: 700; }
.chip-static { background: var(--navy); color: var(--paper); padding: 12px 22px; border-radius: 999px; font-size: 24px; }
.chip-static b { color: var(--gold); margin-right: 8px; }

/* ───────── ¿Qué es TAC? ───────── */
.tac-intro { display: grid; grid-template-columns: 1fr 820px; gap: 50px; flex: 1; }
.anatomy { padding: 36px 30px 30px; }
.anat-row { display: flex; align-items: flex-start; justify-content: center; gap: 26px; font-size: 76px; font-weight: 700; }
.anat-row .eq { color: var(--muted); }
.part { display: flex; flex-direction: column; align-items: center; }
.part em {
  font: 600 22px var(--font-body); font-style: normal; margin-top: 12px; padding: 4px 14px; border-radius: 999px;
  background: var(--navy-2); color: var(--muted); border-top: 4px solid var(--muted);
}
.p-res em { border-color: var(--cyan); color: var(--cyan); }
.p-op em { border-color: var(--gold); color: var(--gold); }
.p-a1 em, .p-a2 em { border-color: var(--violet); color: var(--violet); }
.anatomy .frag { opacity: .25; transform: none; }
.anatomy .frag.visible { opacity: 1; }
.anatomy .frag.current > span:first-child { text-shadow: 0 0 24px currentColor; }
.addr-kinds { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; font-size: 29px; }
.addr-kinds li { display: flex; align-items: center; gap: 18px; }
.ak-tag { min-width: 180px; text-align: center; padding: 8px 16px; border-radius: 14px; background: var(--indigo); color: var(--paper); font-weight: 700; font-size: 25px; }
.addr-kinds code { background: var(--navy); color: var(--paper); padding: 2px 10px; border-radius: 8px; }
.addr-kinds code.tmp { color: var(--cyan); }
.forms { padding: 30px 34px; }
.forms-table { width: 100%; border-collapse: collapse; font-size: 28px; }
.forms-table td { padding: 17px 8px; border-bottom: 1px solid var(--navy-line); }
.forms-table tr:last-child td { border-bottom: 0; }
.forms-table td:first-child { white-space: nowrap; font-size: 29px; }
.forms-table td:last-child { color: var(--muted); text-align: right; }

/* ───────── Tabla comparativa ───────── */
.compare-table { width: 100%; border-collapse: separate; border-spacing: 0 16px; font-size: 32px; margin-top: 10px; }
.compare-table thead th { background: var(--navy); color: var(--paper); padding: 22px 24px; font-size: 30px; text-align: center; }
.compare-table thead th:first-child { border-radius: 20px 0 0 20px; text-align: left; }
.compare-table thead th:last-child { border-radius: 0 20px 20px 0; }
.compare-table tbody th { text-align: left; padding: 34px 28px; background: var(--indigo); color: var(--paper); border-radius: 20px 0 0 20px; font-size: 28px; }
.compare-table tbody td { background: var(--amber-soft); padding: 34px 24px; text-align: center; }
.compare-table tbody td:last-child { border-radius: 0 20px 20px 0; }
.compare-table td.good { color: #0B5B34; font-weight: 700; }
.compare-table td.bad { color: #8A1C0A; font-weight: 700; }
.note { font-size: 32px; margin: 30px 0 0; padding: 22px 30px; border-radius: 20px; background: var(--navy); color: var(--paper); }
.note b { color: var(--gold); }

/* ───────── Buenas prácticas ───────── */
.practices { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 30px; flex: 1; margin-bottom: 40px; }
.practices article { background: var(--navy); color: var(--paper); border-radius: 26px; padding: 34px 34px; display: flex; flex-direction: column; justify-content: center; }
.practices .prob { margin: 0 0 20px; font: 700 33px/1.2 var(--font-body); color: var(--coral); }
.practices .prob::before { content: '⚠ '; }
.practices .sol { margin: 0; font-size: 29px; line-height: 1.45; color: var(--paper); }
.practices .sol::before { content: '✓ '; color: var(--green); font-weight: 700; }
.practices code { background: var(--navy-2); padding: 1px 8px; border-radius: 6px; font-size: 25px; white-space: nowrap; }
.practices article.current { box-shadow: 0 0 0 5px var(--indigo); }

/* ───────── Resumen ───────── */
.takeaways { list-style: none; margin: 10px 0 50px; padding: 0; display: grid; grid-auto-rows: 1fr; gap: 24px; flex: 1; }
.takeaways li { display: flex; align-items: center; gap: 30px; background: var(--amber-soft); border-radius: 24px; padding: 20px 34px; }
.takeaways .num { flex: none; width: 70px; height: 70px; border-radius: 50%; background: var(--indigo); color: var(--paper); display: grid; place-items: center; font: 700 36px var(--font-title); }
.takeaways p { margin: 0; font-size: 36px; line-height: 1.3; }

/* ───────── Referencias ───────── */
.refs { margin: 10px 0 0; padding-left: 48px; display: grid; gap: 34px; font-size: 29px; line-height: 1.45; }
.refs li::marker { font-weight: 700; color: var(--indigo); }
.refs .url { font-family: var(--font-code); font-size: 24px; color: var(--indigo); }

/* ───────── Controles (fuera del lienzo) ───────── */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 5px; z-index: 5; background: rgba(255, 255, 255, .08); }
.progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .35s var(--ease); }
.hud {
  position: fixed; right: 18px; bottom: 16px; z-index: 6; display: flex; gap: 8px; align-items: center;
  background: rgba(15, 20, 40, .88); color: var(--paper); padding: 8px 10px; border-radius: 14px;
  font: 600 15px var(--font-body); transition: opacity .4s;
}
.hud button { background: transparent; color: var(--paper); border: 1px solid var(--navy-line); border-radius: 10px; width: 38px; height: 34px; cursor: pointer; }
.hud button:hover, .hud button:focus-visible { background: var(--navy-2); outline: 2px solid var(--gold); }
.hud-count { padding: 0 8px; white-space: pre; font-variant-numeric: tabular-nums; }
body.idle .hud { opacity: 0; }
body.idle { cursor: none; }

.help { position: fixed; inset: 0; z-index: 9; display: none; place-items: center; background: rgba(7, 10, 22, .7); }
body.show-help .help { display: grid; }
.help-card { background: var(--navy); color: var(--paper); border-radius: 20px; padding: 28px 36px; font-size: 18px; min-width: 460px; }
.help-card h3 { margin: 0 0 14px; color: var(--gold); font-family: var(--font-title); font-size: 28px; }
.help-card dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 24px; margin: 0; }
.help-card dt { font-family: var(--font-code); color: var(--cyan); }
.help-card dd { margin: 0; }
