/* ==========================================
  SISTEMA DE DISEÑO & TOKENS CROMÁTICOS
  ========================================== */
:root {
  /* Paleta cromática */
  --color-olive: #5b6236;
  --color-olive-deep: #3e4526;
  --color-olive-dark: #2b2b23;
  --color-orange: #c96f4a;
  --color-orange-deep: #a85a3a;
  --color-terracotta: #c96f4a;
  --color-lime: #c9d64f;
  --color-gold: #cf8500;
  --color-cream: #f5f0e6;
  --color-process-bg: #f5f0e6;
  --color-process-text: #2b2b23;
  --color-process-line: #3e4526;
  --color-white: #ffffff;
  --color-ink: #292916;
  --color-black: #000000;
  --color-charcoal: #2b2b23;

  /* Tokens semánticos */
  --bg-primary: var(--color-olive);
  --bg-primary-deep: var(--color-olive-deep);
  --bg-accent: var(--color-orange);
  --bg-accent-deep: var(--color-orange-deep);
  --text-body: var(--color-cream);
  --text-heading: var(--color-white);
  --text-accent: var(--color-lime);
  --line-border: rgba(255, 253, 240, 0.3);
  --line-accent: rgba(201, 214, 79, 0.5);
  --surface-dark: rgba(20, 10, 5, 0.95);
  --shadow-color: rgba(0, 0, 0, 0.3);

  /* Tipografía fluida */
  --font-body: 'Jost', sans-serif;
  --fs-body: clamp(1.05rem, 1.96vw, 1.4rem);
  --fs-h1: clamp(1.96rem, 3.85vw, 3.15rem);
  --fs-h2: clamp(1.96rem, 3.5vw, 2.94rem);
  --fs-h3: clamp(1.1rem, 1.8vw, 1.5rem);
  --fs-eyebrow: clamp(0.77rem, 1.4vw, 1.05rem);
  --fs-small: clamp(0.85rem, 1.3vw, 1.05rem);
  --lh-body: 1.35;

  /* Compatibilidad tokens */
  --olive: var(--color-olive);
  --olive-deep: var(--color-olive-deep);
  --orange: var(--color-orange);
  --lime: var(--color-lime);
  --cream: var(--color-cream);
  --white: var(--color-white);
  --ink: var(--color-ink);
}

/* ==========================================
   1. FUENTES & BASE GLOBALES
   ========================================== */
@font-face {
  font-family: 'Jost'; 
  src: url('../fonts/Jost-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Jost'; 
  src: url('../fonts/Jost-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Jost';
  src: url('../fonts/Jost-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  overflow-x: hidden;
}

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

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================
   2. HERO VIDEO CONTAINER
   ========================================== */
.video-container {
  position: relative;
  width: 100%;
  height: 60vh;
  min-height: 400px;
  overflow: hidden;
  background: rgba(22, 26, 18, 0.6);
}

.video-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.video-container .bg-videobio {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.92) contrast(.98) brightness(.75);
}

.hero-title {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 3;
  width: 100%;
  text-align: center;
  color: var(--white);
}

.hero-title h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 0 auto;
  font-size: var(--fs-h1);
  font-weight: 300;
  letter-spacing: 4px;
  color: var(--white);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.hero-title h1::before,
.hero-title h1::after {
  content: "";
  height: 1px;
  background: rgba(255, 255, 255, 0.7);
  flex: 1;
  max-width: 150px;
}

.hero-title p {
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: 3px;
  margin-top: 14px;
  color: var(--white);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* ==========================================
   3. SECCIONES Y GRAMÁTICA DE DISEÑO
   ========================================== */
main > section {
  width: 100%;
  padding: 80px 0;
}

/* --- TÍTULOS Y REGLAS (RULERS) --- */
.section-title {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 300;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--lime);
}

.section-title-naranja {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 300;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-olive-dark);
}

.hrow {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* --- SECCIÓN 1 Y 3: VERDE OLIVA (.main) --- */
section.main {
  background-color: var(--color-olive);
  color: var(--white);
}

#neblina-personaje {
  --plant-divider-height: clamp(50px, 8vw, 100px);
  position: relative;
  z-index: 2;
  margin-top: calc(-1 * var(--plant-divider-height));
  padding: calc(80px + var(--plant-divider-height)) 0 80px;
  background: linear-gradient(
    to bottom,
    transparent 0,
    transparent var(--plant-divider-height),
    var(--color-olive) var(--plant-divider-height)
  );
}

#neblina-personaje::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: var(--plant-divider-height);
  background: var(--color-olive);
  mask: url("../assets/2.svg") center bottom / 40% auto repeat-x;
  -webkit-mask: url("../assets/2.svg") center bottom / 40% auto repeat-x;
  pointer-events: none;
}

