/* Sitio personal — dirección visual 1b (consola / brutalista).
 *
 * Principio V: sin sombras, sin gradientes, sin esquinas redondeadas, sin
 * iconografía decorativa. La separación se resuelve con reglas de 1px.
 * Cualquier color o tamaño nuevo entra primero como token acá arriba.
 *
 * Tres tokens se apartan de los valores literales de spec §5 porque esos no
 * llegaban a WCAG AA sobre --bg (FR-034). El ajuste es el mínimo que cumple,
 * manteniendo tono y saturación: ver §5 del spec y tools/check_contrast.py.
 */

/* ── Temas ────────────────────────────────────────────────────────────────
   Dos versiones de la misma identidad. La oscura es la dirección `1b`
   original; la clara reusa su crema (--surface-fg) como fondo para que se
   sientan el mismo sitio y no dos distintos.

   Resolución: preferencia guardada > preferencia del sistema > oscuro.
   El bloque claro va dos veces a propósito — uno para la elección explícita
   y otro para el sistema — porque CSS sin preprocesador no permite reusar un
   grupo de declaraciones bajo dos selectores distintos.

   Todos los pares de ambos temas se verifican con tools/check_contrast.py.  */

:root {
  /* Oscuro (por defecto) — spec §5 */
  --bg:            #14120E;
  --fg:            #E8E3D7;
  --fg-muted:      #ADA593;
  --fg-dim:        #8F8877;
  --fg-faint:      #847C68;
  --accent:        #CD5931;
  --accent-hover:  #DC6A40;
  --rule:          #2C2822;
  --rule-soft:     #221F19;
  --surface-fg:    #F3EFE4;
  --surface-hover: #191713;
  /* Sobre fondo oscuro exclusion aclara e invierte: el paquete destaca. */
  --pkt-blend:     exclusion;

  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;

  --pad: 48px;
  --measure: 46em;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:            #F3EFE4;
  --fg:            #14120E;
  --fg-muted:      #4A463C;
  --fg-dim:        #5E5849;
  --fg-faint:      #6B6454;
  --accent:        #B34E2B;
  --accent-hover:  #9B4425;
  --rule:          #D5CFC0;
  --rule-soft:     #E4DFD2;
  --surface-fg:    #0D0B08;
  --surface-hover: #E9E4D6;
  /* Sobre fondo claro exclusion volvería cian el naranja: multiply oscurece
     al cruzar una etiqueta y conserva el color de la marca. */
  --pkt-blend:     multiply;

  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:            #F3EFE4;
    --fg:            #14120E;
    --fg-muted:      #4A463C;
    --fg-dim:        #5E5849;
    --fg-faint:      #6B6454;
    --accent:        #B34E2B;
    --accent-hover:  #9B4425;
    --rule:          #D5CFC0;
    --rule-soft:     #E4DFD2;
    --surface-fg:    #0D0B08;
    --surface-hover: #E9E4D6;
    --pkt-blend:     multiply;

    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* La cabecera es fija: sin esto los anclajes quedan tapados. */
  scroll-padding-top: 84px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  /* Cinturón de seguridad para FR-023: nada se sale del ancho. */
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--sans); font-weight: 600; margin: 0; }
p, ul, ol { margin: 0; }
ul, ol { list-style: none; padding: 0; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--bg);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.skip:focus { left: 0; }

/* ── Cabecera ─────────────────────────────────────────────────────────── */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 var(--pad);
  height: 60px;
}

.brand {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
}
.brand__tld { color: var(--fg-dim); }

.topbar__links {
  display: flex;
  gap: 26px;
  margin-left: auto;
  font-size: 12.5px;
  color: var(--fg-muted);
}

.lang { display: flex; align-items: center; gap: 6px; }

.lang__btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 2px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  cursor: pointer;
}
.lang__btn:hover { color: var(--fg); }
.lang__btn[aria-pressed="true"] { color: var(--accent); }
.lang__sep { color: var(--rule); font-size: 12px; }

.theme {
  margin-left: 4px;
  padding-left: 14px;
  border-left: 1px solid var(--rule);
}

.theme__btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 2px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  cursor: pointer;
  white-space: nowrap;
}
.theme__btn:hover { color: var(--accent); }

