/* ══════════════════════════════════════════════════════
   Juan Bautista Crosa — website stylesheet
   ══════════════════════════════════════════════════════ */

:root {
  --white: #ffffff;
  --ink:   #111111;
  --blue:  #0000ff;
  --mid:   #888888;
  --light: #e0e0e0;
  --line:  #ececec;
  --F: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --nav-h: 52px;
  --cat-w: 180px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--white);
  color: var(--ink);
  font-family: var(--F);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ══ NAV ══ */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0; z-index: 300;
  height: var(--nav-h);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 1.6rem;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: background 0.35s ease, border-color 0.35s ease;
}
.nav-name {
  font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--ink);
  cursor: pointer; transition: color 0.35s;
}
.nav-right { display: flex; align-items: center; gap: 1.8rem; }
.nav-links { display: flex; gap: 1.6rem; list-style: none; }
.nav-links a {
  font-weight: 400; font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--ink);
  transition: opacity 0.2s, color 0.35s;
}
.nav-links a:hover { opacity: 0.5; }
.nav-links a.current { color: var(--blue); }

.lang-switch {
  display: flex; gap: 0.4rem; align-items: center;
  font-size: 0.78rem; font-weight: 400;
}
.lang-switch button {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: inherit; font-weight: inherit;
  color: var(--mid); padding: 0; transition: color 0.18s;
}
.lang-switch button.active { color: var(--ink); }
.lang-switch .sep { color: var(--light); }

/* Home: nav sin fondo, texto oscuro sobre el collage blanco */
body.on-home #nav {
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body.on-home .nav-name,
body.on-home .nav-links a { color: var(--ink); }
body.on-home .nav-links a.current { color: var(--blue); }

/* ══ PAGES ══ */
.page { display: none; }
.page.active { display: block; }
@keyframes pgFade { from { opacity: 0 } to { opacity: 1 } }
.page.active { animation: pgFade 0.35s ease both; }

/* Footer fijado al fondo del viewport en último scroll para páginas de
   contenido corto (info, exposiciones, muestra, estudio, contacto). */
#page-info.active,
#page-exposiciones.active,
#page-muestra.active,
#page-estudio.active,
#page-contacto.active {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
#page-info.active > .site-footer,
#page-exposiciones.active > .site-footer,
#page-muestra.active > .site-footer,
#page-estudio.active > .site-footer,
#page-contacto.active > .site-footer {
  margin-top: auto;
}

/* ══ FOOTER GLOBAL ══ */
.site-footer {
  padding: 1.5rem 1.6rem;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.72rem; color: var(--mid); flex-wrap: wrap; gap: 0.8rem;
}
.site-footer a { transition: opacity 0.2s; }
.site-footer a:hover { opacity: 0.5; }
.footer-contact { display: flex; gap: 1.8rem; }
.footer-contact a { color: var(--mid); font-size: 0.72rem; }

/* ══ HOME — collage scattered, scroll loop ══ */
#page-home.active { display: block; padding-top: var(--nav-h); }

.home-collage {
  display: block;
  padding: 8vh 4vw 14vh;
  position: relative;
}
.collage-item {
  display: block;
  width: var(--w, 34%);
  margin-left: var(--x, 0%);
  margin-bottom: var(--g, 4vh);
}
.collage-item img {
  width: 100%;
  height: auto;
  max-height: 92vh;
  object-fit: contain;
  display: block;
  background: transparent;
}

/* Cuando el JS duplica el collage para loop, los items duplicados llevan .clone */
.collage-item.clone { /* mismas reglas, sólo marcador */ }

/* ── HOME footer fijo al pie de la pantalla ── */
.home-footer-fixed {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 250;
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.6rem;
  font-size: 0.72rem;
  color: var(--mid);
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-top: 1px solid var(--line);
}
body.on-home .home-footer-fixed { display: flex; }
.home-footer-fixed .hf-left { letter-spacing: 0.02em; }
.home-footer-fixed .hf-right { display: flex; gap: 1.6rem; align-items: center; }
.home-footer-fixed a {
  color: var(--mid);
  display: inline-flex; align-items: center; gap: 0.45rem;
  transition: color 0.18s;
}
.home-footer-fixed a:hover { color: var(--ink); }
body.on-home .home-collage { padding-bottom: calc(18vh + 56px); }

/* ══ OBRAS ══ */
#page-obras.active { display: block; padding-top: var(--nav-h); }

