/* davidalesina.com — hoja de estilos única */

/* Tipografías alojadas en la propia web (assets/fonts), sin depender de Google Fonts.
   Títulos y menú: Courier Prime. Texto: Inter. Las dos con licencia SIL OFL (gratuitas,
   también para uso comercial); las licencias están en la misma carpeta. */
@font-face { font-family: "Courier Prime"; src: url("fonts/courierprime-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("fonts/courierprime-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("fonts/courierprime-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --bg: #000;
  --fg: #fff;
  --pad: 30px;
  --head: 76px;                                                    /* alto de la cabecera */
  --serif: "Courier Prime", "Courier New", Courier, monospace;     /* títulos y menú */
  --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif; /* texto */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* Etiquetas pequeñas: menú del móvil, créditos, pies de foto, pie de página */
.label { font-size: 13px; font-weight: 500; line-height: 1.35; }

/* Foco visible para quien navega con teclado */
a:focus-visible, button:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

/* ================= CABECERA ================= */
/* El nombre en Inter en el centro; el menú en Courier Prime y mayúsculas a los lados; línea blanca debajo */

.site-header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* izquierda | nombre | derecha */
  align-items: baseline;
  padding: 20px var(--pad) 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--fg);
}
.site-header .name {
  order: 2;
  font-weight: 500;
  font-size: clamp(21px, 2.16vw, 35px);
  letter-spacing: -0.035em;
  line-height: 1;
  white-space: nowrap;
}
.site-header nav { display: contents; }
.site-header .side { display: flex; gap: 32px; }
.site-header .side.left { order: 1; justify-content: flex-start; padding-right: 24px; }
.site-header .side.right { order: 3; justify-content: flex-end; padding-left: 24px; }
.site-header nav a {
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  font-family: var(--serif);
  font-size: 18.7px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: opacity 0.2s ease;
}
.site-header nav a:hover { opacity: 0.55; }
.site-header nav a[aria-current="page"] { border-bottom-color: var(--fg); }

.menu-toggle {
  display: none;
  margin-left: auto;
  padding: 6px 0;
  background: none;
  border: 0;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 16.5px;
  text-transform: uppercase;
  cursor: pointer;
}

/* ================= PIE ================= */

.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 30px;
  margin-top: 90px;
  padding: 24px var(--pad);
}
.site-footer .links { display: flex; flex-wrap: wrap; gap: 10px 30px; }
.site-footer a:hover { opacity: 0.55; }

/* ================= PORTADA ================= */
/* Cada proyecto: título y debajo una fila de imágenes de la misma altura, sin recortar
   (work.js calcula los tamaños). Línea blanca debajo de cada proyecto. */

.pblocks { padding: calc(var(--head) + 24px) var(--pad) 0; }