/* ── Hero ─────────────────────────────────────────────────────────────── */

.hero {
  padding: clamp(104px, 13vh, 168px) var(--pad) clamp(56px, 7vh, 104px);
  border-bottom: 1px solid var(--rule);
}

.hero__kicker {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 28px;
}

.hero__headline {
  font-size: clamp(34px, 5.1vw, 76px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  color: var(--surface-fg);
  max-width: 20em;
  margin-bottom: 28px;
  text-wrap: balance;
}

.hero__positioning {
  max-width: var(--measure);
  color: var(--fg-muted);
  margin-bottom: 36px;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg);
}
.btn:hover { border-color: var(--fg-dim); color: var(--fg); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--bg); }

/* ── Secciones ────────────────────────────────────────────────────────── */

.section {
  padding: 88px var(--pad);
  border-bottom: 1px solid var(--rule);
}

.section__title {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  padding-bottom: 18px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
.section__title--sub { margin-top: 64px; }

/* ── Tabla de proyectos ───────────────────────────────────────────────── */

.table__head,
.project {
  display: grid;
  grid-template-columns: 40px 1.05fr 1.5fr 210px;
  gap: 20px;
}

.table__head {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.project {
  align-items: start;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.project:last-child { border-bottom: 0; }

.project__num {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  padding-top: 3px;
}

.project__title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--surface-fg);
  letter-spacing: -0.01em;
}

.project__desc {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--fg-muted);
}

.project__stack {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--fg-dim);
}

/* ── Stack ────────────────────────────────────────────────────────────── */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  max-width: 64em;
}
.tag { font-size: 13px; color: var(--fg-muted); }

/* ── Trayectoria y formación ──────────────────────────────────────────── */

.entries { max-width: 72em; }

.entry {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.entry:last-child { border-bottom: 0; }

.entry__when {
  font-size: 12px;
  color: var(--fg-dim);
  padding-top: 3px;
}

.entry__role {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--surface-fg);
  letter-spacing: -0.01em;
}

.entry__org {
  font-size: 12.5px;
  color: var(--accent);
  margin: 2px 0 6px;
}

.entry__detail {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--fg-muted);
  max-width: var(--measure);
}

/* ── Contacto ─────────────────────────────────────────────────────────── */

.contact__intro {
  max-width: var(--measure);
  color: var(--fg-muted);
  margin-bottom: 28px;
}

.channels { max-width: 46em; }

.channels li {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 13.5px;
}

.channels__label {
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-faint);
  padding-top: 2px;
}

.channels a { color: var(--fg); border-bottom: 1px solid var(--rule); }
.channels a:hover { color: var(--accent); border-color: var(--accent); }

.colophon {
  margin-top: 40px;
  font-size: 11.5px;
  color: var(--fg-faint);
}

footer.section { border-bottom: 0; }

/* ── Tramo medio: 700–1199px ──────────────────────────────────────────── */

@media (max-width: 1199px) {
  .hero__headline { font-size: 56px; }

  /* La columna de stack se pliega bajo el título del proyecto (FR-022). */
  .table__head,
  .project { grid-template-columns: 40px 1fr 1.5fr; }

  .table__head span:last-child { display: none; }

  .project__stack {
    grid-column: 2;
    margin-top: 8px;
  }
}

/* ── Móvil: <700px ────────────────────────────────────────────────────── */

@media (max-width: 380px) {
  /* A 320px la cabecera no da para el separador ni el aire del conmutador. */
  .topbar__inner { gap: 10px; }
  .theme { margin-left: 0; padding-left: 8px; }
  .brand__tld { display: none; }
}

