:root {
  /* brand colors — constant across themes */
  --green-deep: #123c22;
  --green: #1f7a3d;
  --green-bright: #2f9c4f;
  --yellow: #f3ab1e;
  --yellow-soft: #f7c563;
  --maroon: #6d3524;
  --pesto-dark: #133a22;
  --pina-orange: #e9852c;
  --pina-deep: #c85a1f;

  /* legacy aliases kept for elements that always want the cream tone */
  --cream: #f6efdc;
  --cream-soft: #fbf7ec;

  --font-display: "Baloo 2", "Poppins", system-ui, sans-serif;
  --font-body: "Poppins", system-ui, sans-serif;

  /* ---- theme-aware surface tokens (light default) ---- */
  --surface: #f6efdc;
  --surface-alt: #fbf7ec;
  --surface-raised: #ffffff;
  --text: #1c2417;
  --text-muted: rgba(28, 36, 23, 0.78);
  --header-bg: rgba(246, 239, 220, 0.82);
  --header-border: rgba(18, 60, 34, 0.08);
  --badge-bg: #fbf7ec;
  --badge-text: #123c22;
  --badge-border: #123c22;
  --shadow: rgba(18, 30, 20, 0.16);
  --grain-opacity: 0.035;
  --grain-blend: multiply;
  --blob-yellow-opacity: 0.9;
  --blob-green-opacity: 0.16;
}

html[data-theme="dark"] {
  --surface: #0f1712;
  --surface-alt: #16221b;
  --surface-raised: #1b2820;
  --text: #f1ead8;
  --text-muted: rgba(241, 234, 216, 0.72);
  --header-bg: rgba(14, 22, 17, 0.82);
  --header-border: rgba(243, 171, 30, 0.14);
  --badge-bg: #16221b;
  --badge-text: #f3ab1e;
  --badge-border: #f3ab1e;
  --shadow: rgba(0, 0, 0, 0.5);
  --grain-opacity: 0.05;
  --grain-blend: overlay;
  --blob-yellow-opacity: 0.55;
  --blob-green-opacity: 0.3;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  transition: opacity 0.4s ease;
}

/* ---------- shared bits ---------- */

.eyebrow {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-bright);
  margin: 0 0 10px;
}
.eyebrow-dark { color: var(--green); }

.underline-word {
  position: relative;
  display: inline-block;
}
.underline-word::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -0.06em;
  height: 0.32em;
  background: var(--yellow);
  z-index: -1;
  border-radius: 3px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s cubic-bezier(.22,1,.36,1);
}
.underline-word.is-drawn::after { transform: scaleX(1); }
.underline-word-dark::after { background: var(--yellow-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 15px 30px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(.22,1,.36,1), box-shadow 0.25s ease;
}
.btn-primary {
  background: var(--green);
  color: var(--cream-soft);
  box-shadow: 0 12px 26px rgba(31, 122, 61, 0.35);
}
.btn-primary:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 16px 30px rgba(31, 122, 61, 0.4); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--badge-border);
  transition: transform 0.25s cubic-bezier(.22,1,.36,1), box-shadow 0.25s ease, color 0.4s ease, border-color 0.4s ease;
}
.btn-ghost:hover { transform: translateY(-3px) rotate(1deg); background: rgba(18, 60, 34, 0.06); }
html[data-theme="dark"] .btn-ghost:hover { background: rgba(243, 171, 30, 0.08); }
.btn-outline {
  background: transparent;
  color: var(--cream-soft);
  border-color: var(--cream-soft);
}
.btn-outline:hover { transform: translateY(-3px) rotate(1deg); background: rgba(251, 247, 236, 0.12); }
.btn-nav {
  padding: 11px 22px;
  font-size: 0.9rem;
}