.cat-sidebar {
  position: fixed;
  top: var(--nav-h); left: 0;
  width: var(--cat-w);
  height: calc(100vh - var(--nav-h));
  padding: 3rem 1.6rem 2rem;
  display: flex; flex-direction: column; gap: 0;
  background: var(--white); z-index: 100;
}
.cat-link {
  font-weight: 300; font-size: 0.82rem;
  color: var(--mid); padding: 0.55rem 0;
  cursor: pointer; display: block;
  transition: color 0.18s;
  border: none; background: none; text-align: left;
}
.cat-link:hover { color: var(--ink); }
.cat-link.active { color: var(--ink); font-weight: 400; }

.obras-main {
  margin-left: var(--cat-w);
  padding: 3rem 5rem 0 4rem;
}

.obras-section-title {
  font-weight: 300; font-size: 0.72rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--mid); padding: 3.5rem 0 1.8rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}
.obras-section-title:first-child { border-top: none; padding-top: 0.5rem; }

.obra-item {
  margin-bottom: 6rem;
  max-width: 1100px;
}
.obra-item img, .obra-item .img-ph {
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - var(--nav-h) - 6rem);
  height: auto;
  margin: 0 auto;
  display: block;
  background: #f2f2f2;
  object-fit: contain;
}
/* Tríptico: cada imagen del set comparte el alto disponible */
.obra-item img + img { margin-top: 0.4rem; }
.obra-caption {
  margin-top: 0.9rem;
  font-size: 0.9rem; font-style: italic; font-weight: 300;
  color: var(--ink); line-height: 1.6;
}
.obra-caption small {
  font-style: normal; font-size: 0.72rem;
  color: var(--mid);
}

.obras-footer { margin-left: var(--cat-w); }

/* ══ INFO ══ */
#page-info.active { padding-top: var(--nav-h); }
.bio-brief {
  font-size: 1.05rem; font-weight: 300;
  line-height: 1.7; color: var(--ink);
  margin-bottom: 0.4rem;
}

.info-wrap {
  max-width: 840px;
  padding: 5rem 4rem 6rem 4rem;
}
.info-section {
  margin-bottom: 3.8rem; padding-bottom: 3.8rem;
  border-bottom: 1px solid var(--line);
}
.info-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.info-label {
  font-weight: 700; font-size: 0.72rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 1.6rem; color: var(--ink);
}

.bio-statement {
  font-size: 1rem; font-weight: 300;
  line-height: 1.95; color: #1a1a1a;
}
.bio-statement p { margin-bottom: 1.1rem; }
.bio-statement p:last-child { margin-bottom: 0; }

.cv-list { list-style: none; }
.cv-item {
  display: grid; grid-template-columns: 5.4rem 1fr;
  gap: 1.4rem; padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem; font-weight: 300; line-height: 1.55;
}
.cv-item:first-child { padding-top: 0; }
.cv-item:last-child { border-bottom: none; padding-bottom: 0; }
.cv-y { font-size: 0.68rem; color: var(--mid); padding-top: 0.15rem; letter-spacing: 0.02em; }
.cv-e em { font-style: italic; }
.cv-e small { display: block; font-size: 0.72rem; color: var(--mid); margin-top: 0.2rem; }

/* ══ CONTACTO ══ */
#page-contacto.active {
  padding-top: var(--nav-h);
  background: var(--white); color: var(--ink);
}

.contacto-wrap {
  max-width: 560px;
  padding: 5rem 3rem 5rem 4rem;
  display: flex; flex-direction: column; gap: 2.2rem;
}
.contacto-heading {
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.contacto-invite {
  font-size: 0.95rem; font-weight: 300;
  line-height: 1.85; color: #2a2a2a;
  max-width: 42ch;
}
.contacto-email-btn {
  display: inline-block;
  width: fit-content;
  font-weight: 400; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--blue);
  border-bottom: 1px solid var(--blue);
  padding-bottom: 0.25rem;
  transition: opacity 0.2s;
}
.contacto-email-btn:hover { opacity: 0.55; }

.contacto-data { display: flex; flex-direction: column; margin-top: 0.5rem; }
.ct-row {
  display: flex; flex-direction: column;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem; font-weight: 300;
}
.ct-row:first-child { padding-top: 0; }
.ct-row:last-child { border-bottom: none; }
.ct-lbl {
  font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--mid);
  margin-bottom: 0.3rem;
}
a.ct-val { color: var(--ink); }
a.ct-val:hover { color: var(--blue); }

/* ══ EXPOSICIONES (index) ══ */
#page-exposiciones.active { padding-top: var(--nav-h); }

.expo-index {
  max-width: 760px;
  padding: 5rem 3rem 7rem 4rem;
}

