/* Landing pública (server-rendered). CSS autocontenido: no comparte bundle con
   la SPA, así que su paleta está **duplicada** aquí a propósito (Django sirve
   este archivo; Vite, el de la app). Si cambias un color en la app, hay que
   replicarlo aquí — deuda conocida, anotada en PROGRESS.md.

   v5 (T-137): alineada con la dirección **Sure** (sure.am) de la app: su paleta
   neutra, su tipografía **Geist** y el **botón primario en tinta** en vez de
   azul. Las dos fuentes se sirven desde aquí porque la landing es otro origen
   que la app y no comparte sus assets.

   Tema: el MODO NOCHE es el valor por defecto (`:root`). El claro se activa solo
   si el usuario lo elige (`:root[data-theme="light"]`, marcado por el script de
   <head> antes de pintar). El verde/rojo se reservan a cifras financieras. */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/geist-variable-latin.b3495042e1a3.woff2") format("woff2-variations");
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/geist-mono-variable-latin.bd0693c1a36d.woff2") format("woff2-variations");
}

/* Modo noche (por defecto). El lienzo es más oscuro que las tarjetas, como en
   Sure: así una tarjeta se lee como tarjeta sin sombra. */
:root {
  --bg: #0b0b0b;
  --bg-subtle: #171717;
  --surface: #171717;
  --surface-2: #242424;
  --border: #363636;
  --border-strong: #5c5c5c;
  --text: #ffffff;
  --text-muted: #9e9e9e;
  --accent: #2e90fa; /* azul: SOLO enlaces */
  --accent-soft: #11243d;
  --accent-contrast: #0b0b0b;
  --primary: #ffffff; /* botón primario: en oscuro, blanco */
  --primary-hover: #f0f0f0;
  --primary-contrast: #0b0b0b;
  --pos: #32d583; /* verde: solo cifras financieras */
  --neg: #ed4e4e; /* rojo: solo cifras financieras */

  --shadow: 0 8px 24px rgba(1, 4, 9, 0.6);
  --shadow-sm: 0 1px 0 rgba(1, 4, 9, 0.2);

  --radius: 8px;
  --radius-lg: 10px;
  --gap: 16px;
  --maxw: 1120px;

  /* Escala de la landing. Vive aquí y no suelta por el archivo: una página de
     marketing necesita tipos más grandes que la app (14px de cuerpo sería
     absurdo en un titular), pero los tamaños deben estar en UN sitio. */
  --lp-xs: 12px;
  --lp-sm: 13px;
  --lp-base: 14px;
  --lp-h3: 17px;
  --lp-h2-lg: 28px;
  --lp-h1: 36px;
  --lp-h1-lg: 52px;
  --lp-h2: 26px;
  --lp-lead: 18px;
  --lp-body: 15px;
  --lp-small: 13px;
  --lp-figure: 34px;

  --font:
    "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Modo día. */
:root[data-theme="light"] {
  --bg: #f7f7f7;
  --bg-subtle: #f0f0f0;
  --surface: #ffffff;
  --surface-2: #f0f0f0;
  --border: #e7e7e7;
  --border-strong: #cfcfcf;
  --text: #171717;
  --text-muted: #737373;
  --accent: #1570ef;
  --accent-soft: #eff8ff;
  --accent-contrast: #ffffff;
  --primary: #171717;
  --primary-hover: #242424;
  --primary-contrast: #ffffff;
  --pos: #078c52;
  --neg: #c91313;

  --shadow: 0 8px 24px rgba(31, 35, 40, 0.12);
  --shadow-sm: 0 1px 0 rgba(31, 35, 40, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a {
  color: var(--accent);
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.container--narrow {
  max-width: 680px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  height: 0;
  width: 0;
  overflow: hidden;
}

/* Enlace de salto al contenido: invisible hasta que recibe el foco. Mismo
   patrón que en la app. */
.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 30;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: top 0.12s ease;
}

.skip-link:focus-visible {
  top: 16px;
}

/* ── Header / footer ─────────────────────────────────────────────────────── */
/* Cabecera opaca con su línea, como la de GitHub. Antes era translúcida y
   desenfocaba lo que pasaba por debajo: glassmorphism, que CLAUDE.md prohíbe
   expresamente — y que además dejaba el texto de la página asomando borroso al
   hacer scroll. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  height: 62px;
}

.site-header__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-header__nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: var(--lp-lead);
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: var(--lp-body);
  font-weight: 700;
}

/* Interruptor de tema (sol / luna). En noche se ve el sol; en día, la luna. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Selector de idioma en la cabecera: mismo aspecto que el interruptor de tema,
   con la etiqueta del idioma al que se cambia (EN / ES). El submit hace
   set_language, que guarda la cookie de idioma y recarga la página. */
.lang-switch {
  margin: 0;
  display: inline-flex;
}

.lang-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--lp-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.lang-switch__btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.lang-switch__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Modo noche por defecto: se ve el sol. Solo en modo día se cambia a la luna.
   Se define así (no por [data-theme="dark"]) para que, incluso sin JS y sin
   atributo, se muestre el sol —coherente con el modo noche por defecto—. */
.theme-toggle__moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle__sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle__moon {
  display: block;
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 72px;
  padding: 28px 0;
  color: var(--text-muted);
  font-size: var(--lp-base);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-muted);
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding: 56px 0 40px;
}

.hero__grid {
  display: grid;
  gap: 40px;
  grid-template-columns: 1fr;
  align-items: center;
}

/* Etiqueta sobre el titular: la "Label" de GitHub — borde, fondo del lienzo y
   texto tenue. Antes era una pastilla tintada de acento, que robaba la atención
   al titular que tiene justo debajo. */
.eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: var(--lp-small);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
}

.hero__title {
  font-size: var(--lp-h1);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
  max-width: 15ch;
}

.hero__subtitle {
  font-size: var(--lp-lead);
  color: var(--text-muted);
  margin: 0 0 28px;
  max-width: 54ch;
}

.hero__brokers {
  margin: 20px 0 0;
  font-size: var(--lp-base);
  color: var(--text-muted);
}

/* ── Vista previa de la app ──────────────────────────────────────────────── */
.preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview__chrome {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.preview__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
}

.preview__path {
  margin-left: 8px;
  font-size: var(--lp-small);
  color: var(--text-muted);
}

.preview__body {
  padding: 22px;
}

.preview__hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.preview__label {
  font-size: var(--lp-sm);
  color: var(--text-muted);
}

.preview__figure {
  font-size: var(--lp-figure);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.preview__sub {
  font-size: var(--lp-sm);
  color: var(--text-muted);
}

.preview__ribbon {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 84px;
  margin-bottom: 20px;
}

.preview__ribbon span {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: var(--accent-soft);
}

.preview__ribbon span.is-current {
  background: var(--accent);
}

.preview__rows {
  display: flex;
  flex-direction: column;
}

.preview__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-top: 1px solid var(--border);
  font-size: var(--lp-base);
  font-variant-numeric: tabular-nums;
}

.preview__tk {
  color: var(--text);
}

/* Verde/rojo reservados a cifras financieras (aquí, resultado de cada posición). */
.pos {
  color: var(--pos);
  font-weight: 600;
}

.neg {
  color: var(--neg);
  font-weight: 600;
}

/* ── Secciones ───────────────────────────────────────────────────────────── */
.section-title {
  font-size: var(--lp-h2);
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}

.features {
  padding: 56px 0;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.features .section-title {
  margin-bottom: 28px;
}

/* Ventajas: antes eran tarjetas idénticas con su borde, su icono de acento y un
   salto de 2px al pasar el cursor — tres antipatrones de UX-NOTES de una vez
   (rejilla de tarjetas iguales, un icono por tarjeta, el «card lift» que delata
   una plantilla). Ahora son columnas de texto separadas por una línea de 1px,
   el mismo recurso con el que la app separa datos. */
.features__grid {
  display: grid;
  gap: 0;
  grid-template-columns: 1fr;
}

.feature {
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.feature:first-child {
  border-top: 0;
}

.feature__icon {
  display: block;
  width: 20px;
  height: 20px;
  margin-bottom: 10px;
  color: var(--text-muted);
}

.feature__title {
  font-size: var(--lp-lead);
  margin: 0 0 6px;
}

.feature p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--lp-body);
}

.shots {
  padding: 64px 0;
}

.shots .section-title {
  margin-bottom: 28px;
}

.shots__grid {
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
}

.shot {
  margin: 0;
}

.shot__frame {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.shot__frame img,
.shot__frame svg {
  width: 100%;
  height: auto;
  display: block;
}

.shot figcaption {
  margin-top: 12px;
  font-size: var(--lp-base);
  color: var(--text-muted);
}

/* ── CTA final ───────────────────────────────────────────────────────────── */
.cta-tail {
  padding: 8px 0 64px;
}

.cta-tail__card {
  padding: 44px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  text-align: center;
}

.cta-tail__lead {
  color: var(--text-muted);
  margin: 0 0 26px;
  font-size: var(--lp-h3);
}

/* ── Botones / accesos ───────────────────────────────────────────────────── */
.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero__actions--center {
  justify-content: center;
}

/* Acceso vs. sesión iniciada, resuelto por el script de <head>. `display:
   contents` deja que los botones de acceso sigan siendo hijos directos del
   contenedor flex (mismo gap); "Ir a mis posiciones" solo aparece con sesión. */
.auth-out {
  display: contents;
}

/* .btn.auth-in (not bare .auth-in): the link also carries .btn, whose
   `display: inline-flex` is defined later with equal specificity and would
   otherwise win, leaving "Ir a mis posiciones" always visible. */
.btn.auth-in {
  display: none;
}

html.is-authed .auth-out {
  display: none;
}

html.is-authed .btn.auth-in {
  display: inline-flex;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--lp-body);
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}

/* El CTA principal va en tinta (casi negro en claro, blanco en oscuro), no en
   azul: es el rasgo más reconocible de la dirección. */
.btn--primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

/* Hover por color de token, no por `filter`: el filtro cambia el color real y se
   sale de la paleta. */
.btn--primary:hover {
  background: var(--primary-hover);
}

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

.btn--sm {
  padding: 8px 14px;
  font-size: var(--lp-base);
}

.btn--lg {
  padding: 14px 22px;
  font-size: var(--lp-h3);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Legal (política de privacidad) ──────────────────────────────────────── */
.legal {
  padding: 56px 0;
}

.legal h1 {
  font-size: var(--lp-h2-lg);
  margin: 0 0 8px;
}

.legal__updated {
  color: var(--text-muted);
  margin: 0 0 32px;
}

.legal h2 {
  font-size: var(--lp-lead);
  margin: 28px 0 6px;
}

.legal h3 {
  font-size: var(--lp-body);
  margin: 18px 0 4px;
}

.legal p {
  color: var(--text-muted);
  margin: 0 0 12px;
}

.legal__list {
  margin: 0 0 12px;
  padding-left: 20px;
  color: var(--text-muted);
}

.legal__list li {
  margin: 0 0 8px;
}

.legal__list strong {
  color: var(--text);
}

/* Tabla de cookies: legible y con scroll horizontal en móvil. */
.cookie-table__wrap {
  overflow-x: auto;
  margin: 0 0 16px;
}

.cookie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--lp-base);
}

