@font-face { font-family: "Geist"; src: url("assets/fuentes/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("assets/fuentes/serif.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("assets/fuentes/serif-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }

@font-face { font-family: "Caligrafia"; src: url("assets/fuentes/caligrafia.woff2") format("woff2"); font-display: swap; }

/* Dos temas como en la app: «Azul IDMJI» (aprobado por Daniel) y el rosado de siempre. Lo elige el color de la Biblia. */
:root {
  --papel: #eef3fa; --papel-2: #e3ebf6; --superficie: #f8fafd;
  --tinta: #0f1c36; --tinta-2: #3b4a66; --tinta-3: #5d6b85;
  --acento: #1f5bb8; --acento-hondo: #174a98; --sobre-acento: #fff;
  --linea: rgb(15 28 54 / .10);
  --sombra-color: 15 40 90;
  --sombra: 0 30px 80px -30px rgb(var(--sombra-color) / .35), 0 8px 24px -12px rgb(var(--sombra-color) / .18);
  --radio: 18px;
  --sal: cubic-bezier(0.23, 1, 0.32, 1);
  --ancho: 1180px;
  color-scheme: light;
}
:root[data-tema="rosa"] {
  --papel: #f6f1e4; --papel-2: #efe7d6; --superficie: #fdfaf3;
  --tinta: #1d1a16; --tinta-2: #4a443b; --tinta-3: #6b6356;
  --acento: #b0306a; --acento-hondo: #93245a;
  --linea: rgb(29 26 22 / .11);
  --sombra-color: 90 40 50;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papel: #0b1426; --papel-2: #101c33; --superficie: #13213b;
    --tinta: #e8eef8; --tinta-2: #b7c3d8; --tinta-3: #8f9cb4;
    --acento: #6f9be6; --acento-hondo: #8db0ee; --sobre-acento: #0b1426;
    --linea: rgb(232 238 248 / .12);
    --sombra-color: 0 0 0;
    color-scheme: dark;
  }
  :root[data-tema="rosa"]:not([data-theme="light"]) {
    --papel: #1a1316; --papel-2: #22191d; --superficie: #2a1f24;
    --tinta: #f4ece6; --tinta-2: #d3c4bd; --tinta-3: #a8988f;
    --acento: #e0699d; --acento-hondo: #ea8ab3; --sobre-acento: #1a1316;
    --linea: rgb(244 236 230 / .12);
  }
}
body { transition: background-color .4s ease, color .4s ease; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papel); color: var(--tinta);
  font: 400 1.0625rem/1.55 "Geist", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--acento); color: #fff; }
img, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; border-radius: 6px; }
h1, h2 { font-weight: 600; letter-spacing: -0.035em; line-height: 1.04; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 4.6vw, 4rem); }
h2 { font-size: clamp(2rem, 4.4vw, 3.6rem); }
p { margin: 0; text-wrap: pretty; }

