/* ===========================================================
   Pedro Pablo Hernández — Arquitectura
   Sitio minimalista (réplica de la estética Studio CL).
   Diseño: blanco/negro, tipografía monoespaciada, grilla de
   cuadrados, lightbox de proyectos. Edita los textos en
   assets/js/projects.js
   =========================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #8a8a86;
  --line: #e6e6e3;
  --mono: "Cousine", "Roboto Mono", "Courier New", monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --proj: "Source Sans 3", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --header-h: 72px;
  --footer-h: 56px;
  --gap: 24px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===========================================================
   HEADER — fijo, centrado: logo arriba, navegación debajo
   =========================================================== */
#topBar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 32px;
}

.siteTitle a {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 8px;
  padding-left: 8px; /* compensa el tracking */
  color: var(--ink);
}
.siteTitle img.logo-img { height: 30px; width: auto; display: block; }

/* ---------- Navegación ---------- */
.main-nav { margin-top: 0; }
.main-nav > ul {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 34px;
}
.main-nav a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink);
  padding: 4px 0;
  position: relative;
  transition: opacity .2s ease;
}
.main-nav a:hover { opacity: .45; }
.main-nav li.active > a::after,
.main-nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--ink);
}

/* ---------- Dropdown "Trabajo" ---------- */
.has-sub { position: relative; }
.subnav {
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 10px 0;
  min-width: 180px;
  opacity: 0; visibility: hidden;
  transition: opacity .18s ease;
  z-index: 60;
}
.has-sub:hover .subnav,
.has-sub.open .subnav { opacity: 1; visibility: visible; }
.subnav li { text-align: left; }
.subnav a {
  display: block;
  padding: 8px 22px;
  letter-spacing: 2px;
}
.subnav a::before { content: "> "; color: var(--muted); }

/* ---------- Toggle móvil ---------- */
#navToggle {
  display: none;          /* visible solo en móvil; ahí es el ítem izquierdo de la fila */
  background: none; border: 0;
  font-family: var(--mono);
  font-size: 22px; line-height: 1;
  color: var(--ink); cursor: pointer;
  padding: 0;
}

/* ===========================================================
   CONTENEDOR PRINCIPAL
   =========================================================== */
#container {
  margin-top: var(--header-h);
  margin-bottom: var(--footer-h);
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
}

.page-head {
  text-align: center;
  padding: 46px 20px 30px;
}
.page-head h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 6px;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.page-head p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
}

/* ===========================================================
   GRILLA DE PROYECTOS — cuadrados
   =========================================================== */
#grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-flow: dense;            /* rellena huecos: bento ordenado */
  gap: var(--gap);                  /* espacio blanco entre imágenes */
  max-width: 1600px;
  margin: 0 auto;
  padding: 30px 32px;
}
.item {
  position: relative;
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
  /* el tamaño sale del span de grilla (grid-column / grid-row) según data-c/data-r */
}
.item .thumbnail {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity .35s ease, transform 1.2s ease;
}
.item:hover .thumbnail { opacity: .35; transform: scale(1.02); }

.item .project-title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: 16px;
}
.item .project-title h2 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 6px;
  margin: 0;
  color: var(--ink);
}
.item .project-title .name {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
  opacity: 0;
  transition: opacity .3s ease;
}
.item .project-title .view {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--ink);
  margin-top: 14px;
  opacity: 0;
  transition: opacity .3s ease;
}
.item:hover .name,
.item:hover .view { opacity: 1; }

/* Indicador de video en la grilla */
.item .play-badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  z-index: 2;
  pointer-events: none;
  transition: opacity .3s ease;
}
.item .play-badge::after {
  content: "";
  position: absolute;
  top: 50%; left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #111;
}
.item:hover .play-badge { opacity: 0; }   /* al hover se ve el código y "— ver —" */

.empty-note {
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 2px;
  padding: 80px 20px;
}

/* ===========================================================
   PÁGINA "ACERCA"
   =========================================================== */
