/* ==========================================================================
   BIM Foundation · hoja de estilos común a la portada y a todos los artículos
   Mismo lenguaje visual que el portfolio de Alejandro García Nicolás:
   negro dominante, blanco de contraste, Hello Yellow como acento (nunca texto
   blanco sobre amarillo ni amarillo sobre blanco), grises Slate / Warm Slate
   para la jerarquía, Inter muy negra en mayúsculas para los titulares y
   JetBrains Mono para etiquetas y datos.
   ========================================================================== */

:root {
  --accent: #FFFF00;
  --black: #000000;
  --white: #ffffff;
  --s50: #F7F7F4;  --s100: #EFEFEA; --s200: #E3E3DB; --s300: #D5D5CB;
  --s400: #8F8F87; --s500: #666666; --s600: #555555; --s700: #3D3D3D; --s800: #1F1F1F;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', Menlo, monospace;
  --gutter: 24px;
  --rail: 0px;
}
@media (min-width: 768px)  { :root { --gutter: 48px; --rail: 80px; } }
@media (min-width: 1024px) { :root { --gutter: 80px; --rail: 96px; } }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; background: var(--white); color: var(--black); font-family: var(--sans); font-size: 17px; line-height: 1.65; }
::selection { background: var(--accent); color: var(--black); }
img, svg { max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--black); outline-offset: 3px; }

.custom-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scroll::-webkit-scrollbar-thumb { background: var(--s200); }

/* ---------- Tipografía base de la marca ---------- */
.kicker, .kicker-y {
  display: inline-block; width: max-content; max-width: 100%;
  font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; line-height: 1.4;
}
.kicker-y { background: var(--accent); color: var(--black); padding: .28em .55em; }
@media (min-width: 1024px) { .kicker-y.lg { font-size: 12px; } }
.mono { font-family: var(--mono); }
.label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--s600); }
.hl-y { background: var(--accent); color: var(--black); padding: 0 .08em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.display {
  margin: 0; font-weight: 900; text-transform: uppercase; letter-spacing: -.05em; line-height: .95; color: var(--black);
  overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto;
}
/* El punto final amarillo de los titulares */
.display .dot { display: inline-block; background: var(--accent); line-height: .88; padding: .06em .1em .02em; margin-left: .02em; }
/* Palabra resaltada en un titular: el amarillo se ciñe a las letras (como en el CV) */
.display .hl-y { display: inline-block; line-height: .88; padding: .06em .1em .02em; margin-top: .1em; }
.display .hl-y .dot { padding: 0; margin: 0; background: none; line-height: inherit; }

/* ---------- Navegación tipo cartucho (igual que el CV) ---------- */
#nav-capsule {
  position: fixed; left: 16px; top: 24px; height: 56px; max-width: 56px;
  background: rgba(255,255,255,.98); border-radius: 9999px; border: 1px solid var(--s200);
  box-shadow: 0 4px 24px rgba(0,0,0,.04); overflow: hidden; z-index: 100;
  display: flex; align-items: center;
  transition: max-width .6s cubic-bezier(.7,0,.3,1), box-shadow .4s ease;
}
#nav-capsule.menu-open { max-width: calc(100vw - 32px); box-shadow: 0 12px 48px rgba(0,0,0,.08); }
#menu-trigger {
  width: 48px; height: 48px; margin: 4px; flex-shrink: 0; border-radius: 9999px; border: 0; cursor: pointer;
  background: var(--black); color: var(--white); font-family: var(--sans); font-weight: 900; font-size: 13px; letter-spacing: -.02em;
  transition: background .3s, color .3s;
}
#menu-trigger:hover { background: var(--accent); color: var(--black); }
#menu-content { display: flex; align-items: center; white-space: nowrap; opacity: 0; transition: opacity .3s; }
#nav-capsule.menu-open #menu-content { opacity: 1; }
#menu-content nav { display: flex; align-items: center; gap: 4px; padding: 0 16px 0 12px; }
.menu-link {
  display: flex; align-items: center; padding: 10px 16px; border-radius: 9999px; text-decoration: none;
  font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--s500);
  transition: background .2s, color .2s;
}
.menu-link:hover { background: var(--accent); color: var(--black); }
.menu-link.is-current { background: var(--black); color: var(--white); }