.brush { position: absolute; width: 180px; opacity: 0.55; pointer-events: none; }
.brush path {
  fill: none;
  stroke: var(--green);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  transition: stroke-dashoffset 1.1s cubic-bezier(.22,1,.36,1);
}
.brush.is-drawn path { stroke-dashoffset: 0; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(20px, 5vw, 56px);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--header-border);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.logo { text-decoration: none; }
.logo-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--badge-text);
  background: var(--badge-bg);
  border: 2.5px solid var(--badge-border);
  border-radius: 14px;
  padding: 4px 14px 6px;
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.site-nav {
  display: flex;
  gap: clamp(18px, 3vw, 40px);
}
.site-nav a {
  text-decoration: none;
  font-weight: 600;
  color: var(--text);
  font-size: 0.98rem;
  transition: color 0.3s ease;
}
.site-nav a:hover { color: var(--green-bright); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ---------- theme toggle ---------- */

.theme-toggle {
  background: transparent;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  border-radius: 999px;
}
.theme-toggle-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 58px;
  height: 32px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 2px solid var(--badge-border);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}
.theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 3px 8px rgba(18, 30, 20, 0.3);
  transition: transform 0.35s cubic-bezier(.22,1,.36,1), background-color 0.35s ease;
}
html[data-theme="dark"] .theme-toggle-knob {
  transform: translateX(26px);
  background: var(--green-bright);
}
.theme-icon {
  position: relative;
  z-index: 1;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--badge-text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.35s ease, opacity 0.35s ease;
}
.icon-sun { margin-right: auto; }
.icon-moon { margin-left: auto; fill: currentColor; stroke: none; }
html[data-theme="dark"] .icon-sun { opacity: 0.45; }
html:not([data-theme="dark"]) .icon-moon { opacity: 0.45; }
.theme-toggle:focus-visible .theme-toggle-track {
  outline: 2px solid var(--green-bright);
  outline-offset: 2px;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: clamp(60px, 10vh, 110px) clamp(20px, 6vw, 60px) 0;
  text-align: center;
  overflow: hidden;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  z-index: 0;
}
.blob-yellow {
  width: 640px; height: 640px;
  top: -260px; right: -220px;
  background: var(--yellow);
  opacity: var(--blob-yellow-opacity);
  border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
  transition: opacity 0.4s ease;
}
.blob-green {
  width: 420px; height: 420px;
  bottom: -260px; left: -160px;
  background: var(--green-bright);
  opacity: var(--blob-green-opacity);
  border-radius: 58% 42% 37% 63% / 55% 40% 60% 45%;
  transition: opacity 0.4s ease;
}

.spark {
  position: absolute;
  color: var(--yellow);
  font-size: 1.6rem;
  z-index: 1;
}
.spark-1 { top: 14%; right: 12%; }
.spark-2 { top: 26%; right: 20%; font-size: 1.1rem; }

.brush-1 { top: 8%; left: 4%; transform: rotate(-8deg); }
.brush-2 { bottom: 6%; right: 2%; transform: rotate(6deg) scaleX(-1); }

.hero-title {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  line-height: 0.98;
  color: var(--text);
  margin: 0 auto 22px;
  max-width: 16ch;
  transition: color 0.4s ease;
}

.hero-sub {
  position: relative;
  z-index: 1;
  max-width: 46ch;
  margin: 0 auto 34px;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--text-muted);
  transition: color 0.4s ease;
}

.hero-cta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 34px;
}

.hero-jars {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  border-radius: 28px 28px 0 0;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(18, 30, 20, 0.22);
  transform: translateY(0);
}
.hero-jars img { width: 100%; }

/* ---------- productos ---------- */

.productos {
  padding: clamp(70px, 10vh, 120px) clamp(20px, 6vw, 60px);
  background: var(--surface-alt);
  transition: background-color 0.4s ease;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 56px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  line-height: 1.15;
  color: var(--text);
  margin: 0;
  transition: color 0.4s ease;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  max-width: 1180px;
  margin: 0 auto;
}

.product-card {
  position: relative;
  border-radius: 26px;
  padding: 30px 26px 28px;
  color: var(--cream-soft);
  box-shadow: 0 20px 44px var(--shadow);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(.22,1,.36,1), transform 0.7s cubic-bezier(.22,1,.36,1);
}
.product-card.is-visible { opacity: 1; transform: translateY(0); }
.product-card:nth-child(2) { transition-delay: 0.12s; }
.product-card:nth-child(3) { transition-delay: 0.24s; }

