/* Las Estaciones — Audiolibro */

@font-face {
  font-family: 'cocogoose';
  src: url('../assets/fonts/CocogoosePro-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'rotunda';
  src: url('../assets/fonts/Rotunda-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

/*
 * Diálogo: Bodoni grueso (sistema) con respaldo cocogoose local.
 * Para autonomía total, colocá un .otf en assets/fonts/ y descomentá la src.
 */
@font-face {
  font-family: 'bodoni';
  src:
    local('Bodoni 72 Bold'),
    local('Bodoni MT Bold'),
    local('Bodoni Bold'),
    url('../assets/fonts/CocogoosePro-Regular.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --design-w: 1080px;
  --design-h: 1920px;
  --nav-h: 140px;
  --text-y: 852px;
  --text-h: 768px;
  --player-y: 1640px;
  --player-h: 250px;
  --color-text: #2a2418;
  --color-text-dim: #5a5040;
  --color-panel: rgba(255, 252, 245, 0.92);
  --color-button: #ffc828;
  --color-button-label: #1a1208;
  --color-overlay: rgba(40, 28, 16, 0.45);
  --color-progress-track: rgba(42, 36, 24, 0.18);
  --color-progress-fill: #ffc828;
  --radius: 28px;
  --shadow: 0 10px 28px rgba(42, 36, 24, 0.18);
  --font-story: Georgia, 'Times New Roman', serif;
  /* Escala del stage (Viewport); se usa para piso de legibilidad del texto */
  --stage-scale: 1;
  --text-size-design: 46px;
  --text-size-min-screen: 18px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #c4a574;
  color: var(--color-text);
  font-family: var(--font-story);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none;
}

button,
input {
  font: inherit;
  touch-action: manipulation;
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: block;
  margin: 0;
  padding: 0;
  background: rgb(18, 22, 36);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#loading.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.loading-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 2rem;
  text-align: center;
  color: rgb(240, 244, 255);
  font-family: cocogoose, sans-serif;
  font-size: 1.25rem;
}

.bg-bleed {
  position: fixed;
  inset: 0;
  z-index: 0;
  transition: background-color 0.15s linear;
}

.stage {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  width: var(--design-w);
  height: var(--design-h);
  transform-origin: top left;
  overflow: visible;
  pointer-events: none;
}

.stage > * {
  pointer-events: auto;
}

/* ——— NAV: FS + SALIR | título | INFO ——— */
.nav {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: auto 1fr minmax(140px, 200px);
  align-items: center;
  gap: 16px;
  padding: 12px 28px 0;
  z-index: 50;
}

.nav-leading {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
  min-width: 0;
}

.nav-btn {
  min-width: 140px;
  height: 68px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.9);
  color: var(--color-button-label);
  font-family: cocogoose, sans-serif;
  font-size: 26px;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  justify-self: start;
}

.nav-btn--icon {
  min-width: 68px;
  width: 68px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-fs-icon {
  width: 30px;
  height: 30px;
  display: block;
}

.nav-btn--icon.is-fullscreen .nav-fs-icon__enter {
  display: none;
}

.nav-btn--icon.is-fullscreen .nav-fs-icon__exit {
  display: block;
}

.nav-btn--icon:not(.is-fullscreen) .nav-fs-icon__exit {
  display: none;
}

.nav-btn:last-child,
.nav-btn--info {
  justify-self: end;
}

.nav-btn:active {
  transform: scale(0.97);
}

.nav-btn--info {
  background: var(--color-button);
}

.nav-title {
  text-align: center;
  pointer-events: none;
  min-width: 0;
  padding: 0 8px;
}

.nav-title__eyebrow {
  margin: 0 0 4px;
  font-family: cocogoose, sans-serif;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.1;
  color: #ffcc00;
  text-shadow: 0 2px 8px rgba(30, 20, 10, 0.35);
}

.nav-title__name {
  margin: 0;
  font-family: cocogoose, sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  color: #f0f4ff;
  text-shadow: 0 2px 10px rgba(30, 20, 10, 0.4);
}

/* ——— ESCENA ——— */
.scene-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 840px;
  z-index: 5;
  overflow: visible;
  pointer-events: none;
}

.scene-decor,
.scene-melisa {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  pointer-events: auto;
  cursor: grab;
  filter: drop-shadow(3px 5px 6px rgba(30, 20, 10, 0.25));
  will-change: transform, opacity, left, top;
  transition: filter 0.2s ease;
}

.scene-decor.is-dragging,
.scene-melisa.is-dragging {
  cursor: grabbing;
  filter: drop-shadow(6px 10px 12px rgba(30, 20, 10, 0.35));
  z-index: 45 !important;
}

.scene-melisa {
  z-index: 40;
}

/* ——— TEXTO ——— */
.text-panel {
  position: absolute;
  top: var(--text-y);
  left: 40px;
  right: 40px;
  height: var(--text-h);
  z-index: 30;
  background: var(--color-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 3px solid rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.text-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 52px 56px;
}

.text-track {
  position: relative;
  z-index: 1;
  will-change: transform;
  padding-bottom: 40%;
}

.text-line {
  margin: 0 0 30px;
  font-family: var(--font-story);
  /* Más grande en diseño; piso ~20px en pantalla al achicar el stage */
  font-size: max(
    var(--text-size-design),
    calc(var(--text-size-min-screen) / var(--stage-scale, 1))
  );
  line-height: 1.38;
  color: var(--color-text-dim);
  opacity: 0.55;
  transition: color 0.35s ease, opacity 0.35s ease, transform 0.35s ease;
}

.text-line.is-active {
  color: var(--color-text);
  opacity: 1;
  transform: translateX(4px);
}

/* ——— PLAYER ——— */
.player {
  position: absolute;
  top: var(--player-y);
  left: 40px;
  right: 40px;
  height: var(--player-h);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 14px;
  padding: 24px 36px;
  background: var(--color-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 3px solid rgba(255, 255, 255, 0.65);
}

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

.player-row--meta {
  gap: 28px;
  justify-content: space-between;
}

.play-btn {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border: none;
  border-radius: 50%;
  background: var(--color-button);
  color: var(--color-button-label);
  font-size: 34px;
  line-height: 1;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}

.play-btn:active {
  transform: scale(0.96);
}

.seek,
.volume__fader {
  flex: 1 1 auto;
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  border-radius: 999px;
  background: var(--color-progress-track);
  outline: none;
  cursor: pointer;
}

.seek::-webkit-slider-thumb,
.volume__fader::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-progress-fill);
  border: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(42, 36, 24, 0.25);
  cursor: grab;
}

.seek::-moz-range-thumb,
.volume__fader::-moz-range-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-progress-fill);
  border: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(42, 36, 24, 0.25);
  cursor: grab;
}

.times {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: flex-start;
  font-family: var(--font-story);
  font-size: 26px;
  color: var(--color-text);
  min-width: 200px;
}

.times [data-time-duration]::before {
  content: '/ ';
  opacity: 0.45;
}

.volume {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  max-width: 360px;
  margin-left: auto;
}

.volume__label {
  font-family: var(--font-story);
  font-size: 24px;
  color: var(--color-text-dim);
  flex: 0 0 auto;
}

.volume__fader {
  flex: 1 1 auto;
  min-width: 120px;
}

/* ——— INFO MODAL ——— */
.info-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--color-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.info-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.info-panel {
  width: min(920px, 100%);
  max-height: min(1600px, 92vh);
  display: flex;
  flex-direction: column;
  background: #fffaf2;
  color: var(--color-text);
  border-radius: 36px;
  box-shadow: 0 20px 50px rgba(30, 20, 10, 0.35);
  padding: 36px 28px 28px;
  border: 4px solid rgba(255, 255, 255, 0.8);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.28s ease;
}

.info-overlay.is-open .info-panel {
  transform: none;
}

.info-panel__scroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 8px 24px 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.credits {
  font-family: rotunda, Georgia, serif;
  font-size: clamp(16px, 2.1vw, 24px);
  line-height: 1.45;
}

.credits__title {
  margin: 0 0 28px;
  font-family: cocogoose, sans-serif;
  font-size: clamp(32px, 4.5vw, 48px);
  line-height: 1.15;
  color: var(--color-text);
  text-align: center;
}

.credits__group {
  margin: 0 0 32px;
}

.credits__group h3 {
  margin: 0 0 10px;
  font-family: cocogoose, sans-serif;
  font-size: clamp(24px, 3vw, 34px);
  color: #c45a18;
}

.credits__group .subtitle {
  margin: 0 0 18px;
  font-family: rotunda, Georgia, serif;
  font-size: clamp(16px, 2vw, 22px);
  color: var(--color-text-dim);
  line-height: 1.4;
}

.credits__list {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(140px, 0.42fr) 1fr;
  gap: 6px 20px;
}

.credits__list dt {
  margin: 0;
  font-family: cocogoose, sans-serif;
  font-size: 0.85em;
  color: var(--color-text);
  padding-top: 4px;
}

.credits__list dt:not(:first-of-type) {
  margin-top: 10px;
}

.credits__list dd {
  margin: 0;
  font-family: rotunda, Georgia, serif;
  color: var(--color-text-dim);
}

.credits__list dd + dd {
  grid-column: 2;
}

/* dt ocupa col 1; cada dd tras el primero se fuerza a col 2 */
.credits__list dt {
  grid-column: 1;
}

.credits__list dd {
  grid-column: 2;
}

.credits .note {
  display: inline;
  font-size: 0.9em;
  font-style: italic;
  opacity: 0.85;
}

.credits__highlight {
  margin: 0 0 36px;
  padding: 20px 22px;
  background: rgba(255, 200, 40, 0.22);
  border-radius: 20px;
  border: 2px solid rgba(255, 200, 40, 0.45);
}

.credits__highlight p {
  margin: 0;
  font-size: clamp(15px, 2vw, 22px);
  line-height: 1.45;
  color: var(--color-text);
}

.credits__highlight strong {
  font-family: cocogoose, sans-serif;
  font-weight: 400;
}

.social-links,
.credits__institutions ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-links li,
.credits__institutions li {
  margin: 0 0 12px;
}

.social-links a {
  color: #1a5f8a;
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-word;
}

.social-links a:hover {
  color: #0d3d5c;
}

.info-close {
  flex: 0 0 auto;
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 12px auto 0;
  height: 72px;
  border: none;
  border-radius: 999px;
  background: var(--color-button);
  color: var(--color-button-label);
  font-family: cocogoose, sans-serif;
  font-size: 28px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

audio {
  display: none;
}

#app:not(.is-ready) .stage,
#app:not(.is-ready) .bg-bleed {
  opacity: 0;
}
