/* ════════════════════════════════════════════════════════════════════
   LUCÍA ERIJIMOVICH — hoja de estilos única
   Sitio de una sola página (index.html): home + overlay de detalle.
   Un solo color de acento (--accent, rosa). Lo setea js/data.js desde
   contents.js (site.accentColor), así que cambiarlo en el CMS lo cambia
   en todo el sitio.
   Las fuentes (Google Fonts) se cargan con <link> en el <head> de index.html,
   no con @import acá: así no bloquean el render del CSS.
   ════════════════════════════════════════════════════════════════════ */

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

:root {
  --cream:      #fef8e4;   /* fondo de toda la página; lo puede pisar el CMS (site.pageBg) */
  --cream-mid:  #f5edd0;   /* tono un poco más profundo (secciones "alt" y cards); lo deriva data.js */
  /* Velos translúcidos del mismo color de fondo (nav al scrollear, menú mobile,
     barra del overlay). data.js los recalcula desde site.pageBg. */
  --cream-veil-95: rgba(254,248,228,0.95);
  --cream-veil-97: rgba(254,248,228,0.97);
  --cream-veil-92: rgba(254,248,228,0.92);

  /* Fondo de galería ("pared") del visor de detalle + miniaturas + hero del detalle.
     Por defecto es CLARO; lo puede pisar data.js con site.galleryBg desde el CMS.
     --mat-fg* / --mat-veil* son los colores de texto/overlay que se calculan
     según si --mat es claro u oscuro (data.js → applyGalleryBg). Acá quedan
     seteados para el default CLARO, así el sitio se ve bien sin JS. */
  --mat:           #e9e4d8;
  --mat-fg:        rgba(40,36,32,0.55);   /* texto secundario (caption, contador) */
  --mat-fg-strong: #2c2925;               /* texto/iconos fuertes (flechas) */
  --mat-border:    rgba(40,36,32,0.18);   /* borde de las flechas */
  --mat-veil:      rgba(255,255,255,0.5); /* fondo de las flechas */
  --mat-veil-strong: rgba(255,255,255,0.8);

  --accent:     #ff9e9e;   /* lo pisa data.js con site.accentColor */
  --gray-light: #b0aaa0;
  --gray:       #7a756c;
  --gray-dark:  #4a453f;
  --ink:        #282420;
  --white:      #fff;
  --nav-h:      64px;
  --edge:       clamp(24px, 5vw, 72px);  /* margen lateral fluido */
  --line:       rgba(120,110,96,0.16);
  --card-gap:   clamp(28px, 8vw, 140px);  /* aire entre cards de los carruseles (a más gap, cards más chicas) */

  /* Fuentes. Las pisa data.js con site.fonts (CMS → Tipografía). Los <link> de
     Google Fonts se cargan en el <head> de index.html (bloque FONTS) y/o los
     inyecta data.js para el preview del borrador. */
  --font-body:    "Cormorant Garamond", Georgia, serif;
  --font-display: "Luxurious Script", cursive;

  /* Escalas de tamaño (CMS → Tipografía). Acotadas en data.js a un rango seguro
     para no romper el layout. Multiplican el font-size del texto de contenido
     (--text-scale) y de los títulos (--display-scale). La "chrome" (nav,
     etiquetas) queda fija a propósito. */
  --text-scale:    1;
  --display-scale: 1;
  --hero-scale:    1;  /* nombre en el hero (CMS) */
  --nav-scale:     1;  /* nombre en la barra de navegación (CMS) */
  --navlinks-scale: 1; /* links del menú: Bio, Series, etc. (CMS) */
}

html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: inherit; }

/* ── Etiqueta de sección compartida ──────────────────────────────── */
.s-label {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 400;
  display: block;
}

/* ════════════════════════════════════════════════════════════════════
   NAV
   ════════════════════════════════════════════════════════════════════ */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--edge);
  transition: background 0.5s ease, border-color 0.5s ease;
  border-bottom: 1px solid transparent;
}
/* Scrim: degradado oscuro sutil detrás del nav sobre el hero, para dar
   contraste al texto blanco. Se desvanece al hacer scroll. */
