/* =========================================================
   Componentes compartidos
   ========================================================= */

/* ---------- Barra superior + header ---------- */
.announce { background: var(--forest); color: var(--cream); text-align: center; font-size: var(--fs-xs); letter-spacing: .02em; padding: 9px max(16px, env(safe-area-inset-right, 0px)) 9px max(16px, env(safe-area-inset-left, 0px)); }
#site-header { position: sticky; top: calc(-1 * 36px + env(safe-area-inset-top, 0px)); z-index: 50; }
.header { background: var(--cream); transition: box-shadow .3s var(--ease), background .3s; }
.scrolled .header { box-shadow: 0 1px 0 var(--line), 0 10px 30px -20px rgba(20, 62, 38, .25); background: rgba(248, 245, 223, .94); backdrop-filter: saturate(1.2) blur(10px); }
.header__in { height: var(--header-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.scrolled .header__in { border-bottom-color: transparent; }
.header__logo { justify-self: center; color: var(--forest); }
.header__right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.header__burger { display: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav__item { position: relative; }
.nav__link { display: inline-flex; align-items: center; gap: 4px; padding: 10px 12px; font-size: .9rem; font-weight: 500; color: var(--forest); border-radius: 999px; transition: background .2s; }
.nav__link:hover, .nav__link.is-active { background: rgba(27, 81, 45, .07); }
.nav--right { margin-right: 8px; }

.mega {
  position: absolute; top: calc(100% + 12px); left: -12px; width: min(760px, 80vw);
  display: grid; grid-template-columns: 230px 1fr; gap: 24px;
  background: var(--white); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
}
.mega::before { content: ""; position: absolute; inset: -14px 0 auto; height: 14px; }
.has-mega:hover .mega, .has-mega:focus-within .mega { opacity: 1; visibility: visible; transform: none; }
.mega__cats { display: flex; flex-direction: column; gap: 2px; }
.mega__cat { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: 10px; font-size: var(--fs-sm); font-weight: 500; color: var(--ink); }
.mega__cat .ico { opacity: 0; transition: opacity .2s, transform .2s; }
.mega__cat:hover { background: var(--sage); color: var(--forest); }
.mega__cat:hover .ico { opacity: 1; transform: translateX(2px); }
.mega__all { margin-top: 10px; padding: 10px; font-size: var(--fs-sm); font-weight: 700; color: var(--forest); text-decoration: underline; text-underline-offset: 3px; }
.mega__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mega__prod { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px; border-radius: var(--r-md); background: var(--sage); font-size: var(--fs-xs); font-weight: 600; color: var(--forest); text-align: center; transition: background .2s; }
.mega__prod:hover { background: var(--sage-2); }
.mega__img { height: 92px; display: grid; place-items: end center; }
.mega__img img { max-height: 92px; width: auto; object-fit: contain; }

/* Logo (kit de marca) */
.logo { display: inline-flex; line-height: 0; }
.logo img { height: 34px; width: auto; }
.logo--sm img { height: 28px; }
.logo--lg img { height: 44px; }

/* Píldora carrito */
.cartpill { display: inline-flex; align-items: center; gap: 10px; padding: 5px 5px 5px 18px; border-radius: 999px; background: var(--forest); color: var(--white); font-size: .88rem; font-weight: 600; transition: background .2s; }
.cartpill:hover { background: var(--forest-d); }
.cartpill__ico { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--cream); color: var(--forest); display: grid; place-items: center; }
.cartpill__count { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #D9EBC8; color: var(--forest-d); font-size: .68rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--forest); font-variant-numeric: tabular-nums; }
.cartpill.bump .cartpill__ico { animation: bump .5s var(--ease); }
@keyframes bump { 40% { transform: scale(1.18); } }

@media (max-width: 1180px) {
  .nav--left .nav__item:nth-child(4), .nav--right { display: none; }
}
@media (max-width: 920px) {
  .nav--left { display: none; }
  .header__burger { display: inline-grid; justify-self: start; }
  .header__in { grid-template-columns: auto 1fr auto; }
  .header__logo { justify-self: center; }
  :root { --header-h: 64px; }
  .logo img { height: 28px; }
}
@media (max-width: 560px) {
  .cartpill__label, .hide-sm { display: none; }
  .cartpill { padding: 4px; }
  .header__right { gap: 0; }
}

/* ---------- Overlays / drawers ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.overlay.is-open { pointer-events: auto; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(20, 40, 28, .38); opacity: 0; transition: opacity .35s var(--ease); }
.is-open .drawer__scrim { opacity: 1; }
.drawer {
  position: absolute; top: 0; bottom: 0; width: min(440px, 100%); background: var(--white);
  display: flex; flex-direction: column; transition: transform .45s var(--ease);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.drawer--right { right: 0; transform: translateX(100%); border-radius: var(--r-lg) 0 0 var(--r-lg); padding-right: env(safe-area-inset-right, 0px); }
.drawer--left { left: 0; transform: translateX(-100%); width: min(380px, 92%); background: var(--cream); padding-left: env(safe-area-inset-left, 0px); }
.is-open .drawer { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 18px 24px; border-bottom: 1px solid var(--line); }
.drawer__title { font-size: 1.3rem; }
.drawer__title span { color: var(--muted); font-weight: 500; }
.drawer__foot { margin-top: auto; padding: 20px 24px 24px; border-top: 1px solid var(--line); display: grid; gap: 12px; background: var(--white); }

.cline-list { overflow-y: auto; padding: 8px 24px; flex: 1; }
.cline { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: start; }
.cline:last-child { border-bottom: 0; }
.cline__img { width: 76px; height: 88px; border-radius: 14px; background: var(--sage); display: grid; place-items: center; padding: 8px; color: var(--forest); }
.cline__img img { max-height: 100%; width: auto; object-fit: contain; }
.cline__info { min-width: 0; }
.cline__name { font-weight: 700; color: var(--forest); letter-spacing: -0.01em; }
.cline__meta { font-size: var(--fs-xs); color: var(--muted); margin: 2px 0 10px; }
.cline__row { display: flex; align-items: center; gap: 14px; }
.cline__price { font-weight: 700; color: var(--forest); font-variant-numeric: tabular-nums; font-size: .95rem; text-align: right; }
.cline__price .price--ask { font-size: var(--fs-xs); font-weight: 600; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; height: 36px; }
.stepper button { width: 34px; height: 100%; display: grid; place-items: center; color: var(--forest); border-radius: 999px; }
.stepper button:hover { background: var(--sage); }
.stepper span { min-width: 24px; text-align: center; font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; }
.stepper--lg { height: 54px; }
.stepper--lg button { width: 46px; }
.stepper--lg span { min-width: 30px; font-size: 1rem; }

.sum { display: grid; gap: 8px; margin: 0; }
.sum > div { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.sum__total { padding-top: 10px; border-top: 1px dashed var(--line); font-size: 1rem !important; }
.sum__total dt { color: var(--ink); font-weight: 700; }
.sum__total dd { color: var(--forest); font-size: 1.2rem; font-weight: 800; }
.sum__total small { display: block; font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 60px 24px; margin: auto; color: var(--muted); }
.empty__ico { width: 72px; height: 72px; border-radius: 50%; background: var(--sage); color: var(--forest); display: grid; place-items: center; }
.empty--wide { grid-column: 1 / -1; background: var(--cream); border-radius: var(--r-lg); padding: 56px 24px; width: 100%; }

/* Menú móvil */
.mnav { display: flex; flex-direction: column; padding: 10px 24px; }
.mnav__link { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; font-size: 1.35rem; font-weight: 600; letter-spacing: -0.03em; color: var(--forest); border-bottom: 1px solid var(--line); }
.mnav__link .ico { opacity: .4; }
.mnav__eyebrow { padding: 18px 24px 0; margin-bottom: 10px; }
.mnav__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 24px; }
.mnav__chips .chip { background: var(--white); }
.mnav__wa { margin: auto 24px 24px; width: auto; }

/* Búsqueda */
.overlay--top .search { position: absolute; inset: 0 0 auto; background: var(--cream); padding: calc(20px + env(safe-area-inset-top, 0px)) 0 28px; transform: translateY(-100%); transition: transform .45s var(--ease); max-height: 88vh; overflow-y: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.overlay--top.is-open .search { transform: none; }
.search__bar { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--forest); padding: 8px 0; color: var(--forest); }
.search__bar input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: clamp(1.2rem, 1rem + 1vw, 1.7rem); font-weight: 600; letter-spacing: -0.02em; color: var(--forest); outline: none; padding: 6px 0; }
.search__bar input::placeholder { color: var(--forest); opacity: .4; }
.search__chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.search__chips .chip { background: var(--white); }
.search__res { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sres { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); background: var(--white); transition: box-shadow .2s; }
.sres:hover { box-shadow: var(--shadow); }
.sres__img { width: 48px; height: 56px; border-radius: 10px; background: var(--sage); display: grid; place-items: center; padding: 5px; color: var(--forest); flex: none; }
.sres__img img { max-height: 100%; width: auto; }
.sres__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sres__txt strong { color: var(--forest); font-size: .95rem; }
.sres__txt small { color: var(--muted); font-size: var(--fs-xs); }
.search__empty { grid-column: 1 / -1; padding: 20px 0; color: var(--muted); }
.search__empty a { color: var(--forest); font-weight: 600; text-decoration: underline; }

/* ---------- Tarjeta de producto ---------- */
.card {
  position: relative; display: flex; flex-direction: column; border-radius: var(--r-lg);
  background: var(--sage); overflow: hidden; transition: background .35s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card:hover { background: var(--sage-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.card__link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card__link:focus-visible { outline-offset: -3px; }
.card__badge { position: absolute; top: 16px; left: 16px; z-index: 2; padding: 4px 11px; border-radius: 999px; background: var(--forest); color: var(--white); font-size: .7rem; font-weight: 700; letter-spacing: .02em; }
.card__flag { position: absolute; top: 16px; right: 16px; z-index: 2; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, .75); color: var(--forest); font-size: .68rem; font-weight: 700; }
.card__img { height: 270px; display: flex; padding: 38px 20px 6px; }
.card__img .media { height: 100%; }
.card__img .media img { transition: transform .6s var(--ease); }
.card:hover .card__img .media img { transform: translateY(-6px) scale(1.03); }
.card__body { padding: 8px 20px 18px; display: flex; flex-direction: column; flex: 1; }
.card__cat { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--forest-l); }
.card__name { font-size: 1.08rem; letter-spacing: -0.02em; margin-top: 4px; }
.card__meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }
.card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 14px; gap: 10px; }
.card__foot .iconbtn { position: relative; z-index: 2; }