/* ---------- Estructura de página ---------- */
main { padding-left: var(--rail); }
.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter); }
section { scroll-margin-top: 24px; }

/* Barra de progreso de lectura */
#progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--black); z-index: 110; }
#progress::after { content: ""; position: absolute; right: 0; top: 0; width: 24px; height: 3px; background: var(--accent); }

/* ---------- Cabecera (hero) ---------- */
.hero { min-height: 92vh; display: flex; flex-direction: column; justify-content: center; padding: 112px 0 48px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px 48px; align-items: center; }
@media (min-width: 1280px) { .hero-grid { grid-template-columns: 3fr 2fr; } .hero-side { text-align: right; align-items: flex-end; } }
.hero-id { font-size: 17px; font-weight: 900; letter-spacing: -.02em; margin: 0 0 16px; }
.hero-id a { text-decoration: none; }
.hero .kicker-y { margin-bottom: 24px; }
.hero h1 { font-size: clamp(2.5rem, 7.2vw, 5.4rem); line-height: 1; }
.hero-side { display: flex; flex-direction: column; gap: 20px; }
.hero-lead { font-size: 19px; line-height: 1.6; margin: 0; }
@media (min-width: 1024px) { .hero-lead { font-size: 21px; } }
.hero-meta { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--s600); line-height: 1.9; }
.hero-meta span + span::before { content: " · "; color: var(--s400); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 20px; border-radius: 9999px; border: 0; cursor: pointer;
  background: var(--black); color: var(--white); text-decoration: none; width: max-content;
  font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; transition: background .25s, color .25s;
}
.btn:hover { background: var(--accent); color: var(--black); }
.btn.ghost { background: var(--s50); color: var(--black); border: 1px solid var(--s200); }
.btn.ghost:hover { background: var(--black); color: var(--white); }

/* Cifras de cabecera (como los KPI del CV) */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px 24px; margin-top: 64px; padding-top: 24px; border-top: 2px solid var(--black); }
@media (min-width: 1024px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat b { display: block; font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 900; letter-spacing: -.05em; line-height: 1; }
.stat span { display: block; margin-top: 10px; font-size: 13px; color: var(--s500); line-height: 1.5; max-width: 30ch; }

/* ---------- Artículo: índice lateral + cuerpo ---------- */
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; padding: 48px 0 96px; }
@media (min-width: 1100px) { .article-grid { grid-template-columns: 240px minmax(0, 1fr); gap: 72px; } }
.toc { display: none; }
@media (min-width: 1100px) {
  .toc { display: block; position: sticky; top: 32px; align-self: start; max-height: calc(100vh - 64px); overflow-y: auto; }
}
.toc .kicker-y { margin-bottom: 16px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid; grid-template-columns: 28px 1fr; padding: 7px 0; text-decoration: none; border-top: 1px solid var(--s200);
  font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; line-height: 1.4; color: var(--s400); transition: color .2s;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--mono); font-weight: 700; }
.toc a:hover { color: var(--black); }
.toc a.is-current { color: var(--black); }
.toc a.is-current::before { background: var(--accent); width: max-content; padding: 0 3px; height: max-content; }

.prose { max-width: 760px; }
.prose > section { padding-top: 56px; }
.prose > section:first-child { padding-top: 0; }
.sec-head { margin-bottom: 28px; }
.sec-num { display: block; font-size: 64px; font-weight: 900; letter-spacing: -.05em; line-height: .9; color: var(--s100); margin-bottom: 4px; }
.prose h2 { font-size: clamp(2rem, 4.2vw, 3.2rem); }
.prose h3 { margin: 40px 0 12px; font-size: 18px; font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; line-height: 1.3; }
.prose p, .prose li { color: var(--s800); }
.prose p { margin: 0 0 18px; }
.prose .lead { font-size: 20px; line-height: 1.6; color: var(--s500); font-weight: 300; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose ul li::marker { color: var(--s400); }
.prose strong { font-weight: 800; color: var(--black); }
.prose a { text-decoration: underline; text-decoration-color: var(--s300); text-underline-offset: 3px; transition: text-decoration-color .2s, background .2s; }
.prose a:hover { text-decoration-color: var(--black); background: var(--accent); }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--s50); border: 1px solid var(--s200); padding: .05em .35em; border-radius: 3px; }
.ui { font-weight: 700; }   /* nombres de comandos y menús del software */
.ui::before { content: "‹"; color: var(--s400); font-weight: 400; margin-right: 1px; }
.ui::after { content: "›"; color: var(--s400); font-weight: 400; margin-left: 1px; }

