/* ==========================================================================
   Paz Colotto — estilos
   Blanco / negro, una sola tipografía (Helvetica), mucho aire.
   ========================================================================== */

:root {
  --ink: #000;
  --paper: #fff;
  --mute: #8c8c8c;
  --faint: #f2f2f2;
  --line: #e5e5e5;

  /* Márgenes laterales (header y contenido comparten el mismo eje) */
  --pad-x: 1.25rem;
  --pad-y: 1.25rem;
  --gap: 1rem;
  --header-h: calc(var(--pad-y) * 2 + 1em);

  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

@media (min-width: 768px) {
  :root { --pad-x: 2rem; --pad-y: 1.5rem; --gap: 1.25rem; }
}
@media (min-width: 1280px) {
  :root { --pad-x: 4rem; --pad-y: 2rem; --gap: 1.5rem; }
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

html.no-scroll { overflow: hidden; }

::selection { background: var(--ink); color: var(--paper); }

:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

.muted { color: var(--mute); }

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: none; }

/* ==========================================================================
   NAVBAR — fija, una sola línea, tres zonas
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background-color 0.4s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

/* En el Welcome la barra flota sobre el slider: sin fondo, texto blanco
   con una sombra mínima para que se lea sobre cualquier imagen. */
body.is-home:not(.menu-open) .site-header {
  background: transparent;
  border-bottom-color: transparent;
  color: #fff;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.35), 0 0 2px rgba(0, 0, 0, 0.25);
}
body.is-home:not(.menu-open) .site-header .lang button,
body.is-home:not(.menu-open) .site-header .lang-sep,
body.is-home:not(.menu-open) .site-header .nav-subs { color: rgba(255, 255, 255, 0.6); }
body.is-home:not(.menu-open) .site-header .lang button[aria-pressed='true'],
body.is-home:not(.menu-open) .site-header .lang button:hover { color: #fff; }

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-h);
  padding: var(--pad-y) var(--pad-x);
  line-height: 1;
  white-space: nowrap;
}

/* Escritorio: grilla 1fr / auto / 1fr para que el centro quede centrado de verdad */
@media (min-width: 1024px) {
  .nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    column-gap: 2rem;
  }
}

.nav-left { display: flex; align-items: center; }
.nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.5rem;
}

.brand { font-weight: 500; letter-spacing: 0; }

.nav-center {
  display: none;
  align-items: center;
  gap: 2rem;
}
@media (min-width: 1024px) {
  .nav-center { display: flex; }
  .nav-right { gap: 2.5rem; }
}
@media (min-width: 1280px) {
  .nav-center { gap: 2.5rem; }
}

.nav-link,
.nav-sub,
.brand,
.lang button,
.menu-btn,
.lb-btn,
.u-link {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s, color 0.2s, opacity 0.2s;
}
.nav-link:hover,
.nav-sub:hover,
.brand:hover,
.menu-btn:hover,
.lb-btn:hover,
.u-link:hover,
.nav-link[aria-current='page'],
.nav-sub[aria-current='page'] {
  text-decoration-color: currentColor;
}

