/* Firstsong, hoja unica del sitio.
 *
 * La paleta y la tipografia salen de ~/Desktop/latido-design/brand/tokens.css,
 * que es la fuente de verdad del prototipo de la app. Aqui viven solo los
 * tokens que la web usa, con los mismos valores, para que el sitio y la app se
 * lean como la misma marca.
 *
 * El modo oscuro es el PRIMARIO de esta marca, no una cortesia: el producto se
 * usa de noche. Aqui se respeta el tema del visitante y se declaran los dos.
 */

:root {
  /* NIGHT, los neutros oscuros. El negro de esta marca es marron. */
  --night-975: #0D090B;
  --night-950: #150F12;
  --night-900: #1B1417;
  --night-850: #21181C;
  --night-800: #291E22;
  --night-700: #372930;
  --night-600: #4A3840;

  /* BONE, los neutros claros. Papel calido, nunca blanco frio. */
  --bone-50: #FFFBF7;
  --bone-100: #FFF4EC;
  --bone-200: #F7E7DC;
  --bone-300: #EBD5C9;
  --bone-400: #D9BFB3;
  --bone-800: #57433C;
  --bone-900: #3A2C27;

  /* EMBER, el acento. Significa el latido del BEBE. */
  --ember-50: #FFF1EC;
  --ember-100: #FFDED3;
  --ember-200: #FFC2AF;
  --ember-300: #FFA187;
  --ember-400: #FF8163;
  --ember-700: #B94021;
  --ember-800: #8E3018;

  /* HONEY, el segundo acento. Significa SIEMPRE el pulso de la MADRE. */
  --honey-50: #FFF7E6;
  --honey-100: #FFECC6;
  --honey-300: #F9C267;
  --honey-700: #85540B;

  /* HUSH, el silencio. No es error, asi que no es rojo ni gris apagado. */
  --hush-100: #F0E5EA;
  --hush-300: #BCA3B0;
  --hush-600: #594851;

  /* LEAF, la confirmacion. Oliva calido, jamas el verde de un monitor. */
  --leaf-100: #E2EEDD;
  --leaf-300: #A8C79B;
  --leaf-700: #38562F;

  /* Semanticos, tema claro */
  --bg-canvas: var(--bone-100);
  --bg-surface: var(--bone-50);
  --bg-sunken: var(--bone-200);
  --bg-tint-ember: var(--ember-50);
  --bg-tint-honey: var(--honey-50);
  --bg-tint-hush: var(--hush-100);
  --bg-tint-leaf: var(--leaf-100);
  --bg-alarm: #FFEDE4;
  --bg-inverse: var(--night-950);

  --text-primary: var(--night-950);
  --text-secondary: var(--bone-800);
  --text-tertiary: #6E574E;
  --text-accent: var(--ember-700);
  --text-honey: var(--honey-700);
  --text-hush: var(--hush-600);
  --text-success: var(--leaf-700);
  --text-on-accent: #FFFFFF;
  --text-on-inverse: var(--bone-100);

  --accent: var(--ember-700);
  --accent-strong: #CD4725;
  --accent-hover: var(--ember-800);
  /* Enlace sobre un fondo TENIDO. El acento normal da 4.48 contra el tinte
     brasa del modo claro y AA pide 4.5, asi que sobre tinte se baja un escalon.
     Medido con bin/audit.py, no estimado. */
  --text-accent-on-tint: var(--ember-800);

  --border-hairline: rgba(58, 44, 39, 0.12);
  --border-soft: rgba(58, 44, 39, 0.18);
  --border-strong: rgba(58, 44, 39, 0.30);

  --shadow-card: 0 1px 2px rgba(58, 44, 39, 0.06), 0 8px 24px rgba(58, 44, 39, 0.07);

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: ui-serif, "New York", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: 20px;
  --maxw: 720px;
  --maxw-wide: 1080px;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;

  /* 60/143 y 60/72: la mediana fetal de tercer trimestre y el pulso materno de
     reposo que midio el GATE 0. El pulso de la marca late a datos reales. */
  --beat-fetal: 420ms;
  --beat-maternal: 833ms;

  /* Colores de la onda del canvas. Literales a proposito: getPropertyValue de
     una custom property devuelve el valor especificado, asi que un var() aqui
     llegaria a strokeStyle como la cadena "var(--ember-400)" y el canvas la
     descartaria en silencio. Medido en la primera captura. */
  --wave-fetal: #B94021;
  --wave-maternal: #85540B;
  --wave-quiet: #594851;
  --wave-grid: rgba(58, 44, 39, 0.22);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-canvas: var(--night-950);
    --bg-surface: var(--night-850);
    --bg-sunken: var(--night-900);
    --bg-tint-ember: rgba(255, 129, 99, 0.13);
    --bg-tint-honey: rgba(237, 169, 62, 0.13);
    --bg-tint-hush: rgba(188, 163, 176, 0.11);
    --bg-tint-leaf: rgba(94, 138, 78, 0.16);
    --bg-alarm: #2E1A18;
    --bg-inverse: var(--bone-100);

    --text-primary: var(--bone-100);
    --text-secondary: #D6BCB2;
    --text-tertiary: #AF9389;
    --text-accent: var(--ember-300);
    --text-honey: var(--honey-300);
    --text-hush: var(--hush-300);
    --text-success: var(--leaf-300);
    --text-on-accent: #2A0F07;
    --text-on-inverse: var(--night-950);

    --accent: var(--ember-400);
    --accent-strong: var(--ember-400);
    --accent-hover: var(--ember-300);
    --text-accent-on-tint: var(--ember-200);

    --border-hairline: rgba(255, 236, 226, 0.12);
    --border-soft: rgba(255, 236, 226, 0.18);
    --border-strong: rgba(255, 236, 226, 0.32);

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);

    --wave-fetal: #FF8163;
    --wave-maternal: #F9C267;
    --wave-quiet: #BCA3B0;
    --wave-grid: rgba(255, 236, 226, 0.20);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; height: auto; }

