/* =========================================================
   Alicia del Real García — Portfolio
   Estilo basado en celesterojasmugica.com
   ========================================================= */

:root {
  --ink: rgba(0, 0, 0, 0.85);
  --muted: rgba(0, 0, 0, 0.42);
  --line: rgba(0, 0, 0, 0.14);
  --blue: #0000ff;     /* azul eléctrico: enlaces activos, hover, etiquetas */
  --blue-soft: rgba(0, 0, 255, 0.9); /* textos en inglés de los proyectos */
  --bg: #fff;
  --fs: 12.2px;
  --fs-menu: 11.2px;
  --gutter: 34px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs);
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

p { margin: 0 0 1.3em; }
img { display: block; max-width: 100%; }
figure { margin: 0; }

.wrap { padding: 0 var(--gutter); }

/* ---------- Cabecera ---------- */
/* nombre + INFO en la primera columna; el menú empieza en columnas nuevas,
   todas a la misma altura */
.site-header {
  display: flex;
  align-items: flex-start;
  column-gap: clamp(60px, 9vw, 140px);
  padding-top: 40px;
}

.menu-top {
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.15;
}
.menu-top a.active { color: var(--blue); }

/* menú de proyectos: empieza en el margen izquierdo, igual que las fotos */
.menu {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  column-gap: clamp(36px, 5vw, 80px);
  font-size: var(--fs-menu);
}

.menu-col {
  text-transform: uppercase;
  line-height: 1.05;
}

.menu-head {
  margin: 0;
  font-size: inherit;
  font-weight: 700;
  line-height: 1.1;
}

.menu-sub {
  margin: 0.8em 0 0.1em;
  font-size: inherit;
  font-weight: 400;
  color: var(--muted);
}

.menu ul { list-style: none; margin: 0; padding: 0; }
.menu li a.active { color: var(--blue); }

/* ---------- Pie ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  margin-top: 140px;
  padding: 18px 0 34px;
  border-top: 1px solid var(--line);
  text-transform: uppercase;
}
.footer-right { display: flex; gap: 32px; }

.is-project .site-footer { margin-top: 44px; }

/* ---------- Filas justificadas (index y Casa de Catamarca) ----------
   Cada imagen ocupa un ancho proporcional a su formato (--r, lo calcula
   main.js), así todas las fotos de una fila tienen la misma altura y el
   orden se lee de izquierda a derecha. */
.rows {
  --row-h: 220px;
  --gap: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}
.rows::after { content: ""; flex-grow: 999999; }

.tile {
  --r: 1.5;
  position: relative;
  display: block;
  flex-grow: var(--r);
  flex-shrink: 1;
  flex-basis: calc(var(--r) * var(--row-h));
  min-width: 0;
}
.tile img { width: 100%; height: auto; aspect-ratio: var(--r); object-fit: cover; }

/* ---------- Index: portadas en 3 columnas ----------
   main.js reparte los proyectos de izquierda a derecha entre las columnas
   (1, 2, 3 / 4, 5, 6 ...). Sin JS se ven en columnas CSS normales. */
.covers { margin-top: 150px; column-count: 3; column-gap: 3px; }
.covers .cover { margin-bottom: 3px; break-inside: avoid; }
.covers.is-split { display: flex; align-items: flex-start; gap: 3px; column-count: auto; }
.covers-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.covers.is-split .cover { margin-bottom: 0; }
.cover { position: relative; display: block; }
.cover img { width: 100%; height: auto; }

.cover-title {
  position: absolute;
  left: 10px;
  bottom: 8px;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s;
}
.cover:hover .cover-title,
.cover:focus-visible .cover-title { opacity: 1; }

/* ---------- Página de proyecto ---------- */
.project {
  display: grid;
  grid-template-columns: 5fr 7fr;
  column-gap: 28px;
  margin: 150px 5.5% 0;
}

.p-left { padding-right: 4px; }

.p-title {
  margin: 0;
  font-size: inherit;
  font-weight: 700;
  text-transform: uppercase;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0 46px;
}

.p-meta { margin-bottom: 46px; min-height: 3.9em; }
.p-meta-top { display: none; }   /* solo en móvil, justo debajo del título */
.p-title { scroll-margin-top: 20px; }

.support { font-style: italic; }

.text-block { margin-bottom: 2.2em; }
.block-head,
.credits-head { font-weight: 700; margin-bottom: 0.6em; }

.en { color: var(--blue-soft); }

.credits { margin: 2.4em 0; line-height: 1.2; }
.credits p { margin-bottom: 0.55em; }
.credits b { text-transform: uppercase; }
.credits .credits-head { text-transform: uppercase; margin-bottom: 0.7em; }

/* columna de imágenes (mismo ancho, hacia abajo) */
.img-column img {
  width: 100%;
  height: auto;
  margin-bottom: 20px;
  cursor: zoom-in;
}

/* videos */
.media { margin-bottom: 20px; }
.media-head {
  margin: 2.2em 0 0.8em;
  font-size: inherit;
  font-weight: 700;
}
.media-head:first-child { margin-top: 0; }

