/* Portal de casaflix — mismo lenguaje visual que casaflix.net.
   Los assets están duplicados aquí a propósito: este fichero lo sirve
   PocketBase desde otra máquina y no puede tirar del dominio público
   (Cross-Origin-Resource-Policy: same-origin lo bloquearía). */

/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/poppins-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poppins-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/poppins-600.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
:root {
  --blue: #2b2be0;
  --white: #fff;
  --pad-x: clamp(1.5rem, 6vw, 6.5rem);
  --pad-y: clamp(1.25rem, 3.5vh, 2.75rem);
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 300;
  color: var(--white);
  background: var(--blue);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Escenario ---------- */
/* Entrada al llegar desde casaflix.net: el mismo fundido con el que allí se
   sale. Los dos documentos comparten el azul de fondo, así que la transición
   entre sitios se lee como una sola. */
.stage {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: var(--pad-y) var(--pad-x);
  isolation: isolate;
  animation: stage-in .22s ease-out both;
}

@keyframes stage-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--blue);
}

.bg__img {
  position: absolute;
  top: -25%;
  left: -25%;
  width: 150%;
  height: 150%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.35) brightness(1.05);
  will-change: transform;
  backface-visibility: hidden;
}

.bg__img--back { animation: swell-back 18s ease-in-out infinite alternate; }

.bg__img--front {
  opacity: .45;
  animation: swell-front 13s ease-in-out infinite alternate;
}

@keyframes swell-back {
  from { transform: translate3d(-9%, -3.5%, 0) scale(1.00); }
  to   { transform: translate3d(9%, 3.5%, 0) scale(1.12); }
}

@keyframes swell-front {
  from { transform: scaleY(-1) translate3d(10%, 3%, 0) scale(1.10); }
  to   { transform: scaleY(-1) translate3d(-10%, -3%, 0) scale(1.00); }
}

.bg__sheen {
  position: absolute;
  inset: -30%;
  background: radial-gradient(
    46% 34% at 50% 50%,
    rgba(150, 150, 255, .55) 0%,
    rgba(120, 120, 255, .22) 42%,
    rgba(120, 120, 255, 0) 70%
  );
  animation: sheen 11s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

@keyframes sheen {
  from { transform: translate3d(-28%, 10%, 0) scale(.9); opacity: .35; }
  to   { transform: translate3d(30%, -12%, 0) scale(1.15); opacity: 1; }
}

.bg__tint {
  position: absolute;
  inset: 0;
  background: var(--blue);
  mix-blend-mode: multiply;
}

.bg__grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(14, 14, 130, .82) 0%,
    rgba(28, 28, 190, .55) 38%,
    rgba(43, 43, 224, .40) 70%,
    rgba(61, 61, 255, .48) 100%
  );
}

/* ---------- Cabecera ---------- */
.masthead {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  background: var(--white);
  color: var(--blue);
  font-weight: 600;
  font-size: clamp(.95rem, 1.6vw, 1.15rem);
  letter-spacing: -.01em;
  line-height: 1;
  padding: .65em 1.1em;
  border-radius: 14px;
  text-decoration: none;
}

/* ---------- Tarjeta ---------- */
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vh, 2rem) 0;
  min-height: 0;
}

