/*
 * Inter, servida desde el propio origen. SPEC-001-004 prohíbe CDN, así que la
 * fuente viaja en el repositorio; su licencia SIL OFL 1.1 permite redistribuirla
 * y exige acompañarla del texto de licencia, que se publica junto a ella.
 *
 * Es la variable: un archivo por subset cubre los pesos 400 a 900, en vez de un
 * archivo por peso. Los catorce idiomas del registro son de escritura latina,
 * así que sólo se empaquetan `latin` y `latin-ext` — cirílico, griego y
 * vietnamita quedan fuera y no se descargan nunca.
 *
 * `font-display: swap`: el texto se lee de inmediato con la fuente de sistema y
 * cambia cuando Inter llega. Una página institucional no puede quedarse en
 * blanco esperando una tipografía.
 */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/*
 * Tokens del sistema de diseño de Owlia, copiados de
 * packages/app/lib/tokens.generated.ts. Los valores son literales a propósito:
 * el sitio no importa nada de la aplicación, comparte identidad y no artefactos.
 *
 * Lo que se desvía del sistema, y por qué:
 *  - Escala de titulares. El sistema tope en displayLarge 38/46 y en weight 700,
 *    dimensionado para el chrome de una app en un móvil. Una landing leída en
 *    desktop necesita un extremo superior mayor, y sin él la página se lee como
 *    un panel de administración. Todo lo que no es titular es literal.
 *  - Superficies de feedback como decoración. infoSurface, warningSurface y
 *    successSurface significan info, aviso y éxito en la aplicación; acá dan
 *    color a las tarjetas. Es deliberado y discutible.
 */

:root {
  --action-primary: #180075;
  --action-primary-hovered: #292b8f;
  --action-primary-pressed: #0d004e;
  --border-focus: #180075;
  --border-subtle: #dde3ee;
  --content-primary: #172033;
  --content-secondary: #657089;
  --content-inverse: #ffffff;
  --surface-canvas: #f7f8fc;
  --surface-elevated: #ffffff;
  --surface-selected: #eef2ff;
  --surface-student: #e0e7ff;
  --selection: #fde68a;

  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 40px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --target: 44px;
  --elevation-raised: 0 2px 8px rgba(0, 0, 0, 0.12);

  --font-body:
    Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --action-primary: #a5b4fc;
    --action-primary-hovered: #e0e7ff;
    --action-primary-pressed: #ffffff;
    --border-focus: #a5b4fc;
    --border-subtle: #343c50;
    --content-primary: #f4f6fa;
    --content-secondary: #a7b0c2;
    --content-inverse: #171c29;
    --surface-canvas: #10141d;
    --surface-elevated: #171c29;
    --surface-selected: #252a4d;
    --surface-student: #30375f;
    --selection: #6d3c11;
  }
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  color: var(--content-primary);
  background: var(--surface-canvas);
}

::selection {
  background: var(--selection);
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

@media (min-width: 720px) {
  .wrap {
    padding: 0 var(--space-xxl);
  }
}

/* El foco es visible siempre y no depende del color solo. */
:where(a, summary, button):focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Oculto hasta recibir foco de teclado: es el primer tabulador de la página. */
.skip-link {
  position: absolute;
  left: var(--space-md);
  top: -100px;
  z-index: 10;
  background: var(--selection);
  color: #172033;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: top 120ms ease;
}

.skip-link:focus {
  top: var(--space-md);
}

.site-header {
  background: var(--action-primary);
  border-bottom: 1px solid var(--action-primary-hovered);
}

.header-row {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--surface-student);
}

.brand-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--content-inverse);
}

.owl {
  flex-shrink: 0;
}

/*
 * El estado `resting` del búho, con los valores de owlia.tsx: ciclo de 6 s,
 * pausa de 2400 ms y 300/600/300 ms desplazando las pupilas ±5. CSS puro: el
 * único JavaScript del sitio es el selector de idioma.
 */
