/* Tienda AXION — vidriera
   Paleta: verde botella (marca), blanco papel, salvia (superficies),
   amarillo etiqueta de góndola (precio), tinta verdosa (texto). */
:root {
  --bottle: #1F4A36;
  --bottle-deep: #163728;
  --paper: #FFFFFF;
  --sage: #EDF2EC;
  --sage-line: #D6E0D5;
  --tag: #FFD43B;
  --tag-edge: #E8B800;
  --ink: #1B2A21;
  --muted: #5B6B60;
  --danger: #B42318;
  --radius-card: 14px;
  --radius-ctl: 10px;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --shadow-drawer: -24px 0 48px rgba(22, 55, 40, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--tag-edge); outline-offset: 2px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bottle);
  color: #fff;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 12px 20px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center;
}
.brand {
  font-family: var(--display); font-weight: 800; font-size: 22px;
  letter-spacing: -0.02em; color: #fff; text-decoration: none;
}
.search {
  display: flex; align-items: center; gap: 8px;
  max-width: 460px; width: 100%; justify-self: center;
  background: rgba(255, 255, 255, .12);
  border-radius: 999px; padding: 0 14px;
  transition: background .15s;
}
.search:focus-within { background: #fff; color: var(--ink); }
.search svg { flex: none; opacity: .8; }
.search input {
  border: 0; background: transparent; outline: none;
  padding: 10px 0; width: 100%; color: inherit;
}
.search input::placeholder { color: currentColor; opacity: .7; }
.cart-button {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--tag); color: var(--ink);
  border: 0; border-radius: 999px; padding: 9px 16px 9px 14px;
  font-weight: 700; cursor: pointer;
}
.cart-button:hover { background: #FFE066; }
.cart-count {
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--bottle); color: #fff;
  font-size: 13px; line-height: 22px; text-align: center;
}