/* Bloques de código / STEP */
.prose pre {
  margin: 0 0 24px; padding: 20px 22px; background: var(--black); color: var(--white); border-radius: 6px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
}
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose pre .c { color: var(--s400); }
.prose pre .y { color: var(--accent); }

/* Fórmulas */
.formula { margin: 0 0 24px; padding: 18px 22px; border-left: 4px solid var(--black); background: var(--s50); font-family: var(--mono); font-size: 14px; line-height: 1.9; overflow-x: auto; }

/* Tablas */
.table-wrap { margin: 8px 0 28px; overflow-x: auto; border-top: 2px solid var(--black); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.prose th {
  text-align: left; vertical-align: bottom; padding: 12px 14px 10px 0; border-bottom: 1px solid var(--black);
  font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--s600); white-space: nowrap;
}
.prose td { padding: 11px 14px 11px 0; border-bottom: 1px solid var(--s200); vertical-align: top; color: var(--s800); }
.prose td:first-child { font-weight: 800; color: var(--black); }
.prose td.num, .prose td .mono { font-family: var(--mono); font-size: 13px; }
.prose tr.is-key td { background: var(--accent); }
.table-note { margin-top: -18px; font-size: 12px; color: var(--s500); }

/* Avisos */
.callout { margin: 28px 0; padding: 22px 24px; border: 1px solid var(--s200); background: var(--s50); border-radius: 6px; }
.callout .kicker-y { margin-bottom: 10px; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout.dark { background: var(--black); border-color: var(--black); color: var(--white); }
.callout.dark p, .callout.dark li, .callout.dark strong { color: var(--white); }
.callout.dark .label { color: var(--accent); }
.callout.dark a { text-decoration-color: var(--s500); }
.callout.dark code { background: var(--s800); border-color: var(--s700); color: var(--white); }
.callout.dark a:hover { color: var(--black); }
.callout.check { background: var(--white); border: 1px solid var(--black); }

/* Cita destacada */
.quote { margin: 32px 0; padding: 0 0 0 24px; border-left: 4px solid var(--accent); }
.quote p { font-size: 22px; line-height: 1.45; font-weight: 300; letter-spacing: -.01em; color: var(--black); margin-bottom: 10px; }
.quote cite { font-style: normal; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--s500); }

/* Pasos numerados (como el plan de éxito del CV) */
.steps { list-style: none; padding: 0 !important; margin: 8px 0 28px; counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 18px 52px; margin: 0; }
.steps > li::before {
  content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; border-radius: 9999px;
  background: var(--black); color: var(--white); display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.steps > li::after { content: ""; position: absolute; left: 16.5px; top: 36px; bottom: 2px; width: 1px; background: var(--s300); }
.steps > li:last-child::after { display: none; }
.steps > li:last-child::before { background: var(--accent); color: var(--black); border: 1px solid var(--black); }

/* Tarjetas de los tres orígenes */
.cards3 { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 8px 0 28px; }
@media (min-width: 720px) { .cards3 { grid-template-columns: repeat(3, 1fr); } }
.card3 { border-top: 2px solid var(--black); padding-top: 14px; }
.card3 svg { width: 44px; height: 44px; display: block; margin-bottom: 12px; }
.card3 b { display: block; font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; line-height: 1.25; margin-bottom: 6px; }
.card3 p { font-size: 14px; line-height: 1.55; color: var(--s600) !important; margin: 0; }

/* Figura / diagrama */
figure.diagram { margin: 12px 0 32px; }
figure.diagram svg { width: 100%; height: auto; display: block; }
figure.diagram figcaption { margin-top: 10px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--s500); }

