/* =========================================================
   alvaro matzumura — portafolio
   Las medidas usan vw/vh para respetar las proporciones
   exactas del diseño de Keynote (lienzo 16:9).
   ========================================================= */

:root {
  --bg: #ffffff;
  --ink: #111111;          /* nombre */
  --ink-light: #3a3a3a;    /* menú y textos */
  --muted: #9a9a9a;        /* "scroll" */
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;

  --side-x: 9.9vw;         /* margen izquierdo del nombre y menú */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink-light);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img, video { display: block; width: 100%; }

/* ---------- Columna izquierda ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: 28vw;
  padding-left: var(--side-x);
  z-index: 10;
  pointer-events: none;
}
.sidebar a { pointer-events: auto; }

.name {
  position: absolute;
  top: 21.5vh;
  left: var(--side-x);
  font-weight: 500;
  font-size: clamp(16px, 2.15vw, 34px);
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.nav {
  position: absolute;
  top: 54vh;
  left: var(--side-x);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.1vw, 34px);
}
.nav a {
  font-weight: 300;
  font-size: clamp(13px, 1.5vw, 24px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink-light);
  width: fit-content;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
.nav a:hover,
.nav a.active { text-decoration: underline; }

/* ---------- Páginas ---------- */
.page { display: none; }
.page.active { display: block; animation: fade .5s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* HOME */
.page-home {
  position: fixed;
  top: 21.5vh;
  left: 33vw;
  width: 57.6vw;
}
.home-video {
  aspect-ratio: 2 / 1;
  object-fit: cover;
  background: #3a62a8;
}

/* PHOTO */
.page-photo {
  margin-left: 33vw;
  width: 59vw;
  padding: 5.4vh 0 12vh;
  --gap: 1.7vw;
}
.gallery { display: flex; flex-direction: column; gap: var(--gap); transition: opacity .25s ease; }
.gallery.fading { opacity: 0; }
.row { display: flex; gap: var(--gap); }
.row-fill { display: block; }

/* filtros de categoría */
.filters {
  display: flex;
  gap: clamp(14px, 1.8vw, 30px);
  margin-bottom: 2.6vh;
}
.filters a {
  font-weight: 300;
  font-size: clamp(11px, 1vw, 16px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
  transition: color .2s ease;
}
.filters a:hover { color: var(--ink-light); }
.filters a.active { color: var(--ink-light); text-decoration: underline; }
.gallery-empty {
  font-weight: 300;
  font-size: clamp(11px, 1vw, 16px);
  color: var(--muted);
}
.row figure {
  flex: var(--r) 1 0;            /* el ancho es proporcional al ratio → misma altura */
  aspect-ratio: var(--r);
  overflow: hidden;
}
.row img { height: 100%; object-fit: cover; }

.scroll-hint {
  position: fixed;
  left: 29.5vw;
  bottom: 6vh;
  font-size: clamp(9px, 0.75vw, 12px);
  font-weight: 300;
  color: var(--muted);
}

/* MOTION */
.page-motion {
  margin-left: 38.3vw;
  width: 56.5vw;
  padding: 11.5vh 0 12vh;
}
.page-motion.active { display: flex; flex-direction: column; gap: 5.7vh; }

.project {
  position: relative;
  display: block;
  overflow: hidden;
  background: #000;
}
.project img,
.project .preview {
  aspect-ratio: 2.17 / 1;
  object-fit: cover;
}
.project-info {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4vw;
  padding: 0 8% 0 14%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  opacity: 0;
  transition: opacity .35s ease;
}
.project:hover .project-info,
.project:focus-visible .project-info { opacity: 1; }

.project-info h2 {
  font-weight: 500;
  font-size: clamp(14px, 1.55vw, 26px);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.project-info p {
  max-width: 37%;
  font-weight: 300;
  font-size: clamp(10px, 0.85vw, 14px);
  line-height: 1.3;
}

/* ABOUT */
.page-contact {
  position: fixed;
  top: 37vh;
  right: 11.6vw;
  width: 32vw;
  text-align: right;
  font-weight: 300;
  font-size: clamp(12px, 1.12vw, 18px);
  line-height: 1.35;
}
.page-contact p + p { margin-top: 1.9vh; }
.page-contact a { text-underline-offset: .18em;font-size: clamp(10px, 0.9vw, 14px) } 
.page-contact .contact-gap { margin-top: 15vh; }
.page-contact a:hover { text-decoration: underline; }

/* LIGHTBOX (foto ampliada) */
.row figure { cursor: zoom-in; }
.row img { transition: opacity .25s ease; }
.row figure:hover img { opacity: .88; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
}
.lightbox.open { opacity: 1; visibility: visible; }

.lb-img {
  width: auto;
  max-width: 76vw;
  max-height: 80vh;
  object-fit: contain;
  cursor: zoom-out;
  transition: opacity .2s ease;
}
.lb-img.swap { opacity: 0; }

.lb-btn {
  position: absolute;
  background: none;
  border: 0;
  padding: 10px;
  margin: -10px;
  font: 300 clamp(13px, 1.5vw, 24px)/1 var(--font);
  letter-spacing: -0.01em;
  color: var(--ink-light);
  cursor: pointer;
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
}
.lb-btn:hover { text-decoration: underline; }
.lb-close { top: 5vh;  right: var(--side-x); }
.lb-prev  { top: 50%; left: var(--side-x); transform: translateY(-50%); }
.lb-next  { top: 50%; right: var(--side-x); transform: translateY(-50%); }
.lb-count {
  position: absolute;
  bottom: 5vh;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 300;
  font-size: clamp(10px, 0.9vw, 14px);
  color: var(--muted);
}

/* VISUALIZADOR DE VIDEO (motion) */
.project { cursor: pointer; }
/* el ancho se limita también por la altura de la pantalla, así el texto
   de abajo siempre mide lo mismo que el video y no se sale de sus bordes */
.pl-stage { width: min(66vw, 70vh * 16 / 9); }
.pl-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.pl-frame iframe,
.pl-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.pl-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-weight: 300;
  font-size: 13px;
}
.pl-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4vw;
  margin-top: 2.2vh;
}
.pl-title {
  font-weight: 500;
  font-size: clamp(14px, 1.3vw, 22px);
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.pl-title { min-width: 0; }
.pl-desc {
  max-width: 46%;
  min-width: 0;
  text-align: right;
  font-weight: 300;
  font-size: clamp(11px, 0.9vw, 15px);
  line-height: 1.35;
}

/* ---------- Móvil ---------- */
@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: auto; height: auto;
    padding: 40px 16px 28px;
    pointer-events: auto;
  }
  .name, .nav { position: static; }
  .name { display: block; font-size: 20px; margin-bottom: 18px; }
  .nav { flex-direction: row; gap: 20px; }
  .nav a { font-size: 15px; }

  .page-home, .page-contact {
    position: static;
    width: auto;
    margin: 0 16px;
  }
  .page-contact { text-align: left; font-size: 15px; padding-top: 20px; }
  .page-contact p + p { margin-top: 14px; }

  .page-photo, .page-motion {
    margin: 0 16px;
    width: auto;
    padding: 0 0 48px;
  }
  .page-photo { --gap: 8px; }
  .filters { gap: 18px; margin-bottom: 16px; }
  .filters a, .gallery-empty { font-size: 14px; }
  .page-motion.active { gap: 16px; }
  .scroll-hint { display: none; }

  /* en móvil (sin hover) el título se ve siempre debajo */
  .project-info {
    position: static;
    opacity: 1;
    background: #fff;
    color: var(--ink-light);
    display: block;
    padding: 10px 0 0;
  }
  .project-info h2 { font-size: 15px; color: var(--ink); }
  .project-info p { max-width: none; font-size: 13px; margin-top: 4px; }
  .project { background: none; }

  .lb-img { max-width: calc(100vw - 32px); max-height: 74vh; }
  .lb-btn { font-size: 15px; }
  .lb-close { top: 24px; right: 16px; }
  .lb-prev, .lb-next { top: auto; bottom: 28px; transform: none; }
  .lb-prev { left: 16px; }
  .lb-next { right: 16px; }
  .lb-count { bottom: 30px; font-size: 12px; }

  .pl-stage { width: calc(100vw - 32px); }
  .pl-info { display: block; margin-top: 14px; }
  .pl-title { font-size: 15px; }
  .pl-desc { max-width: none; text-align: left; font-size: 13px; margin-top: 6px; }
}
