/* ===================================================================
   Habito — Design tokens v2 "Dark Aurora Glass"
   (from design-system/habito/MASTER.md — see "v2" section)
   =================================================================== */
:root {
  /* Deep, warm near-black base — never pure #000 */
  --color-background: #12140D;
  --color-background-elevated: #1B1D14;

  /* Brand olive, tuned for a dark UI: a deep-to-near-black range plus a
     brighter luminous tone — everything on the page stays inside this
     one green family now, no second (orange) hue anywhere. */
  --color-primary-deep: #232B14;
  --color-primary-deeper: #171B0E;
  --color-badge-bg: #3A4A22;
  --color-primary: #8CB24A;
  --color-primary-glow: #A9D65C;
  --color-on-primary: #12140D;

  /* CTA accent — the same green family, just the brightest step, used
     only for buttons/CTAs so it still reads as "the thing to click". */
  --color-accent: #A9D65C;
  --color-accent-hover: #97C24E;
  --color-on-accent: #12140D;

  /* Warm lamp-light glow — used ONLY for the hover state on product
     cards ("turning the lamp on"), never for static UI color. */
  --color-warm-glow: #FCEBC4;

  --color-foreground: #F5F1E6;
  --color-muted-foreground: #B9B6A6;

  --color-card: rgba(255, 255, 255, 0.055);
  --color-card-foreground: #F5F1E6;
  --color-muted: rgba(255, 255, 255, 0.06);
  --color-border: rgba(245, 241, 230, 0.14);

  --color-destructive: #E5604D;
  --color-ring: #A9D65C;

  --glass-blur: 20px;
  --glass-border: 1px solid rgba(245, 241, 230, 0.14);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 32px 64px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 70px rgba(169, 214, 92, 0.28);
  --shadow-glow-accent: 0 0 60px rgba(169, 214, 92, 0.3);
  --shadow-glow-warm: 0 0 80px rgba(252, 214, 140, 0.4);

  --ease-natural: cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

h1, h2, h3, h4,
.font-display {
  font-family: 'Playfair Display', serif;
}

::selection {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

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

a {
  cursor: pointer;
}

/* ===================================================================
   Ambient aurora glow — large blurred gradient blobs behind sections.
   Each section that wants ambience gets a .aurora-field wrapper with
   1-3 .aurora-blob children positioned absolutely.
   =================================================================== */
.aurora-field {
  position: relative;
  isolation: isolate;
}

.aurora-blob {
  position: absolute;
  /* Organic curved outline, not a circle — four asymmetric corner radii */
  border-radius: 44% 56% 65% 35% / 55% 40% 60% 45%;
  filter: blur(90px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  --blob-rotate: 0deg;
  transform: rotate(var(--blob-rotate));
  animation: aurora-drift 16s ease-in-out infinite;
}

.aurora-blob.primary {
  background: radial-gradient(ellipse, var(--color-primary-glow), transparent 70%);
}

.aurora-blob.accent {
  /* Deep, near-black green — the flowing "shadow" side of the curve,
     paired with .primary's bright side, like a Back-to-Nature gradient. */
  background: radial-gradient(ellipse, var(--color-primary-deep), transparent 72%);
  animation-duration: 20s;
  animation-delay: -6s;
}

/* Blobs are position:absolute and first in DOM order, so later siblings
   (even ones Tailwind also positions, e.g. "absolute inset-0" overlays)
   naturally paint on top — no extra z-index rule needed here, which
   avoids fighting Tailwind's utility specificity. */

@keyframes aurora-drift {
  0%, 100% { transform: rotate(var(--blob-rotate)) translate(0, 0) scale(1); }
  50% { transform: rotate(var(--blob-rotate)) translate(4%, -5%) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .aurora-blob { animation: none; }
}

/* ===================================================================
   Buttons
   =================================================================== */
.btn-accent {
  background: var(--color-accent);
  color: var(--color-on-accent);
  padding: 14px 28px;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 250ms var(--ease-natural), transform 250ms var(--ease-natural), box-shadow 250ms var(--ease-natural);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  font-size: 0.95rem;
  box-shadow: var(--shadow-glow-accent);
}

.btn-accent:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.btn-accent:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(245, 241, 230, 0.04);
  color: var(--color-foreground);
  border: 1.5px solid var(--color-border);
  padding: 12px 26px;
  border-radius: 6px;
  font-weight: 600;
  transition: background 250ms var(--ease-natural), border-color 250ms var(--ease-natural), color 250ms var(--ease-natural);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.btn-secondary:hover {
  background: rgba(140, 178, 74, 0.14);
  border-color: var(--color-primary);
  color: var(--color-primary-glow);
}

/* kept for backward compatibility with markup written for the light theme —
   dark is now the only mode, so on-dark is just an alias */
.btn-secondary.on-dark {
  color: var(--color-foreground);
  border-color: var(--color-border);
}

.btn-secondary.on-dark:hover {
  background: rgba(140, 178, 74, 0.14);
  color: var(--color-primary-glow);
}

/* ===================================================================
   Focus states (accessibility)
   =================================================================== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===================================================================
   Header / Nav
   =================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(18, 20, 13, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: var(--glass-border);
  transition: box-shadow 250ms var(--ease-natural);
}

.site-logo {
  height: 4.75rem; /* bumped a third time — still read too small at 4.25rem */
  width: auto;
}

@media (min-width: 768px) {
  .site-logo {
    height: 6.5rem;
  }
}

.nav-link {
  position: relative;
  color: var(--color-foreground);
  font-weight: 500;
  transition: color 200ms ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1.5px;
  background: var(--color-primary-glow);
  transition: width 250ms var(--ease-natural);
}

.nav-link:hover {
  color: var(--color-primary-glow);
}

.nav-link:hover::after {
  width: 100%;
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  transition: transform 200ms var(--ease-natural);
}

.cart-badge.bump {
  animation: bump 320ms var(--ease-natural);
}

@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ===================================================================
   Scroll reveal
   =================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms var(--ease-natural), transform 700ms var(--ease-natural);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    transform: none;
    transition: opacity 200ms linear;
  }
  .card,
  .card img,
  .btn-accent,
  .btn-secondary {
    transition: none !important;
  }
}

/* ===================================================================
   Product cards — frosted glass panel with a soft glow behind the
   (transparent-background) product PNG, per "translucidez" request.
   =================================================================== */
.card {
  position: relative;
  background: var(--color-card);
  border: var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: box-shadow 300ms var(--ease-natural), transform 300ms var(--ease-natural), border-color 300ms var(--ease-natural);
}

.card:hover {
  /* Lights up warm on hover — like switching the lamp on — instead of green. */
  box-shadow: var(--shadow-lg), var(--shadow-glow-warm);
  transform: translateY(-4px);
  border-color: rgba(252, 214, 140, 0.4);
}

.card .card-media {
  background: rgba(255, 255, 255, 0.03);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
}

.card .card-media .glow {
  position: absolute;
  inset: 0;
  transition: opacity 450ms var(--ease-natural);
  pointer-events: none;
}

.card .card-media .glow-ambient {
  background: radial-gradient(circle at 50% 40%, rgba(169, 214, 92, 0.22), transparent 60%);
  opacity: 1;
}

.card .card-media .glow-warm {
  background: radial-gradient(circle at 50% 45%, rgba(252, 214, 140, 0.5), transparent 62%);
  opacity: 0;
}

.card:hover .card-media .glow-ambient {
  opacity: 0;
}

.card:hover .card-media .glow-warm {
  opacity: 1;
}

.card .card-media img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
  transition: transform 500ms var(--ease-natural), filter 450ms var(--ease-natural);
}

