/* Papel claro, tinta negra y un dibujo que se hace solo detrás.
   El contenido va directo sobre el fondo, sin cajas: grande, a sangre, y
   el dibujo se ve en los márgenes y entre las portadas. */

:root {
  --paper: #efede8;
  --ink: #121212;
  --dim: #6d6a64;
  --rule: rgb(18 18 18 / .14);
  --trazo: #121212;           /* el fondo lo lee al arrancar */
  --gut: clamp(10px, 1.4vw, 22px);
  --text: 40rem;              /* ancho de lectura */
  --wide: 112rem;             /* ancho de imágenes y vídeos */
  --big: clamp(1.9rem, 3.6vw, 3.6rem);
  --font: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
}

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

html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 400 1.05rem/1.55 var(--font);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* Todo el texto va en blanco con difference (como mokakopa): negro sobre
   el papel, invertido sobre fotos, y las líneas del dibujo que lo cruzan
   salen blancas dentro de la letra. Solo el texto: las imágenes no se
   invierten. Dentro, lo tenue es gris claro, que al restar sale gris medio. */
.site, .project-head, .pager a, .contact a,
.body > p, .body > h2, .body > h3, .body > h4, .body > ul, .body > ol, .body > blockquote,
figcaption, .tweet p, .tweet .src, .ficha, .geek, .about, .site-foot {
  color: #fff;
  --dim: #9a9893;
  mix-blend-mode: difference;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
img, video, iframe { display: block; max-width: 100%; }
img { height: auto; }

/* el dibujo: fijo detrás de todo y sin recibir clics */
.fondo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---------- cabecera ---------- */

.site {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .2rem 1.5rem;
  padding: var(--gut);
}

.site-name {
  font-size: var(--big);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.02em;
  text-decoration: none;
}

.site-tagline { margin: 0; opacity: .6; flex: 1 1 18rem; }

.site nav { display: flex; gap: 1.2rem; }
.site nav a { text-decoration: none; }
.site nav a[aria-current] { text-decoration: underline; }

/* en la portada, la cabecera deja ver el dibujo: media pantalla de aire */
[data-page="work"] .site {
  min-height: 46svh;
  align-content: flex-start;
}
[data-page="work"] .site-name { font-size: clamp(3rem, 11vw, 11rem); flex-basis: 100%; }

main { flex: 1; }

.site-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 2rem;
  padding: 6rem var(--gut) var(--gut);
  color: var(--dim);
  font-size: .85rem;
}

.error { padding: var(--gut); }

/* ---------- work: todas las portadas ---------- */

.work {
  list-style: none;
  margin: 0;
  padding: 0 var(--gut);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gut);
}

.work a {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}

.work img, .work .no-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* el título encima, como v3ga: blanco sobre la foto; la sombra suave lo
   deja leer sobre las portadas claras */
.work .label {
  position: absolute;
  inset: 0 0 auto 0;
  padding: .35em .45em;
  display: flex;
  flex-direction: column;
  text-shadow: 0 0 .5em rgba(0, 0, 0, .45);
  line-height: 1;
}
.work .name { font-size: var(--big); letter-spacing: -.02em; }
.work .year { font-size: clamp(1rem, 1.4vw, 1.3rem); margin-top: .35em; }

/* hover: la foto pasa a tinta y papel (gris + papel multiplicado encima) y
   el título se invierte sobre ella. El título además se baraja (app.js). */
.work a { isolation: isolate; }
.work a::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper);
  mix-blend-mode: multiply;
  opacity: 0;
}
.work a:is(:hover, :focus-visible) img { filter: grayscale(1) contrast(1.3); }
.work a:is(:hover, :focus-visible)::after { opacity: 1; }
.work a:is(:hover, :focus-visible) .label { z-index: 1; text-shadow: none; mix-blend-mode: difference; }

/* ---------- proyecto ---------- */

.project { padding: 0 var(--gut); }

/* arriba, lo grande: el vídeo (con portada hasta que se clica) o la portada */
.hero {
  position: relative;
  display: block;
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  overflow: hidden;
  padding: 0;
  border: 0;
}
.hero img, .hero iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.hero.play { cursor: pointer; }
.play-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(2rem, 5vw, 4rem);
  color: #fff;
  text-shadow: 0 0 30px rgb(0 0 0 / .5);
  transition: transform .3s ease;
}
.hero.play:hover .play-icon { transform: scale(1.12); }