nav::before {
  content: "";
  position: absolute;
  inset: 0;
  bottom: auto;
  height: calc(var(--nav-h) * 2);
  background: linear-gradient(to bottom, rgba(20,16,12,0.38), rgba(20,16,12,0));
  pointer-events: none;
  z-index: -1;
  opacity: 1;
  transition: opacity 0.5s ease;
}
nav.scrolled::before,
.nav-menu-open::before { opacity: 0; }
nav.scrolled {
  background: var(--cream-veil-95);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}
.nav-name {
  font-family: var(--font-display);
  /* Escala propia (CMS) con tope en vw: aunque la agranden, en mobile no se
     pasa de la barra (el nombre tiene white-space:nowrap). */
  font-size: min(calc(21px * var(--nav-scale, 1)), 8vw);
  color: var(--white);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: color 0.4s, text-shadow 0.4s;
  text-shadow: 0 1px 12px rgba(20,16,12,0.35);
}
nav.scrolled .nav-name { color: var(--ink); text-shadow: none; }

.nav-links { display: flex; gap: 36px; list-style: none; }
.nav-links a {
  font-size: calc(11px * var(--navlinks-scale, 1));
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.3s, text-shadow 0.3s;
  text-shadow: 0 1px 10px rgba(20,16,12,0.3);
  position: relative;
  padding-bottom: 2px;
}
.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0; left: 50%; right: 50%;
  height: 1px;
  background: currentColor;
  transition: left 0.35s ease, right 0.35s ease;
}
.nav-links a:hover::after { left: 0; right: 0; }
nav.scrolled .nav-links a { color: var(--gray); text-shadow: none; }
nav.scrolled .nav-links a:hover { color: var(--ink); }

/* Toggle mobile */
.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 4px; flex-direction: column; gap: 5px;
}
.nav-toggle span {
  display: block; width: 22px; height: 1px;
  background: var(--white); transition: background 0.4s;
}
nav.scrolled .nav-toggle span { background: var(--ink); }
.nav-menu-open .nav-links {
  display: flex; flex-direction: column;
  position: fixed; top: var(--nav-h); left: 0; right: 0;
  background: var(--cream-veil-97);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  padding: 32px var(--edge) 40px;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.nav-menu-open .nav-links a { color: var(--gray); font-size: calc(13px * var(--navlinks-scale, 1)); }

/* Con el menú abierto, la barra del nav toma el mismo fondo claro que el panel
   desplegable: así no se ve el hero asomando por encima (el "espacio raro"). */
.nav-menu-open {
  background: var(--cream-veil-97);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--line);
}
.nav-menu-open .nav-name { color: var(--ink); }
.nav-menu-open .nav-toggle span { background: var(--ink); }

/* ════════════════════════════════════════════════════════════════════
   HERO (carrusel crossfade)
   ════════════════════════════════════════════════════════════════════ */
#hero {
  height: 100vh;        /* fallback */
  height: 100svh;       /* viewport "chico": excluye la barra del browser en mobile */
  min-height: 500px;
  position: relative; overflow: hidden;
  touch-action: pan-y;  /* permite el swipe horizontal sin romper el scroll vertical */
}
/* Video de fondo del hero (reemplaza el carrusel de imágenes si está seteado) */
.hero-video {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 30%;
}
.hero-slide {
  position: absolute; inset: 0; opacity: 0; z-index: 1;
  transition: opacity 2.2s ease;
}
.hero-slide.active { opacity: 1; z-index: 2; }
.hero-slide img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 30%;
}
.hero-veil {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to bottom,
    rgba(16,12,8,0.08) 0%, rgba(16,12,8,0.02) 45%, rgba(16,12,8,0.52) 100%);
}
.hero-id { position: absolute; bottom: 48px; left: var(--edge); z-index: 2; }
.hero-id h1 {
  font-family: var(--font-display);
  /* Escala propia (CMS, --hero-scale) con tope en vw: tiene white-space:nowrap,
     así que el min() evita que a tamaños grandes se salga de la pantalla en mobile.
     A escala 1 el clamp manda y el comportamiento no cambia. */
  font-size: min(calc(clamp(34px, 4vw, 48px) * var(--hero-scale, 1)), 12vw);
  color: var(--white); font-weight: 400; line-height: 1;
  letter-spacing: 0.02em; white-space: nowrap;
}
.hero-id p {
  margin-top: 10px; font-size: 10px; letter-spacing: 0.28em;
  text-transform: uppercase; color: rgba(255,255,255,0.5); font-weight: 400;
}
.hero-dots {
  position: absolute; bottom: 52px; right: var(--edge); z-index: 2;
  display: flex; gap: 8px; align-items: center;
}
.hero-dot {
  width: 20px; height: 1px; background: rgba(255,255,255,0.35);
  cursor: pointer; border: none; transition: background 0.3s, width 0.3s;
}
.hero-dot.active { background: rgba(255,255,255,0.85); width: 32px; }