/* Errores comunes: lista numerada grande */
.errors { list-style: none; padding: 0 !important; margin: 8px 0 24px; counter-reset: err; display: grid; grid-template-columns: 1fr; gap: 0 32px; }
@media (min-width: 720px) { .errors { grid-template-columns: 1fr 1fr; } }
.errors li { counter-increment: err; position: relative; padding: 12px 0 12px 40px; margin: 0; border-top: 1px solid var(--s200); font-size: 15px; line-height: 1.5; }
.errors li::before { content: counter(err, decimal-leading-zero); position: absolute; left: 0; top: 14px; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--s400); }

/* Checklist */
.checklist { list-style: none; padding: 0 !important; }
.checklist li { position: relative; padding-left: 30px; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .32em; width: 16px; height: 16px; border: 2px solid var(--black); border-radius: 3px; }

/* Etiqueta "por confirmar" */
.tag { display: inline-block; vertical-align: .1em; margin-left: 4px; padding: 1px 6px; border-radius: 9999px; border: 1px solid var(--black); font-family: var(--mono); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--black); white-space: nowrap; }
.tag.y { background: var(--accent); }

/* Glosario */
.glossary { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0 0 24px; }
@media (min-width: 720px) { .glossary { grid-template-columns: 200px 1fr; } }
.glossary dt { padding: 12px 16px 0 0; font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; border-top: 1px solid var(--s200); }
.glossary dd { margin: 0; padding: 4px 0 12px; font-size: 15px; color: var(--s700); }
@media (min-width: 720px) { .glossary dd { padding: 12px 0; border-top: 1px solid var(--s200); } }

/* Fuentes */
.sources { font-size: 13px; line-height: 1.6; padding-left: 20px !important; }
.sources li { margin: 4px 0; color: var(--s600) !important; word-break: break-word; }

/* Navegación entre artículos de la serie */
.series-nav { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 64px; padding-top: 24px; border-top: 2px solid var(--black); }
@media (min-width: 720px) { .series-nav { grid-template-columns: 1fr 1fr; } }
.series-nav a, .series-nav .empty { display: block; padding: 20px; border: 1px solid var(--s200); border-radius: 6px; text-decoration: none; transition: background .2s, border-color .2s; }
.series-nav a:hover { background: var(--accent); border-color: var(--black); }
.series-nav .empty { color: var(--s400); background: var(--s50); }
.series-nav .next { text-align: right; }
.series-nav b { display: block; margin-top: 6px; font-size: 18px; font-weight: 900; text-transform: uppercase; letter-spacing: -.02em; line-height: 1.15; }

/* ---------- Portada de la serie ---------- */
.series-head { display: flex; flex-direction: column; align-items: flex-end; text-align: right; padding: 64px 0 40px; }
.series-head h2 { font-size: clamp(2.6rem, 5vw, 3.8rem); }
.series-head p { font-size: 18px; font-weight: 300; color: var(--s500); max-width: 36rem; margin: 16px 0 0; }
.article-list { list-style: none; margin: 0; padding: 32px 0 96px; border-top: 2px solid var(--black); display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px 20px; }
@media (min-width: 640px) { .article-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .article-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.article-item a { display: flex; flex-direction: column; gap: 14px; height: 100%; text-decoration: none; }
.article-item h3 { margin: 0 0 8px; font-size: clamp(1.3rem, 2vw, 1.6rem); font-weight: 900; text-transform: uppercase; letter-spacing: -.04em; line-height: 1; }
.article-item p { margin: 0; color: var(--s500); font-size: 15px; line-height: 1.55; }
.article-item .meta { margin: 0 0 8px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--s600); line-height: 1.9; }
.article-item .meta .soon { background: var(--s100); padding: 1px 6px; margin-left: 4px; }
.article-item a:hover .cover { border-color: var(--black); }
.article-item a:hover .cover-n { color: var(--black); }
.article-item a:hover .cover img { transform: scale(1.06); }
.article-item.is-soon a { pointer-events: none; }
.article-item.is-soon h3 { color: var(--s400); }
.article-item.is-soon .cover { opacity: .5; }

