/* ============================================================
   Casa Morena — Catálogo online
   Paleta: tonos cálidos peruanos (terracota, crema, oro, rosa Maras)
   ============================================================ */

:root,
[data-theme='light'] {
  /* Superficies (crema cálida) */
  --color-bg: #faf4ea;
  --color-surface: #fffdf8;
  --color-surface-2: #f4ecde;
  --color-surface-offset: #efe6d4;
  --color-divider: #e4d8c2;
  --color-border: #d8c9ad;

  /* Texto (marrón cálido) */
  --color-text: #2b2118;
  --color-text-muted: #7a6b54;
  --color-text-faint: #b0a48b;

  /* Acentos */
  --color-primary: #b8451f;        /* terracota andina */
  --color-primary-hover: #9a3615;
  --color-primary-active: #7d2a10;
  --color-gold: #c98a2b;           /* oro cúrcuma */
  --color-pink: #c98a86;            /* rosa Maras */
  --color-success: #5a7a3a;

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(43, 33, 24, 0.06);
  --shadow-md: 0 6px 18px rgba(43, 33, 24, 0.08);
  --shadow-lg: 0 18px 48px rgba(43, 33, 24, 0.14);

  --content-default: 1120px;
  --content-narrow: 680px;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Work Sans', 'Helvetica Neue', Arial, sans-serif;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.83rem + 0.3vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.2rem, 1rem + 0.7vw, 1.5rem);
  --text-xl: clamp(1.6rem, 1.2rem + 1.4vw, 2.4rem);
  --text-2xl: clamp(2.2rem, 1.4rem + 3vw, 3.6rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
}

[data-theme='dark'] {
  --color-bg: #161210;
  --color-surface: #1e1a16;
  --color-surface-2: #241f1a;
  --color-surface-offset: #2a241e;
  --color-divider: #322b23;
  --color-border: #433a30;
  --color-text: #f0e8db;
  --color-text-muted: #b3a38a;
  --color-text-faint: #7d6f5a;
  --color-primary: #e08a52;
  --color-primary-hover: #c9753d;
  --color-primary-active: #b0612f;
  --color-gold: #e0b04e;
  --color-pink: #d99a96;
  --color-success: #8bb85f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5);
}

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

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  text-wrap: balance;
  font-weight: 600;
}

p, li {
  text-wrap: pretty;
  max-width: 70ch;
}

a, button, [role='button'] {
  transition: color 180ms cubic-bezier(0.16, 1, 0.3, 1),
              background 180ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-divider);
}

.header__inner {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
}

.brand__logo {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
}

.brand__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand__tagline {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  border: 1px solid transparent;
}

.icon-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}

.btn--primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: translateY(0);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--color-divider);
}

.hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in oklab, var(--color-gold) 22%, transparent), transparent 45%),
    radial-gradient(circle at 85% 30%, color-mix(in oklab, var(--color-pink) 20%, transparent), transparent 50%),
    radial-gradient(circle at 50% 90%, color-mix(in oklab, var(--color-primary) 16%, transparent), transparent 55%);
  z-index: 0;
}

.hero__inner {
  position: relative;
  z-index: 1;
  max-width: var(--content-default);
  margin: 0 auto;
  padding: clamp(var(--space-12), 7vw, var(--space-20)) var(--space-6) var(--space-16);
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: var(--space-5);
}

.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: currentColor;
}

.hero__title {
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-5);
}

.hero__sub {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 38ch;
  margin: 0 auto var(--space-8);
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.hero__cta:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.hero__cta svg {
  width: 20px;
  height: 20px;
}

/* ---------- Products ---------- */
.products {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: clamp(var(--space-10), 6vw, var(--space-16)) var(--space-6);
}

.section-head {
  text-align: center;
  margin-bottom: var(--space-10);
}

.section-head__title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}

.section-head__sub {
  color: var(--color-text-muted);
  max-width: 50ch;
  margin: 0 auto;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}

.product {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.product:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.product__media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-surface-2);
}

.product__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.product:hover .product__media img {
  transform: scale(1.04);
}

.product__badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.product__badge--right {
  left: auto;
  right: var(--space-3);
}

.product__body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-2);
}

.product__name {
  font-size: var(--text-lg);
  font-weight: 600;
}

.product__name-sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-weight: 400;
}

.product__size {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  letter-spacing: 0.03em;
}

.product__price-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.price--launch {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
}

.price--regular {
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  text-decoration: line-through;
}