@keyframes owl-resting {
  0%,
  40% {
    transform: translateX(0);
  }
  45% {
    transform: translateX(5px);
  }
  55% {
    transform: translateX(-5px);
  }
  60%,
  100% {
    transform: translateX(0);
  }
}

/*
 * Estado `puzzled` de owlia.tsx: PUZZLED_ROTATION_DEGREES y las pupilas
 * desplazadas PUPIL_VERTICAL_OFFSET hacia abajo. Es una pose fija, no un bucle,
 * así que no necesita excepción de movimiento reducido.
 */
/*
 * Estado `puzzled` de packages/app/components/owlia.tsx, con sus valores
 * exactos: PUZZLED_ROTATION_DEGREES = 20 sobre el conjunto y las pupilas
 * desplazadas PUPIL_VERTICAL_OFFSET = 6 hacia abajo. Es la pose que la
 * aplicación reserva para `failed`, `stopped` e `idempotency_mismatch`, y una
 * página de error es ese mismo caso.
 *
 * Queda quieto: no arranca ningún bucle, así que no necesita excepción de
 * movimiento reducido.
 */
.owl-puzzled {
  transform: rotate(20deg);
}

.owl-puzzled .owl-pupils {
  transform: translateY(6px);
}

/*
 * El bucle es exclusivo de `resting`, igual que en el componente: allí el efecto
 * sale temprano si el estado no es `resting`, así que `puzzled` nunca lo arranca.
 *
 * Va por `:not()` y no por una regla que apague la animación después: ésa
 * tendría la misma especificidad y el resultado dependería del orden del
 * archivo. Peor todavía, los keyframes escriben `transform`, así que ganar el
 * pulso de la animación también borraría la mirada baja de `puzzled`.
 */
.hero-art .owl:not(.owl-puzzled) .owl-pupils {
  animation: owl-resting 6s ease-in-out infinite;
}

/* Movimiento reducido no inicia ningún bucle y la pose queda distinguible. */
@media (prefers-reduced-motion: reduce) {
  .hero-art .owl:not(.owl-puzzled) .owl-pupils,
  .skip-link {
    animation: none;
    transition: none;
  }
}

.lang {
  position: relative;
}

.lang-current {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--target);
  padding: 0 var(--space-md);
  border: 1px solid var(--action-primary-hovered);
  border-radius: var(--radius-pill);
  color: var(--content-inverse);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.lang-current::-webkit-details-marker {
  display: none;
}

.lang[open] .chev {
  transform: rotate(180deg);
}

.lang-list {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-xs));
  z-index: 20;
  margin: 0;
  padding: var(--space-sm);
  list-style: none;
  width: max-content;
  max-width: min(92vw, 320px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-raised);
}

.lang-list a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--target);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  color: var(--content-primary);
  text-decoration: none;
  font-size: 15px;
}

.lang-list a:hover {
  background: var(--surface-selected);
}

/* La opción actual se marca por texto y forma, no sólo por color. */
.lang-list a[aria-current="true"] {
  background: var(--surface-selected);
  color: var(--action-primary);
  font-weight: 700;
}

.lang-list a[aria-current="true"]::after {
  content: "✓";
  margin-left: auto;
}

.flag {
  font-size: 20px;
  line-height: 1;
}

.hero {
  background: var(--action-primary);
  color: var(--content-inverse);
  padding: 48px 0 64px;
}

.hero-grid {
  display: grid;
  gap: var(--space-xxl);
  align-items: center;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
  }
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  align-items: flex-start;
}