.media { position: relative; width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.media img { max-height: 100%; max-width: 100%; width: auto; object-fit: contain; filter: drop-shadow(0 18px 18px rgba(20, 62, 38, .16)); }
.media[data-shape="box"] img { max-height: 78%; }
.media--duo { display: block; }
.media--duo img { position: absolute; bottom: 0; height: 82%; width: auto; max-width: none; object-fit: contain; filter: drop-shadow(0 16px 16px rgba(20, 62, 38, .16)); }
.media--duo .media__a { left: 50%; transform: translateX(-88%); }
.media--duo .media__b { left: 50%; transform: translateX(-8%); height: 88%; }
.card:hover .media--duo .media__a { transform: translateX(-92%) translateY(-4px); }
.card:hover .media--duo .media__b { transform: translateX(-4%) translateY(-6px); }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1080px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 780px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .card__img { height: 210px; padding: 30px 12px 4px; } .card__body { padding: 6px 14px 14px; } .card__name { font-size: .98rem; } }
@media (max-width: 380px) { .grid { grid-template-columns: 1fr; } .card__img { height: 240px; } }

/* ---------- Acordeón ---------- */
.acc { display: flex; flex-direction: column; }
.acc__item { border-bottom: 1px solid var(--line); }
.acc__item summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 0; font-weight: 600; font-size: 1.05rem; color: var(--forest); letter-spacing: -0.01em; }
.acc__item summary::-webkit-details-marker { display: none; }
.acc__item summary small { display: block; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.acc__item summary i { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--sage); display: grid; place-items: center; transition: transform .35s var(--ease), background .2s; }
.acc__item[open] summary i { transform: rotate(45deg); background: var(--forest); color: var(--white); }
.acc__body { padding: 0 56px 22px 0; color: var(--ink); display: grid; gap: 12px; }
.acc__body p { max-width: 64ch; }
.acc__item[open] .acc__body { animation: accIn .45s var(--ease); }
@keyframes accIn { from { transform: translateY(-6px); } }