/* ---------- Identidad común de los artículos: cubierta y ficha ---------- */
/* Cubierta = papel cuadriculado + número + ilustración (assets/img/cubiertas/<slug>.svg, 320×200, trazo negro 3, una sola pieza amarilla) + tema + sello BF.
   El pictograma (assets/img/iconos/<slug>.svg) va en el menú de diapositivas. */
.cover {
  position: relative; aspect-ratio: 16 / 10; border: 1px solid var(--s200); border-radius: 6px; overflow: hidden; transition: border-color .2s;
  background-color: var(--s50);
  background-image: linear-gradient(var(--s200) 1px, transparent 1px), linear-gradient(90deg, var(--s200) 1px, transparent 1px);
  background-size: 24px 24px; background-position: -1px -1px;
}
.cover img { position: absolute; inset: 14% 8% 15%; width: 84%; height: 71%; object-fit: contain; transition: transform .3s; }
.cover-n { position: absolute; left: 14px; top: 8px; font-size: clamp(2.4rem, 4vw, 3.4rem); font-weight: 900; letter-spacing: -.05em; line-height: 1; color: var(--s300); transition: color .2s; }
.cover-t { position: absolute; left: 14px; bottom: 12px; background: var(--accent); color: var(--black); font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; padding: 2px 6px; }
.cover-bf { position: absolute; right: 12px; bottom: 10px; width: 28px; height: 28px; border-radius: 9999px; background: var(--black); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 900; letter-spacing: -.02em; }
/* Ficha de identidad en la portada de cada artículo (<div class="card w6 ficha" data-ficha></div>, la rellena web.js) */
.card.ficha { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 12px; }
@media (min-width: 560px) { .card.ficha { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; } }
.card.ficha .cover { border-color: var(--s200); }
.card.ficha .cover-n { color: var(--black); }
.ficha-info { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 4px 8px 8px; }
.ficha-info .c-title { font-size: clamp(1.2rem, 1.8vw, 1.6rem); }
.deck-ico { display: block; width: 44px; height: 44px; margin: 0 0 10px; }

/* ---------- Pie ---------- */
footer.site {
  border-top: 1px solid var(--s200); padding: 32px 0 40px var(--rail);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--s400);
}
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
footer.site .sep { color: var(--black); background: var(--accent); padding: 0 3px; }

@media print {
  #nav-capsule, #progress, .toc, .series-nav { display: none !important; }
  main { padding-left: 0; }
  .hero { min-height: 0; }
}

/* ==========================================================================
   Artículo en dos capas (mismo patrón que el portfolio)
   Capa 1: una diapositiva a pantalla completa por idea, legible en 15 s,
   compuesta en bloques (titular + tarjetas visuales) a todo el ancho.
   Capa 2: ficha emergente con el detalle, también en tarjetas, sin repetir
   ningún texto de su diapositiva.
   ========================================================================== */
:root { --side: 0px; --pad: 16px; }
@media (min-width: 768px) { :root { --pad: 28px; } }
@media (min-width: 1200px) { :root { --side: 272px; --pad: 40px; } }
@media (min-width: 1200px) and (min-height: 700px) { html:has(.deck) { scroll-snap-type: y mandatory; } }
main.deck { padding-left: var(--side); overflow-x: clip; }
body:has(.deck) footer.site { padding-left: var(--side); }

.slide {
  position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  padding: 92px var(--pad) 84px; scroll-snap-align: start; border-bottom: 1px solid var(--s100);
}
@media (min-width: 1200px) { .slide { padding: 40px var(--pad); } }
.slide:nth-child(even) { background: var(--s50); }
.slide:nth-child(even) .card:not(.k):not(.y) { background: var(--white); }

/* Rejilla de bloques: titular a la izquierda, tarjetas a la derecha */
.bento { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; width: 100%; }
@media (min-width: 1000px) { .bento { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: stretch; } }
.b-title { display: flex; flex-direction: column; justify-content: center; padding: 8px 4px 16px 0; min-width: 0; }
.b-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
@media (min-width: 640px) { .b-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; } }
.w6, .w4 { grid-column: span 2; }
.w3, .w2 { grid-column: span 1; }
@media (min-width: 640px) { .w6 { grid-column: span 6; } .w4 { grid-column: span 4; } .w3 { grid-column: span 3; } .w2 { grid-column: span 2; } }
.m-full { grid-column: span 2; }
@media (min-width: 640px) { .m-full.w2 { grid-column: span 2; } .m-full.w3 { grid-column: span 3; } }