/* Submenú en línea, debajo del ítem — no empuja al resto del menú */
.nav-group { position: relative; display: flex; align-items: center; }
.nav-subs {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  display: flex;
  align-items: center;
  gap: 0.4em;
  color: var(--mute);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s linear 0.3s;
}
/* Puente invisible para que el hover no se corte entre el ítem y el submenú */
.nav-subs::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 0.5rem;
}
.nav-group:hover .nav-subs,
.nav-group:focus-within .nav-subs,
.nav-group.is-active .nav-subs {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.nav-sub:hover,
.nav-sub[aria-current='page'] { color: var(--ink); }
body.is-home .nav-sub:hover { color: #fff; }

.nav-center:has(.nav-group:not(.is-active):hover) .nav-group.is-active:not(:hover) .nav-subs {
  opacity: 0;
  visibility: hidden;
}

.nav-about { display: none; }
@media (min-width: 1024px) {
  .nav-about { display: inline; }
}

/* Selector ES / EN */
.lang { display: inline-flex; align-items: center; gap: 0.35em; }
.lang button { color: var(--mute); cursor: pointer; }
.lang button:hover,
.lang button[aria-pressed='true'] { color: var(--ink); }
.lang-sep { color: var(--mute); }

.menu-btn { cursor: pointer; }
@media (min-width: 1024px) {
  .menu-btn { display: none; }
  .mobile-menu { display: none !important; }
}

/* Menú móvil */
.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 49;
  background: var(--paper);
  padding: 2rem var(--pad-x);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.mobile-menu.is-open { opacity: 1; }
.mobile-list { display: grid; gap: 1.2rem; }
.mobile-list > li > a {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.02em;
}
.mobile-list a[aria-current='page'] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.mobile-subs { display: block; margin-top: 0.45rem; color: var(--mute); font-size: 1rem; line-height: 1; }
.mobile-subs a[aria-current='page'] { color: var(--ink); }

/* ==========================================================================
   VISTAS
   ========================================================================== */

.view {
  min-height: 100vh;
  padding: calc(var(--header-h) + 2.5rem) var(--pad-x) 6rem;
  outline: none;
  transition: opacity 0.22s ease;
}
.view.is-out { opacity: 0; }

body.is-home .view { padding: 0; min-height: 0; }
body.is-home .site-footer { display: none; }

/* ---- Welcome: slider a pantalla completa -------------------------------- */

.welcome {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
  overflow: hidden;
}
.w-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.1s var(--ease);
}
.w-slide.is-active { opacity: 1; z-index: 1; }
.w-slide img,
.w-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.w-hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  cursor: e-resize;
}
.w-hit:focus-visible { outline: 1px solid #fff; outline-offset: -8px; }

/* ---- Muro de portadas (columnas armadas en js: orden por filas) --------- */

.wall-grid {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
}
.wall-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* ---- Grilla (masonry por columnas) -------------------------------------- */

.masonry {
  columns: 1;
  column-gap: var(--gap);
}
@media (min-width: 480px) { .masonry { columns: 2; } }
@media (min-width: 900px) { .masonry { columns: 3; } }
@media (min-width: 1500px) { .masonry { columns: 4; } }

.masonry > li {
  break-inside: avoid;
  margin-bottom: var(--gap);
}

.card-btn {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.card-media {
  display: block;
  position: relative;
  overflow: hidden;
  background: var(--faint);
}
.card-media img,
.card-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s var(--ease);
}
.card-media .is-loaded { opacity: 1; }

/* Nombre superpuesto (proyectos y video) — Helvetica limpia y discreta.
   Aparece solo al pasar el mouse sobre esa imagen; la foto no se altera.
   En pantallas táctiles (sin hover) queda siempre visible. */
.card-name {
  position: absolute;
  left: 1rem;
  bottom: 0.9rem;
  right: 1rem;
  z-index: 1;
  color: #fff;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.35), 0 0 2px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.01em;
  pointer-events: none;
}
@media (hover: hover) {
  .card-name {
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  .card-btn:hover .card-name,
  .card-btn:focus-visible .card-name { opacity: 1; }
}

.fade-up {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUp 0.8s var(--ease) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes fadeUp { to { opacity: 1; transform: none; } }

/* ---- Video -------------------------------------------------------------- */

.vgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
@media (min-width: 768px) { .vgrid { grid-template-columns: 1fr 1fr; } }

.vcard .card-media { aspect-ratio: 16 / 9; background: #111; }
.vcard .card-media img { position: absolute; inset: 0; }

/* ---- Escritos: muro disperso / mesa de trabajo -------------------------- */

.wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
  padding-bottom: 4rem;
}
.wall-item:nth-child(even) { margin-top: 3rem; }

.wall-card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--ink);
  text-align: left;
  cursor: pointer;
  transform: rotate(var(--r, 0deg));
}
.wall-title {
  line-height: 1;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s;
}
.wall-card:hover .wall-title,
.wall-card:focus-visible .wall-title { text-decoration-color: currentColor; }

/* Escritorio: disposición asimétrica sobre una grilla de 12 columnas */
@media (min-width: 900px) {
  .wall {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
    row-gap: 0;
  }
  .wall-item:nth-child(even) { margin-top: 0; }
  .wall-item:nth-child(6n + 1) { grid-column: 1 / span 3;  margin-top: 0;     --r: -1.2deg; }
  .wall-item:nth-child(6n + 2) { grid-column: 5 / span 2;  margin-top: 7rem;  --r: 0.8deg; }
  .wall-item:nth-child(6n + 3) { grid-column: 8 / span 3;  margin-top: 2rem;  --r: -0.4deg; }
  .wall-item:nth-child(6n + 4) { grid-column: 2 / span 2;  margin-top: 2rem;  --r: 1.4deg; }
  .wall-item:nth-child(6n + 5) { grid-column: 6 / span 3;  margin-top: 5rem;  --r: -0.9deg; }
  .wall-item:nth-child(6n + 6) { grid-column: 10 / span 2; margin-top: 4rem;  --r: 0.6deg; }
}
@media (max-width: 899px) {
  .wall-item:nth-child(4n + 1) .wall-card { --r: -1deg; }
  .wall-item:nth-child(4n + 2) .wall-card { --r: 0.8deg; }
  .wall-item:nth-child(4n + 3) .wall-card { --r: 0.6deg; }
  .wall-item:nth-child(4n + 4) .wall-card { --r: -0.7deg; }
}

/* ---- Sobre mi ----------------------------------------------------------- */

.about-grid {
  display: grid;
  gap: 3rem var(--gap);
}
@media (min-width: 900px) {
  .about-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); column-gap: 4rem; }
}
.about-bio { max-width: 44rem; }
.about-bio p {
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  line-height: 1.45;
  letter-spacing: -0.005em;
  font-weight: 300;
}
.about-bio p + p { margin-top: 1em; }
.about-side { line-height: 1.6; }
.about-h { color: var(--mute); margin-bottom: 0.5rem; line-height: 1; }
.about-block + .about-block { margin-top: 2.5rem; }
.about-list li + li { margin-top: 0.25rem; }
.about-portrait { max-width: 26rem; }
.about-contact { margin-top: 1.5rem; }