.badge {
  background: var(--selection);
  color: #172033;
  border-radius: var(--radius-pill);
  padding: var(--space-xs) var(--space-md);
  font-size: 14px;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: 38px;
  line-height: 58px;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

@media (min-width: 900px) {
  .hero h1 {
    font-size: 56px;
    line-height: 84px;
  }
}

/*
 * El resaltado es una caja inline con relleno, así que sobresale por arriba y
 * por abajo de la caja de contenido de su línea. Dos consecuencias que hay que
 * atender juntas:
 *
 *  - Sin relleno vertical, el fondo corta la cola de las descendentes que están
 *    dentro del propio resaltado.
 *  - Con relleno vertical y poco interlineado, ese mismo fondo sube y tapa las
 *    descendentes de la línea de arriba.
 *
 * Por eso el relleno es pequeño y el `line-height` del titular es generoso: el
 * fondo tiene que caber dentro de su línea sin invadir la anterior.
 */
mark {
  background: var(--selection);
  color: #172033;
  padding: 2px 10px;
  border-radius: var(--radius-xs, 8px);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.lead {
  margin: 0;
  font-size: 18px;
  line-height: 28px;
  color: var(--surface-student);
  max-width: 46ch;
  text-wrap: pretty;
}

.notice {
  margin: 0;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--action-primary-hovered);
  color: var(--content-inverse);
  font-size: 15px;
  line-height: 22px;
  max-width: 52ch;
}

.cta-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: flex-start;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 56px;
  padding: var(--space-md) var(--space-xl);
  background: var(--surface-student);
  color: #171c29;
  border-radius: var(--radius-pill);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.cta:hover {
  background: var(--content-inverse);
}

.cta-invert {
  background: var(--selection);
  color: #172033;
}

.cta-note {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--surface-student);
}

.hero-art {
  display: flex;
  justify-content: center;
  color: var(--surface-student);
}

.hero-art .owl {
  width: 220px;
  height: 220px;
}

.band {
  padding: 56px 0;
  background: var(--surface-canvas);
  border-top: 1px solid var(--border-subtle);
}

.band-alt {
  background: var(--surface-selected);
}

/*
 * `--content-secondary` sobre `--surface-selected` da 4,44:1 en tema claro, y
 * WCAG 2.2 AA pide 4,5:1 para texto normal. El par no es accesible y los tokens
 * no se tocan —son los de la aplicación, copiados literales—, así que en esta
 * banda la prosa usa el color primario, que da 14,55:1. En tema oscuro el mismo
 * par da 6,35:1 y no haría falta, pero una sola regla es más fácil de sostener
 * que una excepción por esquema.
 */
.band-alt .prose {
  color: var(--content-primary);
}

.band h2,
.closing h2 {
  margin: 0 0 var(--space-md);
  font-size: 28px;
  line-height: 38px;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

@media (min-width: 900px) {
  .band h2,
  .closing h2 {
    font-size: 40px;
    line-height: 52px;
  }
}

.prose {
  margin: 0;
  font-size: 17px;
  line-height: 27px;
  color: var(--content-secondary);
  max-width: 62ch;
  text-wrap: pretty;
}

.reasons {
  margin: var(--space-lg) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 720px) {
  .reasons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg);
  }
}

.reasons li {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.reasons h3 {
  margin: 0 0 var(--space-xs);
  font-size: 20px;
  line-height: 28px;
  font-weight: 800;
}

.reasons p {
  margin: 0;
  font-size: 15px;
  line-height: 23px;
  color: var(--content-secondary);
}

.closing {
  padding: 64px 0;
  background: var(--action-primary);
  color: var(--content-inverse);
}

.closing .prose {
  color: var(--surface-student);
  margin-bottom: var(--space-lg);
}

.site-footer {
  background: var(--surface-elevated);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-xl) 0;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-lg);
  align-items: center;
  justify-content: space-between;
}

.footer-brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--content-secondary);
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-links a {
  color: var(--action-primary);
  font-size: 14px;
  font-weight: 600;
}

/*
 * Tonos de acento. Son las superficies de feedback del sistema —infoSurface,
 * warningSurface, successSurface— usadas acá como color de tarjeta y no como
 * semántica de estado. Es un desvío deliberado: sin ellas la página vuelve a
 * ser índigo sobre gris, y una landing para adolescentes necesita ritmo.
 */
