/* ------------------------------------------------------------------
   Álvaro Góngora Studio — nube de proyectos
   Blanco, Helvetica, imágenes solapadas con parallax, modal flotante.
------------------------------------------------------------------- */

/* ------------------- Tipografía editorial (TRJN DaVinci) ---------------- */
@font-face {
  font-family: "TRJN DaVinci";
  src: url("assets/fonts/trjn-davinci-display.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "TRJN DaVinci";
  src: url("assets/fonts/trjn-davinci-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "TRJN DaVinci"; /* negritas → TRJN DaVinci-Text */
  src: url("assets/fonts/trjn-davinci-text.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #111;
  --ink-soft: #6b6b6b;
  --line: #e3e3e3;
  --bg: #ffffff;
  --pad: 28px;
  --fs-base: 13px;
  --fs-small: 11px;
}

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

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ------------------------------ Logo AG® ------------------------------- */
/* sustituible: reemplaza assets/logo_AG.png por el archivo definitivo */
.logo-img { height: 32px; width: auto; display: block; }

/* ------------------------------- Header -------------------------------- */
.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px var(--pad);
  z-index: 60;
  pointer-events: none;
}
.site-head .brand,
.site-head .site-nav { pointer-events: auto; }
.site-nav { display: flex; gap: 26px; }
.site-nav a {
  font-size: var(--fs-base);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
}
.site-nav a:hover { color: var(--ink-soft); }
.site-nav a.active { border-bottom: 2px solid var(--ink); padding-bottom: 2px; }

/* hamburguesa (solo móvil) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px 0;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ------------------------------ Contenido ------------------------------ */
.content { min-height: 100vh; }

/* páginas normales */
.about {
  padding: 110px var(--pad) 80px;
}

/* ---------------------------- Nube de fotos ---------------------------- */
body.is-cloud { overflow: hidden; }
body.is-cloud .footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  border-top: none;
  background: none;
  z-index: 50;
}

.cloud {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.tile {
  position: absolute;
  display: block;
  will-change: transform;
  transition: opacity 0.45s ease; /* fundido en la rotación pieza a pieza */
}
.tile .tile-media {
  display: block;
  position: relative;
  background: #f4f4f4;
  overflow: hidden;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.4s ease, transform 0.5s ease;
}
/* hover: segunda foto del proyecto + ligero zoom (como en las secciones) */
.tile .tm-hover {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.tile:hover .tm-base,
.tile:hover .tm-hover { transform: scale(1.05); }
.tile:hover .tm-hover { opacity: 1; }

/* formatos: cuadrado, vertical, horizontal */
.tile.sq .tile-media { width: 15vw; aspect-ratio: 1 / 1; }
.tile.v  .tile-media { width: 13vw; aspect-ratio: 3 / 4; }
.tile.h  .tile-media { width: 24vw; aspect-ratio: 16 / 10; }

/* tiles de texto (proyectos aún sin fotos) */
.tile.is-text .tile-media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--ink);
  padding: 12px;
}
.tile-text {
  font-weight: 700;
  font-size: clamp(13px, 1.2vw, 18px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.25;
}

.tile-caption {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-caption span { color: var(--ink-soft); }

/* texto central */
.cloud-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 40;
  pointer-events: none;
  white-space: nowrap;
}
.cloud-tag {
  font-family: "TRJN DaVinci", Georgia, serif;
  font-size: 21px;
  line-height: 1.35;
}
/* ----------------------- Grid de secciones (masonry) ------------------- */
/* Barra de áreas al entrar en una sección (texto plano, como la ficha) */
.area-bar {
  padding: 100px var(--pad) 0;
  font-size: var(--fs-base);
  line-height: 1.6;
}
.area-link {
  color: var(--ink);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.area-link:hover { border-bottom-color: var(--ink); }
.area-sep { color: var(--ink-soft); }
.area-bar + .section-grid { padding-top: 30px; }

.section-grid {
  padding: 110px var(--pad) 40px;
  display: flex;
  gap: 42px;
  align-items: flex-start;
}
.grid-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 72px;
}
/* todas las columnas enrasadas arriba: la primera fila queda alineada */
@media (max-width: 700px) { .section-grid { gap: 20px; } .grid-col { gap: 48px; } }

/* Projects y Audiovisual: 2 columnas grandes (media pantalla por proyecto) */
.section-grid-big { gap: 60px; }
.section-grid-big .grid-col { gap: 90px; }
.section-grid-big .grid-caption { margin-top: 16px; font-size: var(--fs-base); }
@media (max-width: 700px) {
  .section-grid-big { gap: 0; }
  .section-grid-big .grid-col { gap: 60px; }
}

.grid-item {
  width: 100%;
}
.grid-media {
  display: block;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background: #f4f4f4;
}
.grid-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.4s ease, transform 0.5s ease;
}
/* segunda foto superpuesta que aparece al pasar el ratón */
.grid-media .gm-hover {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}
.grid-media.has-media:hover .gm-base,
.grid-media.has-media:hover .gm-hover { transform: scale(1.05); }
.grid-media.has-media:hover .gm-hover { opacity: 1; }
.grid-text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--ink);
  aspect-ratio: 4 / 3;
  padding: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.grid-caption {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.grid-caption .grid-title { display: block; font-weight: 700; }
.grid-caption .grid-title:hover { color: var(--ink-soft); }
.grid-caption em {
  font-style: normal;
  color: var(--ink-soft);
  text-transform: none; /* como en la ficha: Visual Identity / Art Direction */
  letter-spacing: 0.04em;
}
.grid-caption em a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* -------------------------------- Modal -------------------------------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.12);
  padding: 4vh 3vw;
}
.modal-panel {
  position: relative;
  background: #fff;
  width: min(1160px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 48px 44px 40px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.22);
}
.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 2;
}
.modal-close:hover { color: var(--ink-soft); }
body.modal-open { overflow: hidden; }