.card:hover .card-media img {
  transform: scale(1.04);
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 30px rgba(252, 214, 140, 0.25));
}

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--color-badge-bg);
  color: var(--color-foreground);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(169, 214, 92, 0.4);
}

/* Frame used for real lifestyle photography so bright daytime shots still
   read as part of the dark theme: soft dark vignette + glass edge. */
.photo-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: var(--glass-border);
  box-shadow: var(--shadow-lg);
}

.photo-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18, 20, 13, 0.15) 0%, rgba(18, 20, 13, 0.55) 100%);
  pointer-events: none;
}

/* ===================================================================
   Hero placeholder — replaces a real photo until the new moody shot
   described in the spec block is produced.
   =================================================================== */
.hero {
  position: relative;
  overflow: hidden;
}

.hero-media {
  position: relative;
  overflow: hidden;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  /* Slow one-way "approaching" zoom — plays once on load and settles
     zoomed in, per the "animación como de acercarse" request. */
  transition: transform 16s var(--ease-natural);
}

.hero.is-loaded .hero-media img {
  transform: scale(1.09);
}

@media (prefers-reduced-motion: reduce) {
  .hero-media img {
    transition: none;
    transform: none;
  }
}

/* ===================================================================
   Cart drawer
   =================================================================== */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 5, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--ease-natural);
  z-index: 50;
}

