/* ---------- 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;
  --blue-deep: #14149c;
  --blue-bright: #3d3dff;
  --white: #fff;
  --pad-x: clamp(1.5rem, 6vw, 6.5rem);
  --pad-y: clamp(1.25rem, 3.5vh, 2.75rem);
  --radius: 999px;
}

*,
*::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; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--white);
  color: var(--blue);
  padding: .6rem 1rem;
  z-index: 10;
  border-radius: 0 0 12px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Secciones (una sola visible; la URL nunca cambia) ---------- */
/* Sin JS no existe [data-view]: las tres secciones quedan visibles y legibles. */
html[data-view] .view { display: none; }
html[data-view="home"] #view-home,
html[data-view="privacy"] #view-privacy,
html[data-view="terms"] #view-terms { display: block; }

/* Sin JS: se muestran las tres secciones en español y se ocultan los
   controles que no funcionarían. (Antes iba en un <style> dentro de
   <noscript>, que la CSP bloquea.) */
html:not([data-view]) [lang="en"],
html:not([data-view]) .lang,
html:not([data-view]) .legal,
html:not([data-view]) .doc-nav { display: none; }

html:not([data-view]) #view-privacy,
html:not([data-view]) #view-terms { border-top: 1px solid rgba(255, 255, 255, .25); }

/* La home ocupa exactamente el viewport y no hace scroll. */
html[data-view="home"] body {
  height: 100dvh;
  overflow: hidden;
}

.view.is-entering { animation: view-in .2s ease-out both; }

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

.stage {
  position: relative;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: var(--pad-y) var(--pad-x);
  isolation: isolate;
}

/* Background: grayscale sea + blue multiply + vertical gradient */
.bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--blue);
}

/* Two drifting copies of the sea texture + a moving sheen = animated swell */
.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); }
}

/* Light band sliding across the surface */
.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%
  );
}

/* ---------- Language switch ---------- */
/* Cada texto existe en los dos idiomas; se oculta el que no está activo. */
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; }
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: clamp(2rem, 6vh, 3.5rem);
}

.logo {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  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;
}

/* ---------- Main ---------- */
.content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: min(50ch, 100%);
  padding: clamp(.5rem, 2vh, 2rem) 0;
  min-width: 0;
  min-height: 0;
}

.title {
  margin: 0;
  font-weight: 300;
  font-size: clamp(2rem, 6.2vw, 4.75rem);
  line-height: 1.06;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.title strong { font-weight: 600; }

.subtitle {
  margin: clamp(.9rem, 2.2vh, 1.6rem) 0 0;
  font-size: clamp(.9rem, 1.55vw, 1.15rem);
  line-height: 1.6;
  max-width: min(42ch, 100%);
  color: rgba(255, 255, 255, .92);
}

.cta {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  align-self: flex-start;
  margin-top: clamp(1.25rem, 3.2vh, 2.5rem);
  display: inline-flex;
  align-items: center;
  background: var(--white);
  color: var(--blue);
  font-weight: 500;
  font-size: clamp(.85rem, 1.3vw, 1rem);
  line-height: 1;
  padding: 1.05em 1.9em;
  border-radius: 14px;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
}

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

/* ---------- Footer ---------- */
/* Switch de idioma abajo a la izquierda, enlaces legales abajo a la derecha. */
.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 button {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

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

/* ---------- Secciones legales (azul plano, con scroll) ---------- */
#view-privacy,
#view-terms { min-height: 100dvh; }

.doc {
  max-width: 700px;
  margin: 0 auto;
  padding: clamp(2.5rem, 8vh, 5rem) clamp(1.5rem, 6vw, 2rem) clamp(3rem, 10vh, 6rem);
}

.doc .logo,
.doc .back {
  color: var(--blue);
}

.doc .lang__btn { color: rgba(43, 43, 224, .55); }
.doc .lang__btn[aria-pressed="true"] { color: var(--white); }

.doc h1 {
  margin: 0 0 .35em;
  font-weight: 300;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -.03em;
}

.doc h1 strong { font-weight: 600; }

/* El foco programático al cambiar de sección no debe dibujar contorno. */
.doc h1[tabindex]:focus,
.doc h1[tabindex]:focus-visible,
#main[tabindex]:focus,
#main[tabindex]:focus-visible { outline: none; }

.doc .updated {
  margin: 0 0 clamp(2rem, 5vh, 3rem);
  font-size: .82rem;
  color: rgba(255, 255, 255, .75);
}

.doc h2 {
  margin: 2.4em 0 .7em;
  font-weight: 600;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  letter-spacing: -.01em;
}

.doc p, .doc li {
  font-size: 1rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, .93);
}

.doc ul { padding-left: 1.15rem; }
.doc li { margin-bottom: .5rem; }
.doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  background: rgba(255, 255, 255, .14);
  padding: .12em .45em;
  border-radius: 5px;
}

.doc a { color: var(--white); }

.doc .lang { margin-top: clamp(2.5rem, 6vh, 3.5rem); }

.doc-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.doc-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
  color: rgba(255, 255, 255, .85);
}

.doc-link:hover { text-decoration: underline; }

.back {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--white);
  color: var(--blue);
  font-weight: 500;
  font-size: .9rem;
  line-height: 1;
  padding: 1em 1.6em;
  border-radius: 14px;
  text-decoration: none;
}

.back:hover { text-decoration: none; transform: translateY(-2px); }

/* ---------- Small screens: shrink, never scroll ---------- */
@media (max-height: 620px) {
  .title { font-size: clamp(1.6rem, 5vw, 2.4rem); }
  .subtitle { font-size: .85rem; margin-top: .7rem; }
  .cta { margin-top: 1rem; padding: .85em 1.5em; }
}

@media (max-width: 480px) {
  .title { font-size: clamp(1.75rem, 8.5vw, 2.6rem); }
  .legal { font-size: .72rem; gap: .9rem; }
}

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