/* ──────────────────────────────────────────────────────────────────
   Design Tokens — Supermarket Design System
   ────────────────────────────────────────────────────────────────── */

:root {
  /* ── Verdes (principales) ── */
  --green-900: #004223;     /* dark green — headers, ink */
  --green-700: #006937;     /* primary brand */
  --green-600: #1E9B6C;     /* mid mint */
  --green-500: #34CC93;     /* light mint */
  --green-400: #83F0C7;     /* pastel mint */
  --green-200: #E3FEF1;     /* surface mint */
  --green-100: #F2FFF9;     /* whisper mint */
  --lime-500: #65B32E;      /* lime */

  /* ── Amarillo & Magenta (acentos) ── */
  --yellow-500: #FFDA00;
  --magenta-500: #D4145A;

  /* ── Secundarios (decorativos) ── */
  --pink-300: #F6B7B7;
  --blue-300: #7AB9CD;

  /* ── Neutros ── */
  --ink-900: #313131;
  --ink-500: #B3B3B3;
  --ink-300: #D4D4D4;
  --ink-200: #EBEBEB;
  --ink-100: #F7F7F7;
  --white: #FFFFFF;

  /* ── Semánticos (driven by tweaks) ── */
  --accent: var(--green-700);
  --accent-hi: var(--green-400);
  --accent-ink: var(--green-900);
  --canvas: var(--white);
  --surface: var(--green-100);
  --surface-2: var(--green-200);
  --text: var(--green-900);
  --text-muted: #5a6d63;
  --border: rgba(0, 66, 35, 0.08);
  --border-strong: rgba(0, 66, 35, 0.18);

  /* ── Tipografía ── */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* ── Espacio (escala) ── */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;
  --s-24: 96px;
  --s-32: 128px;

  /* ── Radios ── */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* ── Sombras ── */
  --shadow-1: 0 1px 2px rgba(0, 66, 35, 0.04), 0 1px 1px rgba(0, 66, 35, 0.03);
  --shadow-2: 0 4px 16px rgba(0, 66, 35, 0.08), 0 1px 2px rgba(0, 66, 35, 0.04);
  --shadow-3: 0 12px 40px rgba(0, 66, 35, 0.12), 0 2px 6px rgba(0, 66, 35, 0.05);

  /* ── Density modifier (tweak) ── */
  --density: 1;
}

/* ── Dark theme ── */
:root[data-theme="dark"] {
  --canvas: #0c1611;
  --surface: #11201a;
  --surface-2: #16291f;
  --text: #e6f5ec;
  --text-muted: #8aa496;
  --border: rgba(131, 240, 199, 0.10);
  --border-strong: rgba(131, 240, 199, 0.22);
  --ink-100: #14241c;
  --ink-200: #1b3027;
  --ink-300: #2a4538;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-3: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ── Compact density ── */
:root[data-density="compact"] {
  --density: 0.78;
}

/* ── Reset / base ── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-hi); color: var(--accent-ink); }

/* ── Page chrome — TopNav (tabs horizontales arriba) ── */
.app {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.topnav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.topnav__brand-logo {
  display: block;
  height: 18px; width: auto;
  color: var(--accent);
}
.topnav__tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;            /* sin esto, la fila de pestañas ensanchaba toda la página en móvil */
  scrollbar-width: none;
}
.topnav__tabs::-webkit-scrollbar { display: none; }
@media (max-width: 720px) {
  .topnav { padding: 12px 16px; gap: 14px; }
}
.topnav__tabs button {
  background: none;
  border: 0;
  font-family: var(--font-sans);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  cursor: pointer;
  transition: all .15s ease;
}
.topnav__tabs button:hover { background: var(--surface); color: var(--text); }
.topnav__tabs button.is-active { background: var(--accent); color: var(--white); }
.topnav__tabs button.is-active .nav-num { color: var(--yellow-500); }
.nav-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 18px;
}

main { min-width: 0; }
section[data-section] {
  scroll-margin-top: 24px;
  padding: calc(var(--s-20) * var(--density)) calc(var(--s-12) * var(--density));
  max-width: 1280px;
  margin: 0 auto;
}
@media (max-width: 720px) {
  section[data-section] { padding: 64px 24px; }
}

/* ── Final de sección: botón "Siguiente sección" ── */
.ds-section-end {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px calc(var(--s-12) * var(--density)) 80px;
  display: flex;
  justify-content: flex-end;
}
.ds-next-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  background: var(--text);
  color: var(--canvas);
  border: 0;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.25);
}
.ds-next-btn:hover {
  transform: translateY(-2px);
  background: var(--accent);
  color: var(--white);
}
.ds-next-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.55;
}
.ds-next-name {
  font-weight: 700;
}
.ds-next-arrow {
  font-size: 18px;
  line-height: 1;
  transition: transform .2s ease;
}
.ds-next-btn:hover .ds-next-arrow {
  transform: translateX(4px);
}
.ds-next-btn--restart:hover .ds-next-arrow {
  transform: translateY(-4px);
}

/* ── Typography helpers ── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 16px;
}
.eyebrow::before {
  content: "";
  width: 24px; height: 1px;
  background: currentColor;
}
.section-title {
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  text-wrap: balance;
}
.section-lead {
  font-size: 18px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0 0 48px;
  text-wrap: pretty;
}

/* ── Card primitive ── */
.card {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card--surface { background: var(--surface); }

/* ── Copy chip (token) ── */
.token {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.token:hover { background: var(--surface-2); border-color: var(--border-strong); }
.token .dot {
  width: 12px; height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
}
.token.is-copied {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}
.token.is-copied .dot { display: none; }
.token.is-copied::after { content: "Copiado ✓"; font-weight: 600; }
.token.is-copied .label { display: none; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green-900);
  color: var(--white);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-3);
  opacity: 0;
  transition: all .2s ease;
  pointer-events: none;
  z-index: 100;
  font-family: var(--font-mono);
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