.slide-n { display: block; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--s400); margin-bottom: 12px; }
.slide .kicker-y { margin-bottom: 16px; }
.slide h2 { font-size: clamp(2.1rem, 4.6vw, 4rem); }
.slide h1.display { font-size: clamp(2.5rem, 6.4vw, 5.2rem); line-height: 1; }
@media (max-width: 480px) { .slide h2 { font-size: 2rem; } }
.slide-lead { margin: 18px 0 0; max-width: 36ch; font-size: 18px; line-height: 1.5; color: var(--s700); }
@media (min-width: 1200px) { .slide-lead { font-size: 20px; } }
.slide-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.l2-btn .plus { display: inline-block; font-size: 15px; line-height: 1; transition: transform .3s; }
.l2-btn:hover .plus { transform: rotate(90deg); }

/* Tarjeta */
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px;
  background: var(--white); border: 1px solid var(--s200); border-radius: 8px;
}
@media (min-width: 1200px) { .card { padding: 20px; } }
.card.g { background: var(--s50); }
.card.k { background: var(--black); border-color: var(--black); color: var(--white); }
.card.y { background: var(--accent); border-color: var(--black); }
.c-label { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--s500); line-height: 1.4; }
.card.k .c-label { color: var(--accent); }
.card.y .c-label { color: var(--black); }
.c-num { display: block; font-size: clamp(2.6rem, 5vw, 4.6rem); font-weight: 900; letter-spacing: -.05em; line-height: .9; }
.c-num small { font-size: .4em; letter-spacing: -.02em; margin-left: .08em; }
.c-num.xl { font-size: clamp(3.4rem, 7vw, 6.4rem); }
.c-text { font-size: 15px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; }
.c-title { font-size: clamp(1.05rem, 1.5vw, 1.3rem); font-weight: 900; text-transform: uppercase; letter-spacing: -.02em; line-height: 1.1; }
.c-foot { margin-top: auto; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--s500); line-height: 1.5; }
.card.k .c-foot { color: var(--s300); }
.card svg.draw { display: block; width: 100%; height: auto; max-height: 300px; }
.card .ico { width: 40px; height: 40px; display: block; }
.badge { display: inline-block; width: max-content; padding: 3px 8px; border-radius: 9999px; font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; border: 1px solid var(--black); }
.badge.y { background: var(--accent); }
.badge.k { background: var(--black); color: var(--white); }
.badge.n { border-color: var(--s300); color: var(--s500); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 11px; border: 1px solid var(--black); border-radius: 4px; font-size: 14px; font-weight: 800; line-height: 1.2; background: var(--white); color: var(--black); }
.chip .mono { font-size: 10px; font-weight: 700; color: var(--s500); }
.chip.y { background: var(--accent); }
.chip.k { background: var(--black); color: var(--white); }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flow .arrow { font-weight: 900; color: var(--s400); }

.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; font-weight: 700; }
.bar i { display: flex; align-items: center; height: 24px; padding-left: 8px; background: var(--s200); font-style: normal; font-size: 10px; color: var(--s600); white-space: nowrap; overflow: hidden; }
.bar.is-key i { background: var(--accent); border: 1px solid var(--black); color: var(--black); }

.step-n { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 9999px; background: var(--black); color: var(--white); font-family: var(--mono); font-size: 11px; font-weight: 700; flex-shrink: 0; }
.card.y .step-n { background: var(--black); }
.card.k .step-n { background: var(--accent); color: var(--black); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

/* Menú de diapositivas: lateral en escritorio, barra inferior en móvil */
#deck-nav { display: none; }
@media (min-width: 1200px) {
  #deck-nav {
    display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; width: var(--side); z-index: 95;
    padding: 100px 16px 20px 20px; background: var(--white); border-right: 1px solid var(--s200);
  }
  #deck-nav .kicker-y { margin-bottom: 12px; }
  #deck-nav ol { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
}
.nav-item a {
  display: grid; grid-template-columns: 30px 1fr; align-items: baseline; padding: 6px 8px; border-radius: 4px; text-decoration: none;
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; line-height: 1.25; color: var(--s400);
  transition: background .2s, color .2s;
}
.nav-item a span { font-family: var(--mono); font-size: 10px; font-weight: 700; }
.nav-item a:hover { color: var(--black); background: var(--s50); }
.nav-item a.is-current { background: var(--black); color: var(--white); }
.nav-item a.is-current span { color: var(--accent); }
.nav-item a.is-done { color: var(--s600); }
#deck-progress { height: 3px; background: var(--s100); margin: 12px 8px 0; }
#deck-progress i { display: block; height: 100%; width: 0; background: var(--black); transition: width .3s; }