.cookie-table th,
.cookie-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-muted);
}

.cookie-table th {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.cookie-table code {
  font-size: var(--lp-xs);
  color: var(--text);
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
}

/* Enlaces legales del pie. */
.site-footer__links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Banner de consentimiento de cookies ─────────────────────────────────── */
.cookie-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 60;
  background: var(--surface);
  border-top: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.cookie-banner__text {
  flex: 1 1 340px;
  margin: 0;
  color: var(--text-muted);
  font-size: var(--lp-base);
  line-height: 1.5;
}

.cookie-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .cookie-banner__actions {
    width: 100%;
  }

  .cookie-banner__actions .btn {
    flex: 1;
  }
}

/* ── Móvil estrecho (iPhone 11 Pro Max y menores) ────────────────────────────
   En 414px la marca y los botones de acceso quedaban casi pegados: se encogen
   un poco los botones (lo que pidió Pedro) y se aprietan las separaciones para
   que la cabecera respire. */
@media (max-width: 480px) {
  .site-header__actions {
    gap: 8px;
  }

  .site-header__nav {
    gap: 8px;
  }

  .site-header__nav .btn--sm {
    padding: 7px 11px;
    font-size: var(--lp-sm);
  }

  .brand {
    font-size: var(--lp-lead);
    gap: 7px;
  }

  .brand__mark {
    width: 24px;
    height: 24px;
    font-size: var(--lp-base);
  }
}

/* ── Tablet / escritorio ─────────────────────────────────────────────────── */
@media (min-width: 720px) {
  .hero {
    padding: 80px 0 56px;
  }

  .hero__title {
    font-size: var(--lp-h1-lg);
  }

  .features__grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0 32px;
  }

  /* En fila, la separación es vertical: cada columna lleva su línea a la
     izquierda y la primera no. */
  .feature {
    padding: 0 0 0 24px;
    border-top: 0;
    border-left: 1px solid var(--border);
  }

  .feature:first-child {
    padding-left: 0;
    border-left: 0;
  }

  .shots__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .cta-tail__card {
    padding: 56px 32px;
  }
}

@media (min-width: 940px) {
  .hero__grid {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