:root {
  --tone-info: #dbeafe;
  --tone-info-ink: #1d4ed8;
  --tone-warning: #fef3c7;
  --tone-warning-ink: #6d3c11;
  --tone-success: #dcfce7;
  --tone-success-ink: #166534;
  --tone-brand: #e0e7ff;
  --tone-brand-ink: #180075;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tone-info: #172554;
    --tone-info-ink: #bfdbfe;
    --tone-warning: #451a03;
    --tone-warning-ink: #fde68a;
    --tone-success: #052e16;
    --tone-success-ink: #bbf7d0;
    --tone-brand: #30375f;
    --tone-brand-ink: #a5b4fc;
  }
}

.split {
  display: grid;
  gap: var(--space-xxl);
  align-items: center;
}

@media (min-width: 900px) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
  }
}

/* --- La conversación de ejemplo ------------------------------------------- */

.chat {
  margin: 0;
  padding: var(--space-lg);
  background: var(--surface-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-raised);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.bubble {
  margin: 0;
  padding: var(--space-sm) var(--space-md);
  font-size: 15px;
  line-height: 22px;
  max-width: 86%;
}

.bubble-student {
  align-self: flex-end;
  background: var(--surface-student);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
}

.bubble-owlia {
  align-self: flex-start;
  background: var(--surface-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
}

.bubble-success {
  background: var(--tone-success);
  color: var(--tone-success-ink);
  border-color: transparent;
  font-weight: 500;
}

.chat figcaption {
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--content-secondary);
}

/* --- Las cartas ------------------------------------------------------------ */

.points {
  margin: var(--space-lg) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.points li {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  font-size: 16px;
  line-height: 24px;
}

.points .icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--action-primary);
}

/* Superpuestas como una mano: con la misma caja y separadas, el giro se lee
   como descuadre en vez de como grupo. */
.cards {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: var(--space-lg) 0;
}

.card {
  width: 152px;
  height: 216px;
  border-radius: var(--radius-lg);
  border: 2px solid currentColor;
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(23, 32, 51, 0.18);
  position: relative;
}

.card:first-child {
  transform: rotate(-9deg) translateY(8px);
  transform-origin: bottom center;
  margin-right: -18px;
}

.card:last-child {
  transform: rotate(9deg) translateY(8px);
  transform-origin: bottom center;
  margin-left: -18px;
}

.card:nth-child(2) {
  transform: translateY(-12px);
  z-index: 3;
}

.card-info {
  color: var(--tone-info-ink);
}
.card-warning {
  color: var(--tone-warning-ink);
}
.card-success {
  color: var(--tone-success-ink);
}

.card-art {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-info .card-art {
  background: var(--tone-info);
}
.card-warning .card-art {
  background: var(--tone-warning);
}
.card-success .card-art {
  background: var(--tone-success);
}

/* `character` es la cara entera; las clases enmarcadas ocupan una ventana. */
.card-framed {
  padding: var(--space-xs);
  gap: var(--space-xs);
}

.card-framed .card-art {
  flex-grow: 0;
  height: 104px;
  border-radius: var(--radius-md);
}

.card-art .owl {
  width: 64px;
  height: 64px;
}

.card-foot {
  padding: var(--space-xs) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
}

.card-character .card-foot {
  border-top: 2px solid currentColor;
}

.card-name {
  font-size: 13px;
  line-height: 17px;
  font-weight: 800;
  color: var(--content-primary);
}

.pips {
  display: flex;
  gap: var(--space-xxs);
}

.pips i {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: currentColor;
}

.pips i.off {
  opacity: 0.28;
}

/* --- Las cuatro razones ---------------------------------------------------- */

.reasons li {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  border: 0;
}

.reasons li.reason-info {
  background: var(--tone-info);
  color: var(--tone-info-ink);
}
.reasons li.reason-warning {
  background: var(--tone-warning);
  color: var(--tone-warning-ink);
}
.reasons li.reason-success {
  background: var(--tone-success);
  color: var(--tone-success-ink);
}
.reasons li.reason-brand {
  background: var(--tone-brand);
  color: var(--tone-brand-ink);
}

.reasons h3,
.reasons p {
  color: var(--content-primary);
}