#deck-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 96; }
@media (min-width: 1200px) { #deck-bar { display: none; } }
#deck-bar-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px 0 16px; border-radius: 9999px; cursor: pointer;
  background: var(--black); color: var(--white); border: 0; box-shadow: 0 10px 30px rgba(0,0,0,.18); text-align: left;
  font-family: var(--sans); font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em;
}
#deck-bar-btn .n { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--black); background: var(--accent); padding: 2px 6px; border-radius: 3px; }
#deck-bar-btn .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#deck-bar-btn .chev { width: 36px; height: 36px; border-radius: 9999px; background: var(--s800); display: flex; align-items: center; justify-content: center; transition: transform .3s; }
#deck-bar.is-open #deck-bar-btn .chev { transform: rotate(180deg); }
#deck-sheet {
  display: none; position: absolute; left: 0; right: 0; bottom: 62px; max-height: min(70vh, 560px); overflow-y: auto; padding: 10px;
  background: var(--white); border: 1px solid var(--s200); border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
#deck-bar.is-open #deck-sheet { display: block; }
#deck-sheet ol { list-style: none; margin: 0; padding: 0; }
#deck-sheet .nav-item a { padding: 10px 8px; font-size: 13px; }
@media (min-width: 640px) { #deck-bar { left: auto; width: 420px; } }

/* Capa 2: ficha emergente (como la ficha de los casos del CV) */
#l2-modal { position: fixed; inset: 0; z-index: 205; display: none; align-items: center; justify-content: center; padding: 8px; background: rgba(0,0,0,.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@media (min-width: 1024px) { #l2-modal { padding: 28px; } }
#l2-modal.is-visible { display: flex; }
.l2-panel {
  position: relative; width: 100%; max-width: 84rem; max-height: 94vh; max-height: 94svh; overflow-y: auto; background: var(--s50); border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); transform: translateY(24px) scale(.98); opacity: 0;
  transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .35s ease;
}
#l2-modal.is-open .l2-panel { transform: none; opacity: 1; }
.l2-close {
  position: sticky; top: 12px; float: right; margin-right: 12px; z-index: 2; width: 40px; height: 40px; border-radius: 9999px; cursor: pointer;
  background: var(--black); border: 0; font-size: 14px; font-weight: 900; color: var(--white); transition: background .2s, color .2s;
}
.l2-close:hover { background: var(--accent); color: var(--black); }
.l2-body { padding: 18px 12px 24px; }
@media (min-width: 768px) { .l2-body { padding: 28px 28px 32px; } }
.l2-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-right: 56px; margin-bottom: 16px; }
.l2-head h3 { margin: 0 !important; font-size: clamp(1.3rem, 2.4vw, 1.9rem) !important; font-weight: 900; text-transform: uppercase; letter-spacing: -.03em; line-height: 1; width: 100%; }
.l2-body .b-cards { gap: 12px; grid-auto-flow: row dense; }
.l2-body .card { font-size: 15px; line-height: 1.55; }
.l2-body .card p, .l2-body .card li { font-size: 15px; color: var(--s800); }
.l2-body .card.k p, .l2-body .card.k li, .l2-body .card.k strong { color: var(--white); }
.l2-body .card p { margin: 0; }
.l2-body .card ul, .l2-body .card ol { margin: 0; }
.l2-body .card h4 { margin: 0; font-size: 15px; font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; }
.l2-body .table-wrap { margin: 0; }
.l2-body pre { margin: 0; }
.l2-body .formula { margin: 0; }
.l2-body.prose { max-width: none; }
body.l2-lock { overflow: hidden; }