.expo-item {
  display: flex; align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: opacity 0.2s, padding-left 0.25s ease;
}
.expo-item:first-child { border-top: 1px solid var(--line); }
.expo-item:hover { opacity: 0.65; padding-left: 0.5rem; }
.expo-item.is-disabled { cursor: default; opacity: 0.55; }
.expo-item.is-disabled:hover { padding-left: 0; opacity: 0.55; }
.expo-item.is-disabled .expo-item-meta small { display: block; margin-top: 0.3rem; font-style: italic; }

.expo-item-title {
  font-size: 1rem; font-weight: 300;
  font-style: italic;
}
.expo-item-meta {
  font-size: 0.72rem; font-weight: 300;
  color: var(--mid); white-space: nowrap;
  text-align: right;
  line-height: 1.6;
}

/* ══ MUESTRA INDIVIDUAL ══ */
#page-muestra.active { padding-top: var(--nav-h); }

.muestra-back {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.75rem; font-weight: 300;
  color: var(--mid); cursor: pointer;
  padding: 1.8rem 4rem 0;
  transition: color 0.2s;
}
.muestra-back:hover { color: var(--ink); }
.muestra-back::before { content: '←'; font-size: 0.9rem; }

.muestra-wrap {
  max-width: 880px;
  padding: 1rem 4rem 7rem;
}

.muestra-header {
  margin: 2rem 0 3.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.muestra-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 300; font-style: italic;
  line-height: 1.15;
  margin-bottom: 0.8rem;
}
.muestra-info {
  font-size: 0.78rem; font-weight: 300;
  color: var(--mid);
  line-height: 1.75;
  letter-spacing: 0.02em;
}
.muestra-desc {
  font-size: 0.95rem; font-weight: 300;
  line-height: 1.9; color: #2a2a2a;
  max-width: 58ch;
  margin-bottom: 3.5rem;
}
.muestra-desc p { margin-bottom: 1rem; }
.muestra-desc p:last-child { margin-bottom: 0; }
.muestra-desc-author {
  margin-top: 1.5rem !important;
  font-size: 0.8rem; color: var(--mid);
  font-style: italic;
}

.muestra-grid {
  display: flex; flex-direction: column; gap: 0;
}
.muestra-grid-heading {
  font-weight: 700; font-size: 0.72rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--mid);
  padding: 1.5rem 0 1.6rem;
  border-top: 1px solid var(--line);
}
.muestra-grid-heading:first-child { border-top: none; padding-top: 0; }
.muestra-grid-row {
  display: flex; flex-direction: column; gap: 4.5rem;
  margin-bottom: 3.5rem;
}
.muestra-img-item img,
.muestra-img-item .img-ph {
  width: 100%; display: block;
  background: #f2f2f2;
}
.muestra-img-caption {
  margin-top: 0.7rem;
  font-size: 0.75rem; font-style: italic; font-weight: 300;
  color: var(--mid);
  line-height: 1.6;
}

/* ══ ESTUDIO ══ */
#page-estudio.active { padding-top: var(--nav-h); }

.estudio-intro {
  max-width: 620px;
  padding: 4rem 4rem 3rem;
  font-size: 0.95rem; font-weight: 300;
  line-height: 1.85; color: #2a2a2a;
}

/* Estudio: masonry CSS-columns. Sin recortar, cada imagen en su proporción real. */
.estudio-collage {
  column-count: 3;
  column-gap: 1.2rem;
  padding: 3rem 2.5rem 4rem;
  width: 100%;
}
.estudio-img {
  break-inside: avoid;
  margin-bottom: 1.2rem;
  background: transparent;
  display: block;
  overflow: hidden;
}
.estudio-img img,
.estudio-img .img-ph {
  width: 100%;
  height: auto;          /* sin crop, proporción natural */
  display: block;
  transition: opacity 0.4s ease;
}

/* ══ i18n ══ */
body.lang-en [data-es]       { display: none; }
body.lang-en [data-en]       { display: inline; }
body.lang-es [data-en]       { display: none; }
body.lang-es [data-es]       { display: inline; }
body.lang-en [data-es-block] { display: none !important; }
body.lang-en [data-en-block] { display: block !important; }
body.lang-es [data-en-block] { display: none !important; }
body.lang-es [data-es-block] { display: block !important; }

/* ══ Instagram icon link ══ */
.ig-link { display: inline-flex; align-items: center; gap: 0.4rem; }
.ig-icon { width: 1em; height: 1em; flex-shrink: 0; vertical-align: middle; }
.home-footer-fixed .ig-icon,
.site-footer .ig-icon { width: 0.95rem; height: 0.95rem; }
.contacto-data .ig-icon { width: 1rem; height: 1rem; }

