/* ==========================================================================
   MisCalorías — sistema de diseño del sitio público
   Verde · blanco · negro. Claro siempre. Español.
   Usado por: landing, blog, artículos y páginas legales.
   ========================================================================== */

/* --- Tipografía autoalojada (Inter variable, subconjunto latino) ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/inter-latin-var.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;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/inter-latin-ext-var.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;
}

/* --- Tokens -------------------------------------------------------------- */
:root {
  --green: #10b981;        /* solo fondos, iconos y texto sobre oscuro */
  --green-deep: #059669;
  --green-dark: #047857;   /* verde para TEXTO sobre claro (5,4:1 en blanco) */
  --ink: #07120c;
  --ink-2: #0b1f15;
  --body: #22312a;
  --muted: #5b6b62;        /* 5,5:1 sobre --bg */
  --line: #e2efe8;
  --bg: #fbfdfc;
  --card: #ffffff;
  --soft: #f1f8f4;
  --radius: 20px;
  --shadow-sm: 0 8px 30px rgba(7, 18, 12, 0.05);
  --shadow-md: 0 18px 44px rgba(7, 18, 12, 0.08);
  --focus: #047857;
}

/* --- Base ---------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
html:focus-within { scroll-padding-top: 84px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
svg { flex-shrink: 0; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }

/* --- Accesibilidad ------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Sin transición a propósito: el enlace de salto debe aparecer en el mismo
   fotograma en que recibe el foco, sin depender de que haya animación. */
.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 700;
}
.skip-link:focus,
.skip-link:focus-visible { top: 12px; }

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

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

/* --- Layout -------------------------------------------------------------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 760px; }
.container--mid { max-width: 880px; }
section { padding: 84px 0; }
@media (max-width: 900px) { section { padding: 60px 0; } }

/* --- Navegación ---------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(251, 253, 252, 0.88);
  border-bottom: 1px solid rgba(226, 239, 232, 0.7);
  transition: box-shadow 0.2s;
}
.nav.scrolled { box-shadow: 0 4px 24px rgba(7, 18, 12, 0.06); }
.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 19px;
  letter-spacing: -0.03em;
  padding: 8px 0;
}
.brand img { width: 34px; height: 34px; border-radius: 9px; }
/* El texto va en su propio elemento: como `.brand` es inline-flex con gap, un
   nodo de texto suelto se convertía en ítem flex independiente y aparecía
   «Mis  Calorías» separado por 10 px. */
.brand > span { display: inline; }
.brand em { font-style: normal; color: var(--green-dark); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav-links a {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 10px;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--green-dark); background: var(--soft); }

.nav-cta {
  background: var(--ink);
  color: #fff;
  padding: 11px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
}
.nav-cta:hover { background: var(--green-dark); transform: translateY(-1px); }
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-cta { margin-left: auto; }
}
@media (max-width: 560px) {
  .nav-inner { gap: 8px; padding-inline: 16px; }
  .brand { font-size: 17px; gap: 8px; }
  .brand img { width: 32px; height: 32px; }
  .nav-cta { padding: 10px 14px; font-size: 13px; }
}
@media (max-width: 360px) {
  .nav-cta { font-size: 0 !important; }
  .nav-cta::after { content: 'Descargar'; font-size: 13px; }
}

/* --- Botones ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 13px 26px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 15.5px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.btn--primary { background: var(--green-dark); color: #fff; }
.btn--primary:hover { background: #036348; transform: translateY(-2px); }
.btn--ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--green-dark); color: var(--green-dark); }
.btn--light { background: #fff; color: var(--ink); }
.btn--light:hover { transform: translateY(-2px); }

.badge-appstore { display: inline-flex; border-radius: 10px; transition: transform 0.15s; }
.badge-appstore:hover { transform: translateY(-2px); }

/* --- Cabeceras de sección ------------------------------------------------ */
.sec-head { text-align: center; max-width: 660px; margin: 0 auto 48px; }
.sec-head .tag {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  display: block;
  margin-bottom: 12px;
}
.sec-head h2 { font-size: clamp(28px, 3.6vw, 42px); font-weight: 900; }
.sec-head p { color: var(--muted); margin-top: 14px; font-size: 16.5px; }