@media (max-width: 699px) {
  :root { --pad: 24px; }

  body { font-size: 15px; }

  .topbar__inner { gap: 16px; height: 56px; }
  .topbar__links { display: none; }
  .brand { font-size: 12.5px; }

  .hero { padding: 116px var(--pad) 72px; }
  .hero__headline { font-size: 36px; letter-spacing: -0.02em; }
  .hero__kicker { font-size: 11px; line-height: 1.6; }
  .hero__actions .btn { flex: 1 1 auto; text-align: center; }

  .section { padding: 56px var(--pad); }

  /* Cada proyecto deja de ser fila de tabla y pasa a bloque apilado. */
  .table__head { display: none; }

  .project {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 26px 0;
  }
  .project__num { padding-top: 0; }
  .project__desc { font-size: 14px; }
  .project__stack { grid-column: auto; margin-top: 4px; }

  .entry { grid-template-columns: 1fr; gap: 6px; }
  .entry__when { padding-top: 0; }
  .entry__detail { font-size: 14px; }

  .channels li { grid-template-columns: 1fr; gap: 4px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   MOVIMIENTO — Principio VI: cada animación muestra algo que el texto declara.
   Todo se anula bajo prefers-reduced-motion dejando un estado final legible.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Pipeline del hero ────────────────────────────────────────────────────
   Es un esquema de los pipelines que corren en producción. Los paquetes
   viajan y los nodos se encienden en cascada: el ciclo dura 5s y cada etapa
   entra con un segundo de desfasaje (--i).                                  */

.pipe {
  margin: 0 0 32px;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.pipe__caption,
.pipe__note {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
}

.pipe__note {
  letter-spacing: 0.02em;
  font-size: 11.5px;
  margin-top: 20px;
  color: var(--fg-dim);
}

.pipe__flow {
  display: flex;
  align-items: center;
  margin-top: 22px;
  max-width: 76em;
}

/* El desfasaje de cada etapa vive acá y no en un atributo style del HTML:
   así la CSP puede prohibir estilos en línea. Cada nodo y el enlace que le
   sigue comparten índice. */
.pipe__flow > li:nth-child(1), .pipe__flow > li:nth-child(2) { --i: 0; }
.pipe__flow > li:nth-child(3), .pipe__flow > li:nth-child(4) { --i: 1; }
.pipe__flow > li:nth-child(5), .pipe__flow > li:nth-child(6) { --i: 2; }
.pipe__flow > li:nth-child(7), .pipe__flow > li:nth-child(8) { --i: 3; }
.pipe__flow > li:nth-child(9) { --i: 4; }

.pipe__node {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--rule);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
  white-space: nowrap;
  animation: node-on 5s linear infinite;
  animation-delay: calc(var(--i) * 1s);
}

@keyframes node-on {
  0%, 3%   { border-color: var(--accent); color: var(--fg); }
  16%      { border-color: var(--accent); color: var(--fg); }
  26%, 100%{ border-color: var(--rule);   color: var(--fg-dim); }
}

.pipe__link {
  position: relative;
  flex: 1 1 auto;
  height: 1px;
  min-width: 26px;
  background: var(--rule);
}

.pipe__pkt {
  position: absolute;
  top: 50%;
  left: 0;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  background: var(--accent);
  /* Técnica del video (min 14): al cruzar una etiqueta el paquete se
     invierte en vez de taparla. */
  mix-blend-mode: var(--pkt-blend);
  animation: pkt 5s linear infinite;
  animation-delay: calc(var(--i) * 1s + 0.15s);
}

@keyframes pkt {
  0%        { left: 0;    opacity: 0; }
  3%        { opacity: 1; }
  17%       { left: 100%; opacity: 1; }
  20%, 100% { left: 100%; opacity: 0; }
}

/* ── Cifras ───────────────────────────────────────────────────────────── */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 56px;
  margin-bottom: 34px;
}

.stat { display: flex; flex-direction: column; gap: 2px; }

.stat__num {
  font-family: var(--sans);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--surface-fg);
  font-variant-numeric: tabular-nums;
}

.stat__label {
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
}

/* ── Reveals al scroll ────────────────────────────────────────────────────
   El contenido está presente desde el primer pintado (Principio VI): lo que
   se anima es un desplazamiento leve, no la visibilidad. Sin JavaScript la
   clase .is-in nunca llega y el estado por defecto ya es el final.          */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s ease;
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* Las filas de la tabla entran escalonadas. */
.js .project.reveal,
.js .entry.reveal { transition-delay: calc(var(--r, 0) * 45ms); }

/* ── Tabla de proyectos interactiva ───────────────────────────────────── */

.project {
  position: relative;
  transition: background-color .18s ease;
}

/* Barra de acento que crece desde el borde al pasar el puntero. */
.project::before {
  content: '';
  position: absolute;
  left: calc(var(--pad) * -1);
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .22s ease;
}

