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

/* ===== VARIABLES ===== */
:root {
  --bg: #fff;
  --fg: #fff;
  --letra: #000;
  --muted: #b7b7b7;
  --top-bar-height: 80px;
  --footer-height: 30px;
}

/* ===== BASE ===== */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Rosario', 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  overflow: hidden;
}

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

/* ===== WRAPPER ===== */
#wrapper {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== TOP BAR ===== */
#top_bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 12px 24px;
  background: transparent;
  pointer-events: none;
}

.top_bar_wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  pointer-events: auto;
}

#custom_logo { display: inline-flex; align-items: center; flex-shrink: 0; }

#custom_logo img {
  height: auto;
  width: auto;
  max-height: none;
  max-width: none;
  display: block;
}

#menu_border_wrapper { display: flex; align-items: center; }

#main_menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 20px;
}

#main_menu li a {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.3s;
}

#main_menu li a:hover { color: var(--letra); }

/* ===== EMBLA CARRUSEL ===== */
#imageFlow {
  flex: 1;
  overflow: hidden;
  padding-top: var(--top-bar-height);
  padding-bottom: var(--footer-height);
  position: relative;
}

.embla {
  position: relative;
  overflow: hidden;
  height: 100%;
  perspective: 1400px;
  perspective-origin: 50% 50%;
}

.embla__container {
  display: flex;
  height: 100%;
  align-items: center;
  transform-style: preserve-3d;
}

.embla__slide {
  flex-shrink: 0;
  width: auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20px;
  transition: opacity 0.35s ease;
  will-change: transform, opacity;
  transform-origin: center center;
  backface-visibility: hidden;
}

.embla__slide a {
  display: block;
  position: relative;
  cursor: pointer;
}

/* La imagen define el tamaño del slide. Ahora limitamos por ANCHO y por ALTO */
.embla__slide img {
  max-height: 75vh;
  max-width: 70vw;
  width: auto;
  height: auto;
  -webkit-box-reflect: below 8px linear-gradient(transparent 70%, rgba(255,255,255,0.18));
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* ===== FLECHAS EMBLA ===== */
.embla__button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.2s;
  z-index: 20;
  padding: 0;
}

.embla__button:hover {
  background: rgba(0,0,0,0.7);
  transform: translateY(-50%) scale(1.08);
}

.embla__button--prev { left: 20px; }
.embla__button--next { right: 20px; }

.embla__button svg {
  width: 32px;
  height: 32px;
  fill: #fff;
  display: block;
}

/* ===== FADE-IN DE LAS IMÁGENES LAZY ===== */
img.lazy-image {
  opacity: 0;
  transition: opacity 0.4s ease-in;
}

img.lazy-image.loaded {
  opacity: 1;
}

/* ===== LIGHTBOX ===== */
.glightbox-clean .gclose,
.glightbox-clean .gslide-description {
  z-index: 99999 !important;
}
.glightbox-clean .gclose {
  background: rgba(0,0,0,0.7) !important;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  opacity: 1 !important;
}
.glightbox-clean .gclose svg {
  fill: #fff !important;
  width: 22px;
  height: 22px;
}
.glightbox-container {
  z-index: 99998 !important;
}
body.glightbox-open { overflow: hidden; }

.glightbox-clean .gslide-description,
.glightbox-clean .gdesc-inner {
  text-align: center !important;
  display: flex !important;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.glightbox-clean .gslide-title,
.glightbox-clean .gdesc-inner h4 {
  text-align: center !important;
  width: 100%;
  margin: 0 auto;
  font-family: 'Rosario', sans-serif;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--letra);
}
.glightbox-clean .gslide-media + .gslide-description,
.glightbox-clean .gslide-description {
  width: 100%;
  max-width: 100%;
}

/* ===== FOOTER ===== */
#footer {
  position: fixed;
  bottom: 8px;
  left: 0; right: 0;
  text-align: center;
  font-size: 100%;
  color: var(--muted);
  z-index: 100;
  pointer-events: none;
}

/* ============================================================
   PÁGINA "DANIEL" (biografía)
   ============================================================ */

/* Cuando estamos en daniel.html, el scroll lo maneja #bio-content */
body.page-daniel {
  overflow: hidden;
}

#bio-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 120px 24px 60px;   /* padding-top amplio para el header fijo */
  background: var(--bg);
  color: var(--letra);
}