.about-wrap { max-width: 680px; margin: 0 auto; padding: 20px 24px 80px; }
.about-wrap.has-photo {
  max-width: 1000px;
  display: grid;
  grid-template-columns: minmax(0, 340px) 1fr;
  gap: 52px;
  align-items: start;
}
.about-photo img { width: 100%; height: auto; display: block; }
@media (max-width: 760px) {
  .about-wrap.has-photo { grid-template-columns: 1fr; gap: 24px; }
  .about-photo { max-width: 340px; }
}
.about {}
.about h2 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin: 40px 0 12px;
}
.about p { margin: 0 0 18px; }
.about p:first-child { font-size: 17px; line-height: 1.7; }   /* primer párrafo = lead */
.about .lead { font-size: 17px; line-height: 1.7; }
.about ul, .about ol { font-family: var(--mono); font-size: 13px; margin: 0 0 18px; padding-left: 18px; }
.about ul { list-style: none; padding-left: 0; }
.about li { padding: 3px 0; color: #444; }
.about a { color: var(--ink); text-decoration: underline; }
.about a:hover { opacity: .6; }

/* ===========================================================
   LIGHTBOX DE PROYECTO  (#/codigo/)
   =========================================================== */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: none;
  flex-direction: column;
}
#lightbox.open { display: flex; }
body.lb-open { overflow: hidden; }

.lb-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}
.lb-bar .lb-code {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 5px;
}
.lb-close {
  background: none; border: 0; cursor: pointer;
  font-family: var(--mono);
  font-size: 12px; letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink);
}
.lb-close:hover { opacity: .5; }
.lb-bar-r { display: flex; align-items: center; gap: 22px; }
.lb-story-cue {
  background: none; border: 0; cursor: pointer;
  font-family: var(--mono);
  font-size: 12px; letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
}
.lb-story-cue:hover { color: var(--ink); }
.lb-story-cue .arr { display: inline-block; animation: lbbob 1.5s ease-in-out infinite; }
@keyframes lbbob { 0%, 100% { transform: translateY(-1px); } 50% { transform: translateY(2px); } }

.lb-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
/* La portada (carrusel + ficha) ocupa la primera pantalla; el relato fluye debajo */
.lb-body {
  height: 100%;
  display: flex;
  min-height: 0;
}

/* Visor de imágenes */
.lb-stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  min-width: 0;
  padding: 30px;
}
.lb-viewport {
  flex: 1 1 auto;
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  touch-action: pan-y;          /* swipe horizontal → JS · arrastre vertical → scroll del relato */
  cursor: grab;
}
.lb-track {
  display: flex;
  height: 100%;
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
.lb-track.dragging { transition: none; cursor: grabbing; }
.lb-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-slide img,
.lb-slide video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}
.lb-video { background: #000; }
.lb-nav {
  position: absolute;
  top: 0; bottom: 0;
  width: 64px;
  z-index: 5;
  cursor: pointer;
  background: none; border: 0;
  display: flex; align-items: center;
  font-family: var(--mono);
  font-size: 32px; color: var(--ink);
  opacity: .35; transition: opacity .2s ease;
}
.lb-nav:hover { opacity: .9; }
.lb-prev { left: 0; justify-content: flex-start; padding-left: 18px; }
.lb-next { right: 0; justify-content: flex-end; padding-right: 18px; }
.lb-single .lb-nav,
.lb-single .lb-dots { display: none; }
.lb-dots {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;
}
.lb-dot {
  width: 7px; height: 7px;
  padding: 0; border: 0;
  border-radius: 50%;
  background: rgba(17, 17, 17, .22);
  cursor: pointer;
  transition: background .3s ease, width .35s cubic-bezier(.4, 0, .2, 1), border-radius .35s ease;
}
.lb-dot:hover { background: rgba(17, 17, 17, .5); }
.lb-dot.on {
  background: var(--ink);
  width: 22px;
  border-radius: 4px;       /* el activo se ensancha en pastilla */
}

/* Panel de metadata */
.lb-meta {
  flex: 0 0 340px;
  border-left: 1px solid var(--line);
  padding: 30px 28px;
  overflow-y: auto;
}
.lb-meta { font-family: var(--proj); }
.lb-meta h1 {
  font-family: var(--proj);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0;
  text-transform: none;
  margin: 0 0 18px;
}
.lb-meta dl { margin: 0 0 22px; }
.lb-meta dt {
  font-family: var(--proj);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  margin-top: 13px;
}
.lb-meta dd { font-family: var(--proj); margin: 1px 0 0; font-size: 15px; color: var(--ink); }
.lb-meta .desc { font-family: var(--proj); font-size: 15px; line-height: 1.7; color: #333; }
.lb-meta .desc p { margin: 0 0 14px; }
.lb-meta .desc p:last-child { margin-bottom: 0; }
.lb-meta .desc ul, .lb-meta .desc ol { margin: 0 0 14px; padding-left: 20px; }
.lb-meta .desc h3 {
  font-family: var(--proj);
  font-weight: 600;
  font-size: 13px; letter-spacing: 0;
  text-transform: none; color: var(--muted);
  margin: 0 0 6px;
}

/* ===========================================================
   RELATO DEL PROYECTO — caso de estudio con scroll
   =========================================================== */
.lb-story { border-top: 1px solid var(--line); background: var(--bg); }
.lb-story:empty { display: none; border-top: 0; }
.lb-story-inner { max-width: 1060px; margin: 0 auto; padding: 70px 34px 110px; }
.lb-story-head { text-align: center; margin-bottom: 56px; }
.lb-story-kicker {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 4px; text-transform: uppercase;
  color: var(--muted);
}
.sb { margin: 0 0 70px; }
.sb:last-child { margin-bottom: 0; }
.sb-split { display: flex; gap: 52px; align-items: center; }
.sb-split.rev { flex-direction: row-reverse; }
.sb-fig { flex: 1 1 56%; min-width: 0; margin: 0; }
.sb-fig img, .sb-img-full img {
  width: 100%; height: auto; display: block;
  border-radius: 3px;
}
.sb-split .sb-prose { flex: 1 1 44%; min-width: 0; }
.sb-img-full { text-align: center; }
.sb-text-full .sb-prose { max-width: 700px; margin: 0 auto; text-align: center; }
.sb-prose {
  font-family: var(--proj);
  font-size: 17px; line-height: 1.8; color: #2b2b2b;
}
.sb-prose h2 {
  font-family: var(--proj); font-weight: 600;
  font-size: 25px; line-height: 1.25; letter-spacing: 0;
  text-transform: none; color: var(--ink); margin: 0 0 14px;
}
.sb-prose h3 {
  font-family: var(--proj); font-weight: 600;
  font-size: 18px; line-height: 1.3; letter-spacing: 0;
  text-transform: none; color: var(--ink); margin: 0 0 10px;
}
.sb-prose p { margin: 0 0 16px; }
.sb-prose p:last-child { margin-bottom: 0; }
.sb-prose ul, .sb-prose ol { margin: 0 0 16px; padding-left: 22px; }
.sb-prose li { margin: 0 0 6px; }

/* ===========================================================
   FOOTER
   =========================================================== */
#footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--footer-h);
  padding: 0 32px;
}
#footer .contact {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
}
#footer .social {
  margin-top: 0;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