/* ---------- Formularios ---------- */
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f--full { grid-column: 1 / -1; }
.f label { font-size: var(--fs-sm); font-weight: 600; color: var(--forest); }
.f label em { font-style: normal; color: var(--muted); font-weight: 500; }
.f input, .f textarea, .f select, .field input, .field select {
  width: 100%; border: 1.5px solid var(--line); background: var(--white); border-radius: 14px;
  padding: 13px 15px; font-size: 1rem; transition: border-color .2s, box-shadow .2s; appearance: none;
}
.f textarea { resize: vertical; min-height: 64px; }
.f input:focus, .f textarea:focus, .f select:focus, .field input:focus, .field select:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 4px rgba(27, 81, 45, .1); }
.f [aria-invalid="true"] { border-color: var(--danger); }
.f__err { color: var(--danger); font-size: var(--fs-xs); font-weight: 600; min-height: 0; }
.f__err:empty { display: none; }
.f__hint { color: var(--muted); font-size: var(--fs-xs); }
.selectwrap { position: relative; }
.selectwrap .ico { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--forest); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: var(--fs-sm); cursor: pointer; line-height: 1.5; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line); background: var(--white); display: grid; place-items: center; color: transparent; margin-top: 1px; transition: all .2s; }
.check input:checked + .check__box { background: var(--forest); border-color: var(--forest); color: var(--white); }
.check input:focus-visible + .check__box { outline: 2px solid var(--forest); outline-offset: 2px; }
.check a { color: var(--forest); font-weight: 600; text-decoration: underline; }
@media (max-width: 600px) { .fgrid { grid-template-columns: 1fr; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 90;
  transform: translate(-50%, 140%); visibility: hidden; display: flex; align-items: center; gap: 10px;
  background: var(--forest-d); color: var(--white); padding: 12px 12px 12px 18px; border-radius: 999px;
  font-size: var(--fs-sm); box-shadow: var(--shadow-lg); transition: transform .45s var(--ease), visibility .45s; max-width: calc(100% - 32px);
}
.toast.is-on { transform: translate(-50%, 0); visibility: visible; }
.toast strong { font-weight: 700; }
.toast__btn { background: var(--cream); color: var(--forest); padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: var(--fs-xs); white-space: nowrap; }

/* ---------- Migas ---------- */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 22px; }
.crumbs a:hover, .crumbs .linkbtn { color: var(--forest); }
.crumbs .linkbtn { font-size: var(--fs-xs); text-decoration: none; font-weight: 500; }
.crumbs span { color: var(--forest); font-weight: 600; }
.crumbs .ico { opacity: .5; }

