/* ============================================================
   GlucoBeacon — Shared Site Design System (preview)
   Loaded by every page. Page-specific tool/table styles stay
   local to their own page so nothing here has to know about
   carb-calculator's search results or compare's matrix table.
   ============================================================ */

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

:root {
  /* brand */
  --navy:    #1E3A5F;
  --navy2:   #162d4a;
  --navy3:   #0F2038;
  --orange:  #F97316;
  --orange2: #EA6010;
  --orange-light: #FCA663;

  /* neutrals */
  --white:  #FFFFFF;
  --bg:     #F6F8FB;
  --surface:#FFFFFF;
  --text:   #0F172A;
  --muted:  #64748B;
  --muted2: #94A3B8;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  /* status */
  --good: #16A34A;    --good-bg: #DCFCE7;
  --warn: #B45309;    --warn-bg: #FEF3C7;
  --bad:  #DC2626;    --bad-bg:  #FEE2E2;

  /* geometry */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --container: 1240px;
  --nav-h: 72px;

  /* shadows */
  --shadow-sm: 0 2px 8px rgba(15,23,42,0.06);
  --shadow-md: 0 8px 28px rgba(15,23,42,0.08);
  --shadow-lg: 0 20px 50px rgba(15,23,42,0.12);
  --shadow-navy: 0 16px 40px rgba(30,58,95,0.28);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  color: var(--text);
  line-height: 1.6;
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

.container { max-width: var(--container); margin: 0 auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--orange); color: var(--white); padding: 12px 20px;
  border-radius: 0 0 10px 0; font-weight: 700; font-size: 0.9rem; text-decoration: none;
}
.skip-link:focus { left: 0; }

::selection { background: var(--orange); color: var(--white); }

:focus-visible { outline: 2.5px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

/* ─── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: inherit; font-size: 0.96rem; font-weight: 700;
  padding: 14px 26px; border-radius: 14px; text-decoration: none;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn svg { flex-shrink: 0; }
.btn-primary {
  background: var(--orange); color: var(--white);
  box-shadow: 0 10px 24px rgba(249,115,22,0.32);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(249,115,22,0.4); background: var(--orange2); }
.btn-white {
  background: var(--white); color: var(--orange2);
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}
.btn-white:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(0,0,0,0.22); }
.btn-outline {
  background: rgba(255,255,255,0.06); color: var(--white);
  border-color: rgba(255,255,255,0.35);
}
.btn-outline:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.6); }
.btn-ghost {
  color: var(--navy); font-weight: 600; padding: 10px 4px;
  border-bottom: 1.5px solid var(--border-strong); border-radius: 0;
}
.btn-ghost:hover { border-color: var(--orange); color: var(--orange2); }
.btn-sm { padding: 10px 18px; font-size: 0.86rem; border-radius: 11px; }
.btn-disabled {
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.55);
  border: 1.5px solid rgba(255,255,255,0.25); cursor: default;
}
.btn-disabled:hover { transform: none; }

/* ─── HEADER / NAV ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(22,45,74,0.88);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.nav {
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 5%;
  max-width: var(--container); margin: 0 auto;
}
.nav-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; flex-shrink: 0; }
.nav-brand img { width: 34px; height: 34px; border-radius: 9px; }
.nav-brand span { color: var(--white); font-size: 1.14rem; font-weight: 800; letter-spacing: -0.3px; }
.nav-brand sup { font-size: 0.6rem; opacity: 0.7; }

.nav-badge {
  background: rgba(249,115,22,0.18); border: 1px solid rgba(249,115,22,0.4); color: var(--orange-light);
  font-size: 0.68rem; font-weight: 700; padding: 4px 11px; border-radius: 20px;
  letter-spacing: 0.5px; text-transform: uppercase; margin-left: 12px; white-space: nowrap;
}

.nav-menu { display: flex; align-items: center; gap: 6px; }
.nav-menu a:not(.nav-cta) {
  color: rgba(255,255,255,0.75); text-decoration: none; font-size: 0.9rem; font-weight: 600;
  padding: 9px 14px; border-radius: 9px; transition: color 0.2s, background 0.2s;
  position: relative;
}
.nav-menu a:not(.nav-cta):hover { color: var(--white); background: rgba(255,255,255,0.06); }
.nav-menu a.active { color: var(--white); }
.nav-menu a.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px;
  background: var(--orange); border-radius: 2px;
}
.nav-cta {
  background: var(--orange); color: var(--white) !important; text-decoration: none;
  font-size: 0.86rem; font-weight: 700; padding: 10px 18px !important; border-radius: 11px;
  margin-left: 8px; box-shadow: 0 6px 16px rgba(249,115,22,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(249,115,22,0.45); background: var(--orange2) !important; }

/* Spanish nav labels run longer than English (e.g. "Calculadora de
   Carbohidratos" vs "Carb Calculator") and overflow the unwrapped desktop
   nav row even after shortening the two worst labels -- tighten spacing
   specifically for /es/ pages rather than changing English's layout. */
html[lang="es"] .nav-menu { gap: 2px; }
html[lang="es"] .nav-menu a:not(.nav-cta) { padding: 9px 9px; font-size: 0.84rem; }

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; background: none; border: none; cursor: pointer;
  border-radius: 8px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--white); border-radius: 2px; transition: transform 0.25s var(--ease), opacity 0.2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--navy2); flex-direction: column; align-items: stretch;
    padding: 10px 6% 20px; gap: 2px; border-bottom: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 16px 32px rgba(0,0,0,0.3);
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.3s var(--ease), opacity 0.25s ease;
  }
  .nav-menu.is-open { max-height: 520px; opacity: 1; padding-top: 14px; }
  .nav-menu a:not(.nav-cta) { padding: 13px 12px; font-size: 0.98rem; }
  .nav-menu a.active::after { display: none; }
  .nav-menu a.active { background: rgba(249,115,22,0.14); }
  .nav-cta { margin: 8px 12px 0; text-align: center; }
  .nav-badge { display: none; }
}