/* ---------- Aviso de retorno de pago ---------- */
.notice {
  max-width: 1180px; margin: 16px auto 0; padding: 14px 18px;
  border-radius: var(--radius-ctl);
  background: var(--sage); border-left: 5px solid var(--bottle);
  font-weight: 500;
}
.notice.is-error { background: #FDECEA; border-left-color: var(--danger); }
.notice.is-wait { background: #FFF6D6; border-left-color: var(--tag-edge); }

/* ---------- Página ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 36px 20px 80px; }
.intro { max-width: 640px; margin-bottom: 28px; }
.intro h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(34px, 5vw, 54px); line-height: 1.02; letter-spacing: -0.03em;
  margin: 0 0 12px; color: var(--bottle-deep);
}
.intro p { margin: 0; color: var(--muted); font-size: 18px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 26px; }
.categories { display: flex; flex-wrap: wrap; gap: 8px; }
.categories:empty { display: none; }
.sort { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); }
.sort select {
  appearance: none; -webkit-appearance: none;
  border: 1.5px solid var(--sage-line); border-radius: 999px; background-color: var(--paper);
  padding: 7px 36px 7px 16px; font-weight: 600; color: var(--ink); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B2A21' stroke-width='2.5' 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 12px center; background-size: 16px;
}
.sort select:hover { border-color: var(--bottle); }
.chip {
  border: 1.5px solid var(--sage-line); background: var(--paper);
  border-radius: 999px; padding: 7px 16px; cursor: pointer; font-weight: 600; font-size: 15px;
}
.chip:hover { border-color: var(--bottle); }
.chip[aria-pressed="true"] { background: var(--bottle); border-color: var(--bottle); color: #fff; }

.status { color: var(--muted); margin: 0 0 18px; }
.status:empty { display: none; }

/* ---------- Productos ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 28px 22px; }
.card { display: flex; flex-direction: column; }
.card-media {
  position: relative; aspect-ratio: 1 / 1;
  background: var(--sage); border-radius: var(--radius-card); overflow: hidden;
}
.card-media img { position: relative; width: 100%; height: 100%; object-fit: cover; }
.card-initial {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 96px;
  color: var(--sage-line); text-transform: uppercase; user-select: none;
}
/* La etiqueta de precio: el elemento distintivo, como en la góndola */
.price-tag {
  position: absolute; left: 12px; bottom: 12px;
  background: var(--tag); color: var(--ink);
  border-radius: 6px; padding: 5px 12px 6px 18px;
  font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em;
  box-shadow: 0 2px 0 var(--tag-edge);
}
.price-tag::before {
  content: ""; position: absolute; left: 7px; top: 50%;
  width: 6px; height: 6px; margin-top: -3px; border-radius: 50%;
  background: var(--paper);
}
.price-tag .cents { font-size: 13px; vertical-align: 8px; margin-left: 1px; }
.soldout {
  position: absolute; right: 12px; top: 12px;
  background: var(--ink); color: #fff; border-radius: 6px;
  font-size: 13px; font-weight: 700; padding: 3px 9px;
}
.card-body { padding: 14px 2px 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-cat { font-size: 14px; color: var(--muted); }
.card-name { font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.card-desc {
  margin: 2px 0 0; color: var(--muted); font-size: 15px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-actions { margin-top: auto; padding-top: 12px; }
.card-sinimp { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

/* Botón agregar / selector de cantidad */
.add {
  width: 100%; border: 1.5px solid var(--bottle); background: var(--paper); color: var(--bottle);
  border-radius: var(--radius-ctl); padding: 10px 14px; font-weight: 700; cursor: pointer;
}
.add:hover { background: var(--bottle); color: #fff; }
.add:disabled { border-color: var(--sage-line); color: var(--muted); background: var(--sage); cursor: not-allowed; }
.stepper {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  border-radius: var(--radius-ctl); background: var(--bottle); color: #fff; overflow: hidden;
}
.stepper button {
  border: 0; background: transparent; color: inherit; height: 44px; cursor: pointer; font-size: 20px; font-weight: 700;
}
.stepper button:hover { background: var(--bottle-deep); }
.stepper button:disabled { opacity: .4; cursor: not-allowed; }
.stepper output { text-align: center; font-weight: 700; }

/* ---------- Panel lateral ---------- */
.scrim { position: fixed; inset: 0; background: rgba(22, 55, 40, .35); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: min(460px, 100vw); background: var(--paper);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-drawer);
  transform: translateX(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  visibility: hidden;
}
.drawer.is-open { transform: none; visibility: visible; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--sage-line);
}
.drawer-head h2 { font-family: var(--display); font-weight: 800; font-size: 24px; margin: 0; letter-spacing: -0.02em; }
.icon-button { border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; }
.icon-button:hover { background: var(--sage); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 22px 20px; }

.cart-items .empty { text-align: center; padding: 48px 8px; color: var(--muted); }
.cart-items .empty strong { display: block; font-family: var(--display); font-size: 20px; color: var(--ink); margin-bottom: 4px; }
.line {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--sage);
}
.line-thumb {
  width: 56px; height: 56px; border-radius: 10px; background: var(--sage); overflow: hidden;
  display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--sage-line);
}
.line-thumb img { width: 100%; height: 100%; object-fit: cover; }
.line-name { font-weight: 600; line-height: 1.25; }
.line-unit { font-size: 14px; color: var(--muted); }
.line-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.line-total { font-weight: 700; }
.mini-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--sage-line); border-radius: 8px; }
.mini-stepper button { width: 30px; height: 28px; border: 0; background: transparent; cursor: pointer; font-weight: 700; }
.mini-stepper button:hover { background: var(--sage); }
.mini-stepper button:disabled { opacity: .35; cursor: not-allowed; }
.mini-stepper span { min-width: 26px; text-align: center; font-weight: 600; font-size: 15px; }

/* Formulario */
fieldset { border: 0; margin: 0 0 22px; padding: 0; }
legend { font-family: var(--display); font-weight: 700; font-size: 19px; margin: 14px 0 12px; padding: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { font-size: 14px; font-weight: 600; }
.optional { font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  border: 1.5px solid var(--sage-line); border-radius: var(--radius-ctl);
  padding: 10px 12px; background: var(--paper); width: 100%;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--bottle); box-shadow: 0 0 0 3px rgba(31, 74, 54, .15); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.choices { display: grid; gap: 8px; margin-bottom: 12px; }
.choice { display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border: 1.5px solid var(--sage-line); border-radius: var(--radius-ctl); padding: 12px 14px;
}
.choice small { color: var(--muted); font-size: 14px; text-align: right; }
.choice:hover span { border-color: var(--bottle); }
.choice input:checked + span { border-color: var(--bottle); background: var(--sage); box-shadow: inset 4px 0 0 var(--bottle); }
.choice input:focus-visible + span { outline: 3px solid var(--tag-edge); outline-offset: 2px; }
.choice input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Confirmado */
.done { text-align: center; padding-top: 48px; }
.done-mark { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--tag); display: grid; place-items: center; }
.done-mark svg { width: 32px; height: 32px; stroke-width: 3; }
.done h3 { font-family: var(--display); font-size: 26px; margin: 0 0 8px; }
.done p { color: var(--muted); max-width: 32ch; margin: 0 auto; }

/* Pie del panel */
.drawer-foot { border-top: 1px solid var(--sage-line); padding: 16px 22px 20px; background: var(--paper); }
.total-line { display: flex; justify-content: space-between; align-items: baseline; }
.total-line span { font-weight: 600; }
.total-line strong { font-family: var(--display); font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.fine { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.form-message { margin: 0 0 10px; color: var(--danger); font-weight: 600; font-size: 15px; }
.form-message:empty { display: none; }
.foot-actions { display: flex; gap: 10px; margin-top: 14px; }
.btn { border: 0; border-radius: var(--radius-ctl); padding: 14px 18px; font-weight: 700; font-size: 16px; cursor: pointer; }
.btn-primary { flex: 1; background: var(--bottle); color: #fff; }
.btn-primary:hover { background: var(--bottle-deep); }
.btn-primary:disabled { background: var(--sage-line); color: var(--muted); cursor: not-allowed; }
.btn-ghost { background: var(--sage); color: var(--ink); }
.btn-ghost:hover { background: var(--sage-line); }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 600;
  max-width: calc(100vw - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Marca (logo de la tabla empresa) ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  height: 44px; width: auto; max-width: 180px; object-fit: contain;
  background: #fff; border-radius: 8px; padding: 4px;
}
.brand-logo[hidden] { display: none; }

/* ---------- Pie con datos de la empresa ---------- */
.site-footer { background: var(--sage); border-top: 1px solid var(--sage-line); color: var(--muted); }
.site-footer[hidden] { display: none; }
.site-footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 28px 20px 36px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 40px;
}
.site-footer strong { font-family: var(--display); color: var(--ink); font-size: 18px; }
.foot-fine { margin: 4px 0 0; font-size: 14px; }
.foot-contact { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.foot-contact a { color: var(--bottle); font-weight: 600; text-decoration: none; }
.foot-contact a:hover { text-decoration: underline; }

/* ---------- Cuenta del cliente ---------- */
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.account-button {
  display: inline-flex; align-items: center; gap: 8px; max-width: 220px;
  background: rgba(255, 255, 255, .12); color: #fff;
  border: 0; border-radius: 999px; padding: 9px 14px; font-weight: 600; cursor: pointer;
}
.account-button:hover { background: rgba(255, 255, 255, .22); }
.account-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-note {
  display: inline-block; margin-top: 12px; padding: 8px 14px; border-radius: 999px;
  background: var(--sage); color: var(--bottle); font-weight: 600; font-size: 15px;
}
.account-dialog {
  border: 0; border-radius: var(--radius-card); padding: 0; width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); color: var(--ink); box-shadow: 0 24px 64px rgba(22, 55, 40, .25);
}
.account-dialog::backdrop { background: rgba(27, 42, 33, .45); }
.account-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 6px; }
.account-head h2 { margin: 0; font-family: var(--display); font-size: 24px; }
.account-tabs { display: flex; gap: 6px; padding: 6px 20px 0; border-bottom: 1px solid var(--sage-line); }
.account-tabs button {
  border: 0; background: none; padding: 10px 4px; margin-right: 14px; font-weight: 600; color: var(--muted);
  border-bottom: 3px solid transparent; cursor: pointer;
}
.account-tabs button[aria-selected="true"] { color: var(--bottle); border-bottom-color: var(--bottle); }
.account-form { padding: 16px 20px 4px; display: grid; gap: 4px; }
.account-form .btn { width: 100%; margin-top: 8px; }
.account-name { font-family: var(--display); font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.account-data { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 8px; font-size: 15px; }
.account-data dt { color: var(--muted); }
.account-data dd { margin: 0; }
.account-dialog .form-message { padding: 0 20px 16px; margin: 6px 0 0; }
/* El atributo hidden tiene que ganarle a los display de arriba. */
.account-form[hidden], .account-tabs[hidden], .account-note[hidden] { display: none; }

/* ---------- Celular ---------- */
@media (max-width: 720px) {
  .topbar-inner { grid-template-columns: 1fr auto; gap: 10px 12px; padding: 10px 16px 12px; }
  .search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .cart-button span:not(.cart-count) { display: none; }
  .account-button { padding: 9px 11px; max-width: 120px; }
  .account-button span { max-width: 70px; }
  .page { padding: 24px 16px 64px; }
  .sort { margin-left: 0; }
  .intro p { font-size: 16px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .price-tag { font-size: 18px; left: 8px; bottom: 8px; padding: 4px 10px 5px 15px; }
  .price-tag::before { left: 6px; width: 5px; height: 5px; }
  .card-name { font-size: 16px; }
  .card-desc { display: none; }
  .card-initial { font-size: 64px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .notice { margin: 12px 16px 0; }
  .brand-logo { height: 36px; max-width: 140px; }
  .site-footer-inner { padding: 24px 16px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer, .toast, .search { transition: none; }
}

/* Aviso destacado de la portada (Administración → Textos de la tienda) */
.store-alert {
  display: block; margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius-ctl);
  background: #FFF6D6; border: 1px solid var(--tag-edge); color: var(--ink); font-weight: 600;
}
.store-alert[hidden] { display: none; }