/* ---------- Footer ---------- */
.footer { background: var(--forest); color: rgba(248, 245, 223, .82); padding-block: 72px 32px; margin-top: 40px; border-radius: var(--r-xl) var(--r-xl) 0 0; overflow: hidden; }
.footer__top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 56px; }
.footer__brand { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.footer__brand p { max-width: 34ch; font-size: var(--fs-sm); }
.footer__cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.footer__cols > div { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.footer h4 { color: var(--cream); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; font-family: var(--font); font-weight: 700; }
.footer__cols a, .footer__muted { font-size: var(--fs-sm); color: rgba(248, 245, 223, .78); transition: color .2s; }
.footer__cols a:hover { color: var(--white); }
.footer .pending { color: #F3D9A4; background: rgba(255, 255, 255, .06); margin-left: 0; }
.footer__muted .pending { margin-left: 4px; }
.footer__pend { color: #F3D9A4 !important; }
.footer__word { margin: 64px 0 28px; opacity: .12; overflow: hidden; }
.footer__word .logo img { height: auto; width: 100%; max-width: 1100px; }
.footer__legal { border-top: 1px solid rgba(248, 245, 223, .16); padding-top: 22px; display: grid; gap: 6px; font-size: var(--fs-xs); }
@media (max-width: 960px) { .footer__top { grid-template-columns: 1fr; gap: 40px; } .footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .footer__cols { grid-template-columns: 1fr 1fr; gap: 24px 16px; } }