.project:hover::before,
.project:focus-within::before { transform: scaleY(1); }

.project:hover,
.project:focus-within { background: var(--surface-hover); }

.project:hover .project__title { color: var(--accent); }
.project:hover .project__desc  { color: var(--fg); }
.project__title { transition: color .18s ease; }
.project__desc  { transition: color .18s ease; }

/* ── Barra de progreso de lectura ─────────────────────────────────────────
   Atada al scroll (técnica del video, min 50). Usa scroll-driven animations
   donde existen; donde no, simplemente no aparece.                          */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  background: var(--accent);
  z-index: 60;
}

@supports (animation-timeline: scroll()) {
  .progress {
    animation: grow linear;
    animation-timeline: scroll(root block);
  }
  @keyframes grow { to { transform: scaleX(1); } }
}

/* ── Respeto por prefers-reduced-motion ───────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .pipe__node {
    animation: none;
    border-color: var(--rule);
    color: var(--fg-dim);
  }
  .pipe__pkt { animation: none; opacity: 0; }

  .js .reveal { opacity: 1; transform: none; transition: none; }

  .project::before { transition: none; }
  .progress { animation: none; transform: scaleX(0); }
}

/* ── Movimiento en pantallas chicas ───────────────────────────────────── */

@media (max-width: 899px) {
  /* El pipeline pasa a vertical: en horizontal las etiquetas se ilegibilizan. */
  .pipe__flow { flex-direction: column; align-items: flex-start; }
  .pipe__node { width: 100%; }
  .pipe__link {
    width: 1px;
    height: 22px;
    min-width: 0;
    margin-left: 20px;
    flex: 0 0 auto;
  }
  @keyframes pkt {
    0%        { top: 0;    left: 0; opacity: 0; }
    3%        { opacity: 1; }
    17%       { top: 100%; left: 0; opacity: 1; }
    20%, 100% { top: 100%; left: 0; opacity: 0; }
  }
  .pipe__pkt { left: -2px; }
}

@media (max-width: 699px) {
  .stat__num { font-size: 28px; }
  .stats { gap: 18px 36px; }
  .project::before { left: calc(var(--pad) * -1); width: 2px; }
}

/* ── Carrusel de imágenes de proyecto ────────────────────────────────────
   El disparador lo inyecta gallery.js: sin JavaScript no existe, en vez de
   quedar un botón que no lleva a ningún lado.                               */

.shots-btn {
  justify-self: start;
  appearance: none;
  background: none;
  border: 1px solid var(--rule);
  padding: 4px 10px;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg-dim);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease;
}
.shots-btn:hover,
.shots-btn:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

/* Solo en la tabla de 4 columnas: el disparador se inserta antes del stack,
   así que sin esto caería en una quinta columna implícita. Ambos piden la
   columna 4 y el grid los apila en filas sucesivas dentro de ella.
   Va acotado por media query a propósito: suelto pisaba los tramos de abajo
   y mandaba el stack a la columna 4 también en móvil. */
@media (min-width: 1200px) {
  .shots-btn,
  .project__stack { grid-column: 4; }
}

body.gal-open { overflow: hidden; }

.gal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  /* color-mix mantiene el velo atado al tema en vez de fijar un negro. */
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.gal[hidden] { display: none; }

.gal__panel {
  position: relative;
  width: min(1120px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--rule);
}

.gal__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--rule);
}

.gal__title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--surface-fg);
}

.gal__count {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--fg-faint);
  white-space: nowrap;
}

.gal__fig {
  margin: 0;
  min-height: 0;
  display: flex;
}

.gal__fig img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 68vh;
  object-fit: contain;
  object-position: top;
}

.gal__foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  border-top: 1px solid var(--rule);
}

.gal__nav,
.gal__close {
  appearance: none;
  background: none;
  border: 1px solid var(--rule);
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
  padding: 7px 13px;
  cursor: pointer;
}
.gal__nav:hover,
.gal__close:hover { color: var(--accent); border-color: var(--accent); }

.gal__close { padding: 3px 11px; font-size: 17px; }

.gal__note {
  flex: 1;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
  text-align: center;
}

.gal__dots { display: flex; gap: 8px; flex: 0 0 auto; }