/* Pasos verticales compactos */
.vsteps { list-style: none; margin: 0 !important; padding: 0 !important; counter-reset: vs; display: grid; gap: 10px; }
.vsteps li { counter-increment: vs; position: relative; padding-left: 38px; min-height: 28px; margin: 0 !important; }
.vsteps li::before { content: counter(vs, decimal-leading-zero); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 9999px; background: var(--black); color: var(--white); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; font-weight: 700; }
.vsteps li:last-child::before { background: var(--accent); color: var(--black); border: 1px solid var(--black); }

.prose code { overflow-wrap: anywhere; }
@media print { #deck-nav, #deck-bar, .slide-actions { display: none !important; } main.deck { padding-left: 0; } .slide { min-height: 0; break-inside: avoid; } }

/* Capa 2 en móvil: una tarjeta por fila; diagramas contenidos */
@media (max-width: 767px) { .l2-body .b-cards > .card { grid-column: 1 / -1; } }
.l2-body .diagram { margin: 0; }
.l2-body .diagram svg { display: block; width: 100%; height: auto; max-height: 340px; }

/* ---------- Hilo narrativo: capítulos ---------- */
/* data-cap="I · El problema" en la primera slide de cada capítulo: cabecera en el menú y rótulo junto a la numeración */
.nav-cap { margin: 12px 0 4px; padding: 0 8px; font-family: var(--mono); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--black); display: flex; align-items: center; gap: 8px; }
.nav-cap::after { content: ""; flex: 1; height: 1px; background: var(--s200); }
.nav-cap:first-child { margin-top: 0; }
#deck-sheet .nav-cap { margin: 14px 0 4px; }
.slide-cap { display: inline-block; margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--s300); color: var(--black); font-weight: 700; }
.slide.is-cap-start .slide-cap { background: var(--black); color: var(--accent); border: 0; padding: 2px 8px; }

/* ---------- Capa 2 más visual ---------- */
.l2-body .card h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.l2-body .card h4::before { content: ""; width: 10px; height: 10px; flex-shrink: 0; background: var(--accent); border: 1.5px solid var(--black); }
.l2-body .card.y h4::before { background: var(--black); }
.l2-body .card.k h4::before { border-color: var(--accent); }
.l2-body .card.k h4 { color: var(--white); }
.l2-body .card ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.l2-body .card ul li { position: relative; padding-left: 18px; margin: 0; }
.l2-body .card ul li::before { content: ""; position: absolute; left: 2px; top: .6em; width: 7px; height: 7px; background: var(--black); }
.l2-body .card.k ul li::before { background: var(--accent); }
.l2-body .card ul.sources li::before, .l2-body .card ul.checklist li::before { content: none; }
.l2-body .card p + p { margin-top: 8px; }
.l2-body .card .step-n + .c-title { margin-top: 10px; display: block; }
.l2-body .card .c-title + p { margin-top: 6px; }
.l2-head .label { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--s500); }

/* Mapa del artículo por bloques (portada) */
.mapa { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.mapa a { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 2px 12px; padding: 8px 10px; background: var(--white); border: 1px solid var(--s200); border-radius: 6px; text-decoration: none; transition: border-color .2s, background .2s; }
.mapa a:hover { border-color: var(--black); }
.mapa b { grid-row: span 2; width: 34px; height: 34px; border-radius: 9999px; background: var(--black); color: var(--white); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; }
.mapa span { font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; font-size: 14px; line-height: 1.1; }
.mapa em { font-style: normal; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--s500); }
.mapa .is-key a { background: var(--accent); border-color: var(--black); }
.mapa .is-key b { background: var(--black); color: var(--accent); }
.mapa .is-key em { color: var(--black); }
@media (min-width: 1200px) { .mapa { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mapa li.is-key { grid-column: 1 / -1; } }
.w2 .c-num { font-size: clamp(2rem, 3.4vw, 3.2rem); }
.card { min-width: 0; overflow-wrap: break-word; } .card .c-title { hyphens: auto; }
.badge { max-width: 100%; }
.card.k code { background: rgba(255,255,255,.14); color: var(--white); border-color: transparent; }