.cart-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  max-width: 420px;
  background: rgba(20, 22, 15, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: var(--glass-border);
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform 350ms var(--ease-natural);
  z-index: 51;
  display: flex;
  flex-direction: column;
}

.cart-drawer.open {
  transform: translateX(0);
}

.cart-line {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

.cart-line img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background:
    radial-gradient(circle at 50% 40%, rgba(169, 214, 92, 0.2), transparent 60%),
    rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  flex-shrink: 0;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-foreground);
}

.qty-btn:hover {
  border-color: var(--color-primary);
  background: rgba(140, 178, 74, 0.14);
}

/* ===================================================================
   Forms
   =================================================================== */
.input {
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-foreground);
  transition: border-color 200ms ease, box-shadow 200ms ease;
  width: 100%;
}

.input::placeholder {
  color: var(--color-muted-foreground);
}

.input:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(140, 178, 74, 0.2);
}

/* ===================================================================
   Misc
   =================================================================== */
.divider-dot::before {
  content: '·';
  margin: 0 10px;
  color: var(--color-muted-foreground);
}

.mobile-menu {
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms var(--ease-natural), transform 250ms var(--ease-natural);
  background: rgba(18, 20, 13, 0.96);
  backdrop-filter: blur(16px);
}

.mobile-menu.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: 10px 16px;
  border-radius: 0 0 6px 0;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
  top: 0;
}

/* ===================================================================
   Cursor glow + trail — a very subtle warm light that follows the
   pointer around the page. Two layered dots with different transition
   durations create the "lag" that reads as a soft trail, no JS easing
   loop needed. Off entirely for touch devices and reduced-motion.
   =================================================================== */
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 90px;
  height: 90px;
  margin-left: -45px;
  margin-top: -45px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(252, 214, 140, 0.18), transparent 70%);
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  transform: translate(-9999px, -9999px);
  transition: transform 480ms cubic-bezier(0.16, 1, 0.3, 1), opacity 400ms ease;
  will-change: transform;
}

.cursor-glow.trail {
  width: 50px;
  height: 50px;
  margin-left: -25px;
  margin-top: -25px;
  background: radial-gradient(circle, rgba(252, 214, 140, 0.12), transparent 70%);
  transition: transform 820ms cubic-bezier(0.16, 1, 0.3, 1), opacity 500ms ease;
}

.cursor-glow.visible {
  opacity: 1;
}

@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor-glow {
    display: none;
  }
}

/* ===================================================================
   Checkout (datos de entrega) y administración de pedidos
   =================================================================== */
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--color-foreground);
}

.field .hint {
  font-size: 0.78rem;
  color: var(--color-muted-foreground);
  margin-top: 4px;
}

.field-error {
  font-size: 0.8rem;
  color: #ff9d8f;
  margin-top: 5px;
  min-height: 0;
}