.product__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  flex: 1;
}

.product__cta {
  margin-top: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  width: 100%;
}

.product__cta:hover {
  background: var(--color-primary-hover);
}

.product__cta svg {
  width: 18px;
  height: 18px;
}

/* ---------- Info strip (delivery) ---------- */
.info-strip {
  background: var(--color-surface-offset);
  border-block: 1px solid var(--color-divider);
}

.info-strip__inner {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--space-10) var(--space-6);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-8);
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.info-item__icon {
  width: 40px;
  height: 40px;
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}

.info-item__title {
  font-size: var(--text-base);
  font-weight: 600;
}

.info-item__text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ---------- Footer ---------- */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
}

.footer__inner {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.footer__logo {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-full);
}

.footer__brand {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.footer__tagline {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}

.footer__contact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
}

.footer__contact:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.footer__contact svg {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
}

.footer__copy {
  margin-top: var(--space-8);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ---------- Quantity selector & cart ---------- */
.product__buy {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.qty {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  width: 100%;
}

.qty__btn {
  width: 44px;
  height: 40px;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  background: transparent;
}

.qty__btn:hover {
  background: var(--color-surface-2);
  color: var(--color-primary);
}

.qty__value {
  flex: 1;
  min-width: 2ch;
  text-align: center;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.product__cta {
  width: 100%;
}

.product__cta--added {
  background: var(--color-success);
}

/* Cart bar */
.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: color-mix(in oklab, var(--color-surface) 96%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-divider);
  box-shadow: var(--shadow-lg);
  transform: translateY(0);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-bar--hidden {
  transform: translateY(110%);
  pointer-events: none;
}

.cart-bar__inner {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.cart-bar__info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.cart-bar__count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 600;
}

.cart-bar__total {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary);
}

.cart-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.cart-bar__clear {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.cart-bar__review {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  white-space: nowrap;
  background: var(--color-surface-2);
}

.cart-bar__review:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.cart-bar__clear:hover {
  color: var(--color-primary);
}

.cart-bar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.cart-bar__btn:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.cart-bar__btn svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 600px) {
  .cart-bar__inner {
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }
  .cart-bar__info {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    width: 100%;
  }
  .cart-bar__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: var(--space-2);
  }
  .cart-bar__clear,
  .cart-bar__review {
    justify-content: center;
  }
  .cart-bar__btn {
    grid-column: 1 / -1;
    width: 100%;
  }
  .cart-bar__btn span {
    font-size: var(--text-xs);
  }
}

/* ---------- Review drawer ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.drawer[hidden] {
  display: none;
}

.drawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(43, 33, 24, 0.5);
  opacity: 1;
  transition: opacity 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer__sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--content-default);
  max-height: 88dvh;
  background: var(--color-surface);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
}

.drawer__title {
  font-size: var(--text-lg);
}

.drawer__close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  font-size: var(--text-xl);
  line-height: 1;
  color: var(--color-text-muted);
}

.drawer__close:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.drawer__body {
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.drawer__empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-8) 0;
  font-size: var(--text-sm);
}

.review-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.review-item__info {
  flex: 1;
  min-width: 0;
}

.review-item__name {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
}

.review-item__sub {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: 2px;
}

.review-item__price {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.review-item__stepper {
  flex-shrink: 0;
}

.review-item__stepper.qty {
  width: auto;
  align-self: auto;
}

.review-item__stepper .qty__btn {
  width: 30px;
  height: 30px;
  font-size: var(--text-base);
}

.review-item__stepper .qty__value {
  min-width: 1.5ch;
  font-size: var(--text-sm);
}

.review-item__remove {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--color-text-faint);
  flex-shrink: 0;
}

.review-item__remove:hover {
  color: var(--color-primary);
  background: var(--color-surface-2);
}

.drawer__footer {
  border-top: 1px solid var(--color-divider);
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--color-surface);
}

.drawer__total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.drawer__total-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 600;
}

.drawer__total {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
}

.drawer__send {
  width: 100%;
}

.drawer__actions {
  display: flex;
  gap: var(--space-3);
}

.drawer__clear {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.drawer__send {
  flex: 2;
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .header__inner {
    padding: var(--space-3) var(--space-4);
  }
  .brand__tagline {
    display: none;
  }
  .btn--primary span {
    display: none;
  }
  .btn--primary {
    width: 40px;
    height: 40px;
    padding: 0;
  }
}