a { color: var(--text-accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-wide { width: 100%; max-width: var(--maxw-wide); margin: 0 auto; padding: 0 var(--gutter); }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--bg-surface); color: var(--text-primary);
  padding: 12px 18px; z-index: 50; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------ cabecera */
.site-header {
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-canvas);
}
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text-primary); text-decoration: none;
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px;
}
.wordmark:hover { color: var(--text-primary); }
.wordmark .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); display: inline-block; flex: 0 0 auto;
  animation: beat var(--beat-fetal) ease-in-out infinite;
}
@keyframes beat {
  0%, 100% { transform: scale(1); opacity: 1; }
  22% { transform: scale(1.45); opacity: 0.72; }
  44% { transform: scale(1); opacity: 1; }
}
.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  color: var(--text-secondary); text-decoration: none;
  font-size: 15px; font-weight: 500;
  padding: 11px 12px; min-height: 44px; display: inline-flex; align-items: center;
  border-radius: var(--r-sm);
}
.site-nav a:hover { color: var(--text-primary); background: var(--bg-sunken); }
.site-nav a.nav-cta {
  color: var(--text-on-accent); background: var(--accent-strong);
  padding: 11px 18px; font-weight: 600;
}
.site-nav a.nav-cta:hover { background: var(--accent-hover); color: var(--text-on-accent); }

/* --------------------------------------------------------------- heroe */
main { display: block; }
section { padding: 0; }
.hero { padding: 56px 0 40px; }
.eyebrow {
  font-size: 13px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-tertiary); margin: 0 0 14px;
}
h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 7.2vw, 46px);
  line-height: 1.13; letter-spacing: -0.02em; font-weight: 600;
  margin: 0 0 18px;
}
.lede { font-size: 20px; line-height: 1.55; color: var(--text-secondary); margin: 0 0 26px; }

h2 {
  font-size: clamp(23px, 4.6vw, 29px);
  line-height: 1.25; letter-spacing: -0.015em; font-weight: 650;
  margin: 44px 0 14px;
}
h3 { font-size: 19px; line-height: 1.35; font-weight: 650; margin: 30px 0 10px; }
p { margin: 0 0 18px; }
ul, ol { margin: 0 0 20px; padding-left: 22px; }
li { margin: 0 0 9px; }
strong { font-weight: 650; }

.block { padding: 8px 0 28px; }
.block-tint { background: var(--bg-sunken); padding: 34px 0 8px; margin: 40px 0; }