/* in-page pill sub-nav (index only) */
.subnav-wrap { position: sticky; top: var(--nav-h); z-index: 190; background: var(--white); border-bottom: 1px solid var(--border); }
.subnav {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 5%;
  max-width: var(--container); margin: 0 auto;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  flex-shrink: 0; text-decoration: none; color: var(--muted); font-size: 0.84rem; font-weight: 600;
  padding: 8px 15px; border-radius: 20px; transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.subnav a:hover { background: var(--bg); color: var(--navy); }
.subnav a.is-active { background: var(--navy); color: var(--white); }
@media (max-width: 640px) { .subnav-wrap { top: var(--nav-h); } }

/* ─── SECTION BASE ─────────────────────────────────────────── */
.section { padding: 96px 5%; }
.section-tight { padding: 64px 5%; }
.section-head { max-width: 640px; margin-bottom: 52px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.76rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.6px;
  color: var(--orange2); margin-bottom: 14px;
}
.eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.eyebrow-light { color: var(--orange-light); }
.section-title { font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 800; letter-spacing: -0.7px; line-height: 1.18; margin-bottom: 16px; color: var(--text); }
.section-title.on-dark { color: var(--white); }
.section-lead { font-size: 1.05rem; color: var(--muted); line-height: 1.7; }
.section-lead.on-dark { color: rgba(255,255,255,0.68); }

.bg-tint { background: var(--bg); }
.bg-navy { background: linear-gradient(160deg, var(--navy2) 0%, var(--navy) 70%); color: var(--white); }
.bg-white { background: var(--white); }

/* ─── REVEAL ON SCROLL ─────────────────────────────────────── */
/* Visible by default — content must never depend on JS to be seen.
   Only hidden-then-fade-in if site.js actually runs (adds .js to <html> first). */
.reveal { opacity: 1; transform: none; }
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ─── BENTO GRID ───────────────────────────────────────────── */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.bento-tile {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
  grid-column: span 2; display: flex; flex-direction: column;
}
.bento-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.bento-tile.span-3 { grid-column: span 3; }
.bento-tile.span-4 { grid-column: span 4; }
.bento-tile.span-6 { grid-column: span 6; }
.bento-tile.featured {
  background: linear-gradient(150deg, var(--navy2), var(--navy));
  color: var(--white); border-color: transparent;
}
.bento-tile.featured .tile-icon { background: rgba(255,255,255,0.12); }
.bento-tile.featured p { color: rgba(255,255,255,0.72); }
.tile-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #FFF3E8, #FFE4CC);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 18px;
}
.bento-tile h3 { font-size: 1.08rem; font-weight: 800; margin-bottom: 8px; }
.bento-tile p { font-size: 0.89rem; color: var(--muted); line-height: 1.62; flex-grow: 1; }
.tile-tags { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 11px; border-radius: 20px; }
.tag-free { background: #DCFCE7; color: #166534; }
.tag-pro  { background: #EDE9FE; color: #5B21B6; }
.bento-tile.featured .tag-free { background: rgba(220,252,231,0.18); color: #86EFAC; }
.bento-tile.featured .tag-pro  { background: rgba(237,233,254,0.18); color: #D8B4FE; }

@media (max-width: 980px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento-tile, .bento-tile.span-3, .bento-tile.span-4, .bento-tile.span-6 { grid-column: span 2; }
}
@media (max-width: 560px) {
  .bento { grid-template-columns: 1fr; }
  .bento-tile, .bento-tile.span-3, .bento-tile.span-4, .bento-tile.span-6 { grid-column: span 1; }
}

/* ─── ACCORDION (FAQ) ──────────────────────────────────────── */
.accordion { max-width: 760px; }
.accordion-item { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 12px; overflow: hidden; }
.accordion-trigger {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: none; border: none; text-align: left; cursor: pointer; font-family: inherit;
  padding: 20px 24px; font-size: 1rem; font-weight: 700; color: var(--navy);
}
.accordion-trigger .chev { flex-shrink: 0; transition: transform 0.3s var(--ease); color: var(--muted2); }
.accordion-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); color: var(--orange); }
.accordion-panel { max-height: 0; overflow: hidden; transition: max-height 0.35s var(--ease); }
.accordion-panel-inner { padding: 0 24px 22px; font-size: 0.92rem; color: var(--muted); line-height: 1.68; }

/* ─── BACK TO TOP ──────────────────────────────────────────── */
.to-top {
  position: fixed; bottom: 26px; right: 26px; z-index: 150;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--navy); color: var(--white); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
}
.to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { background: var(--orange); }

/* ─── FOOTER ───────────────────────────────────────────────── */
.site-footer { background: var(--navy3); color: rgba(255,255,255,0.55); }
.footer-top { padding: 64px 5% 40px; max-width: var(--container); margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; }
.footer-brand-col .footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.footer-brand-col img { width: 32px; border-radius: 8px; }
.footer-brand-col span { color: var(--white); font-weight: 800; font-size: 1.05rem; }
.footer-brand-col p { font-size: 0.86rem; line-height: 1.6; max-width: 280px; color: rgba(255,255,255,0.5); }
.footer-col h5 { color: var(--white); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; }
.footer-col a { display: block; color: rgba(255,255,255,0.55); text-decoration: none; font-size: 0.87rem; margin-bottom: 11px; transition: color 0.2s; }
.footer-col a:hover { color: var(--orange-light); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08); padding: 22px 5%;
  max-width: var(--container); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  font-size: 0.8rem;
}
.footer-bottom .legal-links { display: flex; gap: 20px; }
.footer-bottom a { color: rgba(255,255,255,0.55); text-decoration: none; }
.footer-bottom a:hover { color: var(--white); }

@media (max-width: 860px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-brand-col { grid-column: span 2; margin-bottom: 8px; }
}
@media (max-width: 560px) {
  .footer-top { grid-template-columns: 1fr; }
  .footer-brand-col { grid-column: span 1; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* Local-currency price estimate note (site.js), used on both the Pricing
   cards and the compare-page table -- previously fully unstyled, so on
   dense inline text (e.g. "$4.99/mo") the ≈ note ran flush against the
   price with no visual gap. */
.price-fx-note { margin-left: 4px; font-size: 0.86em; color: var(--muted); font-weight: 500; }