.card-mayo { background: linear-gradient(160deg, #7a4230, var(--maroon)); }
.card-pesto { background: linear-gradient(160deg, #1c5c34, var(--pesto-dark)); }
.card-pina  { background: linear-gradient(160deg, var(--pina-orange), var(--pina-deep)); }

.product-card .tag {
  position: absolute;
  top: -14px;
  right: 22px;
  background: var(--yellow);
  color: var(--green-deep);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.98rem;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 16px rgba(18, 30, 20, 0.25);
  transform: rotate(6deg);
  transition: transform 0.3s ease;
}
.product-card:hover .tag { transform: rotate(-4deg) scale(1.05); }

.card-top { margin-bottom: 14px; }
.kicker {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 6px;
}
.product-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0;
  line-height: 1.1;
}
.product-card p {
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.92;
  margin: 0 0 22px;
}
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--cream-soft);
  border-bottom: 2px solid rgba(251, 247, 236, 0.5);
  padding-bottom: 2px;
  transition: gap 0.25s ease;
}
.card-link:hover { gap: 12px; }

/* ---------- historia ---------- */

.historia {
  padding: clamp(70px, 10vh, 120px) clamp(20px, 6vw, 60px);
  background: var(--green-deep);
  color: var(--cream-soft);
  text-align: center;
}
.historia-inner { max-width: 720px; margin: 0 auto; }
.historia h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin: 0 0 22px;
  color: var(--cream-soft);
}
.historia .underline-word::after { background: var(--yellow); }
.historia-copy {
  font-size: 1.08rem;
  line-height: 1.6;
  color: rgba(251, 247, 236, 0.82);
  margin: 0 0 50px;
}

.historia-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
}
.stat dt {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.6rem;
  color: var(--yellow);
  margin: 0;
}
.stat dd {
  margin: 8px 0 0;
  font-size: 0.92rem;
  color: rgba(251, 247, 236, 0.75);
}

/* ---------- pedir / cta ---------- */

.pedir {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: clamp(80px, 12vh, 130px) clamp(20px, 6vw, 60px);
  background: var(--surface);
  transition: background-color 0.4s ease;
}
.blob-cta {
  width: 520px; height: 520px;
  top: -220px; left: -160px;
  right: auto;
  opacity: 0.85;
}
.brush-3 { top: 18%; right: 8%; transform: rotate(10deg); }

.pedir h2 {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4rem);
  color: var(--text);
  margin: 0 0 16px;
  transition: color 0.4s ease;
}
.pedir p {
  position: relative;
  z-index: 1;
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 36px;
  transition: color 0.4s ease;
}
.pedir-cta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.pedir .btn-outline { color: var(--text); border-color: var(--badge-border); }
.pedir .btn-outline:hover { background: rgba(18, 60, 34, 0.06); }
html[data-theme="dark"] .pedir .btn-outline:hover { background: rgba(243, 171, 30, 0.08); }

/* ---------- footer ---------- */

.site-footer {
  background: var(--green-deep);
  color: rgba(251, 247, 236, 0.7);
  text-align: center;
  padding: 46px 20px 34px;
}
.logo-badge-footer {
  border-color: var(--yellow);
  color: var(--cream-soft);
  background: transparent;
  margin-bottom: 12px;
}
.site-footer p { margin: 4px 0; }
.fine-print { font-size: 0.82rem; opacity: 0.7; margin-top: 14px; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .product-grid { grid-template-columns: 1fr; }
  .historia-stats { gap: 18px; }
  .site-nav { display: none; }
}

@media (max-width: 560px) {
  .site-header { padding: 14px 18px; }
  .btn-nav { padding: 9px 16px; font-size: 0.82rem; }
  .hero { padding-top: 50px; }
  .hero-title { max-width: 13ch; }
  .stat dt { font-size: 2.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .product-card, .underline-word::after, .brush path, .btn { transition: none; }
}