.project-head {
  text-align: center;
  padding: clamp(3rem, 9vw, 7rem) 0;
  max-width: 50rem;
  margin: 0 auto;
}
.project-head h1 { margin: 0; font-size: var(--big); font-weight: 500; letter-spacing: -.02em; line-height: 1.05; }
.project-head .meta { margin: .8rem 0 0; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.project-head .line { margin: 1.4rem auto 0; font-size: 1.25rem; max-width: 34rem; }

/* el texto estrecho, para leer; las imágenes y vídeos, anchos */
.body > *, .ficha, .geek { max-width: var(--text); margin-left: auto; margin-right: auto; }
.body > figure, .body > .outputs, .body > .embed, .body > video, .body > .tweets {
  max-width: var(--wide);
  margin: clamp(2rem, 5vw, 4rem) auto;
}
.body p { font-size: 1.2rem; margin-top: 0; margin-bottom: 1.1em; }
.body h2, .body h3, .body h4 { font-weight: 500; margin: 2.5rem auto 1rem; }

figure { margin: 0; }
figure img, .body video { width: 100%; }
figcaption { color: var(--dim); font-size: .85rem; margin-top: .5rem; }

.embed iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; background: var(--ink); }

/* dos o más imágenes seguidas: a dos columnas, grandes */
.outputs { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gut); align-items: start; }

blockquote { margin: 2.5rem auto; padding: 0; font-size: 1.5rem; line-height: 1.35; }
blockquote p { font-size: inherit !important; }
cite { display: block; font-size: .9rem; font-style: normal; color: var(--dim); margin-top: .6rem; }

.tweets { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--gut); align-items: start; }
.tweet { margin: 0; font-size: .95rem; line-height: 1.45; border-top: 1px solid var(--ink); padding-top: .6rem; }
.tweet p { margin: 0 0 .6rem; }
.tweet-media { display: grid; gap: 4px; }
.tweet .src { font-size: .8rem; color: var(--dim); }

/* la ficha al final: etiqueta y dato */
.ficha {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: .5rem 1.5rem;
  margin-top: clamp(3rem, 8vw, 6rem);
  padding-top: 1rem;
  border-top: 1px solid currentColor;
  font-size: .95rem;
}
.ficha dt { color: var(--dim); }
.ficha dd { margin: 0; }
.ficha ul { list-style: none; margin: 0; padding: 0; }

.geek { margin-top: 4rem; }
.geek h2 { font-size: 1rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }

/* abajo: más nuevo · todos · más viejo, grande */
.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: var(--gut);
  max-width: var(--wide);
  margin: clamp(5rem, 12vw, 9rem) auto 0;
}
.pager a { text-decoration: none; font-size: clamp(1.2rem, 2vw, 1.8rem); line-height: 1.1; }
.pager small { display: block; font-size: .8rem; color: var(--dim); margin-bottom: .3rem; }
.pager .older { text-align: right; grid-column: 3; }
.pager .back { grid-column: 2; text-decoration: underline; }

/* ---------- about y contact ---------- */

.about, .contact { padding: 0 var(--gut); max-width: var(--wide); margin: 0 auto; }

.bio { max-width: 52rem; font-size: clamp(1.2rem, 1.9vw, 1.6rem); line-height: 1.4; margin-top: 2rem; }

.upcoming, .cv { margin-top: 4rem; }
.upcoming h2, .cv h2 { font-size: .85rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 3rem 0 .8rem; }
.upcoming ul, .cv ul { list-style: none; margin: 0; padding: 0; }
.cv li { display: grid; grid-template-columns: 4rem 1fr; gap: 1rem; padding: .35rem 0; border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.cv .year { color: var(--dim); }
.cv .same-year .year { visibility: hidden; }
@media (min-width: 1100px) { .cv { columns: 2; column-gap: calc(var(--gut) * 3); } .cv h2:first-child { margin-top: 0; } .cv li { break-inside: avoid; } }

.contact ul { list-style: none; margin: 2rem 0 0; padding: 0; }
.contact a { font-size: var(--big); text-decoration: none; }
.contact a:hover { text-decoration: underline; }

/* ---------- móvil: una columna, portadas en vertical ---------- */

@media (max-width: 700px) {
  .work { grid-template-columns: 1fr; }
  .work a { aspect-ratio: 4 / 5; }
  .outputs { grid-template-columns: 1fr; }
  .ficha { grid-template-columns: 1fr; gap: 0; }
  .ficha dd { margin-bottom: .7rem; }
  .pager { grid-template-columns: 1fr 1fr; }
  .pager .back { grid-column: 1 / -1; grid-row: 2; text-align: center; margin-top: 2rem; }
  .pager .older { grid-column: 2; }
  [data-page="work"] .site { min-height: 36svh; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
