/* Coffee Coach — landing / páginas legales.
   Paleta "Organic Minimalist" tomada del design system de la app.
   Dirección "Ficha de receta": tipografía editorial, capturas reales de la app,
   matcha como único acento. Tema claro y oscuro vía light-dark(). */

:root {
  /* Tema: el sistema decide por defecto; [data-theme] en <html> lo fuerza.
     Cada token se declara dos veces a propósito: el primer valor es el
     respaldo para navegadores sin light-dark(), el segundo es el real. */
  color-scheme: light dark;

  --coffee: #553722;
  --coffee: light-dark(#553722, #c79a70);
  --coffee-light: #6f4e37;
  --coffee-light: light-dark(#6f4e37, #d8b28a);
  --on-coffee: #ffffff;
  --on-coffee: light-dark(#ffffff, #1b1512);
  --cream-accent: #eec1a4;
  --matcha: #7a8f5a;
  --matcha: light-dark(#7a8f5a, #a8c27d);
  --paper: #ffffff;
  --paper: light-dark(#ffffff, #14100e);
  --paper-2: #fff8f5;
  --paper-2: light-dark(#fff8f5, #1c1613);
  --card: #ffffff;
  --card: light-dark(#ffffff, #1c1613);
  --ink: #221a14;
  --ink: light-dark(#221a14, #f0e8e2);
  --ink-soft: #50453e;
  --ink-soft: light-dark(#50453e, #b6a89f);
  --outline: #e4d7d0;
  --outline: light-dark(#e4d7d0, #322822);
  --outline-strong: #d4c3ba;
  --outline-strong: light-dark(#d4c3ba, #46392f);
  /* Titulares y superficies de botón: se invierten entre temas. */
  --heading: #2c241e;
  --heading: light-dark(#2c241e, #f8f3ef);
  --btn-bg: #2c241e;
  --btn-bg: light-dark(#2c241e, #f0e4d9);
  --btn-fg: #ffffff;
  --btn-fg: light-dark(#ffffff, #241c17);
  --header-bg: rgba(255, 255, 255, 0.85);
  --header-bg: light-dark(rgba(255, 255, 255, 0.85), rgba(20, 16, 14, 0.85));
  --halo: rgba(238, 193, 164, 0.38);
  --halo: light-dark(rgba(238, 193, 164, 0.38), rgba(199, 154, 112, 0.16));
  /* El marco del teléfono es un degradado: light-dark() solo admite colores,
     así que se compone con dos tokens. */
  --phone-1: #f2e9e3;
  --phone-1: light-dark(#f2e9e3, #3b302a);
  --phone-2: #d8c8bf;
  --phone-2: light-dark(#d8c8bf, #241c17);
  --phone-edge: rgba(85, 55, 34, 0.07);
  --phone-edge: light-dark(rgba(85, 55, 34, 0.07), rgba(255, 255, 255, 0.08));

  --max-w: 1140px;
  /* Una sola escala de radios: contenedores y elementos internos. */
  --radius: 16px;
  --radius-sm: 12px;
  /* light-dark() solo admite colores, así que el tema viaja en el color de la
     sombra y la geometría queda fija. */
  --sh-1: rgba(85, 55, 34, 0.12);
  --sh-1: light-dark(rgba(85, 55, 34, 0.12), rgba(0, 0, 0, 0.5));
  --sh-2: rgba(85, 55, 34, 0.08);
  --sh-2: light-dark(rgba(85, 55, 34, 0.08), rgba(0, 0, 0, 0.4));
  --sh-3: rgba(85, 55, 34, 0.28);
  --sh-3: light-dark(rgba(85, 55, 34, 0.28), rgba(0, 0, 0, 0.65));
  --shadow: 0 12px 40px var(--sh-1);
  --shadow-sm: 0 4px 16px var(--sh-2);
  --shadow-lg: 0 30px 60px -18px var(--sh-3);
  /* Mismas familias que la app: Outfit (títulos) + Inter (cuerpo). */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Outfit", var(--font-body);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* El botón de tema fuerza uno u otro; sin atributo manda el sistema. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Foco visible para navegación con teclado (accesibilidad). */
:focus-visible {
  outline: 2px solid var(--coffee);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Enlace "saltar al contenido": solo visible al tabular. */
.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 50;
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus-visible { top: 12px; }

body {
  margin: 0;
  /* clip (y no hidden) recorta el halo del hero sin romper el header sticky. */
  overflow-x: clip;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand, .section-title, .hero h1, .cta h2,
.feature-num, .store-btn .sb-bottom, .doc h1 {
  font-family: var(--font-display);
}

/* Evita palabras huérfanas en títulos y viudas en párrafos. */
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

/* height:auto es imprescindible: sin él, los atributos width/height del HTML
   (que evitan saltos de layout) fijan una altura literal y deforman la imagen. */
img { max-width: 100%; height: auto; display: block; }

a { color: var(--coffee-light); }

.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* Entrada escalonada al entrar en viewport. Solo se oculta si hay JS:
   sin JS el contenido se ve igual (la clase .js la pone app.js). */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease) var(--reveal-delay, 0ms),
              transform 0.7s var(--ease) var(--reveal-delay, 0ms);
}
html.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--outline);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--heading);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.brand img { width: 38px; height: 38px; border-radius: var(--radius-sm); }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--outline-strong);
  border-radius: 999px;
  overflow: hidden;
  background: var(--card);
}
.lang-switch button {
  border: 0;
  background: transparent;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-switch button:hover { background: var(--paper-2); color: var(--coffee); }
.lang-switch button.active { background: var(--coffee); color: var(--on-coffee); }
.lang-switch button.active:hover { background: var(--coffee); color: var(--on-coffee); }

/* Controles de la cabecera: idioma y tema comparten caja. */
.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--outline-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-toggle:hover {
  background: var(--paper-2);
  color: var(--coffee);
  border-color: var(--coffee-light);
}
.theme-toggle svg { width: 18px; height: 18px; }

/* ---------- Hero (split asimétrico) ---------- */
.hero { padding: 88px 0 96px; }
.hero .wrap {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 72px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.5rem, 5.6vw, 4rem);
  line-height: 1.03;
  margin: 0 0 20px;
  color: var(--heading);
  letter-spacing: -0.035em;
  font-weight: 700;
}
.hero p.lead {
  font-size: 1.18rem;
  color: var(--ink-soft);
  margin: 0 0 34px;
  max-width: 42ch;
}

/* Marco de teléfono: contenedor CSS alrededor de la captura real. */
.phone-shot {
  position: relative;
  display: grid;
  place-items: center;
  /* Halo cálido detrás del teléfono: se dibuja dentro de la caja, así que no
     ensancha el documento en móvil. */
  background: radial-gradient(circle at 50% 50%, var(--halo), rgba(238, 193, 164, 0) 62%);
}
.phone {
  position: relative;
  width: 276px;
  max-width: 100%;
  padding: 8px;
  border-radius: 34px;
  background: linear-gradient(155deg, var(--phone-1), var(--phone-2));
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--phone-edge);
}
.phone img { width: 100%; border-radius: 27px; }
.phone--sm { width: 228px; }

/* ---------- Botones de tienda ---------- */
.store-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  text-decoration: none;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s;
  box-shadow: var(--shadow-sm);
}
.store-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.store-btn:active { transform: translateY(1px) scale(0.99); box-shadow: var(--shadow-sm); }
.store-btn svg { width: 26px; height: 26px; flex: none; }
.store-btn .sb-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.store-btn .sb-top { font-size: 0.7rem; opacity: 0.85; }
.store-btn .sb-bottom { font-size: 1.05rem; font-weight: 600; }
.store-btn[data-disabled="true"] { opacity: 0.75; cursor: default; }
.store-btn[data-disabled="true"]:hover { transform: none; box-shadow: var(--shadow-sm); }
/* App Store ya está publicada: color de marca propio para distinguirla de Android (aún "próximamente"). */
.store-btn[data-store="ios"]:not([data-disabled="true"]) {
  background: #000000;
  background: light-dark(#000000, #ffffff);
  color: #ffffff;
  color: light-dark(#ffffff, #000000);
}

.soon-note {
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ---------- Tipografía de sección ---------- */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--matcha);
  margin: 0 0 14px;
}
.section-title {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  color: var(--heading);
  margin: 0 0 16px;
  letter-spacing: -0.03em;
  line-height: 1.08;
  max-width: 18ch;
  font-weight: 600;
}
.section-sub {
  color: var(--ink-soft);
  margin: 0;
  max-width: 52ch;
  font-size: 1.05rem;
}

/* ---------- Métodos (chips con scroll-snap) ---------- */
.methods { padding: 24px 0 88px; }
.methods-head { margin-bottom: 28px; }
.methods-track {
  display: flex;
  list-style: none;
  margin: 0;
  padding-left: 0;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  /* overflow-x recorta también en vertical: este relleno deja sitio al chip
     elevado en :hover para que no se corte por arriba. */
  padding: 0 0 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--outline-strong) transparent;
}
/* Nombres de método: son etiquetas informativas, no controles. Sin borde,
   sin hover y sin cursor de puntero para no prometer una acción inexistente. */
.method {
  flex: none;
  scroll-snap-align: start;
  padding: 2px 26px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--heading);
  border-left: 1px solid var(--outline-strong);
}
.method:first-child { padding-left: 0; border-left: 0; }

/* ---------- Features 01-02 (split imagen/texto alternado) ---------- */
.feature-split {
  padding: 0 0 96px;
}
.feature-split .wrap {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 56px;
  align-items: center;
}
/* La segunda invierte el orden para romper la lectura en zigzag. */
.feature-split--flip .wrap { grid-template-columns: 0.8fr 1fr; }
.feature-split--flip .feature-media { order: -1; }
.feature-num {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--matcha);
  letter-spacing: 0.16em;
  margin-bottom: 14px;
}
.feature-split h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  color: var(--heading);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 16px;
  font-weight: 600;
}
.feature-split p {
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0;
  max-width: 44ch;
}

/* ---------- Features 03-04 (dos columnas, sin cajas) ---------- */
.feature-cols {
  padding: 0 0 96px;
}
.feature-cols .wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
}
.feature-cols article { max-width: 42ch; }
.feature-cols h2 {
  font-size: 1.45rem;
  color: var(--heading);
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  font-weight: 600;
}
.feature-cols p { color: var(--ink-soft); margin: 0; }

/* ---------- CTA de cierre (franja a ancho completo) ---------- */
.cta {
  background: var(--paper-2);
  border-top: 1px solid var(--outline);
  padding: 88px 0 96px;
}
.cta .wrap {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 64px;
  align-items: center;
}
.cta h2 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  color: var(--heading);
  letter-spacing: -0.03em;
  line-height: 1.08;
  font-weight: 600;
}
.cta p { margin: 0 0 30px; color: var(--ink-soft); font-size: 1.05rem; max-width: 40ch; }
.cta .phone { background: linear-gradient(160deg, var(--phone-1), var(--phone-2)); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--outline);
  padding: 40px 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
  justify-content: space-between;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--coffee); text-decoration: underline; }

/* Enlace a redes: icono + etiqueta, alineados ópticamente. */
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.social-link svg { width: 18px; height: 18px; flex: none; transform: translateY(-0.5px); }
.social-link:hover { color: var(--coffee); }

/* ---------- Legal / content pages ---------- */
.doc { padding: 56px 0 80px; }
.doc .wrap { max-width: 760px; }
.doc h1 {
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  color: var(--heading);
  margin: 0 0 6px;
  letter-spacing: -0.03em;
  font-weight: 600;
}
.doc .updated {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 0 32px;
}
.doc h2 {
  color: var(--heading);
  margin: 40px 0 12px;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.doc h3 { color: var(--heading); margin: 24px 0 8px; font-size: 1.05rem; font-weight: 600; }
.doc p, .doc li { color: var(--ink-soft); }
.doc p { max-width: 68ch; }
.doc ul { padding-left: 22px; }
.doc a { color: var(--coffee-light); }
.doc .contact-card {
  background: var(--paper-2);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
}
.doc .contact-card a { font-weight: 600; }

/* Página 404 */
.notfound { padding-top: 88px; }
.notfound-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  margin-top: 28px;
}
.notfound-links a { color: var(--coffee-light); text-decoration: none; font-weight: 600; }
.notfound-links a:hover { text-decoration: underline; }
.notfound-links .back-link { margin-bottom: 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--coffee-light);
  font-weight: 600;
  margin-bottom: 24px;
}

/* i18n: mostrar/ocultar según idioma activo en <html lang> */
[data-lang] { display: none; }
html[lang="es"] [data-lang="es"],
html[lang="en"] [data-lang="en"] { display: revert; }

/* Respeta la preferencia de movimiento reducido del sistema. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html.js [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { padding: 56px 0 64px; }
  .hero .wrap,
  .feature-split .wrap,
  .feature-cols .wrap,
  .cta .wrap {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .hero .wrap { text-align: center; }
  .hero p.lead { margin-left: auto; margin-right: auto; }
  .hero .store-buttons { justify-content: center; }
  .phone-shot { order: -1; }
  .hero .phone { width: min(240px, 66%); }
  .feature-split--flip .feature-media { order: 0; }
  .feature-split, .feature-cols { padding-bottom: 64px; }
  .methods { padding-bottom: 64px; }
  .cta { padding: 64px 0 72px; text-align: center; }
  .cta p { margin-left: auto; margin-right: auto; }
  .cta .store-buttons { justify-content: center; }
  .cta .phone-shot { order: 0; }
  .section-title { max-width: none; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 20px; }
  .methods-track { margin: 0 -20px; padding: 0 20px 10px; }
}