.auth {
  width: min(24rem, 100%);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 22px;
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

.auth__title {
  margin: 0 0 clamp(1.25rem, 3vh, 1.75rem);
  font-weight: 300;
  font-size: clamp(1.4rem, 3.4vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -.02em;
}

.auth__title strong { font-weight: 600; }

/* Cambio entre las dos opciones y el formulario de email: la caja crece de una
   altura a otra (el JS mide y fija el valor) y el panel entrante aparece. */
.auth__form { transition: height .34s cubic-bezier(.4, 0, .2, 1); }

.auth__form.is-resizing { overflow: hidden; }

.auth__pane--in { animation: pane-in .28s ease-out both; animation-delay: .07s; }

@keyframes pane-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.auth__label {
  display: block;
  margin-bottom: .4rem;
  font-size: .78rem;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .78);
}

.auth__input {
  width: 100%;
  margin-bottom: 1rem;
  font: inherit;
  font-size: .95rem;
  line-height: 1.2;
  color: var(--white);
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 12px;
  padding: .85em 1em;
}

.auth__input:focus {
  outline: none;
  border-color: var(--white);
  background: rgba(255, 255, 255, .16);
}

/* El autorrelleno de Chrome pinta fondo blanco: se fuerza el tema oscuro. */
.auth__input:-webkit-autofill,
.auth__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--white);
  -webkit-box-shadow: 0 0 0 100px rgba(30, 30, 160, .95) inset;
  caret-color: var(--white);
}

.auth__btn {
  appearance: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: .5rem;
  background: var(--white);
  color: var(--blue);
  font-weight: 500;
  font-size: clamp(.85rem, 1.3vw, .95rem);
  line-height: 1;
  padding: 1.05em 1.5em;
  border-radius: 14px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.auth__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}

.auth__btn[disabled] {
  cursor: default;
  opacity: .6;
  transform: none;
  box-shadow: none;
}

.auth__btn--ghost {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .30);
  color: var(--white);
}

.auth__btn--ghost:hover { background: rgba(255, 255, 255, .18); }

/* Volver a las dos opciones: enlace, no botón. */
.auth__btn--link {
  background: none;
  border-color: transparent;
  color: rgba(255, 255, 255, .8);
  font-weight: 300;
  font-size: .82rem;
  padding: .9em 1em;
  margin-top: .15rem;
}

.auth__btn--link:hover {
  transform: none;
  box-shadow: none;
  color: var(--white);
}

.auth__who {
  margin: 0 0 1rem;
  font-size: .9rem;
  line-height: 1.5;
  word-break: break-all;
  color: rgba(255, 255, 255, .92);
}

.auth__msg {
  margin: 1rem 0 0;
  font-size: .82rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, .92);
}

.auth__msg:empty { display: none; }

.auth__msg--error { color: #ffd2d2; }

/* ---------- Idioma ---------- */
/* Cada texto existe en los dos idiomas; se oculta el que no está activo.
   Mismo mecanismo y mismo switch que en casaflix.net. */
html[data-lang="es"] [lang="en"],
html[data-lang="en"] [lang="es"] { display: none; }

.lang {
  position: relative;
  display: inline-flex;
  gap: .15rem;
  padding: .25rem;
  background: var(--white);
  border-radius: 14px;
}

/* Pastilla azul que se desliza entre ES y EN. */
.lang::before {
  content: '';
  position: absolute;
  top: .25rem;
  bottom: .25rem;
  left: .25rem;
  width: calc(50% - .325rem);
  background: var(--blue);
  border-radius: 11px;
  transition: transform .22s cubic-bezier(.4, 0, .2, 1);
}

html[data-lang="en"] .lang::before { transform: translateX(calc(100% + .15rem)); }

.lang__btn {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: clamp(.72rem, 1.2vw, .82rem);
  letter-spacing: .04em;
  line-height: 1;
  padding: .62em .95em;
  border-radius: 11px;
  background: transparent;
  color: rgba(43, 43, 224, .55);
  transition: color .22s ease;
}

.lang__btn:hover { color: var(--blue); }

.lang__btn[aria-pressed="true"] { color: var(--white); }

/* Fundido del texto al cambiar de idioma. */
html.is-lang-anim [lang] { animation: lang-in .22s ease-out both; }

@keyframes lang-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Pie ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.legal {
  display: flex;
  gap: 1.25rem;
  font-size: .78rem;
  letter-spacing: .01em;
  color: rgba(255, 255, 255, .82);
}

.legal a { text-decoration: none; }

.legal a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