@media (max-width: 767px) {
  #neblina-personaje::before {
    height: clamp(56px, 15.625vw, 80px);
    mask-size: 100% auto;
    -webkit-mask-size: 100% auto;
  }
}

/* Grid de Proyectos / Hábitat / Neblina */
.neblina-personaje-section .habitat-projects-grid {
  display: flex;
  flex-direction: column;
  gap: 50px;
  margin-top: 20px;
}

.habitat-project-row {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 50px; /* <--- Añade esta línea para separar las filas */
}

.habitat-project-row-reverse {
  grid-template-columns: 1fr 380px;
}

.habitat-project-row-reverse .habitat-media {
  order: 2;
}

.habitat-media img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 6px 20px var(--shadow-color);
  object-fit: cover;
}

/* Limita la altura de la portada de documento para que sea proporcionada a la página */
.neblina-personaje-section .habitat-media img {
  aspect-ratio: 4 / 5;
  max-height: 480px;
  object-fit: cover;
}

.habitat-info h3 {
  font-size: var(--fs-h2);
  color: var(--lime);
  font-weight: 300;
  margin: 0 0 8px 0;
}

.habitat-tagline {
  font-size: var(--fs-eyebrow);
  color: var(--lime);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.habitat-info p {
  line-height: 1.5;
  margin-bottom: 16px;
  color: var(--cream);
} 

.habitat-info .rule{
  display:block;
  width: 39%;
  height:2px;
  margin-bottom: 18px;
  background:var(--color-terracotta);
}

.section-orange .habitat-info .rule{
  display:block;
  width: 50%;
  height:2px;
  margin-bottom: 18px;
  background: #2b2b23;
}

/* Enlaces y botones de acción */
.habitat-video-link {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 22px;
  border: 1px solid var(--lime);
  border-radius: 4px;
  color: var(--olive-deep);
  background-color: var(--lime);
  font-size: var(--fs-small);
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 0.25s ease;
}

.habitat-video-link:hover {
  background-color: var(--cream);
  color: var(--color-olive-dark);
  border-color: var(--cream);
  transform: translateY(-2px);
}

/* --- SECCIÓN 2 Y 4: NARANJA / TERRACOTA (.section-orange) --- */
section.section-orange {
  background-color: var(--color-orange);
  color: var(--white);
}

/* Contraste de títulos y filetes sobre fondo naranja (misma gramática que stylehabitat.css) */
.section-orange .section-title,
.section-orange .section-title-naranja {
  color: var(--cream);
}

.section-orange .hrow .rule,
.section-orange .section-title + .rule,
.section-orange .section-title-naranja + .rule {
  background: var(--cream);
}

.section-orange .lead-text,
.section-orange strong {
  color: var(--cream);
}

.escuela-section .habitat-info h3 {
  color: var(--white);
}

.escuela-section .habitat-info p {
  color: var(--cream);
}

.escuela-section strong {
  color: var(--color-olive-dark);
}

/* --- BLOQUES DE ARTE RURAL --- */
.section-title-arte-rural {
  margin: 0 0 15px;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 400;
  letter-spacing: 1.5px;
  color: var(--lime);
}

.habitat-context {
  background: rgba(0, 0, 0, 0.15);
  padding: 30px;
  border-radius: 12px;
  border-left: 4px solid var(--lime);
  margin-bottom: 40px;
}

.habitat-context-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 30px;
  align-items: center;
}

.habitat-context-media {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.surcando-bloque {
  max-width: 580px;
  margin: 0 auto 3rem;
  text-align: center;
}

.surcando-poster img {
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 8px 25px var(--shadow-color);
  transition: transform 0.3s ease;
}

.surcando-poster img:hover {
  transform: scale(1.02);
}

.surcando-cta {
  display: inline-block;
  margin-top: 18px;
}

/* Miniatura de video reutilizable (poster + botón de reproducción) */
.habitat-video-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 8px 25px var(--shadow-color);
}

.habitat-video-thumb img {
  width: 100%;
  transition: transform 0.35s ease;
}

.habitat-video-thumb:hover img {
  transform: scale(1.04);
}

/* Copy de una sola columna (Arte Rural) */
.habitat-copy p {
  margin: 0 0 14px;
  line-height: 1.6;
  color: var(--cream);
}

.habitat-copy p:last-child {
  margin-bottom: 0;
}

.apuesta-artistica {
  max-width: 780px;
  margin: 3.5rem auto;
  text-align: center;
}

.apuesta-titulo {
  margin-bottom: 18px;
  font-size: var(--fs-eyebrow);
  letter-spacing: 2px;
  color: var(--lime);
  text-transform: uppercase;
}