.gal__dot {
  appearance: none;
  width: 26px;
  height: 3px;
  padding: 0;
  border: 0;
  background: var(--rule);
  cursor: pointer;
}
.gal__dot[aria-current="true"] { background: var(--accent); }

@media (max-width: 1199px) {
  .shots-btn { grid-column: 2; grid-row: auto; margin-top: 8px; justify-self: start; }
  .project__stack { grid-column: 2; }
  .gal { padding: 20px; }
  .gal__fig img { max-height: 60vh; }
}

@media (max-width: 699px) {
  /* En una sola columna, todo vuelve al flujo. `grid-column: 2` heredado del
     tramo de arriba creaba una segunda columna implícita que dejaba la
     descripción en 109px y 15 líneas. */
  .shots-btn { grid-column: auto; grid-row: auto; margin-top: 4px; }
  .project__stack { grid-column: auto; }
  .gal { padding: 12px; }
  .gal__note { display: none; }   /* no hay ancho: el aviso queda en la imagen */
  .gal__head { padding: 13px 16px; }
  .gal__title { font-size: 13px; }
  .gal__foot { padding: 10px 16px; }
  .gal__fig img { max-height: 52vh; }
}

@media print { .gal, .shots-btn { display: none; } }

/* ── Pantallas bajas ──────────────────────────────────────────────────────
   Una MacBook Air ronda los 700-780px de alto útil. Sin esto el hero mide
   1072px: el titular ocupa media pantalla y las cifras y los botones quedan
   abajo del pliegue. La escala tipográfica de §5 vale para pantallas altas;
   acá se comprime para que el hero completo entre de una.                   */

@media (max-height: 900px) and (min-width: 700px) {
  .hero { padding-top: 92px; padding-bottom: 48px; }
  .hero__headline { font-size: clamp(32px, 3.7vw, 54px); margin-bottom: 22px; }
  .hero__kicker { margin-bottom: 20px; }
  .hero__positioning { margin-bottom: 26px; }
  .pipe { margin-bottom: 24px; padding: 20px 0; }
  .pipe__flow { margin-top: 16px; }
  .pipe__note { margin-top: 14px; }
  .stats { margin-bottom: 26px; gap: 12px 48px; }
  .stat__num { font-size: 28px; }
}

@media (max-height: 760px) and (min-width: 700px) {
  .hero { padding-top: 80px; padding-bottom: 40px; }
  .hero__headline { font-size: clamp(30px, 3.1vw, 44px); }
  .pipe { padding: 16px 0; margin-bottom: 20px; }
  .stat__num { font-size: 25px; }
}

/* ── Impresión ────────────────────────────────────────────────────────────
   Es un CV: alguien lo va a imprimir o guardar como PDF desde el navegador.
   Sin esto, todo lo que no alcanzó a revelarse sale en blanco, y el fondo
   oscuro se come un cartucho.                                               */

@media print {
  /* Lo primero: nada puede quedar invisible en papel. */
  .js .reveal,
  .js .reveal.is-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  :root {
    --bg: #FFFFFF;
    --fg: #14120E;
    --fg-muted: #3A362E;
    --fg-dim: #55503F;
    --fg-faint: #55503F;
    --surface-fg: #000000;
    --accent: #A8431F;
    --rule: #B9B3A5;
    --rule-soft: #D6D1C5;
  }

  body { background: #fff; color: #14120E; font-size: 10.5pt; line-height: 1.5; }

  /* Controles que en papel no hacen nada. */
  .topbar, .progress, .skip, .lang, .hero__actions, .pipe__pkt { display: none; }

  .hero { padding: 0 0 18pt; border-bottom: 1px solid var(--rule); }
  .hero__headline { font-size: 26pt; max-width: none; }
  .section { padding: 18pt 0; }

  .pipe__node { animation: none; border-color: var(--rule); color: var(--fg-dim); }

  .project, .entry { page-break-inside: avoid; }
  .section__title { page-break-after: avoid; }

  /* En papel un enlace sin su dirección es texto muerto. */
  .channels a::after { content: ' (' attr(href) ')'; font-size: 8.5pt; color: var(--fg-dim); }
  .channels a[href^="mailto:"]::after,
  .channels a[href^="https://api.whatsapp"]::after { content: ''; }
}
