:root {
  --bg: #f7f4ee;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #18201f;
  --muted: #69706d;
  --line: #ded8cc;
  --primary: #b72c2c;
  --primary-dark: #8d1f23;
  --green: #1f7a4d;
  --gold: #f2b84b;
  --blue: #22668d;
  --shadow: 0 18px 48px rgba(34, 28, 21, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* En iPhone, un input con letra menor a 16px provoca zoom automatico al
   tocarlo. Se fija 16px en todos los campos para evitarlo. */
input,
select,
textarea {
  font-size: 16px;
}

body.no-scroll {
  overflow: hidden;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.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;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 42px);
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 1px solid rgba(222, 216, 204, 0.9);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--primary);
  border: 3px solid var(--gold);
  border-radius: 50%;
  font-weight: 900;
  line-height: 1;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.top-nav {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: #efe9de;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.top-nav a {
  padding: 8px 12px;
  color: #3d4541;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 750;
}

.top-nav a:hover {
  background: var(--surface-strong);
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(34, 28, 21, 0.08);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.cart-toggle span {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  color: #fff;
  background: var(--primary);
  border: 2px solid var(--surface-strong);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.hero-band {
  position: relative;
  min-height: clamp(410px, 54vw, 560px);
  isolation: isolate;
  overflow: hidden;
}

.hero-image {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(13, 24, 21, 0.78), rgba(13, 24, 21, 0.2) 58%, rgba(13, 24, 21, 0.05)),
    url("assets/hero-store.png") center / cover;
}

.hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(760px, 100%);
  min-height: inherit;
  padding: clamp(30px, 7vw, 72px) clamp(16px, 5vw, 54px);
  color: #fff;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-band .eyebrow {
  color: var(--gold);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 560px;
  margin-bottom: 12px;
  font-size: clamp(2.8rem, 7vw, 5.6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 5px;
  font-size: 1rem;
  line-height: 1.25;
}

.hero-copy {
  max-width: 540px;
  margin-bottom: 24px;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1rem, 2vw, 1.22rem);
}

.hero-search {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 10px;
  width: min(560px, 100%);
  min-height: 58px;
  padding: 0 17px;
  color: #202725;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-search svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.hero-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-metrics span {
  padding: 8px 11px;
  color: #10211b;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
}

.store-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: clamp(18px, 3vw, 32px);
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 42px);
  align-items: start;
}

.section-heading {
  margin-bottom: 16px;
}

.category-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.category-button {
  position: relative;
  display: grid;
  min-height: 132px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: #202725;
  box-shadow: 0 10px 24px rgba(34, 28, 21, 0.1);
}