.pb { position: relative; display: block; padding: 28px 0 48px; }
.pb.is-first { padding-top: 6px; }   /* la cabecera ya tiene su línea */
.pb::after {   /* pseudo-elemento para poder trazarlo en la animación del filtro */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--fg);
  transform-origin: left center;
}
.pb.is-drawing { visibility: hidden; }
.pb.line-off::after { transform: scaleX(0); }
.pb.draw-line::after { animation: draw-line 0.6s cubic-bezier(.6, 0, .2, 1) both; }
@keyframes draw-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.pb-title {
  display: block;
  margin-bottom: 16px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.pb-strip { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.pb-strip > * {
  display: block;
  flex: none;
  max-width: 100%;
  object-fit: contain;
  background: #0d0d0d;
  transition: opacity 0.25s ease;
}
.pb:hover .pb-strip > * { opacity: 0.85; }

/* ================= PÁGINA DE PROYECTO ================= */
/* Franja con el título | columna principal (vídeo o visor + descripción) | BITS | REFERENCES.
   Ocupa toda la pantalla bajo la cabecera; cada columna hace scroll por su cuenta. */

body[data-page="project"] { overflow: hidden; }

.pj {
  position: fixed;
  top: var(--head);
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
}
.pj.pj-photo, .pj.pj-norefs { grid-template-columns: 58px minmax(0, 2fr) minmax(0, 1fr); }
.pj.pj-missing { display: block; padding: 0 var(--pad); }

/* Franja con el título en vertical, en bucle, y Back al pie */
.pj-strip { position: relative; overflow: hidden; border-right: 1px solid var(--fg); }
.pj-strip .mq-wrap { position: absolute; inset: 0 0 52px 0; overflow: hidden; }
.pj-strip .mq {
  position: absolute;
  left: 50%;
  bottom: 0;
  writing-mode: vertical-rl;
  transform: translateX(-50%) rotate(180deg);
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1;
}
.pj-strip .mq-inner { display: inline-block; animation: mq 38s linear infinite; }
.pj-strip .mq-inner span { padding-inline-end: 0.9em; }
@keyframes mq { from { transform: translateY(0); } to { transform: translateY(-50%); } }
.pj-strip .nav-pj {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  border-top: 1px solid var(--fg);
  text-transform: uppercase;
  font-size: max(13px, 1.04vw);
}
.pj-strip .nav-pj a { height: 52px; display: flex; align-items: center; justify-content: center; }
.pj-strip .nav-pj a:hover { opacity: 0.55; }

/* Columna principal: el vídeo sube con el texto al hacer scroll */
.pj-main { min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--fg); }
.pj-film { padding: 20px; border-bottom: 1px solid var(--fg); }
.pj-main .pj-col { display: block; }
.pj-main .pj-col > h2 { display: none; }   /* sin etiqueta «Description» */
.pj-main .pj-scroll { overflow: visible; padding-top: 22px; }

.pj-col { display: flex; flex-direction: column; min-height: 0; }
.pj > .pj-col:not(:last-child) { border-right: 1px solid var(--fg); }
.pj-col > h2 {
  margin: 0;
  padding: 0.7vw 12px;
  min-height: 2.6vw;
  border-bottom: 1px solid var(--fg);
  text-align: center;
  text-transform: uppercase;
  font-size: max(13px, 1.25vw);
  font-weight: 400;
  line-height: 1.1;
}
.pj-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 20px 60px; }

/* Sin barras de scroll visibles (se sigue pudiendo hacer scroll) */
.pj-main, .pj-scroll { scrollbar-width: none; }
.pj-main::-webkit-scrollbar, .pj-scroll::-webkit-scrollbar { display: none; }

.pj figure { margin: 0 0 26px; }
.pj figure img, .pj figure video { width: 100%; height: auto; background: #0d0d0d; }
.pj figcaption { margin-top: 8px; }
.pj .zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.pj .zoom:hover img { opacity: 0.85; }
.pj button:focus-visible, .pj a:focus-visible { outline-offset: 3px; }

/* Descripción: título y subtítulo arriba; sinopsis a la izquierda y créditos a la derecha */
.pj-desc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 40px; }
.pj-desc .head, .pj-desc .next-project { grid-column: 1 / -1; }
.pj-desc h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 3vw, 50px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.pj-desc .sub { margin: 0 0 24px; font-size: 20px; line-height: 1.2; }
.pj-desc .text:empty { display: none; }
.pj-desc .text:empty + .credits { grid-column: 1 / -1; }   /* sin sinopsis, los créditos ocupan su sitio */
.pj-desc .text p { margin: 0 0 1em; max-width: 60ch; text-align: justify; hyphens: auto; }   /* sinopsis siempre justificada */
.pj-desc .text p.quote { font-style: italic; text-align: left; }
.credits { margin: 0; }
.credits div { margin-bottom: 14px; }
.credits dt { margin-bottom: 3px; }
.credits dd { margin: 0; }