.bio-wrapper {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.bio-imagen {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

.bio-imagen img {
  width: 201px;
  height: auto;
  display: block;
}

.bio-lema {
  text-align: center;
  font-size: 15px;
  color: #000;
  letter-spacing: 1px;
  margin: 22px 0;
}

.bio-texto {
  text-align: center;
  font-size: 13px;
  line-height: 1.75;
  color: #4c4c4c;
  margin: 18px 0;
}

.bio-fechas {
  text-align: center;
  font-size: 14px;
  color: #000;
  margin-top: 32px;
}

.bio-fechas strong {
  font-weight: 700;
}

/* ============================================================
   RESPONSIVE BIOGRAFÍA
   ============================================================ */

/* Tablets */
@media (max-width: 1024px) {
  #bio-content { padding: 120px 24px 60px; }
}

/* Móvil general */
@media (max-width: 767px) {
  #bio-content { padding: 100px 20px 50px; }
  .bio-imagen img { width: 170px; }
  .bio-texto { font-size: 13px; line-height: 1.65; margin: 14px 0; }
  .bio-lema { font-size: 14px; margin: 18px 0; }
  .bio-fechas { font-size: 13px; margin-top: 24px; }
}

/* Móvil en VERTICAL — todos los tamaños */
@media (max-width: 767px) and (orientation: portrait) {
  /* El header fijo en portrait tiene el logo a 60px + padding 14px
     arriba y abajo => ~88px de alto. Dejamos 120px de padding-top
     para que la imagen no se pegue al header. */
  #bio-content {
    padding: 120px 22px 50px;
  }
  .bio-imagen img { width: 190px; }
  .bio-imagen { margin: 20px 0 26px; }
  .bio-texto {
    font-size: 13.5px;
    line-height: 1.75;
    margin: 16px 0;
  }
  .bio-lema { font-size: 15px; letter-spacing: 1.5px; }
  .bio-fechas { font-size: 14px; }
}

/* Móvil en HORIZONTAL */
@media (max-width: 900px) and (orientation: landscape) {
  /* En landscape el header es más bajo (logo 34px) => menos padding */
  #bio-content {
    padding: 70px 24px 40px;
  }
  .bio-imagen img { width: 130px; }
  .bio-imagen { margin: 12px 0; }
  .bio-texto { font-size: 12px; line-height: 1.55; margin: 10px 0; }
  .bio-lema { font-size: 13px; margin: 12px 0; }
  .bio-fechas { margin-top: 16px; font-size: 12px; }
}

/* Móvil pequeño (≤ 400px) vertical */
@media (max-width: 400px) and (orientation: portrait) {
  #bio-content { padding: 110px 18px 40px; }
  .bio-imagen img { width: 160px; }
  .bio-texto { font-size: 13px; line-height: 1.7; }
  .bio-lema { font-size: 14px; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
  #custom_logo img { height: 45px; }
  .embla__button { width: 42px; height: 42px; }
  .embla__button svg { width: 26px; height: 26px; }
  .embla__button--prev { left: 10px; }
  .embla__button--next { right: 10px; }
}

/* ============================================================
   MÓVIL GENERAL (hasta 767px, cualquier orientación)
   ============================================================ */
@media (max-width: 767px) {
  #main_menu li a {
    font-size: 12px;
    letter-spacing: 1.2px;
  }

  #footer { font-size: 55%; bottom: 6px; }

  #imageFlow {
    padding-top: 8px;
    padding-bottom: 10px;
  }

  .embla__slide { margin-right: 14px; }

  .embla__button { width: 40px; height: 40px; }
  .embla__button svg { width: 22px; height: 22px; }
  .embla__button--prev { left: 4px; }
  .embla__button--next { right: 4px; }
}

/* ============================================================
   MÓVIL EN VERTICAL (portrait) — aplica a TODOS los tamaños
   aquí van las reglas del header, que era lo que faltaba
   ============================================================ */
@media (max-width: 767px) and (orientation: portrait) {
  /* Header claro y visible */
  #top_bar {
    padding: 14px 18px;
  }
  #custom_logo img {
    height: 60px;
  }
  #main_menu li a {
    font-size: 13px;
    letter-spacing: 1.5px;
  }

  /* El cuadro grande, aprovechando el ancho y el alto */
  .embla__slide img {
    max-width: 88vw;
    max-height: 72vh;
    -webkit-box-reflect: below 8px linear-gradient(transparent 70%, rgba(255,255,255,0.18));
  }
}

/* ============================================================
   MÓVIL EN HORIZONTAL (landscape)
   ============================================================ */
@media (max-width: 900px) and (orientation: landscape) {
  #top_bar { padding: 8px 16px; }
  #custom_logo img { height: 34px; }
  #main_menu li a { font-size: 12px; letter-spacing: 1.2px; }

  #imageFlow {
    padding-top: 40px;
    padding-bottom: 12px;
  }

  .embla__slide img {
    max-width: 55vw;
    max-height: 80vh;
  }
}