.input.is-invalid {
  border-color: var(--color-destructive);
  box-shadow: 0 0 0 3px rgba(229, 96, 77, 0.18);
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B9B6A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

select.input option {
  background: #1B1D14;
  color: var(--color-foreground);
}

.summary-card {
  background: var(--color-card);
  border: var(--glass-border);
  border-radius: 12px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--color-border);
}

.status-pill.paid { background: rgba(169, 214, 92, 0.16); border-color: rgba(169, 214, 92, 0.5); color: var(--color-primary-glow); }
.status-pill.warn { background: rgba(229, 96, 77, 0.16); border-color: rgba(229, 96, 77, 0.5); color: #ff9d8f; }

/* ===================================================================
   Páginas de texto (legales, envíos, contacto) + dato pendiente + WhatsApp
   =================================================================== */
.legal h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin: 2.5rem 0 0.75rem;
}

.legal p,
.legal li {
  color: rgba(245, 241, 230, 0.82);
  line-height: 1.75;
}

.legal p {
  margin-bottom: 1rem;
}

.legal ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.legal a {
  color: var(--color-primary-glow);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal strong {
  color: var(--color-foreground);
}

/* Dato que el dueño aún debe completar en js/site-config.js */
.is-pending {
  background: rgba(217, 164, 65, 0.16);
  border-bottom: 1px dashed rgba(217, 164, 65, 0.7);
  padding: 0 4px;
  border-radius: 3px;
}

.wa-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: var(--shadow-lg), var(--shadow-glow-accent);
  z-index: 35;
  transition: transform 250ms var(--ease-natural);
}

.wa-float:hover {
  transform: translateY(-3px);
}

/* ===================================================================
   Favoritos
   =================================================================== */
.fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-foreground);
  transition: color 200ms var(--ease-natural), transform 200ms var(--ease-natural), background 200ms var(--ease-natural);
}

.fav-btn svg {
  fill: transparent;
  stroke: currentColor;
  transition: fill 200ms var(--ease-natural);
}

.fav-btn[aria-pressed="true"] {
  color: var(--color-accent);
}

.fav-btn[aria-pressed="true"] svg {
  fill: currentColor;
}

/* Corazón flotante sobre la foto de cada tarjeta */
.fav-btn.fav-card {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(18, 20, 13, 0.55);
  border: 1px solid rgba(245, 241, 230, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.fav-btn.fav-card:hover {
  transform: scale(1.08);
  background: rgba(18, 20, 13, 0.75);
}

.fav-btn.fav-card:focus-visible,
.fav-btn.fav-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ===================================================================
   Rendimiento en celulares y pantallas táctiles
   Las manchas de luz animadas y el desenfoque de cristal (backdrop-filter)
   son muy pesados para un celular: aquí se calman, sin cambiar el diseño.
   =================================================================== */
@media (max-width: 767px), (hover: none) {
  .aurora-blob {
    animation: none;
    filter: blur(40px);
  }

  .site-header {
    background: rgba(18, 20, 13, 0.95);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .card,
  .summary-card,
  .btn-secondary,
  .cart-drawer,
  .mobile-menu,
  .fav-btn.fav-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .cart-drawer {
    background: rgba(20, 22, 15, 0.97);
  }

  .card:hover {
    transform: none;
  }
}

/* ===================================================================
   Tarjeta de producto completamente clicable
   El enlace del nombre se extiende sobre toda la tarjeta; los botones
   (corazón y Añadir) quedan por encima para seguir funcionando.
   =================================================================== */
.card .card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card [data-add-to-cart] {
  position: relative;
  z-index: 2;
}

.card:has(.card-link) {
  cursor: pointer;
}

/* ===================================================================
   Ficha de producto: en celular la foto es más baja para que el nombre,
   el precio y la descripción se vean sin tener que bajar.
   =================================================================== */
.card .card-media.product-media {
  aspect-ratio: 5 / 4;
}

@media (min-width: 768px) {
  .card .card-media.product-media {
    aspect-ratio: 1 / 1;
  }
}