/* ══ RESPONSIVE ══ */
@media (max-width: 900px) {
  :root { --cat-w: 150px; }
  .obras-main { padding: 2.5rem 2.5rem 0 2rem; }
  .info-wrap { padding: 4rem 2.5rem 5rem; }
  .contacto-wrap { padding: 4rem 2rem 5rem 2.5rem; }
  .expo-index { padding: 4rem 2.5rem 5rem; }
  .muestra-back { padding: 1.5rem 2.5rem 0; }
  .muestra-wrap { padding: 1rem 2.5rem 5rem; }
  .estudio-intro { padding: 3rem 2.5rem 2.5rem; }
  .estudio-collage { column-count: 2; padding: 0 1.6rem 4rem; }
  .home-collage { padding: 8vh 4vw 14vh; }
  .collage-item { margin-bottom: var(--g, 3.5vh); }
}

@media (max-width: 640px) {
  :root { --nav-h: 46px; --cat-w: 110px; }
  #nav { padding: 0 1rem; gap: 0.6rem; }
  .nav-name { font-size: 0.78rem; letter-spacing: 0.01em; }
  .nav-right { gap: 0.85rem; }
  .nav-links { gap: 0.85rem; flex-wrap: wrap; }
  .nav-links a { font-size: 0.66rem; letter-spacing: 0.04em; }
  .lang-switch { font-size: 0.7rem; }
  .obras-main { padding: 1.5rem 1.2rem 0 1rem; }
  .obra-item { margin-bottom: 4rem; }
  .obra-item img { max-height: calc(100vh - var(--nav-h) - 4rem); }
  .info-wrap { padding: 3rem 1.3rem 4rem; }
  .cv-item { grid-template-columns: 4rem 1fr; gap: 1rem; font-size: 0.85rem; }
  .bio-statement { font-size: 0.95rem; line-height: 1.8; }
  .contacto-wrap { padding: 3rem 1.3rem 4rem; }
  .expo-index { padding: 3rem 1.3rem 4rem; }
  .expo-item { flex-direction: column; align-items: flex-start; gap: 0.4rem; padding: 1.1rem 0; }
  .expo-item-meta { text-align: left; white-space: normal; }
  .muestra-back { padding: 1.3rem 1.3rem 0; }
  .muestra-wrap { padding: 0.8rem 1.3rem 4rem; }
  .muestra-header { margin: 1.5rem 0 2.5rem; padding-bottom: 1.5rem; }
  .muestra-grid { gap: 3rem; }
  .estudio-intro { padding: 2.5rem 1.3rem 2rem; font-size: 0.9rem; }
  .estudio-collage { column-count: 1; column-gap: 0; padding: 0 1.3rem 3rem; }
  .estudio-img { margin-bottom: 1rem; }
  .site-footer { padding: 1.2rem 1.3rem; flex-direction: column; align-items: flex-start; }
  .footer-contact { gap: 1.2rem; flex-wrap: wrap; }

  /* Home collage en celular: imágenes más grandes, menos gap */
  .home-collage { padding: 6vh 4vw 16vh; }
  .collage-item {
    width: max(var(--w, 70%), 70%) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-bottom: 5vh;
  }
  .collage-item img { max-height: 76vh; }

  /* Footer fijo home en celular */
  .home-footer-fixed { padding: 0.7rem 1rem; font-size: 0.66rem; }
  .home-footer-fixed .hf-right { gap: 1rem; }
  .home-footer-fixed .hf-left { display: none; }
  body.on-home .home-collage { padding-bottom: calc(18vh + 50px); }
}

@media (max-width: 430px) {
  .cat-sidebar {
    position: sticky; top: var(--nav-h); left: 0;
    width: 100%; height: auto;
    flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1rem;
    padding: 0.7rem 1.1rem;
    border-right: none;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,0.96);
    backdrop-filter: saturate(160%) blur(8px);
    -webkit-backdrop-filter: saturate(160%) blur(8px);
    z-index: 90;
    scrollbar-width: none;
  }
  .cat-sidebar::-webkit-scrollbar { display: none; }
  .cat-link {
    padding: 0.2rem 0; font-size: 0.74rem;
    white-space: nowrap; flex-shrink: 0;
  }
  .obras-main { margin-left: 0; padding: 1.2rem 1.2rem 0; }
  .obras-footer { margin-left: 0; }
  .obras-section-title { padding: 2.5rem 0 1.2rem; }

  /* Nav extra compacta en mobile pequeño */
  .nav-links a { font-size: 0.62rem; }
  .nav-name { font-size: 0.72rem; }
}
                                    