/* -------------------------------------------------------------- botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 14px 26px;
  border-radius: 999px; border: 1px solid transparent;
  font-size: 17px; font-weight: 650; font-family: inherit;
  text-decoration: none; cursor: pointer;
  background: var(--accent-strong); color: var(--text-on-accent);
}
.btn:hover { background: var(--accent-hover); color: var(--text-on-accent); }
.btn-ghost {
  background: transparent; color: var(--text-accent);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text-accent); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.btn-note { font-size: 14px; color: var(--text-tertiary); margin: 0 0 8px; }

/* -------------------------------------------------------------- tarjetas */
.card {
  background: var(--bg-surface); border: 1px solid var(--border-hairline);
  border-radius: var(--r-md); padding: 22px; margin: 0 0 16px;
  box-shadow: var(--shadow-card);
}
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.callout {
  border-left: 4px solid var(--accent); background: var(--bg-tint-ember);
  padding: 18px 20px; border-radius: 0 var(--r-sm) var(--r-sm) 0; margin: 0 0 22px;
}
.callout p:last-child { margin-bottom: 0; }
.callout a, .alarm a, .factbar a, th a, td a { color: var(--text-accent-on-tint); }
.callout a:hover, .alarm a:hover, .factbar a:hover, th a:hover, td a:hover { color: var(--text-accent-on-tint); text-decoration-thickness: 2px; }
.callout-honey { border-left-color: var(--honey-300); background: var(--bg-tint-honey); }
.callout-hush { border-left-color: var(--hush-300); background: var(--bg-tint-hush); }

/* La banda del disclaimer. NO es roja a proposito: un rojo de alarma
   permanente se vuelve invisible en dos dias. La verdad se dice en la letra de
   mas contraste de la pagina, no en el color mas chillon. */
.alarm {
  background: var(--bg-alarm); border-radius: var(--r-md);
  padding: 18px 20px; margin: 0 0 22px;
}
.alarm p { margin: 0; color: var(--text-secondary); font-size: 16px; }
.alarm strong { color: var(--text-primary); }

.factbar {
  display: grid; gap: 14px; grid-template-columns: 1fr;
  margin: 0 0 26px; padding: 0; list-style: none;
}
@media (min-width: 640px) { .factbar { grid-template-columns: repeat(3, 1fr); } }
.factbar li {
  background: var(--bg-surface); border: 1px solid var(--border-hairline);
  border-radius: var(--r-md); padding: 16px 18px; margin: 0;
}
.factbar .n {
  display: block; font-size: 27px; font-weight: 700; line-height: 1.15;
  letter-spacing: -0.02em; color: var(--text-accent); margin-bottom: 3px;
}
.factbar .k { display: block; font-size: 14px; color: var(--text-secondary); line-height: 1.4; }

table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 15px; }
.table-scroll { overflow-x: auto; margin: 0 0 24px; }
.table-scroll table { margin: 0; min-width: 380px; }
@media (max-width: 460px) { th, td { padding: 9px 8px; font-size: 14px; } }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border-hairline); vertical-align: top; }
th { font-weight: 650; color: var(--text-primary); background: var(--bg-sunken); }
td { color: var(--text-secondary); }

/* ---------------------------------------------------------------- FAQ */
.faq details {
  border: 1px solid var(--border-hairline); border-radius: var(--r-md);
  background: var(--bg-surface); margin: 0 0 12px; overflow: hidden;
}
.faq summary {
  cursor: pointer; padding: 16px 20px; min-height: 56px;
  display: flex; align-items: center; font-weight: 650; font-size: 17px;
  color: var(--text-primary); list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; padding-left: 14px; color: var(--text-tertiary); font-weight: 400; font-size: 21px; }
.faq details[open] summary::after { content: "\2013"; }
.faq .answer { padding: 0 20px 4px; color: var(--text-secondary); }