/* Barra */
.barra {
  position: fixed; inset: 0 0 auto; z-index: 20; height: 56px;
  display: flex; align-items: center; gap: 2rem; padding: 0 max(16px, calc((100vw - var(--ancho)) / 2));
  background: color-mix(in srgb, var(--papel) 72%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--linea);
}
.marca { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.barra-enlaces { display: flex; gap: 1.75rem; margin-left: auto; font-size: .9rem; }
.barra-enlaces a { text-decoration: none; color: var(--tinta-2); transition: color .2s ease; }
.barra-enlaces a:hover { color: var(--tinta); }

.boton {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  height: 48px; padding: 0 1.5rem; border-radius: 999px; text-decoration: none; font-weight: 550;
  background: var(--acento); color: #fff; transition: transform .16s var(--sal), background-color .2s ease;
}
.boton:hover { background: var(--acento-hondo); }
.boton { color: var(--sobre-acento); }
.boton:active { transform: scale(.97); }
.boton-chico { height: 34px; padding: 0 1rem; font-size: .875rem; }
.enlace { color: var(--acento); text-decoration: none; font-weight: 500; }
.enlace:hover { text-decoration: underline; text-underline-offset: 4px; }
.acciones { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }

/* Portada pegajosa con el libro */
.portada { height: 340vh; position: relative; }
.portada-fija { position: sticky; top: 0; height: 100dvh; overflow: hidden; }
#libro3d { position: absolute; inset: 0; width: 100%; height: 100%; }
.portada-respaldo { display: none; }
.portada-texto {
  position: absolute; left: max(16px, calc((100vw - var(--ancho)) / 2)); top: 50%;
  transform: translateY(-50%); width: min(600px, 44vw); display: grid; gap: 1.5rem;
}
.portada-texto p { font-size: 1.2rem; color: var(--tinta-2); max-width: 34ch; }
.portada-texto-2 { left: 50%; transform: translate(-50%, 0); top: auto; bottom: 9vh; width: min(640px, 90vw); text-align: center; gap: .5rem; opacity: 0; }
.portada-texto-2 .frase { font: italic 400 clamp(1.4rem, 2.4vw, 2rem)/1.3 "Source Serif", Georgia, serif; color: var(--tinta); max-width: none; letter-spacing: -0.01em; }
.portada-texto-2 .cita { font-size: .95rem; color: var(--tinta-3); }
.portada-app {
  position: absolute; margin: 0; left: 50%; top: 50%; width: min(1100px, 88vw);
  transform: translate(-50%, -50%) scale(.9); opacity: 0; border-radius: var(--radio); overflow: hidden;
  box-shadow: var(--sombra); background: var(--superficie);
}

/* Selector de color de la Biblia */
.colores {
  position: absolute; right: max(16px, calc((100vw - var(--ancho)) / 2)); bottom: 6vh; display: flex; gap: .25rem;
  padding: .3rem; border-radius: 999px; background: color-mix(in srgb, var(--superficie) 80%, transparent);
  border: 1px solid var(--linea); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.colores button {
  display: inline-flex; align-items: center; gap: .5rem; height: 36px; padding: 0 .9rem 0 .5rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--tinta-2); font: 500 .875rem "Geist", system-ui, sans-serif; cursor: pointer;
  transition: background-color .2s ease, color .2s ease, transform .16s var(--sal);
}
.colores button:active { transform: scale(.96); }
.colores button[aria-pressed="true"] { background: var(--papel); color: var(--tinta); box-shadow: 0 1px 3px rgb(var(--sombra-color) / .15); }
.muestra { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); }
.muestra-azul { background: #2c4c98; }
.muestra-rosa { background: #c8326f; }

/* El problema */
.problema { padding: 18vh 16px; max-width: var(--ancho); margin: 0 auto; }
.problema-texto { font-size: clamp(1.6rem, 3.4vw, 2.9rem); line-height: 1.18; letter-spacing: -0.03em; font-weight: 500; color: var(--tinta-3); max-width: 24ch; }
.problema-texto span { color: var(--tinta-2); }
.problema-texto strong { display: block; margin-top: .6em; color: var(--tinta); font-weight: 600; }

/* Funciones */
.funcion { max-width: var(--ancho); margin: 0 auto; padding: 12vh 16px; display: grid; gap: 3rem; }
.funcion-texto { display: grid; gap: 1.25rem; max-width: 46rem; }
.funcion-texto p, .celda-texto p { font-size: 1.2rem; color: var(--tinta-2); max-width: 52ch; }
.funcion-lado { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; }
.marco { border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); background: var(--superficie); border: 1px solid var(--linea); aspect-ratio: 16 / 10; }
.marco video { width: 100%; height: 100%; object-fit: cover; }
.marco-pelicula { aspect-ratio: 16 / 9; background: #0a1430; }

/* Cuaderno y mapa: dos celdas de distinto peso */
.mosaico { max-width: var(--ancho); margin: 0 auto; padding: 12vh 16px; display: grid; grid-template-columns: 7fr 5fr; gap: 1rem; }
.celda { display: grid; grid-template-rows: auto 1fr; gap: 2rem; padding: 2rem 2rem 0; border-radius: calc(var(--radio) + 6px); background: var(--papel-2); overflow: hidden; }
.celda-texto { display: grid; gap: .75rem; }
.celda h3 { margin: 0; font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.celda video { align-self: end; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px 12px 0 0; box-shadow: var(--sombra); }
.celda-mapa { background: color-mix(in srgb, var(--acento) 14%, var(--papel)); }
.celda-mapa video { width: 150%; max-width: none; object-position: left top; }

/* Película */
.pelicula { max-width: var(--ancho); margin: 0 auto; padding: 12vh 16px; display: grid; gap: 2.5rem; }

/* Entradas al aparecer */
.revelar { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--sal), transform .9s var(--sal); }
.revelar.visto { opacity: 1; transform: none; }

/* Descargas */
.descargar { max-width: var(--ancho); margin: 0 auto; padding: 16vh 16px 18vh; display: grid; gap: 1rem; }
.descargar-sub { font-size: 1.2rem; color: var(--tinta-2); margin-bottom: 2.5rem; }
.descargas { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1rem; }
.descarga {
  display: grid; gap: .35rem; align-content: start; min-height: 220px; padding: 1.75rem;
  border-radius: var(--radio); background: var(--superficie); border: 1px solid var(--linea);
  text-decoration: none; transition: transform .2s var(--sal), border-color .2s ease;
}
.descarga:hover { border-color: color-mix(in srgb, var(--acento) 45%, transparent); }
.descarga:active { transform: scale(.985); }
.descarga-nombre { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.03em; }
.descarga-detalle { color: var(--tinta-3); font-size: .95rem; }
.descarga-accion { margin-top: auto; padding-top: 2rem; color: var(--acento); font-weight: 550; display: inline-flex; align-items: center; gap: .4rem; }

.logo { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; margin-bottom: 1rem; background: var(--papel); border: 1px solid var(--linea); }
.logo-android svg { fill: #3ddc84; }
.logo-windows svg { fill: #0078d4; }
.logo-web { color: var(--acento); }
.nota-android { margin-top: 1.5rem; color: var(--tinta-3); font-size: .95rem; max-width: 60ch; }
.pie { max-width: var(--ancho); margin: 0 auto; padding: 3rem 16px 4rem; display: flex; align-items: center; gap: .75rem; color: var(--tinta-3); font-size: .95rem; border-top: 1px solid var(--linea); }
.descarga.es-tuyo { border-color: color-mix(in srgb, var(--acento) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--acento) 55%, transparent), var(--sombra); }

@media (max-width: 860px) {
  .barra-enlaces { display: none; }
  .barra { justify-content: space-between; }
  .portada { height: 300vh; }
  .portada-texto { left: 16px; right: 16px; width: auto; top: calc(56px + 4vh); transform: none; gap: 1rem; }
  .portada-texto p { font-size: 1.05rem; }
  .colores { right: 50%; transform: translateX(50%); bottom: 3vh; }
  .portada-texto-2 { top: auto; bottom: 8vh; left: 16px; right: 16px; width: auto; }
  .descargas, .mosaico, .funcion-lado { grid-template-columns: 1fr; }
  .celda { padding: 1.5rem 1.5rem 0; }
  .descarga { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .revelar { opacity: 1; transform: none; transition: none; }
  .portada { height: auto; }
  .portada-fija { position: relative; height: auto; padding: calc(56px + 8vh) 16px 8vh; display: grid; gap: 3rem; justify-items: center; }
  #libro3d, .portada-texto-2, .portada-app, .colores { display: none; }
  .portada-texto { position: static; transform: none; width: min(640px, 100%); }
  .portada-respaldo { display: block; width: min(360px, 80vw); height: auto; border-radius: 10px; box-shadow: var(--sombra); }
}

/* Al estilo Apple: las grabaciones crecen y se enderezan a medida que entran en pantalla */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .marco.revelar, .celda.revelar { opacity: 1; transform: none; transition: none; }
    .marco { animation: acercar linear both; animation-timeline: view(); animation-range: entry 0% cover 42%; transform-origin: 50% 80%; }
    .celda { animation: subir linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
    .celda:nth-child(2) { animation-range: entry 8% cover 42%; }
    @keyframes acercar {
      from { transform: perspective(1400px) rotateX(16deg) scale(.84) translateY(80px); opacity: .35; }
      to { transform: none; opacity: 1; }
    }
    @keyframes subir {
      from { transform: translateY(90px) scale(.94); opacity: .3; }
      to { transform: none; opacity: 1; }
    }
  }
}
