/* ====== TIPOGRAFÍA: Commit Mono (SIL OFL 1.1, cargada en el <head>) ====== */
:root {
  --font-main: "Commit Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-alt: var(--font-main);
  --bg: #fff;
  --fg: #3a3a3a;
  --accent: #2a2aff;
  --line: #999;
  --pad: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); height: 100%; overflow: hidden; }
body {
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--fg);
  background: var(--bg);
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, .row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ====== Cabecera ====== */
header { display: flex; gap: 28px; padding: var(--pad); margin-bottom: clamp(16px, 7vh, 70px); flex: none; }
header a:hover, header a[aria-current] { color: var(--accent); }
/* Iconos de redes, a la derecha, alineados con el menú */
header .redes { --icono: 2.4em; margin-left: auto; display: flex; align-items: flex-start; gap: var(--pad); margin-bottom: calc(1.2em - var(--icono)); }   /* --icono = tamaño de los iconos; el margen negativo evita que el menú crezca */
header .redes a { display: block; line-height: 0; }
header .redes img { display: block; height: var(--icono); width: auto; }
header .redes a:hover { color: inherit; }
header .redes a:hover img, header .redes a:focus-visible img { filter: url(#azul); }   /* el dibujo pasa al azul de los enlaces */

/* ====== Listado ====== */
.list { list-style: none; flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 4.5rem 1.4fr 1.6fr 1.6fr 2rem;
  gap: 0 16px;
  align-items: center;
  flex: 1 1 0;
  min-height: 0;
  max-height: 3.4rem;
  padding: 0 var(--pad);
  border-bottom: 1px dotted var(--line);
  font-weight: 300;
  cursor: pointer;
  transition: color .15s;
}
.row { position: relative; }
.row .plus { text-align: right; }
.row { transition: filter .25s, opacity .25s; }
/* Con un proyecto abierto, el resto se desenfoca */
.split.abierto .row:not(.activo) { filter: blur(3px); opacity: .55; }
/* Línea superior de la lista: se difumina como las demás (salvo si la fila 1 es la activa, que ya trae la suya nítida) */
.list::before { content: ""; flex: none; border-top: 1px dotted var(--line); transition: filter .25s, opacity .25s; }
.split.abierto .list::before { filter: blur(3px); opacity: .55; }
.split.abierto .list:has(.row:first-child.activo)::before { opacity: 0; }
/* La fila activa conserva sus dos líneas discontinuas nítidas */
.row.activo::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; border-top: 1px dotted var(--line); }

/* ====== Móvil: sin hover, columnas reducidas ====== */
@media (max-width: 800px) {
  .row { grid-template-columns: 2.5rem 1fr 1.5rem; }
  .row .cat, .row .role { display: none; }
}
@media (prefers-reduced-motion: reduce) { .row, .panel { transition: none; } }

/* ====== Footer ====== */
footer {
  flex: none;
  display: grid;
  grid-template-columns: 4.5rem 1.4fr 1.6fr 1.6fr 2rem;
  gap: 0 16px;
  padding: var(--pad);
  font-weight: 300;
}
footer span:first-child { grid-column: 1 / 3; }
footer span:nth-child(2) { grid-column: 3; }
footer a { grid-column: 4; justify-self: start; }
footer a:hover { color: var(--accent); }
@media (max-width: 800px) {
  footer { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
}

/* ====== Proyectos: carrusel horizontal ====== */
.stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.stage.drag { cursor: grabbing; }
.stage:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.slide {
  position: absolute;
  left: 0;
  top: 50%;
  margin: 0;
  background: #f2f2f2;
  will-change: transform;
}
.slide img, .slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}
.caption {
  position: absolute;
  left: 0; right: 0; bottom: var(--pad);
  text-align: center;
  font-weight: 300;
  pointer-events: none;
}

/* ====== Info ====== */
.info {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  font-weight: 300;
  line-height: 1.25;
}
/* Texto a sangre en los laterales, justificado y respetando mayúsculas originales */
.info .texto {
  padding: 0;
  text-align: justify;
  text-transform: none;
}
/* Foto centrada en el espacio que queda */
.info figure {
  margin: auto;
  width: clamp(120px, 15vw, 220px);
  aspect-ratio: 7 / 8;
  background: #f2f2f2;
}
.info figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 800px) { .info figure { margin: 32px auto; } }

/* ====== Listado + panel de descripción ====== */
.split { position: relative; flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }

.panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  left: max(33%, 26rem);       /* donde terminan las líneas de la lista */
  padding-left: var(--pad);    /* hueco entre la lista y el contenido = margen superior del menú */
  z-index: 5;
  background: var(--bg);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
  text-transform: none;
  font-weight: 400;
  font-size: 13px;
  line-height: 1.25;
}
.split.abierto .panel { opacity: 1; visibility: visible; }
/* El contenido se desliza para alinearse con la fila activa */
.panel-in { transition: transform .3s ease; will-change: transform; }