.category-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.category-button span {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  justify-content: center;
  padding: 8px 9px;
  color: #fff;
  background: rgba(20, 28, 25, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.category-button:hover img,
.category-button.active img {
  transform: scale(1.04);
  opacity: 0.88;
}

.category-button.active {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.catalog-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.result-copy strong,
.result-copy span {
  display: block;
}

.result-copy span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.select-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.select-control select,
.checkout-form select,
.checkout-form input,
.checkout-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
}

.select-control select {
  min-height: 40px;
  padding: 0 36px 0 12px;
  font-weight: 750;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.product-card {
  display: grid;
  grid-template-rows: 180px auto;
  overflow: hidden;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(34, 28, 21, 0.08);
}

.product-media {
  position: relative;
  background: #e9e2d7;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge-row {
  position: absolute;
  left: 10px;
  top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  padding: 5px 8px;
  color: #fff;
  background: rgba(24, 32, 31, 0.82);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.badge.offer {
  background: var(--primary);
}

.badge.cold {
  background: var(--blue);
}

.product-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.product-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.product-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  font-size: 1.22rem;
  font-weight: 950;
}

.unit {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.add-button,
.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: var(--radius);
  font-weight: 900;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.add-button,
.primary-button {
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
}

.add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 0 14px;
}

.add-button:hover,
.primary-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(183, 44, 44, 0.18);
}

.cart-panel {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cart-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.close-cart {
  display: none;
}

.cart-lines {
  display: grid;
  gap: 10px;
  min-height: 92px;
  padding: 14px 18px 0;
}

.empty-cart,
.empty-products {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
  font-weight: 750;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.cart-line strong {
  display: block;
  line-height: 1.2;
}

.cart-line small {
  color: var(--muted);
  font-weight: 750;
}

.qty-control {
  display: grid;
  grid-template-columns: 34px 42px 34px;
  align-items: center;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.qty-control button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: #f2ece2;
  border: 0;
  color: var(--ink);
  font-weight: 950;
}

.qty-control span {
  text-align: center;
  font-size: 0.84rem;
  font-weight: 900;
}

.checkout-form {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkout-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.checkout-form input,
.checkout-form select {
  height: 44px;
  padding: 0 12px;
}

.checkout-form textarea {
  min-height: 72px;
  resize: vertical;
  padding: 10px 12px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background: #efe9de;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented label {
  display: block;
  color: var(--muted);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 6px;
  font-weight: 900;
}

.segmented input:checked + span {
  color: #fff;
  background: var(--green);
}

.totals {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f2ece2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.totals span {
  color: var(--muted);
  font-weight: 800;
}

.total-line {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 1.14rem;
}

.checkout-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-button,
.ghost-button {
  padding: 0 14px;
}

.ghost-button {
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.ghost-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(34, 28, 21, 0.08);
}

.service-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  width: min(1440px, 100%);
  margin: 0 auto clamp(28px, 4vw, 48px);
  padding: 0 clamp(16px, 4vw, 42px);
}

.service-band div {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 18px;
  background: #202725;
  color: #fff;
}

.service-band div:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.service-band div:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.service-band strong {
  color: var(--gold);
}

.service-band span {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}

.cart-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(13, 24, 21, 0.45);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  width: min(360px, calc(100vw - 36px));
  padding: 14px 16px;
  color: #fff;
  background: #202725;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-weight: 800;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(34, 28, 21, 0.08);
  font-weight: 850;
  font-size: 0.88rem;
  max-width: 180px;
}

.account-button svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.account-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(13, 24, 21, 0.5);
}

.account-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  width: min(560px, 100vw);
  margin: auto;
  max-height: min(720px, 100dvh);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.account-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.account-note {
  margin: 0;
  padding: 14px 18px 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.account-form {
  display: grid;
  gap: 14px;
  padding: 16px 18px 22px;
}

.account-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.account-form input,
.account-form select {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
}

.account-form textarea {
  min-height: 60px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
}

.account-form .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.account-form .cedula-grid {
  grid-template-columns: 150px 1fr;
}

.account-section {
  margin: 6px 0 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.95rem;
}

.account-actions {
  margin-top: 4px;
}

.buyer-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f2ece2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.buyer-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.buyer-info {
  display: grid;
  gap: 2px;
}

.buyer-info small {
  color: var(--muted);
  font-weight: 750;
}

.buyer-edit {
  justify-self: start;
  min-height: 38px;
  padding: 0 14px;
}

@media (max-width: 1180px) {
  .store-layout {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 50;
    width: min(430px, 100vw);
    max-height: none;
    border-radius: 0;
    transform: translateX(105%);
    transition: transform 0.22s ease;
  }

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

  .close-cart {
    display: inline-grid;
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .site-header {
    grid-template-columns: 1fr auto;
    min-height: 66px;
  }

  .qty-control {
    grid-template-columns: 40px 44px 40px;
    height: 40px;
  }

  .qty-control button {
    width: 40px;
    height: 40px;
  }

  .top-nav {
    display: none;
  }

  .hero-band {
    min-height: 520px;
  }

  .hero-image {
    background:
      linear-gradient(180deg, rgba(13, 24, 21, 0.82), rgba(13, 24, 21, 0.42) 64%, rgba(13, 24, 21, 0.66)),
      url("assets/hero-store.png") center / cover;
  }

  .hero-content {
    justify-content: flex-end;
  }

  .category-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-button {
    min-height: 118px;
  }

  .catalog-tools,
  .product-bottom,
  .checkout-actions,
  .service-band,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .catalog-tools {
    display: grid;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-band div,
  .service-band div:first-child,
  .service-band div:last-child {
    border-radius: 0;
  }

  .service-band div:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .service-band div:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

@media (max-width: 540px) {
  .brand span:last-child {
    display: none;
  }

  .account-button {
    max-width: 132px;
    padding: 0 12px;
  }

  .account-modal {
    inset: 0;
    width: 100vw;
    max-height: none;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }

  .account-form .form-grid,
  .account-form .cedula-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    font-size: 1rem;
  }

  .hero-search {
    min-height: 54px;
  }

  .hero-metrics {
    gap: 8px;
  }

  .hero-metrics span {
    font-size: 0.76rem;
  }

  .store-layout {
    padding-inline: 12px;
  }

  .category-row {
    gap: 10px;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .product-card {
    grid-template-rows: 170px auto;
  }
}