.apuesta-video {
  position: relative;
  display: block;
  max-width: 640px;
  margin: 0 auto 24px;
}

.apuesta-video img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.habitat-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  background: rgba(245, 240, 230, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, background 0.25s ease;
}

.habitat-play::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 18px solid var(--color-olive-dark);
  margin-left: 4px;
}

.apuesta-video:hover .habitat-play {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--lime);
}

/* ==========================================
   --- GALERÍAS Y THUMBNAILS (Estandarizado & Sin Scrollbar) ---
   ========================================== */
.habitat-gallery {
  margin-top: 60px;
}

.habitat-gallery-title {
  margin-bottom: 25px;
}

/* Disposición principal en PC: Grid de 2 columnas (Imagen a la izq, Miniaturas a la der) */
.habitat-gallery-view {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 20px;
  align-items: start;
}

.habitat-gallery-main-wrap {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 25px var(--shadow-color);
  margin-bottom: 0;
}

.habitat-gallery-main {
  width: 100%;
  height: 560px;
  object-fit: cover;
  display: block;
}

.habitat-gallery-context {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 30px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
  color: var(--color-white);
}

.habitat-gallery-context h3 {
  margin: 0 0 6px 0;
  color: var(--color-lime);
}

.habitat-gallery-context p {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--color-cream);
}