/* ════════════════════════════════════════════════════════════════════
   BIO
   ════════════════════════════════════════════════════════════════════ */
#bio {
  display: grid; grid-template-columns: 1fr 1fr;
  scroll-margin-top: var(--nav-h);
}
.bio-img-col {
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h)); overflow: hidden;
}
.bio-img-col img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  transition: filter 0.7s ease;
}
.bio-img-col:hover img { filter: saturate(0.85); }
.bio-text-col {
  padding: 96px var(--edge);
  display: flex; flex-direction: column; justify-content: center;
}
.bio-text-col .s-label { margin-bottom: 10px; }
.bio-text-col h2 {
  font-size: calc(clamp(22px, 2.5vw, 32px) * var(--display-scale));
  font-weight: 300; font-style: italic; color: var(--heading-color, var(--gray-dark));
  line-height: 1.25; margin-bottom: 32px;
}
.bio-text-col p {
  font-size: calc(clamp(14px, 1.1vw, 16px) * var(--text-scale));
  line-height: 2; color: var(--text-color, var(--gray)); max-width: 50ch;
}
.bio-text-col p + p { margin-top: 16px; }
.bio-formation {
  margin-top: 52px; padding-top: 36px; border-top: 1px solid var(--line);
}
.bio-formation .s-label { margin-bottom: 20px; }
.formation-list { list-style: none; }
.formation-item {
  display: flex; gap: 20px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px; position: relative;
  transition: padding-left 0.3s;
}
.formation-item::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 1px; background: var(--accent);
  transform: scaleY(0); transform-origin: top; transition: transform 0.4s ease;
}
.formation-item:hover { padding-left: 10px; }
.formation-item:hover::before { transform: scaleY(1); }
.formation-year {
  color: var(--gray-light); letter-spacing: 0.06em;
  width: 64px; flex-shrink: 0; font-size: 12px;
}
.formation-text { color: var(--gray); line-height: 1.6; }

/* ════════════════════════════════════════════════════════════════════
   CARRUSELES (Proyectos + Exposiciones)
   ════════════════════════════════════════════════════════════════════ */