/* Pestañas de idioma (sinopsis y bio) */
.tabs { display: flex; gap: 18px; margin-bottom: 14px; }
.tabs button {
  padding: 0 0 3px;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.tabs button[aria-selected="true"] { border-bottom-color: var(--fg); }

.next-project {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin-top: 50px;
  padding: 26px 0;
}
.next-project .title { font-family: var(--serif); font-size: clamp(26px, 3.4vw, 44px); line-height: 1.05; text-align: right; }
.next-project:hover .title { opacity: 0.6; }

/* Reproductor: barra propia Play / Sound / Full screen / tiempo */
.player { position: relative; background: #0d0d0d; }
.player video { width: 100%; height: auto; cursor: pointer; }
.player-vimeo { background: none; }
.vimeo { position: relative; aspect-ratio: 16 / 9; background: #0d0d0d; }
.vimeo iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pl-hit { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }   /* clic sobre el vídeo = play/pausa */
.player-vimeo.no-api .pl-bar, .player-vimeo.no-api .pl-hit { display: none; }   /* sin API de Vimeo: sus controles */
.pl-bar { display: flex; align-items: center; gap: 22px; padding: 10px 0 0; background: var(--bg); }
.pl-bar button { padding: 0; background: none; border: 0; color: var(--fg); font: inherit; cursor: pointer; }
.pl-bar button:hover { opacity: 0.55; }
.pl-bar .pl-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.player:fullscreen { display: flex; flex-direction: column; justify-content: center; background: #000; }
.player:fullscreen video { max-height: calc(100vh - 50px); object-fit: contain; }
.player:fullscreen .pl-bar { padding: 12px var(--pad); }

/* Proyecto de foto: visor grande y hoja de contactos */
.vw-stage {
  height: calc(100vh - var(--head) - 92px);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vw-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: e-resize; }
.viewer:fullscreen { display: flex; flex-direction: column; justify-content: center; background: #000; padding: 0 var(--pad); }
.viewer:fullscreen .vw-stage { height: calc(100vh - 56px); }
.contacts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.contacts button { aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; opacity: 0.4; transition: opacity 0.2s; }
.contacts button:hover { opacity: 0.75; }
.contacts button.is-on { opacity: 1; }
.contacts img { width: 100%; height: 100%; object-fit: contain; }

.pj-tabs { display: none; }   /* pestañas de columnas: solo en el móvil */

/* Visor de imágenes a pantalla completa */
.lightbox { position: fixed; inset: 0; z-index: 100; background: #000; }
.lightbox img {
  position: absolute;
  inset: 60px var(--pad);
  width: calc(100% - 2 * var(--pad));
  height: calc(100% - 120px);
  object-fit: contain;
}
.lightbox button { position: absolute; background: none; border: 0; color: var(--fg); font: inherit; cursor: pointer; }
.lb-prev, .lb-next { top: 60px; bottom: 60px; width: 50%; }
.lb-prev { left: 0; cursor: w-resize; }
.lb-next { right: 0; cursor: e-resize; }
.lb-close { top: 22px; right: var(--pad); padding: 6px 0; }
.lb-count { position: absolute; bottom: 22px; left: var(--pad); }

/* ================= ABOUT, CONTACT, 404 ================= */

main.page { padding: 130px var(--pad) 0; }

.about { display: grid; grid-template-columns: 1fr 3fr; align-items: start; }
.about .portrait { padding-right: 30px; }
.about .portrait img { width: 100%; height: auto; }
.about .body { max-width: 68ch; }
.about h1 {
  margin: 0 0 30px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 1.02;
}
.about .tabs { margin-bottom: 18px; }
.about .bio p { margin: 0 0 1em; font-size: 17px; }

.contact {
  min-height: calc(100svh - 110px);
  display: grid;
  grid-template-columns: 1fr 3fr;
  align-content: center;
  padding-bottom: 110px;
}
.contact .inner { grid-column: 2; }
.contact .mail {
  display: inline-block;
  font-family: var(--serif);
  font-size: clamp(30px, 5.4vw, 76px);
  line-height: 1.05;
  word-break: break-word;
}
a.mail:hover { opacity: 0.6; }
.contact h1.mail { margin: 0; font-weight: 400; }
.contact .links { display: flex; flex-wrap: wrap; gap: 10px 30px; margin-top: 34px; }
.contact .links a { border-bottom: 1px solid transparent; padding-bottom: 3px; }
.contact .links a:hover { border-bottom-color: var(--fg); }

/* Proyecto que no existe y aviso de error en projects.js */
.not-found, .load-error { padding: 60px 0; font-family: var(--serif); font-size: 32px; line-height: 1.2; }
.load-error .label { display: block; margin-top: 14px; font-family: var(--sans); }
.pblocks .load-error, .pj .load-error { padding: 60px var(--pad); }

/* ================= TABLET ================= */

@media (min-width: 768px) and (max-width: 1100px) {
  .pj { grid-template-columns: 52px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
  .pj.pj-photo, .pj.pj-norefs { grid-template-columns: 52px minmax(0, 2fr) minmax(0, 1fr); }
  .pj-scroll { padding: 20px 14px 50px; }
  .pj-film { padding: 16px 14px 20px; }
  .pj-desc { display: block; }
  .contacts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) and (max-width: 880px) {
  .site-header .side { gap: 18px; }   /* menos aire para que el nombre siga centrado */
}

/* ================= MÓVIL ================= */

@media (max-width: 767px) {
  :root { --pad: 20px; --head: 70px; }

  /* Cabecera: nombre y botón Menu; el menú se abre a pantalla completa */
  .site-header { display: flex; padding: 16px var(--pad); pointer-events: none; }
  .site-header a, .site-header button { pointer-events: auto; }
  .site-header .name { order: 0; font-size: 17.6px; }
  .site-header .side { display: contents; }
  .menu-toggle { display: block; }
  .site-header nav {
    position: fixed;
    inset: 0;
    z-index: -1;
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
    padding: 0 var(--pad);
    background: #000;
  }
  .site-header nav a { align-self: flex-start; font-size: 44px; letter-spacing: 0; line-height: 1.1; }
  .menu-open .site-header nav { display: flex; pointer-events: auto; }
  .menu-open { overflow: hidden; }

  /* Portada: el teaser primero, en su propia fila */
  .pblocks { padding-top: calc(var(--head) + 16px); }
  .pb { padding: 20px 0 36px; }
  .pb-strip > .pb-loop { order: -1; }

  /* Proyecto: franja | vídeo arriba, pestañas, y la columna elegida debajo */
  .pj { grid-template-columns: 44px minmax(0, 1fr) !important; grid-template-rows: auto auto minmax(0, 1fr); }
  .pj-strip { grid-row: 1 / -1; }
  .pj-strip .mq { font-size: 22px; }
  .pj-strip .mq-wrap { bottom: 60px; }
  .pj-strip .nav-pj a { height: 60px; writing-mode: vertical-rl; transform: rotate(180deg); }
  .pj-main { display: contents; }
  .pj-film { grid-column: 2; grid-row: 1; padding: 12px 12px 4px; border-bottom: 0; }
  .pj-col, .pj-main .pj-col { grid-column: 2; grid-row: 3; display: none; border-right: 0 !important; }
  .pj-col.is-on, .pj-main .pj-col.is-on { display: flex; }
  .pj-col > h2 { display: none; }
  .pj-scroll, .pj-main .pj-scroll { overflow-y: auto; padding: 14px 12px 50px; }
  .pj-desc { display: block; }
  .pj-tabs {
    grid-column: 2; grid-row: 2;
    display: flex;
    border-top: 1px solid var(--fg);
    border-bottom: 1px solid var(--fg);
    text-transform: uppercase;
  }
  .pj-tabs button { flex: 1; padding: 12px 4px; background: none; border: 0; color: var(--fg); font: inherit; text-transform: inherit; cursor: pointer; }
  .pj-tabs button + button { border-left: 1px solid var(--fg); }
  .pj-tabs button[aria-selected="true"] { background: var(--fg); color: var(--bg); }
  .vw-stage { height: 58vh; min-height: 0; }
  .contacts { gap: 8px; }
  .lightbox img { inset: 56px 0; width: 100%; height: calc(100% - 112px); }

  /* Páginas de texto */
  main.page { padding-top: 96px; }
  .about, .contact { grid-template-columns: 1fr; }
  .contact .inner { grid-column: 1; }
  .about .portrait { padding: 0 0 26px; max-width: 320px; }
  .contact { min-height: calc(100svh - 84px); padding-bottom: 84px; }

  /* Pie: zona táctil de 44 px en cada enlace */
  .site-footer { margin-top: 60px; gap: 0 30px; align-items: center; padding-top: 14px; padding-bottom: 14px; }
  .site-footer a, .contact .links a { display: inline-flex; align-items: center; min-height: 44px; }
  .site-footer .links { gap: 0 30px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .pj-strip .mq-inner { animation: none; }
}