/* --- Tarjetas ------------------------------------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

/* --- FAQ ----------------------------------------------------------------- */
.faq { max-width: 720px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 4px;
  min-height: 44px;
  font-weight: 700;
  font-size: 16.5px;
  letter-spacing: -0.01em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .pm {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(4, 120, 87, 0.1);
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  transition: transform 0.2s;
}
.faq details[open] .pm { transform: rotate(45deg); }
.faq details > p { padding: 0 44px 22px 4px; color: var(--muted); font-size: 15.5px; }
.faq details > p a { color: var(--green-dark); text-decoration: underline; }

/* --- Aviso honesto ------------------------------------------------------- */
.honest {
  max-width: 780px;
  margin: 0 auto;
  background: #fffdf5;
  border: 1px solid #ebdfae;
  border-radius: 18px;
  padding: 26px 30px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.honest .ic {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #f4e9c4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 700;
  color: #6b5313;
  font-size: 19px;
}
.honest p { font-size: 14.8px; color: #5c4810; line-height: 1.7; }
.honest strong { color: #3f310a; }

/* --- Pie ----------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 52px 0 40px;
  font-size: 14px;
  color: var(--muted);
  background: var(--card);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 34px;
}
.footer-grid h2 {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink);
  margin-bottom: 14px;
  font-weight: 800;
}
.footer-grid ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
/* Objetivo táctil mínimo de 24×24 px (WCAG 2.2 AA, 2.5.8): estos enlaces
   no van dentro de una frase, así que no les aplica la excepción «inline». */
.footer-grid ul a {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 0;
}
.footer-grid a { text-decoration: underline; text-decoration-color: rgba(4, 120, 87, 0.35); text-underline-offset: 3px; }
.footer-grid a:hover { color: var(--green-dark); }
.footer-brand { font-weight: 900; font-size: 19px; color: var(--ink); letter-spacing: -0.03em; margin-bottom: 10px; }
.footer-brand em { font-style: normal; color: var(--green-dark); }
.footer-legal {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}
.footer-disclosure { max-width: 620px; }
@media (max-width: 820px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }

/* --- Revelado ------------------------------------------------------------ */
.rv { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; } }
@media (max-width: 640px) { .rv { opacity: 1; transform: none; transition: none; } }

/* --- Barra fija de descarga (móvil) -------------------------------------- */
.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(7, 18, 12, 0.09);
  transform: translateY(110%);
  transition: transform 0.25s ease;
}
.sticky-cta.is-visible { transform: none; }
.sticky-cta p { font-size: 13px; color: var(--muted); line-height: 1.35; }
.sticky-cta strong { display: block; color: var(--ink); font-size: 14.5px; }
.sticky-cta .btn { min-height: 44px; padding: 11px 20px; font-size: 14.5px; white-space: nowrap; }
@media (max-width: 900px) { .sticky-cta { display: flex; } }

/* --- Prosa (legales, quiénes somos) -------------------------------------- */
.prose { padding: 40px 0 80px; }
.prose h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 900; margin-bottom: 10px; }
.prose .updated { color: var(--muted); font-size: 14px; margin-bottom: 34px; }
.prose h2 {
  font-size: clamp(20px, 2.4vw, 25px);
  font-weight: 800;
  margin: 42px 0 12px;
  padding-left: 14px;
  border-left: 5px solid var(--green);
}
.prose h3 { font-size: 17.5px; font-weight: 800; margin: 26px 0 8px; }
.prose p, .prose li { color: var(--body); font-size: 16px; }
.prose p { margin-bottom: 15px; }
.prose ul, .prose ol { margin: 0 0 16px 22px; }
.prose li { margin-bottom: 8px; }
.prose a {
  color: var(--green-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.prose strong { color: var(--ink); }
.prose code { overflow-wrap: anywhere; word-break: break-word; }
/* La tabla conserva `display: table`: con `display: block` los navegadores le
   quitan el rol de tabla en el árbol de accesibilidad y los lectores de
   pantalla dejan de anunciar filas y columnas. El desplazamiento horizontal lo
   hace el contenedor `.table-scroll`, que además es enfocable. */
.prose table {
  min-width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14.5px;
}
.prose .table-scroll table { margin: 0; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--soft); font-weight: 800; }
/* Región con desplazamiento propio: la tabla nunca ensancha el documento y,
   al ser enfocable, se puede recorrer con teclado (WCAG 2.1.1). */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 20px 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table-scroll table { margin: 0; }
.table-scroll:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.callout {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 22px;
  margin: 22px 0;
  font-size: 15px;
  color: var(--body);
}

/* --- Migas de pan -------------------------------------------------------- */
.crumb { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }
.crumb ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.crumb li { display: inline-flex; align-items: center; }
.crumb li::after { content: '›'; margin-left: 6px; color: var(--line); }
.crumb li:last-child::after { content: ''; }
/* Las migas son navegación, no texto corrido: no les aplica la excepción
   «inline» de WCAG 2.2 (2.5.8), así que necesitan 24 px de alto real. */
.crumb a {
  color: var(--green-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

/* --- Divulgación de afiliación ------------------------------------------- */
.disclosure {
  background: var(--soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green-dark);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--body);
  margin: 22px 0;
}
.disclosure a { color: var(--green-dark); text-decoration: underline; }