.carousel-section {
  scroll-margin-top: var(--nav-h);
  padding: 88px 0;
}
.carousel-section.alt { background: var(--cream-mid); }
.carousel-header {
  padding: 0 var(--edge) 36px;
  display: flex; align-items: flex-end; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.carousel-header .s-label { margin-bottom: 6px; }
.carousel-header h2 {
  font-size: calc(clamp(20px, 2.2vw, 30px) * var(--display-scale));
  font-weight: 300; font-style: italic; color: var(--heading-color, var(--gray-dark));
}
.carousel-nav { display: flex; gap: 2px; align-items: center; }
.carousel-btn {
  width: 40px; height: 40px;
  background: none; border: 1px solid rgba(120,110,96,0.25);
  cursor: pointer; color: var(--gray); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.3s, color 0.3s;
}
.carousel-btn:hover { border-color: var(--accent); color: var(--ink); }
.carousel-btn:disabled { opacity: 0.3; cursor: default; }
.carousel-btn:disabled:hover { border-color: rgba(120,110,96,0.25); color: var(--gray); }
.carousel-count {
  font-size: 11px; letter-spacing: 0.1em; color: var(--gray-light);
  padding: 0 14px; white-space: nowrap;
}
.carousel-track-wrap { overflow: hidden; position: relative; }
.carousel-track {
  display: flex;
  gap: var(--card-gap);   /* aire entre cards; makeCarousel() lo descuenta del ancho */
  transition: transform 0.55s cubic-bezier(0.4,0,0.2,1);
  will-change: transform;
}

/* Cards (obra + expo comparten base) */
.obra-card {
  flex: 0 0 auto; min-width: 0;
  background: var(--cream);
  display: block; text-decoration: none; position: relative;
}
.carousel-section.alt .obra-card { background: var(--cream-mid); }
.obra-card-img-wrap {
  overflow: hidden; aspect-ratio: 5/4; background: var(--cream-mid);
}
.obra-card-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: filter 0.6s ease, opacity 0.5s ease, transform 0.8s cubic-bezier(0.25,0,0,1);
}
.obra-card:hover .obra-card-img-wrap img { filter: saturate(0.78); transform: scale(1.03); }
.obra-card-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(45deg, rgba(120,110,96,0.05) 0 2px, transparent 2px 12px),
    var(--cream-mid);
  text-align: center; padding: 16px;
}
.obra-card-placeholder span {
  font-size: 12px; letter-spacing: 0.04em; color: var(--gray-light); font-style: italic;
}
.obra-card-info {
  padding: 18px 24px 24px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.obra-card-title {
  font-size: 14px; font-style: italic; color: var(--gray-dark);
  font-weight: 300; transition: color 0.4s;
}
.obra-card:hover .obra-card-title { color: var(--accent); }
.obra-card-year {
  font-size: 11px; color: var(--gray-light);
  letter-spacing: 0.08em; white-space: nowrap;
}
.obra-card::after {
  content: ""; position: absolute; bottom: 0; left: 0;
  width: 0; height: 1px; background: var(--accent);
  transition: width 0.65s cubic-bezier(0.4,0,0.2,1);
}
a.obra-card:hover::after { width: 100%; }

/* Variante expo: venue debajo del título */
.expo-card .obra-card-info { flex-direction: column; gap: 3px; align-items: flex-start; }
.expo-card .obra-card-title { font-size: 13px; }
.expo-card-venue { font-size: 11px; color: var(--gray); line-height: 1.4; }
.expo-card .obra-card-year { margin-top: 4px; }
/* expo sin detalle: no es clickeable */
div.obra-card { cursor: default; }

/* ════════════════════════════════════════════════════════════════════
   CONTACTO
   ════════════════════════════════════════════════════════════════════ */
#contacto {
  display: grid; grid-template-columns: 1fr 1fr;
  min-height: 80vh; scroll-margin-top: var(--nav-h);
}
.contacto-img { position: relative; overflow: hidden; }
.contacto-img img {
  width: 100%; height: 100%; object-fit: cover; transition: filter 0.7s ease;
}
.contacto-img:hover img { filter: saturate(0.85); }
.contacto-content {
  padding: 96px var(--edge);
  display: flex; flex-direction: column; justify-content: center;
}
.contacto-content .s-label { margin-bottom: 10px; }
.contacto-content h2 {
  font-family: var(--font-display);
  font-size: calc(38px * var(--display-scale)); font-weight: 400; color: var(--heading-color, var(--gray-dark));
  line-height: 1; margin-bottom: 48px;
}
.contact-list { list-style: none; display: flex; flex-direction: column; }
.contact-link {
  font-size: calc(15px * var(--text-scale)); color: var(--text-color, var(--gray)); text-decoration: none; font-weight: 300;
  display: flex; align-items: center; gap: 16px;
  padding: 18px 0; border-bottom: 1px solid var(--line);
  transition: color 0.3s; overflow: hidden;
}
.contact-link:hover { color: var(--ink); }
.contact-link-label {
  font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--accent); width: 72px; flex-shrink: 0; font-weight: 400;
}
.contact-link-text {
  transition: transform 0.35s ease; display: inline-block; white-space: nowrap;
}
.contact-link:hover .contact-link-text { transform: translateX(4px); }