.project-title {
  font-size: clamp(30px, 4.4vw, 54px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 20px;
}
.project-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 48px;
  margin-bottom: 26px;
}
.field { display: flex; flex-direction: column; gap: 1px; }
.field-label { font-size: var(--fs-small); color: var(--ink-soft); }
.field-value { font-size: var(--fs-base); color: var(--ink); }

/* descripción editorial: tras las dos primeras fotos, TRJN DaVinci,
   párrafo justificado (última línea a la izquierda), retranqueada */
.modal-desc {
  font-family: "TRJN DaVinci", Georgia, serif;
  font-size: clamp(19px, 2.3vw, 29px);
  line-height: 1.32;
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
  -webkit-hyphens: auto;
  padding: 5vh 9%;
}
.modal-desc p { margin-bottom: 1.1em; }
.modal-desc p:last-child { margin-bottom: 0; }
.modal-desc strong { font-weight: 700; }   /* TRJN DaVinci-Text */
.modal-desc em { font-style: italic; }      /* TRJN DaVinci-Italic */
.modal-desc .d-sm { font-size: 0.72em; }
.modal-desc .d-lg { font-size: 1.35em; }
@media (max-width: 700px) {
  .modal-desc { padding: 30px 6%; }
}

/* Proyectos recomendados al final de la ficha */
.modal-more {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.modal-more-label {
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.more-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.more-item { display: block; cursor: pointer; }
.more-media {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f4f4f4;
}
.more-media img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.2s; }
.more-item:hover img { opacity: 0.85; }
.more-media .more-text {
  display: flex; align-items: center; justify-content: center;
  height: 100%; padding: 8px; text-align: center;
  font-weight: 700; font-size: var(--fs-small); text-transform: uppercase;
  letter-spacing: 0.04em; border: 1px solid var(--line);
}
.more-title {
  display: block;
  margin-top: 8px;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
@media (max-width: 700px) {
  .more-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tags de habilidades */
.tag {
  color: var(--ink);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.tag:hover { border-bottom-color: var(--ink); }
.tag-sep { color: var(--ink-soft); }

/* Galería dentro del modal: horizontales a ancho completo,
   verticales a 2 columnas (se emparejan solas) */
.strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.strip img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
  background: #f4f4f4;
}
.strip img.is-portrait {
  width: calc(50% - 5px);
  align-self: flex-start;
}
/* proyectos con muchas piezas pequeñas (p. ej. Other Projects) */
.strip.as-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.strip.as-grid img { aspect-ratio: 6 / 5; object-fit: cover; }

/* embeds de vídeo */
.embed { width: 100%; background: #f4f4f4; }
.embed iframe { width: 100%; height: 100%; display: block; border: 0; }
.embed.yt { aspect-ratio: 16 / 9; }
.embed.ig {
  aspect-ratio: 9 / 16;
  max-width: 420px;
  margin: 0 auto;
}
.strip.as-grid .embed.yt { grid-column: 1 / -1; }

.placeholder-box {
  border: 1px dashed var(--line);
  padding: 60px 40px;
  color: var(--ink-soft);
}

/* ------------------- Filtro por área (galería de fotos) ---------------- */
.skill-head { padding: 110px var(--pad) 0; }
.skill-head + .section-grid { padding-top: 30px; }
.skill-kicker {
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.skill-head h2 {
  font-size: 22px;
  font-weight: 700;
}
.skill-count { color: var(--ink-soft); font-weight: 400; }

/* galería pura: proporción natural, sin textos */
.skill-gallery .grid-col { gap: 42px; }
.ph-item { display: block; cursor: pointer; }
.ph-item img {
  width: 100%;
  height: auto;
  display: block;
  background: #f4f4f4;
  transition: opacity 0.2s;
}
.ph-item:hover img { opacity: 0.88; }
@media (max-width: 700px) {
  .skill-gallery .grid-col { gap: 20px; }
}

/* ------------------------------- About ---------------------------------- */
.about {
  max-width: 780px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 50px;
  align-items: start;
}
.about-media img,
.about-media video { width: 100%; height: auto; display: block; }
.about h1 { font-size: 14px; margin-bottom: 24px; text-transform: uppercase; letter-spacing: 0.1em; }
.about p { margin-bottom: 18px; font-size: 16px; line-height: 1.7; }
.about .about-contact {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.about .about-contact a { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; gap: 26px; max-width: 560px; }
  .about-media img,
  .about-media video { width: 140px; }
}

/* ------------------------------- Footer -------------------------------- */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px var(--pad) 24px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-small);
  color: var(--ink-soft);
}
.footer-left, .footer-right { display: flex; align-items: center; gap: 16px; }
.footer a:hover { color: var(--ink); }

/* ------------------------------ Lightbox ------------------------------- */
.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
}

/* ------------------------------- Mobile -------------------------------- */
@media (max-width: 900px) {
  .nav-toggle { display: flex; pointer-events: auto; }

  /* menú contraído: panel que se despliega desde arriba */
  .site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: -1; /* por debajo del header (logo y hamburguesa siguen visibles) */
    flex-direction: column;
    gap: 20px;
    padding: 86px var(--pad) 30px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    transform: translateY(-110%);
    transition: transform 0.28s ease;
  }
  body.nav-open .site-nav { transform: translateY(0); }
  .site-nav a { font-size: 17px; }

  /* la nube pasa a flujo vertical con scroll */
  body.is-cloud { overflow: auto; }
  body.is-cloud .footer { display: flex; }
  .cloud {
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-wrap: wrap;
    gap: 26px 14px;
    justify-content: space-between;
    align-items: flex-start;
    padding: 130px var(--pad) 60px;
  }
  .tile { position: static !important; }
  .tile.sq .tile-media { width: 42vw; }
  .tile.v  .tile-media { width: 40vw; }
  .tile.h  .tile-media { width: 62vw; }
  .tile:nth-child(3n) { margin-top: 34px; }

  .cloud-center {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 45;
  }

  .modal { padding: 0; }
  .modal-panel {
    width: 100vw;
    max-height: 100vh;
    height: 100%;
    padding: 60px 20px 40px;
  }
  /* X siempre visible al hacer scroll en el proyecto */
  .modal-close {
    position: fixed;
    top: 14px;
    right: 16px;
  }
  .strip { gap: 8px; }
  .strip img.is-portrait { width: calc(50% - 4px); }
  .modal-desc { max-width: none; margin-left: 0; }

  .about { padding-top: 96px; }
  .skill-head { padding-top: 96px; }
}

/* --------- aviso del modo vista previa (?preview=1, desde el admin) ------ */
.preview-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 200; /* por encima del lightbox (100) */
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  padding: 9px 16px;
  border-radius: 30px;
  pointer-events: none; /* no estorba al hacer clic debajo */
  opacity: 0.92;
}