/* ------------------------------------------------- la seccion de captura */
.capture {
  background: var(--bg-surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: 26px 22px; margin: 34px 0;
}
.capture h2 { margin-top: 0; }
.capture form { margin: 0; }
.field { margin: 0 0 14px; }
.field label { display: block; font-size: 15px; font-weight: 600; margin: 0 0 7px; color: var(--text-primary); }
.field input[type="email"] {
  width: 100%; min-height: 52px; padding: 13px 15px; font-size: 17px;
  font-family: inherit; color: var(--text-primary);
  background: var(--bg-canvas); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
}
.field input[type="email"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.consent { display: flex; gap: 11px; align-items: center; margin: 0 0 16px; min-height: 48px; padding: 4px 0; cursor: pointer; }
.consent input[type="checkbox"] { width: 24px; height: 24px; margin: 0; flex: 0 0 auto; accent-color: var(--accent-strong); }
.consent span { font-size: 15px; color: var(--text-secondary); line-height: 1.5; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { margin: 12px 0 0; font-size: 15px; color: var(--text-secondary); min-height: 1px; }
.form-msg.ok { color: var(--text-success); }
.form-msg.bad { color: var(--text-accent); }

/* ------------------------------------------------------- la herramienta */
.tool { margin: 26px 0 34px; }
.clips { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 0 0 22px; }
@media (min-width: 760px) { .clips { grid-template-columns: repeat(3, 1fr); } }
.clip {
  background: var(--bg-surface); border: 1px solid var(--border-hairline);
  border-radius: var(--r-md); padding: 18px; text-align: left;
  font-family: inherit; font-size: 16px; color: var(--text-primary);
  cursor: pointer; min-height: 92px; display: block; width: 100%;
}
.clip:hover { border-color: var(--border-strong); background: var(--bg-sunken); }
.clip[aria-pressed="true"] { border-color: var(--accent); background: var(--bg-tint-ember); }
.clip .t { display: block; font-weight: 650; margin-bottom: 4px; }
.clip .s { display: block; font-size: 14px; color: var(--text-secondary); line-height: 1.45; }

.stage {
  background: var(--bg-sunken); border: 1px solid var(--border-hairline);
  border-radius: var(--r-lg); padding: 20px; margin: 0 0 18px;
}
.wave-box { position: relative; width: 100%; height: 132px; margin: 0 0 14px; }
.wave-box canvas { display: block; width: 100%; height: 132px; border-radius: var(--r-sm); }
.verdict { min-height: 118px; }
.verdict .state {
  font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-tertiary); margin: 0 0 8px;
}
.verdict .headline {
  font-family: var(--font-display); font-size: clamp(24px, 5vw, 32px);
  line-height: 1.2; margin: 0 0 8px; font-weight: 600;
}
.verdict .headline.fetal { color: var(--text-accent); }
.verdict .headline.maternal { color: var(--text-honey); }
.verdict .headline.quiet { color: var(--text-hush); }
.verdict .why { font-size: 16px; color: var(--text-secondary); margin: 0; }
.bpm { font-size: clamp(46px, 12vw, 68px); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.bpm .u { font-size: 19px; font-weight: 600; letter-spacing: 0; margin-left: 6px; color: var(--text-secondary); }

.meter { margin: 16px 0 6px; }
.meter .lab { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-secondary); margin: 0 0 6px; }
.meter .track { height: 10px; border-radius: 999px; background: var(--bg-canvas); border: 1px solid var(--border-hairline); overflow: hidden; }
/* display:block es imprescindible. Un span es inline por defecto y un inline
   NO admite width ni height, asi que la barra se pintaba con 0 px de ancho y el
   medidor salia vacio con el 89 por ciento escrito al lado. Cazado en la
   captura de produccion, y ahora bin/tool_check.py mide el ancho pintado. */
.meter .fill { display: block; height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width 220ms ease; }
.meter .fill.maternal { background: var(--honey-300); }
.meter .fill.quiet { background: var(--hush-300); }

.stages { list-style: none; margin: 16px 0 0; padding: 0; font-size: 14px; }
.stages li {
  display: flex; align-items: baseline; gap: 10px; padding: 5px 0; margin: 0;
  color: var(--text-tertiary); font-family: var(--font-mono);
}
.stages li.done { color: var(--text-secondary); }
.stages li .tick { width: 15px; flex: 0 0 auto; color: var(--text-success); }

.source-note { font-size: 14px; color: var(--text-tertiary); }

/* ----------------------------------------------------------- pie de pagina */
.site-footer {
  margin-top: 56px; padding: 40px 0 28px;
  border-top: 1px solid var(--border-hairline); background: var(--bg-sunken);
}
.foot-grid { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 940px) { .foot-grid { grid-template-columns: repeat(4, 1fr); } }
.foot-col h2 {
  font-size: 13px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-tertiary); margin: 0 0 10px;
}
.foot-col ul { list-style: none; margin: 0; padding: 0; }
.foot-col li { margin: 0; }
.foot-col a {
  color: var(--text-secondary); text-decoration: none; font-size: 15px;
  display: block; padding: 7px 0; line-height: 1.4;
}
.foot-col a:hover { color: var(--text-primary); text-decoration: underline; }
.foot-legal {
  margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border-hairline);
  font-size: 14px; color: var(--text-tertiary);
}
.foot-legal p { margin: 0 0 8px; }
.foot-legal a { color: var(--text-tertiary); }

.crumb { font-size: 14px; color: var(--text-tertiary); margin: 20px 0 0; }
.crumb a { color: var(--text-tertiary); }

.updated { font-size: 14px; color: var(--text-tertiary); margin: 26px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
