/* style.css — public catalog, mobile-first.
 *
 * A marketplace-shaped storefront: a full-height slide-in category menu, a
 * persistent search field, a category chip rail, a 2-up product grid, and a
 * product page with a swipeable image carousel + breadcrumb. The shell copies
 * the patterns shoppers already know from big resale apps; the skin keeps the
 * store's own identity — a serif carries each product name, a monospace carries
 * every price, a single hairline "shelf rule" sits the price under the name.
 * No web fonts.
 */

/* ---------------------------------------------------------------- tokens */
:root {
  --paper: #f4f2ef;     /* warm near-white ground */
  --card: #ffffff;
  --ink: #1a1a1e;       /* near-black */
  --ink-2: #6b6b73;     /* secondary text */
  --ink-3: #9a9aa2;     /* meta / faint */
  --line: #e8e6e1;      /* hairlines, borders, shelf rule */
  --line-2: #d9d6cf;    /* stronger hairline: inputs, hover */
  --gold: #8a6d3b;      /* the one metallic accent — discount + flourish */
  --wa: #25d366;        /* WhatsApp action */
  --wa-press: #1da851;
  --stop: #b23c3c;      /* "Agotado" + saved heart — muted brick */
  --focus: #1b57c9;

  --shadow-sm: 0 1px 2px rgba(20, 18, 15, 0.04), 0 3px 10px rgba(20, 18, 15, 0.06);
  --shadow-md: 0 6px 16px rgba(20, 18, 15, 0.10), 0 16px 40px rgba(20, 18, 15, 0.12);

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino,
    "Book Antiqua", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo,
    Consolas, "Liberation Mono", monospace;

  --pad: 16px;
  --gap: 14px;
  --maxw: 1120px;
  --r: 14px;
  --r-sm: 9px;
  --tap: 46px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131316;
    --card: #1b1b1f;
    --ink: #ededed;
    --ink-2: #a6a6ae;
    --ink-3: #75757d;
    --line: #2a2a30;
    --line-2: #3a3a42;
    --gold: #c79a56;
    --stop: #e0736c;
    --focus: #6ea8ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.5), 0 20px 48px rgba(0, 0, 0, 0.5);
  }
}

/* ----------------------------------------------------------------- reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip; /* not "hidden" — that breaks position: sticky on the topbar */
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

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

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* ---------------------------------------------------------------- layout */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--pad);
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.topbar-bar {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 54px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tb-burger {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.tb-burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.tb-brand {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-home {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
}

.tb-search {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 12px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.tb-search-ico {
  position: absolute;
  left: 24px;
  color: var(--ink-3);
  pointer-events: none;
}

.tb-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}

.tb-search input::placeholder {
  color: var(--ink-3);
}

@media (min-width: 760px) {
  .topbar-bar { min-height: 62px; }
  .tb-brand { text-align: left; font-size: 1.3rem; padding-left: 4px; }
  .tb-search { padding-bottom: 12px; }
  .tb-search input { max-width: 460px; margin-left: auto; }
  .tb-search-ico { left: auto; right: calc(460px + 12px); }
}

/* ------------------------------------------------------------------ menu */
.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(10, 10, 12, 0.44);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.26s ease, visibility 0s linear 0.26s;
}

.menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.28s;
}

body.menu-open {
  overflow: hidden;
}

body.menu-open .menu {
  transform: none;
  visibility: visible;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

body.menu-open .menu-scrim {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.26s ease;
}

.menu-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 8px 14px 20px;
  border-bottom: 1px solid var(--line);
}

.menu-brand {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-x {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 1.7rem;
  line-height: 1;
}

.menu-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 6px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 20px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.02rem;
  border-bottom: 1px solid var(--line);
}

.menu-item:first-child {
  border-top: 1px solid var(--line);
}

.menu-item-sub {
  font-size: 0.95rem;
  color: var(--ink-2);
  min-height: 46px;
}

.menu-item.is-active {
  font-weight: 700;
  background: var(--paper);
}

.menu-chev {
  color: var(--ink-3);
  font-size: 1.3rem;
  line-height: 1;
}

.menu-label {
  margin: 18px 0 4px;
  padding: 0 20px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

.menu-foot {
  flex: 0 0 auto;
  margin: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-3);
}

/* ----------------------------------------------------------------- chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 14px;
  margin-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

.chip.is-on {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--card);
  font-weight: 600;
}

.result-note {
  margin: 2px 0 16px;
  font-size: 0.92rem;
  color: var(--ink-2);
}

.result-note a {
  color: var(--ink);
  text-underline-offset: 2px;
}

/* ------------------------------------------------------------------ grid */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap) 12px;
}