/* ════════════════════════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════════════════════════ */
footer {
  padding: 26px var(--edge);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
footer p {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gray-light);
}

/* ════════════════════════════════════════════════════════════════════
   OVERLAY DE DETALLE (obra / exposición) — inline, sin iframe
   ════════════════════════════════════════════════════════════════════ */
.detail-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: var(--cream);
  overflow-y: auto; overflow-x: hidden;
  opacity: 0; visibility: hidden;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.32,0,0.15,1), visibility 0.5s;
  -webkit-overflow-scrolling: touch;
}
.detail-overlay.open { opacity: 1; visibility: visible; transform: translateY(0); }

/* Barra superior del overlay (volver / cerrar) */
.detail-bar {
  position: sticky; top: 0; z-index: 10;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--edge);
  background: var(--cream-veil-92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.detail-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gray); text-decoration: none; background: none; border: none;
  cursor: pointer; font-family: inherit;
  transition: color 0.3s;
}
.detail-back::before { content: "←"; font-size: 14px; display: inline-block; transition: transform 0.3s; }
.detail-back:hover { color: var(--ink); }
.detail-back:hover::before { transform: translateX(-4px); }
.detail-bar-name {
  font-family: var(--font-display); font-size: 18px; color: var(--ink);
  background: none; border: none; cursor: pointer; padding: 6px 14px;
  line-height: 1; transition: color 0.25s; font-style: normal;
}
.detail-bar-name:hover { color: var(--accent); }
.detail-close {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(120,110,96,0.25); background: none;
  font-size: 18px; line-height: 1; color: var(--gray-dark); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.25s, color 0.25s;
}
.detail-close:hover { border-color: var(--accent); color: var(--ink); }

/* Encabezado tipográfico (mismo para obra y expo) */
.detail-header {
  padding: 56px var(--edge) 44px;
  border-bottom: 1px solid var(--line);
}
.detail-header .s-label { margin-bottom: 18px; }
.detail-title {
  font-size: calc(clamp(34px, 6vw, 72px) * var(--display-scale));
  font-weight: 300; font-style: italic;
  line-height: 1.02; letter-spacing: -0.005em; color: var(--heading-color, var(--ink));
  text-wrap: balance;
}
.detail-sub {
  margin-top: 18px; font-size: calc(clamp(13px, 1.4vw, 15px) * var(--text-scale));
  letter-spacing: 0.04em; color: var(--text-color, var(--gray));
}
.detail-sub .dot { color: var(--accent); padding: 0 8px; }
.detail-sub:empty { display: none; }

/* ════════════════════════════════════════════════════════════════════
   CUERPO DEL DETALLE — visor (izq) + texto/ficha (der), lado a lado.
   Una sola plantilla para obra y expo: el texto se lee al lado de la
   obra (sin scroll entre medio) y la ficha de la obra en foco se
   actualiza al navegar la serie.
   ════════════════════════════════════════════════════════════════════ */
.detail-body {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: clamp(28px, 4vw, 64px);
  padding: clamp(26px, 3.4vw, 44px) var(--edge) clamp(48px, 7vw, 96px);
  align-items: start;
}
/* Sin esto, los items del grid usan min-width:auto y se estiran al ancho
   natural de la obra (que es grande), desbordando el visor en mobile. */
.viewer-col, .detail-text { min-width: 0; }