.video { margin-bottom: 20px; }
.video-box { position: relative; width: 100%; height: 0; background: #000; }
.video-box iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.video-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* zona a todo el ancho (collage y fotografía analógica) */
.p-full { grid-column: 1 / -1; margin-top: 30px; }

/* ---------- Casa de Catamarca: miniaturas en filas ---------- */
.collage { --row-h: 120px; --gap: 5px; }
.collage .thumb { cursor: zoom-in; overflow: hidden; }
.collage img { transition: transform 0.4s ease, opacity 0.25s; }
.collage .thumb:hover img { transform: scale(1.04); opacity: 0.88; }

/* ---------- Fotografía analógica: series en filas ---------- */
.series { margin-bottom: 50px; }
.series-title {
  margin: 0 0 10px;
  font-size: inherit;
  font-weight: 400;
  text-transform: uppercase;
}
.strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.strip .thumb { flex: none; cursor: zoom-in; }
.strip img {
  height: clamp(220px, 30vw, 470px);
  width: auto;
  max-width: none;
}

/* ---------- Navegación Prev / Up / Next ---------- */
.p-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  margin-top: 200px;
  font-weight: 700;
  text-transform: uppercase;
}
.p-nav a { display: inline-flex; align-items: flex-start; gap: 8px; }
.p-nav svg {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.4;
  margin-top: -3px;
}
.p-nav small {
  display: block;
  margin-top: 3px;
  font-weight: 400;
  color: var(--muted);
}
.p-nav a:hover small { color: inherit; }
.p-prev { justify-self: start; }
.p-up { justify-self: center; }
.p-next { justify-self: end; text-align: right; }

/* ---------- Info ---------- */
.blue { color: var(--blue); }

.info {
  display: grid;
  grid-template-columns: 3.75fr 4.5fr 4.5fr;
  grid-template-areas:
    "photo contact ."
    "photo es      en";
  grid-template-rows: auto 1fr;
  column-gap: 28px;
  margin: 150px 5.5% 0 0;
}
.info-photo { grid-area: photo; }
.info-photo img { width: 100%; height: auto; }
.info-photo figcaption { margin-top: 8px; color: var(--muted); }
.info-photo figcaption a:hover { color: var(--blue); }
.info-contact { grid-area: contact; margin-bottom: 1em; }
.info-contact p { margin-bottom: 0.3em; }
.info-contact .blue { text-transform: uppercase; }
.info .es { grid-area: es; }
.info .en { grid-area: en; color: var(--blue); }

/* ---------- YouTube abierto con doble clic (file://): miniatura con enlace ---------- */
.yt-fallback { position: absolute; inset: 0; display: block; background: #000 center / cover no-repeat; }
.yt-fallback span {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.yt-fallback:hover span { background: var(--blue); }

/* ---------- Placeholder (imagen aún no subida) ---------- */
img.missing { background: #f1f1f1; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.97);
}
.lightbox.open { display: flex; }
.lb-figure {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0;
}
.lb-caption {
  margin-bottom: 10px;
  text-transform: uppercase;
}
.lb-caption:empty { display: none; }
.lightbox img {
  max-width: calc(100vw - 140px);
  max-height: calc(100vh - 120px);
  width: auto; height: auto;
}
.lightbox button {
  position: absolute;
  background: none; border: 0; padding: 14px;
  color: var(--ink); cursor: pointer;
  line-height: 0;
}
.lightbox button:hover { color: var(--blue); }
.lightbox button svg {
  width: 26px; height: 26px;
  fill: none; stroke: currentColor; stroke-width: 1.4;
}
.lb-close { top: 12px; right: 14px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lb-count {
  position: absolute; bottom: 20px; left: 0; right: 0;
  text-align: center; color: var(--muted);
}
body.lb-open { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .collage { --row-h: 110px; }
}

@media (max-width: 800px) {
  :root { --gutter: 16px; --fs: 12.5px; --fs-menu: 11.8px; }

  .site-header { flex-direction: column; row-gap: 16px; padding-top: 20px; }
  .menu { grid-template-columns: 1fr 1fr; row-gap: 22px; column-gap: 24px; }

  .covers { margin-top: 40px; column-count: 2; }

  .project { grid-template-columns: 1fr; margin: 50px 0 0; }
  hr { margin: 14px 0 24px; }
  .p-meta-side { display: none; }
  .p-meta-top { display: block; margin: 8px 0 0; min-height: 0; }
  .p-right { margin-top: 30px; }
  .collage { --row-h: 90px; --gap: 4px; }

  .info {
    grid-template-columns: 1fr;
    grid-template-areas: "contact" "photo" "es" "en";
    margin: 50px 0 0;
  }
  .info-contact { margin-bottom: 24px; }
  .info-photo { max-width: 70%; margin-bottom: 30px; }

  .p-nav { margin-top: 120px; }
  .p-nav small { display: none; }

  .lightbox img { max-width: calc(100vw - 24px); }
  .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; }
}

@media (max-width: 480px) {
  .menu { grid-template-columns: 1fr; }
  .covers { column-count: 1; }
  .site-footer { gap: 12px; font-size: 11px; white-space: nowrap; }
  .footer-right { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
