/* Pantalla de videos: oscura, a sangre, tipo plataforma de streaming. */
:root {
  --bg: #0c0b0a;
  --bg-2: #161412;
  --ink: #f4efe8;
  --muted: #a59d92;
  --line: rgba(244, 239, 232, .14);
  --accent: #d2693c;
  --accent-2: #e9a46f;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.wordmark { font-family: var(--sans); font-weight: 600; letter-spacing: .32em; font-size: .9rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.wordmark span { color: var(--accent); }
.kicker { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; font-weight: 600; color: var(--accent-2); margin: 0 0 .8rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; border: 0; border-radius: 6px; padding: .65rem 1.2rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .12s ease, background .15s ease, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn-lg { padding: .85rem 1.6rem; font-size: 1.02rem; }
.btn-light { background: var(--ink); color: #111; }
.btn-light:hover { background: #fff; }
.btn-ghost { background: rgba(120, 112, 104, .45); color: var(--ink); backdrop-filter: blur(6px); }
.btn-ghost:hover { background: rgba(140, 130, 120, .6); }
.btn:focus-visible, .ctl:focus-visible, .card:focus-visible, .bar:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Ícono play/pausa dibujado con CSS */
.ico { width: 14px; height: 16px; display: inline-block; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.ico.is-pause { clip-path: none; background: linear-gradient(90deg, currentColor 0 34%, transparent 34% 66%, currentColor 66%); }
.ico-sound { width: 18px; height: 16px; clip-path: polygon(0 30%, 30% 30%, 65% 0, 65% 100%, 30% 70%, 0 70%); }

/* ─── Login ─────────────────────────────────────────────── */
.login-body { min-height: 100vh; }
.login { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 32px var(--gutter); overflow: hidden; }
.login-glow { position: absolute; inset: -20%; background:
  radial-gradient(40% 40% at 20% 30%, rgba(210, 105, 60, .35), transparent 70%),
  radial-gradient(35% 35% at 80% 70%, rgba(233, 164, 111, .22), transparent 70%),
  radial-gradient(50% 50% at 60% 10%, rgba(90, 70, 160, .18), transparent 70%);
  filter: blur(30px); animation: drift 18s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate3d(4%, -3%, 0) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .login-glow { animation: none; } }
.login-card { position: relative; max-width: 560px; width: 100%; }
.login-card .wordmark { display: block; margin-bottom: 3.5rem; }
.login-card h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.08; margin: 0 0 2.2rem; letter-spacing: -.01em; }
.login-note { color: var(--muted); font-size: .9rem; margin: .9rem 0 0; }
.login-error { background: rgba(210, 70, 50, .18); border: 1px solid rgba(210, 70, 50, .5); padding: .7rem .9rem; border-radius: 6px; margin: 0 0 1.2rem; }
.dev-login { display: grid; gap: .7rem; max-width: 380px; }
.dev-login input { background: rgba(255,255,255,.07); border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: .8rem .9rem; font: inherit; }

/* ─── Barra superior ────────────────────────────────────── */
.topbar { position: fixed; inset: 0 0 auto; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 18px var(--gutter); background: linear-gradient(rgba(0,0,0,.7), transparent); transition: opacity .4s; }
.topbar-right { text-shadow: 0 1px 8px rgba(0,0,0,.6); display: flex; align-items: center; gap: 1.1rem; font-size: .9rem; }
.topbar-right form { margin: 0; }
.hello { color: var(--muted); }
.top-link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: none; cursor: pointer; opacity: .85; }
.top-link:hover { opacity: 1; text-decoration: underline; }
@media (max-width: 560px) { .hello { display: none; } }

/* ─── Escenario ─────────────────────────────────────────── */
.stage { position: relative; width: 100%; height: min(86vh, 56.25vw + 160px); min-height: 420px; background: #000; overflow: hidden; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage:fullscreen { height: 100vh; }
.shade { position: absolute; inset: 0; pointer-events: none; transition: opacity .6s;
  background: linear-gradient(90deg, rgba(12,11,10,.85) 0%, rgba(12,11,10,.35) 38%, transparent 60%),
              linear-gradient(0deg, var(--bg) 0%, rgba(12,11,10,.4) 22%, transparent 45%); }
.info { position: absolute; left: var(--gutter); bottom: 120px; max-width: min(560px, 80vw); transition: opacity .6s, transform .6s; }
.info h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem, 4.2vw, 3.4rem); line-height: 1.05; margin: 0 0 .8rem; letter-spacing: -.01em; text-shadow: 0 2px 20px rgba(0,0,0,.5); }
.info .desc { font-size: clamp(.95rem, 1.3vw, 1.08rem); line-height: 1.5; color: #e2dbd2; margin: 0 0 1.4rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 10px rgba(0,0,0,.6); }
.actions { display: flex; gap: .7rem; flex-wrap: wrap; }

.controls { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 var(--gutter) 18px; transition: opacity .4s, transform .4s ease; }
.bar { position: relative; height: 4px; background: rgba(255,255,255,.22); border-radius: 2px; cursor: pointer; margin-bottom: 12px; transition: height .15s; touch-action: none; }
.bar:hover, .bar.dragging { height: 7px; }
.bar-buf, .bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 2px; }
.bar-buf { background: rgba(255,255,255,.28); width: 0; transition: opacity .4s; }
.bar-fill { background: var(--accent); width: 0; }
.bar-knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--accent); left: 0; transform: scale(0); transition: transform .15s; }
.bar:hover .bar-knob, .bar.dragging .bar-knob { transform: scale(1); }
.ctl-row { display: flex; align-items: center; gap: .3rem; transition: opacity .4s; }
.ctl { background: none; border: 0; padding: .45rem .6rem; border-radius: 6px; cursor: pointer; font-size: .9rem; font-weight: 600; opacity: .9; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }
.ctl:hover { background: rgba(255,255,255,.1); opacity: 1; }
.ctl .ico { width: 13px; height: 15px; }
.time { font-variant-numeric: tabular-nums; font-size: .85rem; color: #ddd5cb; margin: 0 auto 0 .4rem; white-space: nowrap; }
/* En el teléfono: video arriba a lo ancho, controles y texto debajo (no encima del video). */
@media (max-width: 640px) {
  .stage { height: auto; min-height: 0; padding-top: 60px; display: flex; flex-direction: column; background: var(--bg); overflow: visible; }
  .stage video { position: relative; inset: auto; height: auto; aspect-ratio: 16/9; }
  .shade { display: none; }
  .controls { position: static; order: 2; padding-top: 10px; padding-bottom: 0; }
  .info { position: static; order: 3; max-width: none; padding: 18px var(--gutter) 0; transform: none !important; }
  .info .desc { -webkit-line-clamp: 4 !important; }
  .stage.playing[data-idle="1"] .info, .stage.playing[data-idle="1"] .ctl-row { opacity: 1; pointer-events: auto; }
  .stage.playing[data-idle="1"] .controls { transform: none; }
  .stage.playing[data-idle="1"] { cursor: auto; }
  body:has(.stage.playing[data-idle="1"]) .topbar { opacity: 1; }
  .topbar { background: var(--bg); }
  #ctl-back, #ctl-fwd { display: none; }
  .time { flex: 1; }
  .upnext, .endcard { position: fixed; z-index: 30; bottom: 16px; top: auto; left: 16px; right: 16px; width: auto; transform: none; }
}

/* Mientras se reproduce y el mouse está quieto: se ve solo el video */
.stage.playing[data-idle="1"] .info, .stage.playing[data-idle="1"] .ctl-row { opacity: 0; pointer-events: none; }
/* La barra de tiempo queda siempre: solo el naranja y un riel muy tenue */
.stage.playing[data-idle="1"] .bar { background: rgba(255,255,255,.1); }
/* ...y baja hasta quedar pegada al borde inferior (la barra mide 4px y es lo primero de .controls) */
.stage.playing[data-idle="1"] .controls { transform: translateY(calc(100% - 4px)); }
.stage.playing[data-idle="1"] .bar-buf { opacity: 0; }
.stage.playing[data-idle="1"] .shade { opacity: .25; }
.stage.playing[data-idle="1"] { cursor: none; }
body:has(.stage.playing[data-idle="1"]) .topbar { opacity: 0; }
.stage.playing .info { transform: translateY(10px); }
.stage.playing .info .desc { -webkit-line-clamp: 2; }

/* Entrada de cada video: la imagen aparece desde negro y el texto sube en cascada */
.stage video { transition: opacity .9s ease, transform 1.6s cubic-bezier(.2, .7, .2, 1); }
.info > * { transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
.info > :nth-child(2) { transition-delay: .12s; }
.info > :nth-child(3) { transition-delay: .24s; }
.info > :nth-child(4) { transition-delay: .36s; }
.stage.loading video { opacity: 0; transform: scale(1.04); transition: none; }
.stage.loading .info > * { opacity: 0; transform: translateY(18px); transition: none; }
@media (prefers-reduced-motion: reduce) {
  .stage video, .info > * { transition: opacity .4s ease !important; transform: none !important; }
}

/* Título: queda un momento al arrancar cada video y se va (vuelve al pausar) */
@media (min-width: 641px) {
  .stage.playing.title-off .info { opacity: 0; pointer-events: none; }
  .stage.playing.title-off .shade { opacity: .35; }
}

/* Play grande cuando el navegador no deja arrancar con sonido solo */
.start { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(8, 7, 6, .45); border: 0; cursor: pointer; color: var(--ink); animation: fadein .4s ease; }
.start-ring { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: rgba(244, 239, 232, .14); border: 2px solid rgba(244, 239, 232, .85); backdrop-filter: blur(6px); transition: transform .2s ease, background .2s ease; }
.start-ring .ico { width: 28px; height: 32px; margin-left: 6px; }
.start-label { font-weight: 600; letter-spacing: .18em; text-transform: uppercase; font-size: .8rem; }
.start:hover .start-ring { transform: scale(1.06); background: var(--accent); border-color: var(--accent); }
.start:focus-visible .start-ring { outline: 2px solid var(--accent-2); outline-offset: 4px; }
@keyframes fadein { from { opacity: 0; } }
@media (max-width: 640px) { .start { bottom: auto; aspect-ratio: 16/9; top: 60px; height: auto; } .start-ring { width: 72px; height: 72px; } }

/* Siguiente / fin */
.stage.is-over .controls, .stage.is-over .info, .stage.is-over .start { display: none; }
.stage.is-over::after { content: ""; position: absolute; inset: 0; z-index: 8; background: rgba(8, 7, 6, .7); backdrop-filter: blur(4px); }
.stage.is-over .endcard { z-index: 9; }
.upnext, .endcard { position: absolute; right: var(--gutter); bottom: 110px; width: min(420px, calc(100% - 2 * var(--gutter))); background: rgba(22, 20, 18, .88); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem; animation: rise .35s ease; }
.endcard { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%, -50%); text-align: center; padding: 2rem 1.6rem; width: min(520px, calc(100% - 2 * var(--gutter))); animation: none; }
.endcard h2 { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; margin: 0 0 .6rem; }
.endcard .btn { margin-top: 1rem; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.upnext-card { display: flex; gap: .9rem; align-items: center; margin-bottom: 1rem; }
.upnext-card h2 { font-size: 1.05rem; margin: 0 0 .3rem; font-weight: 600; }
.upnext-card p { margin: 0; font-size: .88rem; }
.upnext-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.upnext-thumb { width: 128px; aspect-ratio: 16/9; border-radius: 6px; background: #222 center/cover; flex: none; position: relative; overflow: hidden; }
.upnext-thumb::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); width: var(--p, 0%); transition: width 1s linear; }

/* ─── Fila de episodios ─────────────────────────────────── */
.row { padding: 28px var(--gutter) 64px; position: relative; z-index: 2; }
.row-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 .9rem; }
.row-title .muted { font-weight: 400; font-size: .9rem; margin-left: .4rem; }
.cards { list-style: none; margin: 0; padding: 4px 0 12px; display: grid; grid-auto-flow: column; grid-auto-columns: clamp(220px, 24vw, 320px); gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: #3a3530 transparent; }
.cards li { scroll-snap-align: start; }
.card { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.thumb { position: relative; display: block; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--bg-2); transition: transform .2s ease, box-shadow .2s; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.card:hover .thumb { transform: scale(1.03); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.card.is-current .thumb { box-shadow: 0 0 0 2px var(--accent); }
.num { position: absolute; left: 10px; top: 6px; font-family: var(--serif); font-size: 2rem; line-height: 1; text-shadow: 0 2px 10px rgba(0,0,0,.7); }
.badge-now, .badge-done { position: absolute; top: 8px; right: 8px; font-size: .7rem; font-weight: 600; border-radius: 4px; padding: .2rem .45rem; display: none; }
.badge-now { background: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.badge-done { background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.4); }
.card.is-current .badge-now { display: block; }
.card.is-done:not(.is-current) .badge-done { display: block; }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.18); }
.prog span { display: block; height: 100%; background: var(--accent); }
.card-title { display: block; margin-top: .6rem; font-weight: 600; font-size: .95rem; line-height: 1.3; }
.card-meta { display: block; font-size: .8rem; margin-top: .2rem; }

.empty { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 0 var(--gutter); }
.empty h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0 0 .8rem; }