/* ── Visor (columna izquierda) ── */
.viewer-main {
  position: relative; background: var(--mat);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(18px, 2.4vw, 38px);
  height: clamp(400px, 64vh, 680px);
  cursor: zoom-in; overflow: hidden;
  touch-action: pan-y;   /* swipe horizontal sin bloquear el scroll vertical */
}
.viewer-main img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  min-width: 0; min-height: 0;   /* que la obra pueda achicarse dentro del flex */
  box-shadow: 0 24px 60px -28px rgba(0,0,0,0.7);
  transition: opacity 0.35s ease;
}
.viewer-ph {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12px; letter-spacing: 0.1em; color: var(--mat-fg);
}
.vnav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px;
  border: 1px solid var(--mat-border); background: var(--mat-veil);
  color: var(--mat-fg-strong); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.25s, color 0.25s; z-index: 2;
}
.vnav:hover { background: var(--mat-veil-strong); color: var(--mat-fg-strong); }
.vnav.prev { left: 14px; }
.vnav.next { right: 14px; }
.vnav[hidden] { display: none; }
.vcount {
  position: absolute; bottom: 12px; right: 16px;
  font-size: 10px; letter-spacing: 0.16em; color: var(--mat-fg);
}
/* Subtítulo de la obra en foco, abajo a la izquierda del visor */
.vcap {
  position: absolute; bottom: 11px; left: 16px; right: 86px;
  font-size: 11px; font-style: italic; letter-spacing: 0.03em;
  color: var(--mat-fg); pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vcap:empty { display: none; }

/* Tira de miniaturas (toda la serie a la vista) */
.rail {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 16px 0 4px; margin-top: 16px;
  border-top: 1px solid var(--line); scrollbar-width: thin;
}
.thumb {
  flex: 0 0 auto; width: 72px; height: 90px; background: var(--mat);
  cursor: pointer; opacity: 0.5; overflow: hidden;
  outline: 1px solid transparent; outline-offset: 2px;
  transition: opacity 0.3s, outline-color 0.3s;
  display: flex; align-items: center; justify-content: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.active, .thumb:hover { opacity: 1; }
.thumb.active { outline-color: var(--accent); }
.thumb-ph {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 8px; color: var(--mat-fg); text-transform: lowercase;
}

/* ── Texto del proyecto + ficha (columna derecha) ── */
.detail-text { position: sticky; top: calc(var(--nav-h) + 18px); }
.detail-text .s-label { margin-bottom: 12px; }
.detail-text h2 {
  font-size: calc(clamp(18px, 1.9vw, 24px) * var(--display-scale)); font-weight: 300; font-style: italic;
  color: var(--heading-color, var(--gray-dark)); line-height: 1.28; margin-bottom: 16px; max-width: 26ch;
}
.detail-text p { font-size: calc(clamp(14px, 1.05vw, 15px) * var(--text-scale)); line-height: 1.9; color: var(--text-color, var(--gray)); }
.detail-text p + p { margin-top: 12px; }
.detail-serie { margin-top: 16px; font-size: 13.5px; font-style: italic; color: var(--gray); }
.detail-serie a { color: var(--accent); text-decoration: none; }

/* Hero image (obras y exposiciones que la tienen seteada).
   Necesita una ALTURA definida (vía aspect-ratio) para que object-fit: cover
   recorte de verdad y object-position (el foco elegido en el CMS) tenga efecto.
   El 3/1 coincide con el preview del CMS para que el recorte sea WYSIWYG. */
.detail-hero {
  width: 100%;
  aspect-ratio: 3 / 1;
  max-height: 56vh;
  overflow: hidden;
  margin-bottom: 32px;
  background: var(--mat, #1a1a1a);
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.detail-hero-placeholder {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: auto; min-height: 240px; color: var(--gray-light);
  font-style: italic; letter-spacing: 0.04em;
}

/* Label custom encima de la galería (ej. "Vistas de sala" / "Obras y vistas") */
.detail-gallery-label { margin-bottom: 14px; }

/* Ficha general del proyecto / muestra — se inserta dentro de detail-text */
.detail-ficha {
  margin-top: 26px; padding-top: 22px;
  border-top: 1px solid var(--line);
}
.detail-ficha .s-label { margin-bottom: 12px; }
.detail-ficha-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 13.5px; line-height: 1.5;
}
.detail-ficha-row:last-child { border-bottom: none; }
.detail-ficha-key {
  color: var(--gray); letter-spacing: 0.05em;
  text-transform: uppercase; font-size: 11px; flex-shrink: 0;
}
.detail-ficha-val { color: var(--ink); text-align: right; font-style: italic; }

/* Ficha de la obra en foco — solo obras; el título de la obra va acá */
.wficha { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.wficha .s-label { margin-bottom: 10px; }
.wficha-title {
  font-size: clamp(18px, 1.9vw, 23px); font-weight: 300; font-style: italic;
  color: var(--ink); line-height: 1.25; margin-bottom: 14px;
}
.ficha-row {
  display: flex; flex-direction: column; gap: 3px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
  position: relative; transition: padding-left 0.35s ease;
}
.ficha-row::before {
  content: ""; position: absolute; left: 0; top: 11px; bottom: 11px;
  width: 1px; background: var(--accent);
  transform: scaleY(0); transform-origin: top; transition: transform 0.4s ease;
}
.ficha-row:hover { padding-left: 10px; }
.ficha-row:hover::before { transform: scaleY(1); }
.ficha-key {
  font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--gray-light); font-weight: 400;
}
.ficha-val { font-size: 14px; font-style: italic; color: var(--gray-dark); line-height: 1.4; }
.ficha-val a { color: var(--accent); text-decoration: none; }

/* ── Lightbox (zoom de una obra) ─────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 700;
  background: rgba(16,12,8,0.92);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(20px, 5vw, 72px);
  opacity: 0; visibility: hidden; transition: opacity 0.35s ease, visibility 0.35s;
  cursor: zoom-out;
  touch-action: pan-y;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.8);
}
.lightbox-cap {
  position: absolute; bottom: 24px; left: 0; right: 0; text-align: center;
  font-size: 12px; font-style: italic; color: rgba(254,248,228,0.7); letter-spacing: 0.04em;
  padding: 0 24px;
}
.lightbox-close {
  position: absolute; top: 20px; right: 24px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(254,248,228,0.3); background: none;
  color: var(--cream); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { border-color: var(--cream); }

/* Flechas para navegar la serie dentro del zoom (sin cerrarlo) */
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(254,248,228,0.3); background: rgba(16,12,8,0.4);
  color: var(--cream); font-size: 18px; cursor: pointer; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.25s, background 0.25s;
}
.lightbox-nav:hover { border-color: var(--cream); background: rgba(16,12,8,0.7); }
.lightbox-nav.prev { left: clamp(12px, 3vw, 32px); }
.lightbox-nav.next { right: clamp(12px, 3vw, 32px); }
.lightbox-nav[hidden] { display: none; }

/* Estado vacío / no encontrado dentro del overlay */
.detail-empty {
  padding: 160px var(--edge); text-align: center; color: var(--gray);
}
.detail-empty p:first-child { font-style: italic; font-size: 18px; }
.detail-empty p + p { font-size: 12px; margin-top: 12px; letter-spacing: 0.1em; }

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .nav-links { display: none; }

  #bio { grid-template-columns: 1fr; }
  .bio-img-col { position: relative; top: 0; height: 62vw; min-height: 280px; }
  .bio-text-col { padding: 56px var(--edge) 72px; }

  .carousel-section { padding: 60px 0; }

  #contacto { grid-template-columns: 1fr; min-height: 0; }
  .contacto-img { height: 60vw; min-height: 240px; }
  .contacto-content { padding: 56px var(--edge) 72px; }
}

@media (max-width: 860px) {
  .detail-body { grid-template-columns: 1fr; gap: 30px; }
  .detail-text { position: static; }
  .viewer-main { height: 58vh; }
}

@media (max-width: 640px) {
  .viewer-main { height: 56vh; }
  .thumb { width: 60px; height: 76px; }

  /* ── Salir del detalle más fácil en mobile ──────────────────────────
     El nombre (izquierda) es un target grande y tappable que vuelve al
     inicio; la "×" cierra. Se omite el "Volver" redundante para darle aire.
     (Además se puede cerrar tocando el fondo, fuera de la información.) */
  .detail-bar { padding: 0 var(--edge); gap: 12px; }
  .detail-back { display: none; }
  .detail-bar-name { font-size: 19px; padding: 10px 4px; }
  .detail-close { width: 42px; height: 42px; font-size: 22px; }

  .lightbox-nav { width: 42px; height: 42px; }
}

/* ── Accesibilidad: respetar reduce-motion ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}
