/* ==========================================================================
   CosteoChef · UI 2.0 — capa de diseño moderna
   Se carga DESPUÉS de los estilos de cada página (styles.css, recetario.css…).
   Quitar esta hoja (y ui.js) devuelve el diseño anterior. Fuente: tools/ui.src.css
   (node tools/build-ui.js genera /ui.css con los iconos incrustados).
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #edf2f0;
  --ink: #0d1714;
  --ink-2: #3a4944;
  --muted: #65746e;
  --line: #e0e8e5;
  --line-2: #cddad5;
  --brand: #0b7a56;
  --brand-2: #14b886;
  --brand-ink: #ffffff;
  --brand-soft: #e2f6ee;
  --accent: #ff6a3d;
  --accent-soft: #ffece5;
  --deep: #06130f;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(13, 23, 20, .04), 0 10px 30px rgba(13, 23, 20, .07);
  --shadow-lg: 0 2px 6px rgba(13, 23, 20, .05), 0 26px 60px rgba(13, 23, 20, .13);
  --grad: linear-gradient(135deg, #0b7a56 0%, #14b886 100%);
  --display: "Sora", "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
html, body { overflow-x: clip; }
body { background: var(--bg); }
h1, h2, h3 { letter-spacing: -.02em; }
::selection { background: rgba(20, 184, 134, .25); }

/* ---------- Encabezado ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .74);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(13, 23, 20, .07);
  transition: background .25s, box-shadow .25s;
}
.site-header.is-scrolled { background: rgba(255, 255, 255, .9); box-shadow: 0 8px 28px rgba(13, 23, 20, .08); }
.header-in { height: 66px; gap: 16px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.14rem; letter-spacing: -.02em; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark { width: 32px; height: 32px; color: var(--brand); filter: drop-shadow(0 4px 10px rgba(11, 122, 86, .3)); }
.top-nav { gap: 2px; align-items: center; }
.top-nav a {
  padding: 8px 13px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: .93rem;
  transition: background .2s, color .2s;
}
.top-nav a:hover { background: var(--surface-2); color: var(--ink); }
.top-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.top-nav .nav-extra { display: none; }
.top-nav a.nav-cta {
  margin-left: 8px; padding: 9px 17px; background: var(--grad); color: #fff;
  box-shadow: 0 6px 18px rgba(11, 122, 86, .28); font-weight: 700;
}
.top-nav a.nav-cta:hover { background: var(--grad); color: #fff; filter: brightness(1.06); }
.nav-toggle { display: none; }
@media (max-width: 900px) { html:not(.ui-js) .top-nav { display: none; } }

/* Menú clásico de móvil (hamburguesa) — solo con JavaScript; sin JS queda la fila de enlaces anterior */
@media (max-width: 900px) {
  html.ui-js .header-in { height: 62px; min-height: 0; flex-wrap: nowrap; padding-top: 0; }
  html.ui-js .nav-toggle {
    display: inline-grid; place-items: center; position: relative; flex: none;
    width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line);
    background: #fff; cursor: pointer; padding: 0; color: var(--ink);
    box-shadow: 0 2px 8px rgba(13, 23, 20, .05);
  }
  .nav-toggle span { position: absolute; left: 13px; width: 20px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .28s cubic-bezier(.2,.7,.2,1), opacity .2s; }
  .nav-toggle span:nth-child(1) { transform: translateY(-6px); }
  .nav-toggle span:nth-child(3) { transform: translateY(6px); }
  html.nav-open .nav-toggle span:nth-child(1) { transform: rotate(45deg); }
  html.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  html.nav-open .nav-toggle span:nth-child(3) { transform: rotate(-45deg); }

  html.ui-js .top-nav {
    position: absolute; top: 100%; left: 0; right: 0; height: calc(100vh - 62px); height: calc(100dvh - 62px);
    display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    width: auto; margin: 0; padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
    background: var(--bg); border-top: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain;
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
  }
  html.nav-open .top-nav { opacity: 1; visibility: visible; transform: none; transition: opacity .22s ease, transform .22s ease; }
  html.ui-js .top-nav a {
    display: flex; align-items: center; gap: 14px; padding: 15px 16px; border-radius: 16px;
    background: #fff; border: 1px solid var(--line); color: var(--ink);
    font-size: 1.06rem; font-weight: 700; white-space: normal; flex: none;
  }
  html.ui-js .top-nav a::before {
    content: ""; flex: 0 0 38px; height: 38px; border-radius: 12px;
    background: var(--brand-soft) center / 20px 20px no-repeat;
  }
  html.ui-js .top-nav a::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.5rem; line-height: 1; font-weight: 500; }
  html.ui-js .top-nav a[aria-current="page"] { background: var(--brand-soft); border-color: #bfe6d6; color: var(--brand); }
  html.ui-js .top-nav a[aria-current="page"]::before { background-color: #fff; }
  html.ui-js .top-nav .nav-extra { display: flex; }
  html.ui-js .top-nav a.nav-cta { justify-content: center; margin: 10px 0 0; border: 0; color: #fff; background: var(--grad); box-shadow: 0 10px 26px rgba(11, 122, 86, .3); padding: 16px; font-size: 1.05rem; }
  html.ui-js .top-nav a.nav-cta::before, html.ui-js .top-nav a.nav-cta::after { content: none; }
  html.ui-js .top-nav .nav-note { margin: 8px 4px 0; color: var(--muted); font-size: .85rem; text-align: center; }
  html.nav-open, html.nav-open body { overflow: hidden; }
  html.nav-open .site-header { background: var(--bg); box-shadow: none; }
  /* Iconos de cada enlace del menú */
  html.ui-js .top-nav a[href*="herramienta"]::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%225%22%20y%3D%222.5%22%20width%3D%2214%22%20height%3D%2219%22%20rx%3D%222.5%22%2F%3E%3Cpath%20d%3D%22M8.5%206.5h7%22%2F%3E%3Cpath%20d%3D%22M8.5%2011h.01M12%2011h.01M15.5%2011h.01M8.5%2014.5h.01M12%2014.5h.01M15.5%2014.5h.01M8.5%2018h.01M12%2018h.01M15.5%2018h.01%22%2F%3E%3C%2Fsvg%3E"); }
  html.ui-js .top-nav a[href*="como-funciona"]::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M12%2011v5.5M12%207.5h.01%22%2F%3E%3C%2Fsvg%3E"); }
  html.ui-js .top-nav a[href*="guias"]::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%205.5A2.5%202.5%200%200%201%205.5%203H11v17H5.5A2.5%202.5%200%200%200%203%2022.5Z%22%2F%3E%3Cpath%20d%3D%22M21%205.5A2.5%202.5%200%200%200%2018.5%203H13v17h5.5a2.5%202.5%200%200%201%202.5%202.5Z%22%2F%3E%3C%2Fsvg%3E"); }
  html.ui-js .top-nav a[href*="recetario"]::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M7%2014.5a4%204%200%201%201%201.2-7.8%204.5%204.5%200%200%201%207.6%200A4%204%200%201%201%2017%2014.5%22%2F%3E%3Cpath%20d%3D%22M7%2014.5V20h10v-5.5%22%2F%3E%3Cpath%20d%3D%22M7%2017h10%22%2F%3E%3C%2Fsvg%3E"); }
  html.ui-js .top-nav a[href*="manual"]::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%224%22%20y%3D%223%22%20width%3D%2216%22%20height%3D%2218%22%20rx%3D%222.5%22%2F%3E%3Cpath%20d%3D%22M8%208h8M8%2012h8M8%2016h5%22%2F%3E%3C%2Fsvg%3E"); }
  html.ui-js .top-nav a[href*="faq"]::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M9.5%209a2.5%202.5%200%201%201%203.5%202.3c-.6.3-1%20.9-1%201.6V14%22%2F%3E%3Cpath%20d%3D%22M12%2017.5h.01%22%2F%3E%3C%2Fsvg%3E"); }
  html.ui-js .top-nav a[href*="mi-cuenta"]::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%228%22%20r%3D%224%22%2F%3E%3Cpath%20d%3D%22M4%2021a8%208%200%200%201%2016%200%22%2F%3E%3C%2Fsvg%3E"); }
}
.top-nav .nav-note { display: none; }
@media (max-width: 900px) { html.ui-js .top-nav .nav-note { display: block; } }

/* ---------- Barra de cupón (?cupon=…) ---------- */
.promo-bar { position: relative; z-index: 5; background: linear-gradient(90deg, #0b7a56, #14b886); color: #fff; text-align: center; padding: 10px 16px; font-size: .92rem; line-height: 1.4; }
.promo-bar b { color: #fff; }

/* ---------- Botones ---------- */
.btn { border-radius: 12px; transition: transform .15s ease, box-shadow .2s ease, filter .2s ease, background .2s ease; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 22px rgba(11, 122, 86, .26); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 12px 28px rgba(11, 122, 86, .32); }
.btn-secondary { background: linear-gradient(135deg, #ff6a3d, #ff9356); box-shadow: 0 8px 22px rgba(255, 106, 61, .26); }
.btn-secondary:hover { background: linear-gradient(135deg, #ff6a3d, #ff9356); filter: brightness(1.05); transform: translateY(-1px); }
.btn-ghost { background: var(--brand-soft); color: var(--brand); }
.btn-ghost:hover { background: #d2efe3; }
.btn-link { color: var(--brand); }

/* ---------- Portada (home): bloque oscuro tecnológico ---------- */
.hero { position: relative; isolation: isolate; color: #fff; padding-top: clamp(40px, 7vw, 78px); padding-bottom: clamp(96px, 12vw, 132px); }
.hero::before, .hero::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%); z-index: -1; pointer-events: none; }
.hero::before {
  background:
    radial-gradient(55% 75% at 12% 0%, rgba(20, 184, 134, .38), transparent 62%),
    radial-gradient(45% 65% at 92% 18%, rgba(255, 106, 61, .2), transparent 62%),
    linear-gradient(180deg, #06130f 0%, #0a2219 100%);
}
.hero::after {
  background-image: linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000 35%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000 35%, transparent 78%);
  animation: ccGrid 18s linear infinite;
}
@keyframes ccGrid { to { background-position: 46px 46px, 46px 46px; } }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 6px 12px 6px 8px;
  border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: #c9f2e3; font-size: .82rem; font-weight: 700; letter-spacing: .02em;
}
.hero-eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: #2ee6a6; box-shadow: 0 0 0 4px rgba(46,230,166,.18); animation: ccPulse 2s ease-in-out infinite; }
@keyframes ccPulse { 50% { box-shadow: 0 0 0 7px rgba(46,230,166,.05); } }
.hero h1 { color: #fff; font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 5.6vw, 3.5rem); line-height: 1.07; letter-spacing: -.035em; max-width: 17ch; }
.hero h1 .grad { background: linear-gradient(90deg, #5ff0bf, #14b886 45%, #ffb37f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { color: rgba(255,255,255,.76); font-size: clamp(1rem, 2vw, 1.16rem); max-width: 60ch; margin-top: 16px; }
.hero .sub strong { color: #fff; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.hero-chips li { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); color: #e4f3ed; font-size: .86rem; font-weight: 600; }
.hero-chips li::before { content: "✓"; color: #2ee6a6; font-weight: 800; }
.hero-visual { display: none; }
@media (min-width: 1080px) {
  .hero-visual { display: grid; gap: 9px; position: absolute; right: 16px; top: clamp(34px, 5vw, 60px); width: 286px; }
  .hv-label { margin: 0 0 2px; color: rgba(255,255,255,.55); font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
  .hv-card {
    display: grid; gap: 1px; padding: 11px 15px; border-radius: 16px; color: #fff;
    background: linear-gradient(160deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
    border: 1px solid rgba(255,255,255,.14); box-shadow: 0 18px 40px rgba(0,0,0,.25);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    animation: ccFloat 7s ease-in-out infinite;
  }
  .hv-card span { color: rgba(255,255,255,.7); font-size: .8rem; font-weight: 600; }
  .hv-card b { font-family: var(--display); font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
  .hv-card small { color: rgba(255,255,255,.6); font-size: .78rem; }
  .hv-card small.hv-up { color: #5ff0bf; font-weight: 700; }
  .hv-card i { display: block; height: 6px; border-radius: 6px; background: rgba(255,255,255,.12); margin: 6px 0 4px; overflow: hidden; }
  .hv-card i em { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #14b886, #5ff0bf); }
  .hv-2 { margin-left: 28px; animation-delay: -2.3s; }
  .hv-3 { animation-delay: -4.6s; }
}
@keyframes ccFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .hv-card { animation: none; } }
#herramienta { position: relative; z-index: 2; margin-top: clamp(-104px, -9vw, -64px); }
@media (max-width: 640px) {
  .hero { padding-top: 30px; padding-bottom: 86px; }
  .hero .sub { font-size: .98rem; line-height: 1.55; }
  #herramienta { margin-top: -62px; }
  .hero-chips { gap: 6px; }
  .hero-chips li { font-size: .78rem; padding: 6px 10px; }
}

/* ---------- Calculadora ---------- */
.tool-card { border-radius: 24px; border: 1px solid rgba(13, 23, 20, .07); box-shadow: var(--shadow-lg); }
@media (max-width: 640px) { .tool-card { border-radius: 20px; padding: 16px; } }
.num { background: var(--grad); box-shadow: 0 4px 12px rgba(11, 122, 86, .3); }
.step-legend { font-family: var(--display); letter-spacing: -.01em; }
input[type="text"], select { border-radius: 12px; border-color: var(--line-2); background: #fbfdfc; }
input[type="text"]:hover, select:hover { border-color: #b9cbc4; }
input[type="text"]:focus, select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(20, 184, 134, .16); background: #fff; }
.kpis > * { border-radius: 16px; }
.privacy { color: var(--muted); }

/* ---------- Secciones y tarjetas ---------- */
.section { padding-top: clamp(48px, 7vw, 76px); }
.section-title { font-family: var(--display); font-weight: 800; font-size: clamp(1.5rem, 3.4vw, 2.2rem); letter-spacing: -.03em; }
.section-sub { color: var(--muted); }
.step, .article, .faq details, .toc, .art-body { border-radius: 20px; border-color: var(--line); }
.step, .article { box-shadow: 0 1px 2px rgba(13,23,20,.03); transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.step:hover, .article:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: #c6e6d9; }
.step { padding: 22px; }
.step-ic { width: 48px; height: 48px; border-radius: 14px; background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(11, 122, 86, .28); }
.faq details { transition: border-color .2s, box-shadow .2s; }
.faq details[open] { border-color: #bfe6d6; box-shadow: var(--shadow); }
.faq summary::after { color: var(--brand-2); }
.tag { color: var(--accent); background: var(--accent-soft); }

/* Tarjetas de guías */
.g-card { border-radius: 20px; transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease; }
.g-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.g-chip { border-radius: 999px; }

/* Promos del Recetario / Manual */
.rc-home-card { border-radius: 24px; box-shadow: var(--shadow-lg); }

/* ---------- Guías (artículos) ---------- */
.art-hero { position: relative; isolation: isolate; overflow: hidden; }
.art-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: linear-gradient(90deg, #000, transparent 70%);
  mask-image: linear-gradient(90deg, #000, transparent 70%);
}
.art-hero h1 { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; }
.art-hero-img { border-radius: 18px; box-shadow: 0 24px 50px rgba(0,0,0,.25); }
.art-body h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; }
.callout { border-radius: 16px; }
.side-cta { background: var(--grad); border-radius: 20px; box-shadow: 0 14px 34px rgba(11, 122, 86, .25); }
.read-progress { background: var(--grad); height: 3px; }
.toc a.is-active { background: var(--brand-soft); color: var(--brand); }

/* ---------- Pie ---------- */
.site-footer { position: relative; background: var(--deep); color: #a6b6b0; padding-top: 44px; }
.site-footer::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, #14b886, #5ff0bf, #ff9356); }
.footer-in { gap: 22px 40px; align-items: flex-start; }
.footer-in p b { color: #fff; font-family: var(--display); }
.footer-in nav { flex-wrap: wrap; gap: 10px 22px; }
.site-footer a { color: #e3ede9; text-decoration: none; transition: color .2s; }
.site-footer a:hover { color: #5ff0bf; }

/* ---------- Animación al hacer scroll (solo con JS y si el usuario no pidió menos movimiento) ---------- */
html.ui-anim .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
html.ui-anim .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .hero::after, .hero-eyebrow i { animation: none; }
  .step:hover, .article:hover, .g-card:hover, .btn-primary:hover { transform: none; }
}