@media (min-width: 620px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px 18px;
  }
}

@media (min-width: 940px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 28px 20px;
  }
}

.card {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  text-decoration: none;
}

.card-photo {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
}

.card-img,
.card-noimg {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--paper);
  transition: transform 0.35s ease;
}

@media (hover: hover) {
  .card:hover .card-img {
    transform: scale(1.04);
  }
}

.card:active {
  opacity: 0.9;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 2px 4px;
}

.card .brand {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
}

.card .name {
  font-family: var(--serif);
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-block {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.price {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.price-was {
  font-family: var(--mono);
  font-size: 0.74rem;
  text-decoration: line-through;
  color: var(--ink-3);
}

.badge-disc {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold);
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0 4px;
}

.badge-agotado {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(26, 26, 30, 0.82);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-save {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}

.card-save[aria-pressed="true"] {
  color: var(--stop);
}

.card-save[aria-pressed="true"] svg path {
  fill: currentColor;
}

.empty {
  padding: 64px 16px;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink-2);
}

/* -------------------------------------------------------- product detail */
.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.76rem;
  color: var(--ink-3);
  overflow: hidden;
}

.crumbs a {
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}

.crumbs .crumbs-here {
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumbs-sep {
  color: var(--line-2);
}

.producto-grid {
  display: grid;
  gap: 22px;
}

@media (min-width: 780px) {
  .producto-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
    gap: 40px;
    align-items: start;
  }
}

.gallery {
  min-width: 0;
}

/* ---- carousel ---- */
.carousel {
  position: relative;
}

.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--card);
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  padding: 0;
  border: 0;
  background: none;
  display: block;
}

.carousel-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  padding-top: 12px;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line-2);
}

.carousel-dot.is-on {
  background: var(--ink);
}

.hero-noimg {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}

/* ---- info ---- */
.info {
  min-width: 0;
}

.info-brand {
  margin: 0 0 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

.info h1 {
  font-size: 1.5rem;
}

.info .price-block {
  margin-top: 14px;
  padding-top: 14px;
  gap: 12px;
}

.info .price {
  font-size: 1.4rem;
}

.info .price-was {
  font-size: 0.95rem;
}

.info-cat {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--ink-2);
}

.info-cat a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stock-note {
  margin: 14px 0 0;
  color: var(--stop);
  font-weight: 600;
  font-size: 0.9rem;
}

.desc {
  margin: 18px 0 0;
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--ink);
}

/* mobile-first: a fixed action bar pinned to the bottom of the viewport */
.actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 10px;
  margin: 0;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}

/* keep page content clear of the fixed bar */
.producto {
  padding-bottom: 92px;
}

.btn-wa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--wa);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.btn-wa:active {
  background: var(--wa-press);
}

.wa-icon {
  display: block;
  flex: 0 0 auto;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  width: 50px;
  min-height: 50px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink-2);
  font-weight: 600;
}

.share-icon {
  display: block;
  flex: 0 0 auto;
}

.btn-share-label {
  display: none;
}

@media (min-width: 780px) {
  .actions {
    position: static;
    margin-top: 24px;
    flex-wrap: wrap;
    padding: 0;
    border-top: 0;
    background: transparent;
  }

  .producto {
    padding-bottom: var(--pad);
  }

  .btn-wa {
    flex: 0 0 auto;
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.28);
  }

  .btn-share {
    width: auto;
    padding: 0 20px;
  }

  .btn-share-label {
    display: inline;
  }
}

/* ------------------------------------------------------------ lightbox */
body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0b0b0d;
  touch-action: none;
  overscroll-behavior: contain;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.08s linear;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-close,
.lightbox-nav,
.lightbox-zoom button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  line-height: 1;
}

.lightbox-close {
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  font-size: 1.5rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  font-size: 1.7rem;
}

.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.lightbox-zoom {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.lightbox-zoom button {
  position: static;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
}

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 230;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--card);
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease, toast-out 0.35s ease 1.6s forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu,
  body.menu-open .menu,
  .menu-scrim {
    transition: none;
  }

  .card-img,
  .card:hover .card-img {
    transition: none;
    transform: none;
  }

  .lightbox-img {
    transition: none;
  }

  .toast {
    animation: none;
  }
}