/* Flechas de Navegación */
.habitat-gallery-next,
.habitat-gallery-prev {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 34px;
  height: 54px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.habitat-gallery-next {
  right: 1.5rem;
}

.habitat-gallery-prev {
  left: 1.5rem;
}

.habitat-gallery-next::after {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  border-top: 7px solid var(--color-lime);
  border-right: 7px solid var(--color-lime);
  transform: rotate(45deg);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.habitat-gallery-next:hover::after {
  border-color: var(--color-white);
  transform: translateX(5px) rotate(45deg);
}

.habitat-gallery-prev::after {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  border-top: 7px solid var(--color-lime);
  border-left: 7px solid var(--color-lime);
  transform: rotate(-45deg);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.habitat-gallery-prev:hover::after {
  border-color: var(--color-white);
  transform: translateX(-5px) rotate(-45deg);
}

/* Carrusel de Miniaturas (Thumbnails) */
.habitat-gallery-thumbs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scroll-behavior: smooth;

  /* --- Ocultar barra de desplazamiento (Firefox, Edge, IE) --- */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Ocultar barra de desplazamiento en Chrome, Safari y Opera */
.habitat-gallery-thumbs::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.habitat-gallery-thumb {
  flex: 0 0 auto;
  width: 100%;
  height: 85px;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  padding: 0;
  background: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.habitat-gallery-thumb.is-active,
.habitat-gallery-thumb:hover {
  opacity: 1;
  border-color: var(--color-lime);
}

.habitat-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- SECCIÓN MURAL --- */
.mural-section .section-title-naranja {
  color: var(--cream);
}

.mural {
  width: 100%;
  max-height: 550px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 25px var(--shadow-color);
}

.mural-caption {
  max-width: 800px;
  margin: 28px auto 0;
  text-align: center;
  line-height: 1.6;
  font-size: var(--fs-body);
  color: var(--cream);
}

/* ==========================================
   --- ADAPTACIÓN RESPONSIVE DE LA GALERÍA ---
   ========================================== */
@media (max-width: 991px) {
  .habitat-gallery-view {
    grid-template-columns: 1fr; /* Pasa a 1 columna */
  }

  .habitat-gallery-main {
    height: 380px;
  }

  .habitat-gallery-thumbs {
    flex-direction: row; /* Pasa las miniaturas abajo en horizontal */
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
  }

  .habitat-gallery-thumb {
    flex: 0 0 90px;
    height: 70px;
  }
}

@media (max-width: 767px) {
  .habitat-gallery-main {
    height: 280px;
  }

  .habitat-gallery-thumb {
    flex: 0 0 70px;
    height: 55px;
  }
}
@media (max-width: 767px) {
  /* ... resto de tus estilos celular ... */

  .habitat-gallery-main {
    height: 280px;
  }

  .habitat-gallery-thumb {
    flex: 0 0 70px;
    height: 55px;
  }
}

@media (max-width: 767px) {
  /* Corrige el desborde horizontal: la columna fija de 380px
     de .habitat-project-row no cabe en pantallas de móvil */
  .habitat-project-row,
  .habitat-project-row-reverse {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .habitat-project-row-reverse .habitat-media {
    order: 0;
  }

  .neblina-personaje-section .habitat-media img {
    max-height: 320px;
  }

  .video-container {
    height: 45vh;
  }

  .hero-title {
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
  }

  .hero-title.reveal.is-visible {
    transform: translate(-50%, -50%);
  }

  .hero-title h1 {
    font-size: 1.8rem;
  }

  .hero-title h1::before,
  .hero-title h1::after {
    display: none;
  }

  main > section {
    padding: 50px 0;
  }

  .apuesta-artistica .apuesta-video {
    max-width: 100%;
  }

  .habitat-gallery-main {
    height: 280px;
  }

  .habitat-gallery-thumb {
    flex: 0 0 70px;
    height: 55px;
  }
}

/* Visor compartido de PDF */
/* ============================================================
     VISOR DE PDF CON PASADOR DE PÁGINA
     Colores y tamaños se cambian en estas variables.
     ============================================================ */
  .pfm {
    --pfm-backdrop: rgba(18, 16, 14, .82);
    --pfm-ui: #f5f2ed;
    --pfm-ui-dim: rgba(245, 242, 237, .6);
    --pfm-paper: #fff;
    --pfm-bar-offset: 5vh;
    position: fixed; inset: 0; z-index: 2147483000;
    display: none; flex-direction: column;
    background: var(--pfm-backdrop);
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
    opacity: 0; transition: opacity .25s ease;
  }
  .pfm.is-open { display: flex; }
  .pfm.is-visible { opacity: 1; }

  .pfm__bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: calc(12px + var(--pfm-bar-offset)) 16px 12px; color: var(--pfm-ui);
    font: 500 14px/1.2 "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  .pfm__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pfm-ui-dim); }
  .pfm__close, .pfm__nav, .pfm__tool {
    appearance: none; border: 0; cursor: pointer; color: var(--pfm-ui);
    background: rgba(255,255,255,.1); border-radius: 999px;
    width: 40px; height: 40px; display: grid; place-items: center;
    transition: background .15s ease, opacity .15s ease;
  }
  .pfm__close:hover:not(:disabled), .pfm__nav:hover:not(:disabled), .pfm__tool:hover:not(:disabled) { background: rgba(255,255,255,.2); }
  .pfm__close:focus-visible, .pfm__nav:focus-visible, .pfm__tool:focus-visible { outline: 2px solid var(--pfm-ui); outline-offset: 2px; }
  .pfm__nav:disabled, .pfm__tool:disabled { opacity: .3; cursor: default; }
  .pfm svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

  .pfm__title { flex: 1; min-width: 0; }
  .pfm__dl {
    display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
    border-radius: 999px; background: rgba(255,255,255,.1); color: var(--pfm-ui);
    font: inherit; text-decoration: none; cursor: pointer;
    transition: background .15s ease;
  }
  .pfm__dl[hidden] { display: none; }
  .pfm__dl:hover { background: rgba(255,255,255,.2); }
  .pfm__dl:focus-visible { outline: 2px solid var(--pfm-ui); outline-offset: 2px; }
  .pfm__dl svg { width: 18px; height: 18px; }
  .pfm__tools { display: flex; align-items: center; gap: 8px; }
  .pfm__zoomlabel { min-width: 44px; text-align: center; color: var(--pfm-ui-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
  .pfm__book { transform-origin: center center; }

  /* Capa que permite arrastrar el documento cuando hay zoom (bloquea el giro de hoja) */
  .pfm__pan { position: absolute; inset: 0; z-index: 1; cursor: grab; touch-action: none; }
  .pfm__pan.is-drag { cursor: grabbing; }

  /* Evita que el navegador robe los gestos táctiles (scroll, zoom, "tirar para refrescar") */
  .pfm, .pfm__stage, .pfm__book { touch-action: none; overscroll-behavior: contain; }
  .pfm__book { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

  /* Flechas siempre visibles a los costados */
  .pfm__nav--side {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 48px; height: 48px; background: rgba(20, 18, 16, .55);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  }
  .pfm__nav--prev { left: max(10px, env(safe-area-inset-left, 0px)); }
  .pfm__nav--next { right: max(10px, env(safe-area-inset-right, 0px)); }
  .pfm__nav--side svg { width: 24px; height: 24px; }

  .pfm__stage {
    flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
  }
  .pfm__book { position: relative; }
  .pfm__page { background: var(--pfm-paper); overflow: hidden; }
  .pfm__page canvas { width: 100%; height: 100%; display: block; }
  .pfm__msg {
    position: absolute; color: var(--pfm-ui); text-align: center; padding: 0 24px;
    font: 15px/1.4 "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  }

  .pfm__foot {
    display: flex; align-items: center; justify-content: center; gap: 16px;
    padding: 12px 16px 16px; color: var(--pfm-ui);
    font: 500 14px/1 "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-variant-numeric: tabular-nums;
  }

  @media (prefers-reduced-motion: reduce) { .pfm { transition: none; } }