/* Tira de imágenes en movimiento lento (llega hasta el borde derecho) */
/* --th = altura común de todas las imágenes de la tira (el ancho es el original de cada una) */
.panel { --th: clamp(140px, 18vw, 320px); --gap: 14px; }
.tira { overflow: hidden; }
.pista { display: flex; gap: var(--gap); width: max-content; will-change: transform; }
.thumb {
  flex: none;
  height: var(--th);          /* misma altura para todas; el ancho es el original */
  padding: 0;
  border: 0;
  background: #ddd;
  cursor: zoom-in;
}
.pista a.video-enlace { position: relative; display: block; height: calc(var(--th) * 1.5); width: calc(var(--th) * 1.5 * 16 / 9); background: #111; }
.pista a.video-enlace img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pista a.video-enlace::after { content: "▶ Ver en YouTube"; position: absolute; left: 12px; bottom: 12px; padding: 4px 8px; background: var(--bg); color: var(--fg); font-size: 11px; line-height: 1.2; text-transform: uppercase; }
.pista a.video-enlace:hover::after { color: var(--accent); }
.pista iframe.video-fijo { display: block; border: 0; background: #000; height: calc(var(--th) * 1.5); width: calc(var(--th) * 1.5 * 16 / 9); }   /* vídeo único, fijo */
.thumb { position: relative; font: inherit; color: inherit; }
/* Etiqueta de la miniatura que abre la web en vivo */
.thumb.web::after { content: "↗ Ver web en vivo"; position: absolute; left: 8px; bottom: 8px; padding: 3px 6px; background: var(--bg); font-size: 11px; line-height: 1.2; text-transform: uppercase; }
.thumb.web.yt::after { content: "▶ Ver vídeo"; }
.thumb.cargando, .thumb.vacio { width: calc(var(--th) * 4 / 3); }
.thumb img, .thumb video { height: 100%; width: auto; max-width: none; display: block; }
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel h2 { margin-top: 30px; font-size: inherit; font-weight: 700; }
.panel p { margin-top: 16px; max-width: 58ch; padding-right: var(--pad); text-wrap: pretty; }   /* max-width = ancho de la caja de texto */

.cerrar { display: none; }

/* Imagen ampliada */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img, .lightbox video { max-width: 90vw; max-height: 84vh; object-fit: contain; display: block; }
.lightbox [hidden] { display: none; }
.lightbox iframe { width: min(94vw, 1500px); height: 80vh; border: 1px solid var(--line); background: #fff; cursor: auto; display: block; }
.lightbox iframe.video { width: min(92vw, calc(80vh * 16 / 9)); height: auto; aspect-ratio: 16 / 9; border: 0; background: #000; }
.lightbox .lb-link { position: absolute; top: var(--pad); right: var(--pad); text-transform: uppercase; color: inherit; text-decoration: none; cursor: pointer; }
.lightbox .lb-link:hover { color: var(--accent); }
.lightbox .lb-n { position: absolute; bottom: var(--pad); left: 0; right: 0; text-align: center; font-weight: 300; }
.lightbox button {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: none; border: 0; font: inherit; font-size: 28px; color: inherit; cursor: pointer; padding: 16px;
}
.lightbox .lb-prev { left: var(--pad); }
.lightbox .lb-next { right: var(--pad); }
.lightbox button:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) { .tira { overflow-x: auto; } }

@media (max-width: 800px) {
  .panel { left: 0; padding-left: 0; }
  .panel-in { transform: none !important; }
  /* Panel: fotos arriba (una y poco más), texto justificado y "Cerrar" subrayado abajo, pegados al pie */
  .panel { --th: clamp(180px, 29vh, 320px); overflow-y: auto; }
  .panel-in { display: flex; flex-direction: column; min-height: 100%; }
  .tira { margin-top: 18px; }
  /* Vídeo único: a todo el ancho de la pantalla */
  .pista iframe.video-fijo, .pista a.video-enlace { width: 100vw; height: calc(100vw * 9 / 16); }
  .panel h2 { margin-top: 0; padding: 36px var(--pad) 0; font-size: 14px; }   /* hueco bajo las fotos = hueco sobre ellas */
  .panel p { margin-top: 10px; max-width: none; padding: 0 var(--pad); font-size: 13px; font-weight: 300; line-height: 1.2; text-align: justify; }
  .cerrar { display: block; align-self: flex-start; margin: 18px var(--pad) 0; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 300; text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; color: inherit; cursor: pointer; }
  .cerrar:hover, .cerrar:active { color: var(--accent); }
}

/* Puntero: siempre la flecha normal del sistema (sin mano, lupa ni mano de arrastre) */
html, html * { cursor: default !important; }

/* ====== Móvil ====== */
/* Iconos de redes en el pie (solo se usan en Info y solo en móvil) */
footer .redes-pie { display: none; }
@media (max-width: 800px) {
  /* cabecera: mismo tamaño de letra que el pie, en una sola línea, sin iconos */
  header { gap: 12px; font-size: 12px; white-space: nowrap; }
  header .redes { display: none; }
  footer > span:first-child { white-space: nowrap; }   /* "© 2026" siempre en una línea */
  /* Info: los iconos sustituyen a "Ir al inicio" */
  footer.con-redes .inicio { display: none; }
  footer.con-redes { align-items: center; }
  footer.con-redes .redes-pie { display: flex; align-items: center; gap: var(--pad); margin-block: -0.4em; }   /* centrados con el texto del pie, sin hacerlo más alto */
  footer .redes-pie a { display: block; line-height: 0; }
  footer .redes-pie img { display: block; height: 2em; width: auto; }
  footer .redes-pie a:hover img, footer .redes-pie a:focus-visible img { filter: url(#azul); }
}