#footer .social a {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  opacity: .7;
  transition: opacity .2s ease, color .2s ease;
}
#footer .social a:hover { opacity: 1; }
#footer .social svg { width: 20px; height: 20px; }
#footer .footer-intranet {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 1;
}
#footer .footer-intranet:hover { color: var(--ink); }

/* ===========================================================
   RESPONSIVE
   =========================================================== */
@media (max-width: 1200px) {
  #grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  #grid { grid-template-columns: repeat(2, 1fr); }
  .lb-meta { flex-basis: 280px; }
}

@media (max-width: 820px) {
  .lb-story-inner { padding: 54px 26px 84px; }
  .sb { margin-bottom: 48px; }
  .sb-split, .sb-split.rev { flex-direction: column; gap: 22px; }
  .sb-fig, .sb-split .sb-prose { flex: 1 1 auto; width: 100%; }
}

@media (max-width: 680px) {
  :root { --header-h: 58px; }
  #topBar { padding: 0 18px; }
  .siteTitle a { font-size: 20px; letter-spacing: 6px; }

  #navToggle { display: block; }
  .main-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    display: none;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 10px 18px 16px;
  }
  .main-nav.open { display: block; }
  .main-nav > ul { flex-direction: column; align-items: flex-start; gap: 14px; }
  .subnav {
    position: static; transform: none; opacity: 1; visibility: visible;
    border: 0; padding: 6px 0 0; min-width: 0;
    background: none;
  }
  .has-sub .subnav { display: none; }
  .has-sub.open .subnav { display: block; }

  #grid { grid-template-columns: repeat(2, 1fr); padding: 16px; gap: 10px; }
  #footer { padding: 0 14px; }
  #footer .contact { font-size: 9px; letter-spacing: 0.5px; }
  #footer .social { gap: 11px; }
  #footer .footer-intranet { font-size: 9px; letter-spacing: 1px; }

  .lb-body { flex-direction: column; }
  .lb-meta {
    flex: 0 0 auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .lb-nav { width: 52px; opacity: .5; }   /* angostas: el centro queda libre para el swipe */

  .lb-bar-r { gap: 14px; }
  .lb-story-cue { letter-spacing: 2px; }
  .lb-story-inner { padding: 42px 18px 64px; }
  .lb-story-head { margin-bottom: 34px; }
  .sb { margin-bottom: 44px; }
  .sb-prose { font-size: 16px; line-height: 1.75; }
  .sb-prose h2 { font-size: 22px; }
  .sb-prose h3 { font-size: 17px; }
}