/* ---- Footer ------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1.5rem var(--pad-x) 2rem;
  color: var(--mute);
  line-height: 1;
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a:hover { color: var(--ink); }

/* ==========================================================================
   MODALES
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.modal.is-open { opacity: 1; }
.modal[hidden] { display: none; }

.lb-btn { color: inherit; cursor: pointer; }

.pv-bar,
.vb-bar,
.wb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--header-h);
  padding: var(--pad-y) var(--pad-x);
  line-height: 1;
  white-space: nowrap;
}

/* Créditos ultra mínimos: una línea editorial */
.credit-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  line-height: 1.2;
}
.cr-name { font-weight: 500; }
.cr-k { color: var(--mute); }
.cr-sep { color: var(--mute); }

/* ---- Vista de proyecto -------------------------------------------------- */

.pv {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  height: 100vh;
  height: 100dvh;
  background: var(--paper);
  color: var(--ink);
}
.pv-counter { color: var(--mute); font-variant-numeric: tabular-nums; }

.lb-stage { position: relative; min-height: 0; }
.lb-figure {
  position: absolute;
  inset: 0 var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: center;
}
#lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.45s var(--ease);
  user-select: none;
  -webkit-user-drag: none;
}
#lb-img.is-loaded { opacity: 1; }
#lb-video {
  max-width: 100%;
  max-height: 100%;
  background: #000;
}
#lb-img[hidden],
#lb-video[hidden],
.lb-embed[hidden] { display: none; }
.lb-embed {
  position: absolute;
  inset: 0 var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-embed iframe {
  width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}
/* En videos, las zonas de clic izquierda/derecha no tapan los controles */
.lb-stage.is-video .lb-hit { display: none; }

.lb-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
}
.lb-hit--prev { left: 0; cursor: w-resize; }
.lb-hit--next { right: 0; cursor: e-resize; }
.lb-hit:focus-visible { outline-offset: -6px; }

.pv-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.25rem var(--pad-x) var(--pad-y);
}
.pv-text {
  max-height: 35vh;
  overflow-y: auto;
  max-width: 44rem;
  padding: 1.25rem var(--pad-x) 0;
  line-height: 1.5;
}
.pv-text[hidden] { display: none; }
.pv-text p + p { margin-top: 0.7em; }
.pv-arrows { display: flex; gap: 1.25rem; flex-shrink: 0; line-height: 1; }

/* ---- Video modal -------------------------------------------------------- */

.vb {
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
}
.vb .cr-k,
.vb .cr-sep { color: rgba(255, 255, 255, 0.5); }
.vb-scroll { flex: 1; overflow-y: auto; }
.vb-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--pad-x) 4rem;
}
.vb-player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b0b0b;
}
.vb-player iframe,
.vb-player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.vb-credits { padding-top: 1.25rem; max-width: 52rem; }
.vb-synopsis {
  margin-top: 1rem;
  max-width: 40rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
}
.vb-awards { margin-top: 0.6rem; max-width: 40rem; line-height: 1.5; color: rgba(255, 255, 255, 0.55); }
.vb-crew { margin-top: 1rem; font-size: 12px; }
.vb.is-open .vb-credits { animation: fadeUp 0.9s var(--ease) 0.2s both; }

/* ---- Lector de escritos ------------------------------------------------- */

.wb {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
}
.wb-scroll { flex: 1; overflow-y: auto; }
.wb-paper {
  max-width: 36rem;
  margin: 0 auto;
  padding: 2rem var(--pad-x) 6rem;
}
.wb-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
  margin-bottom: 0.6rem;
}
.wb-body {
  margin-top: 2.5rem;
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 300;
}
.wb-body p + p { margin-top: 1.1em; }
.wb.is-open .wb-paper > * { animation: fadeUp 0.9s var(--ease) both; }
.wb.is-open .wb-paper > *:nth-child(2) { animation-delay: 80ms; }
.wb.is-open .wb-paper > *:nth-child(3) { animation-delay: 160ms; }

/* ---- Movimiento reducido ------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
