*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  background: #111; color: #e8e0d4;
  max-width: 430px; margin: 0 auto; min-height: 100vh;
}

/* ── SPLASH ── */
#splash {
  position: fixed; inset: 0; max-width: 430px; margin: 0 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  padding-bottom: 64px; z-index: 100;
  transition: opacity 0.7s ease, transform 0.7s ease;
}
#splash.out { opacity: 0; transform: translateY(-16px); pointer-events: none; }
.splash-bg {
  position: absolute; inset: 0;
  background: url('images/splash.webp') center/cover no-repeat;
  opacity: 0.80;
}
.splash-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to top, #0e0e0e 48%, rgba(14,14,14,0.35) 100%);
}
.splash-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; width: 100%;
}
.splash-eyebrow {
  font-size: 10px; letter-spacing: 0.4em; text-transform: uppercase;
  color: #c8a96e; margin-bottom: 4px;
}
.splash-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  font-size: 34px; font-weight: 300; line-height: 1.15;
  text-align: center; padding: 0 32px; color: #f0ebe3;
}
.splash-sub {
  font-size: 11px; font-weight: 300; letter-spacing: 0.22em;
  text-transform: uppercase; color: #666; margin-bottom: 38px;
}
.splash-langs {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: center; padding: 0 28px;
}
.lang-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e8e0d4; border-radius: 100px;
  padding: 10px 20px; font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  backdrop-filter: blur(8px);
}
.lang-btn:hover { background: rgba(200,169,110,0.15); border-color: #c8a96e; color: #c8a96e; }

/* ── HEADER ── */
#header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px;
  background: rgba(17,17,17,0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  font-size: 16px; font-weight: 300; letter-spacing: 0.04em;
  color: #e8e0d4; flex: 1; text-align: center;
}
.icon-btn {
  background: none; border: none; color: #666; cursor: pointer;
  padding: 6px; border-radius: 8px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; transition: color 0.2s;
}
.icon-btn:hover { color: #c8a96e; }

/* lang pill — minimal */
.lang-pill {
  font-size: 11px; letter-spacing: 0.1em; font-weight: 500;
  text-transform: uppercase; color: #666;
  background: none; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px; padding: 3px 7px; cursor: pointer;
  font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif; transition: all 0.2s;
  line-height: 1.4;
}
.lang-pill:hover { border-color: #c8a96e; color: #c8a96e; }

/* ── SLIDER ── */
.slider-wrap {
  position: relative; width: 100%; aspect-ratio: 16/9;
  overflow: hidden; background: #1a1a1a;
}
.slide {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 0.5s ease;
}
.slide.active { opacity: 1; }
video.slide { background: #000; }
.slider-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.42); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); z-index: 2; transition: background 0.2s;
}
.slider-nav:hover { background: rgba(0,0,0,0.7); }
.slider-nav.prev { left: 12px; }
.slider-nav.next { right: 12px; }
.slider-dots {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 2;
}
.slider-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.3); border: none; cursor: pointer;
  transition: background 0.2s; padding: 0;
}
.slider-dot.active { background: #c8a96e; }

/* ── ITEM INFO ── */
.item-info {
  padding: 20px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.item-section-label {
  font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase;
  color: #c8a96e; margin-bottom: 6px;
}
.item-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  font-size: 25px; font-weight: 300; line-height: 1.25; color: #f0ebe3;
}

/* ── PLAYER ── */
.player { padding: 18px 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.player-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.play-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: #c8a96e; border: none; color: #111;
  font-size: 17px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.2s;
}
.play-btn:hover { transform: scale(1.06); background: #d4b880; }
.player-meta { flex: 1; min-width: 0; }
.player-time { font-size: 12px; color: #888; letter-spacing: 0.04em; margin-bottom: 10px; }
.progress-track {
  width: 100%; height: 3px; background: rgba(255,255,255,0.1);
  border-radius: 2px; position: relative; cursor: pointer;
}
.progress-fill { height: 100%; background: #c8a96e; border-radius: 2px; width: 0%; transition: width 0.15s linear; }
.progress-track::before {
  /* area de toque ampliada: la barra visible mide 3px y en un celu es imposible de acertar */
  content: ""; position: absolute; left: 0; right: 0; top: -12px; bottom: -12px;
}
.progress-thumb {
  position: absolute; top: 50%; transform: translate(-50%,-50%);
  width: 10px; height: 10px; border-radius: 50%; background: #c8a96e; left: 0%;
}
.read-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: #999; border-radius: 8px; padding: 10px 16px;
  font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif; font-size: 13px; cursor: pointer;
  transition: all 0.2s;
}
.read-btn:hover { background: rgba(200,169,110,0.08); border-color: #c8a96e; color: #c8a96e; }

/* progress indicator */
.item-progress {
  font-size: 11px; color: #555; letter-spacing: 0.08em;
  font-weight: 400; margin-top: 6px;
}
.item-progress-current { color: #c8a96e; font-weight: 500; }

/* prev / next navigation */
.item-nav {
  display: flex; gap: 10px; padding: 14px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.item-nav-btn {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 10px 14px;
  cursor: pointer; transition: all 0.2s; color: #888;
  font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif; font-size: 12px;
  line-height: 1.3; text-align: left;
}
.item-nav-btn:hover:not(:disabled) { background: rgba(200,169,110,0.08); border-color: #c8a96e; color: #c8a96e; }
.item-nav-btn:disabled { opacity: 0.2; cursor: default; }
.item-nav-btn.next { text-align: right; justify-content: flex-end; }
.item-nav-btn svg { flex-shrink: 0; }
.item-nav-label { font-size: 11px; }

/* ── INLINE NAV ── */
.section-nav { padding: 4px 20px 36px; }

.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; padding: 10px 10px;
  border-radius: 8px; cursor: pointer; text-align: left; transition: background 0.2s;
}
.nav-item:hover { background: rgba(255,255,255,0.03); }
.nav-item.active { background: rgba(200,169,110,0.07); }
.nav-num {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid #444; background: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: #666;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-num { border-color: #c8a96e; color: #c8a96e; background: rgba(200,169,110,0.08); }
.nav-item-label { font-size: 14px; color: #aaa; flex: 1; text-align: left; transition: color 0.2s; }
.nav-item.active .nav-item-label { color: #e8e0d4; }
.nav-item-dur { font-size: 11px; color: #555; }

/* group separators */
.nav-group-sep {
  font-size: 9px; letter-spacing: 0.3em; text-transform: uppercase;
  color: #666; padding: 12px 10px 4px;
  border-top: 1px solid rgba(255,255,255,0.07); margin-top: 6px;
}
.nav-group-sep:first-of-type { border-top: none; margin-top: 0; }
.drawer-group-sep {
  font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase;
  color: #666; padding: 10px 20px 4px;
  border-top: 1px solid rgba(255,255,255,0.07); margin-top: 4px;
}

/* section heading as button */
.section-nav-heading {
  font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase;
  color: #777; padding: 20px 0 10px;
  background: none; border: none; width: 100%; text-align: left;
  cursor: pointer; font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  display: flex; align-items: center; gap: 6px;
  transition: color 0.2s;
}
.section-nav-heading:hover { color: #c8a96e; }
.section-nav-heading::after {
  content: "ⓘ"; font-size: 12px; opacity: 0.4; margin-left: 2px;
  font-style: normal; letter-spacing: 0;
}
.section-nav-heading:hover::after { opacity: 0.8; }

/* splash close (visible only when lang already chosen) */
.splash-close {
  position: absolute; top: 20px; right: 20px; z-index: 3;
  background: rgba(255,255,255,0.08); border: none; color: #aaa;
  border-radius: 50%; width: 32px; height: 32px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.splash-close.visible { display: flex; }
.splash-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── DRAWER ── */
#drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  z-index: 80; backdrop-filter: blur(5px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
#drawer-overlay.open { opacity: 1; pointer-events: all; }
#drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 285px;
  background: #161616; z-index: 90;
  transform: translateX(100%); transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  border-left: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto; display: flex; flex-direction: column;
}
#drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #161616; z-index: 2;
}
.drawer-header-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  font-size: 16px; font-weight: 300; color: #e8e0d4; line-height: 1.3;
}
.drawer-section-label {
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: #c8a96e; padding: 18px 20px 8px;
}
.drawer-item {
  display: flex; align-items: center;
  background: none; border: none; width: 100%;
  padding: 11px 20px; cursor: pointer; text-align: left;
  transition: background 0.2s; gap: 10px;
}
.drawer-item:hover { background: rgba(255,255,255,0.03); }
.drawer-item.active { background: rgba(200,169,110,0.06); }
.drawer-item-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid #2a2a2a; background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 500; color: #777;
  transition: border-color 0.2s, color 0.2s;
  font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
}
.drawer-item.active .drawer-item-num { border-color: #c8a96e; color: #c8a96e; }
.drawer-item-text { font-size: 13px; color: #aaa; flex: 1; transition: color 0.2s; line-height: 1.4; }
.drawer-item.active .drawer-item-text { color: #e8e0d4; }
.drawer-item-dur { font-size: 11px; color: #555; white-space: nowrap; }

/* ── POPUP ── */
#popup-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.82);
  z-index: 95; backdrop-filter: blur(8px);
  display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
#popup-overlay.open { opacity: 1; pointer-events: all; }
#popup {
  background: #1c1b1b; width: 100%;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 24px 24px 48px;
  transform: translateY(24px); transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  max-height: 76vh; overflow-y: auto; position: relative;
}
#popup-overlay.open #popup { transform: translateY(0); }
.popup-handle {
  width: 38px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,0.1); margin: 0 auto 22px;
}
.popup-eyebrow { font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: #c8a96e; margin-bottom: 8px; }
.popup-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  font-size: 25px; font-weight: 300; color: #f0ebe3;
  margin-bottom: 18px; line-height: 1.2;
}
.popup-body { font-size: 15px; line-height: 1.82; color: #bbb; font-weight: 300; white-space: pre-line; }
.popup-close {
  position: absolute; top: 18px; right: 18px;
  background: rgba(255,255,255,0.05); border: none;
  color: #777; border-radius: 50%; width: 30px; height: 30px;
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.popup-close:hover { background: rgba(255,255,255,0.1); color: #ccc; }

#main { display: none; }

/* section intro popup */
#section-popup-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.82);
  z-index: 95; backdrop-filter: blur(8px);
  display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
#section-popup-overlay.open { opacity: 1; pointer-events: all; }
#section-popup {
  background: #1c1b1b; width: 100%;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 24px 24px 40px;
  transform: translateY(24px); transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  max-height: 70vh; overflow-y: auto; position: relative;
}
#section-popup-overlay.open #section-popup { transform: translateY(0); }
#section-popup-cta {
  margin-top: 24px; display: flex; align-items: center; gap: 10px;
  background: #c8a96e; border: none; color: #111;
  border-radius: 8px; padding: 12px 20px; width: 100%;
  font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; justify-content: center; transition: background 0.2s;
}
#section-popup-cta:hover { background: #d4b880; }

/* splash dismiss area */
#splash-dismiss {
  position: absolute; inset: 0; z-index: 1; cursor: pointer;
}

/* ── MENSAJE DE ERROR DE CARGA ── */
.fatal {
  padding: 40px 28px;
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
  color: #bbb;
}
.fatal p { max-width: 340px; margin: 0 auto; }

/* ── EPÍGRAFE SOBRE LA FOTO ── */
.slide-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 30px 14px 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.78) 30%, rgba(0,0,0,0));
  pointer-events: none;
}
.slide-caption span {
  display: -webkit-box; display: box;
  -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; box-orient: vertical;
  overflow: hidden;
  max-height: 32px;              /* 2 líneas exactas, por si el clamp no aplica */
  font-size: 11px; line-height: 16px; font-weight: 300;
  color: #d8d0c4; letter-spacing: 0.01em;
}
.slider-wrap.has-caption .slider-dots { bottom: 6px; }

/* botón de ampliar */
.slider-expand {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  background: rgba(0,0,0,0.42); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(4px); transition: background 0.2s;
}
.slider-expand:hover { background: rgba(0,0,0,0.7); }

/* ── VISOR A PANTALLA COMPLETA ── */
#lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: #0b0b0b;
  display: flex; flex-direction: column;
  opacity: 0; transition: opacity 0.25s ease;
}
#lightbox.open { opacity: 1; }
#lightbox[hidden] { display: none; }

#lb-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px calc(14px);
  padding-top: max(14px, env(safe-area-inset-top));
  flex: 0 0 auto;
}
#lb-counter {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #777; font-weight: 500;
}
#lb-close {
  background: rgba(255,255,255,0.06); border: none; color: #bbb;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
#lb-close:hover { background: rgba(200,169,110,0.18); color: #c8a96e; }

#lb-stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#lb-img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
  opacity: 1; transition: opacity 0.18s ease;
}
#lb-img.loading { opacity: 0.25; }

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.07); border: none; color: #e8e0d4;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); transition: background 0.2s;
}
.lb-nav:hover { background: rgba(200,169,110,0.22); }
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }
.lb-nav[hidden] { display: none; }

#lb-bottom {
  flex: 0 0 auto; padding: 16px 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
#lb-caption {
  font-size: 13px; line-height: 1.65; font-weight: 300; color: #bbb;
  max-height: 26vh; overflow-y: auto;
}
#lb-caption:empty { display: none; }
#lb-dots {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
  margin-top: 14px;
}
#lb-dots:empty { display: none; }
.lb-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.25); border: none; cursor: pointer;
  padding: 0; transition: background 0.2s;
}
.lb-dot.active { background: #c8a96e; }
