/* ---------- Tokens ---------- */
:root{
  /* marca */
  --verde:#9cc816;
  --verde-osc:#86ae0d;
  --verde-claro:#f1f8dd;
  --rojo:#e02b20;
  --rojo-osc:#c4231a;
  --wsp:#25d366;

  /* superficies y texto */
  --bg:#ffffff;
  --surface:#ffffff;
  --surface-2:#f5f6f7;
  --line:#e3e6e8;
  --text:#2e3a43;
  --titulo:#3f5262;
  --muted:#6b7a85;
  --oscuro:#3f5262;
  --oscuro-hover:#33424f;
  --on-oscuro:#ffffff;

  --on-verde:#ffffff;
  --on-text:#ffffff;
  --disabled:#c9ced3;
  --chip-hover:#d3d7db;
  --scrim:rgba(20,23,26,.42);
  --error:#e02b20;

  /* hero: verde de marca sobre superficie clara */
  --hero-glow:rgba(156,200,22,.22);
  --hero-cruz:rgba(156,200,22,.13);

  --radius:8px;
  --shadow:0 1px 2px rgba(46,58,67,.06), 0 8px 22px rgba(46,58,67,.09);
  --wrap:1200px;
}

*{box-sizing:border-box}
/* `display` en una clase gana sobre el `[hidden]` del navegador: hay que forzarlo */
[hidden]{display:none!important}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:Poppins,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,p,ul{margin:0}
ul{list-style:none;padding:0}
button{font:inherit;color:inherit}
a{color:inherit;text-decoration:none}
:focus-visible{outline:3px solid var(--verde);outline-offset:2px;border-radius:4px}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

.wrap{max-width:var(--wrap);margin:0 auto;padding:0 24px}
.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;
}
.skip{position:absolute;left:-9999px}
.skip:focus{left:16px;top:16px;background:var(--oscuro);color:var(--on-oscuro);padding:10px 14px;border-radius:6px;z-index:80}

/* ---------- Header ---------- */
.topbar{position:sticky;top:0;z-index:30}

.topbar__top{background:var(--surface);border-bottom:1px solid var(--line)}
.topbar__inner{display:flex;align-items:center;gap:28px;padding-top:14px;padding-bottom:14px}

.logo{display:flex;align-items:center;gap:9px;flex:none}
.logo__mark{
  display:grid;place-items:center;width:34px;height:34px;border-radius:6px;
  background:var(--verde);color:var(--on-verde);font-weight:700;font-size:22px;line-height:1;
}
.logo__text{
  font-size:19px;font-weight:600;letter-spacing:-.01em;color:var(--titulo);
  text-transform:uppercase;line-height:1;
}
.logo__text b{font-weight:800;color:var(--verde)}

/* buscador con botón verde */
.search{display:flex;flex:1;max-width:520px}
.search input{
  flex:1;min-width:0;height:44px;padding:0 16px;
  border:1px solid var(--line);border-right:0;border-radius:4px 0 0 4px;
  background:var(--surface-2);font:inherit;font-size:14.5px;color:var(--text);outline:none;
}
.search input::placeholder{color:var(--muted)}
.search input:focus{background:var(--surface);border-color:var(--verde)}
.search__btn{
  flex:none;width:56px;height:44px;display:grid;place-items:center;
  border:0;border-radius:0 4px 4px 0;background:var(--verde);color:var(--on-verde);
  cursor:pointer;transition:background .16s;
}
.search__btn:hover{background:var(--verde-osc)}

/* accesos de la derecha */
.acciones{display:flex;align-items:center;gap:26px;margin-left:auto;flex:none}
.accion{
  position:relative;display:flex;align-items:center;gap:8px;
  border:0;background:none;padding:0;cursor:pointer;
  font-size:13.5px;font-weight:600;text-transform:uppercase;letter-spacing:.02em;
  color:var(--titulo);transition:color .16s;
}
.accion:hover{color:var(--verde)}
.accion svg{color:var(--verde);width:22px;height:22px}
.accion__count{
  position:absolute;top:-8px;left:12px;min-width:19px;height:19px;padding:0 5px;
  display:grid;place-items:center;border-radius:999px;
  background:var(--rojo);color:#fff;font-size:11px;font-weight:700;letter-spacing:0;
}

/* banda verde de categorías */
.navbar{background:var(--verde)}
.nav__inner{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:4px}
.chip--destacado{background:var(--rojo);margin-left:6px}
.chip--destacado:hover{background:var(--rojo-osc)}
.chips{
  display:flex;align-items:center;justify-content:center;flex-wrap:wrap;
  gap:4px;padding-top:4px;padding-bottom:4px;
}
.chip{
  border:0;background:none;cursor:pointer;
  padding:14px 22px;
  font-size:14px;font-weight:700;text-transform:uppercase;letter-spacing:.03em;
  color:var(--on-verde);transition:background .16s;
}
.chip:hover{background:rgba(255,255,255,.18)}
.chip[aria-selected="true"]{background:rgba(255,255,255,.28)}

/* ---------- Hero ---------- */
.hero{
  position:relative;overflow:hidden;
  padding:96px 0 84px;
  border-bottom:1px solid var(--line);
  background:radial-gradient(circle at 88% 22%, var(--hero-glow), transparent 46%), var(--surface-2);
  color:var(--text);
}
/* cruz de farmacia como marca de agua, hecha con dos barras */
.hero::after{
  content:"";position:absolute;right:7%;top:50%;
  width:230px;height:230px;transform:translateY(-50%) rotate(-8deg);
  background:
    linear-gradient(var(--hero-cruz),var(--hero-cruz)) center/32% 100% no-repeat,
    linear-gradient(var(--hero-cruz),var(--hero-cruz)) center/100% 32% no-repeat;
  pointer-events:none;
}
.hero__inner{position:relative;z-index:1;max-width:640px}
.hero h1{
  font-size:clamp(30px,4.6vw,46px);font-weight:800;line-height:1.1;color:var(--titulo);
  text-transform:uppercase;letter-spacing:-.01em;text-wrap:balance;
}
.hero h1 em{font-style:normal;color:var(--verde)}
.hero p{margin-top:16px;color:var(--muted);font-size:16.5px;line-height:1.65}
.hero__badges{display:flex;flex-wrap:wrap;gap:8px;margin-top:26px}
.hero__badges li{
  font-size:12.5px;font-weight:600;text-transform:uppercase;letter-spacing:.03em;
  color:var(--muted);background:var(--surface);
  border:1px solid var(--line);border-radius:999px;padding:7px 14px;
}

/* ---------- Catálogo ---------- */
.titulo-seccion{
  text-align:center;padding-top:52px;
  font-size:clamp(20px,2.6vw,27px);font-weight:700;
  text-transform:uppercase;letter-spacing:.02em;color:var(--verde);
}
.titulo-seccion span{display:block;margin-top:8px;font-size:14px;font-weight:400;text-transform:none;letter-spacing:0;color:var(--muted)}

.toolbar{display:flex;align-items:center;justify-content:flex-end;gap:16px;padding:26px 0 20px;flex-wrap:wrap}
.select{
  height:40px;border:1px solid var(--line);border-radius:4px;background:var(--surface);
  padding:0 12px;font:inherit;font-size:13.5px;color:var(--text);cursor:pointer;outline:none;
}
.select:focus{border-color:var(--verde)}

.grid{
  display:grid;gap:20px;padding-bottom:64px;
  grid-template-columns:repeat(auto-fill,minmax(232px,1fr));
}
.card{
  position:relative;display:flex;flex-direction:column;
  border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);
  padding:18px;transition:box-shadow .2s,transform .2s;
}
.card:hover{box-shadow:var(--shadow);transform:translateY(-3px)}
.card__thumb{
  height:120px;border-radius:6px;background:var(--surface-2);
  display:grid;place-items:center;font-size:42px;margin-bottom:16px;
}
.card__tag{
  position:absolute;top:14px;left:14px;
  background:var(--rojo);color:#fff;
  font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;
  padding:5px 12px;border-radius:999px;
}
.card__cat{font-size:11px;font-weight:600;color:var(--verde);text-transform:uppercase;letter-spacing:.07em}
.card__name{font-size:15px;font-weight:600;margin-top:7px;line-height:1.35;color:var(--titulo)}
.card__desc{font-size:13px;color:var(--muted);margin-top:6px;line-height:1.55;flex:1}
.card__foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:18px}
.card__price{font-size:20px;font-weight:800;color:var(--titulo);letter-spacing:-.02em}

.btn{
  border:1px solid var(--line);background:var(--surface);border-radius:4px;
  padding:10px 16px;font:inherit;font-size:13px;font-weight:700;
  text-transform:uppercase;letter-spacing:.03em;cursor:pointer;transition:.16s;
}
.btn:hover{border-color:var(--titulo)}
.btn--primary{background:var(--verde);border-color:var(--verde);color:var(--on-verde)}
.btn--primary:hover{background:var(--verde-osc);border-color:var(--verde-osc)}
.btn--primary:disabled{background:var(--disabled);border-color:var(--disabled);color:var(--muted);cursor:not-allowed}
.btn--full{width:100%;padding:14px;font-size:14px}

.vacio{text-align:center;color:var(--muted);padding:64px 0 96px;font-size:15px}

/* ---------- Ofertas (folletos) ---------- */
.ofertas{background:var(--surface-2);padding-bottom:60px;border-top:1px solid var(--line)}
.promos{
  display:grid;gap:18px;margin-top:30px;
  grid-template-columns:repeat(auto-fill,minmax(210px,1fr));
}
.promo{
  position:relative;display:block;padding:0;overflow:hidden;
  border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);
  cursor:zoom-in;transition:box-shadow .2s,transform .2s;
}
.promo:hover{box-shadow:var(--shadow);transform:translateY(-3px)}
.promo img{display:block;width:100%;height:auto;aspect-ratio:620/1102;object-fit:cover}
.promo__pie{
  display:block;padding:11px 12px;
  font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;
  color:var(--titulo);border-top:1px solid var(--line);
}

/* visor a pantalla completa */
.lightbox{position:fixed;inset:0;z-index:70;display:grid;place-items:center;padding:24px}
.lightbox__fondo{position:absolute;inset:0;background:rgba(10,14,18,.9);cursor:zoom-out}
.lightbox__figura{position:relative;margin:0;max-height:100%;display:flex;flex-direction:column;align-items:center;gap:12px}
.lightbox__figura img{
  max-width:min(560px,100%);max-height:calc(100vh - 120px);
  width:auto;height:auto;border-radius:var(--radius);background:#fff;
}
.lightbox__pie{
  font-size:12.5px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;
  color:rgba(255,255,255,.82);
}
.lightbox__cerrar,.lightbox__nav{
  position:absolute;z-index:2;display:grid;place-items:center;
  width:46px;height:46px;border:0;border-radius:999px;
  background:rgba(255,255,255,.14);color:#fff;cursor:pointer;transition:background .16s;
}
.lightbox__cerrar:hover,.lightbox__nav:hover{background:rgba(255,255,255,.28)}
.lightbox__cerrar{top:20px;right:20px}
.lightbox__nav--prev{left:20px;top:50%;transform:translateY(-50%)}
.lightbox__nav--next{right:20px;top:50%;transform:translateY(-50%)}
.lightbox svg{width:24px;height:24px}

/* ---------- Newsletter ---------- */
.news{background:var(--verde);color:var(--on-verde)}
.news__inner{
  display:flex;align-items:center;justify-content:space-between;gap:32px;flex-wrap:wrap;
  padding-top:44px;padding-bottom:44px;
}
.news__texto{max-width:480px}
.news__texto h2{font-size:23px;font-weight:800;text-transform:uppercase;letter-spacing:.01em}
.news__texto p{margin-top:8px;font-size:14px;line-height:1.6;color:rgba(255,255,255,.92)}
.news__form{display:flex;gap:8px;flex-wrap:wrap}
.news__form input{
  width:270px;height:46px;padding:0 16px;
  border:1px solid transparent;border-radius:4px;background:var(--surface);
  font:inherit;font-size:14.5px;color:var(--text);outline:none;
}
.news__form input::placeholder{color:var(--muted)}
.news__form input:focus{border-color:var(--titulo)}
.news__form input[aria-invalid="true"]{border-color:var(--rojo)}
.news__form .btn{height:46px;padding:0 26px;background:var(--oscuro);border-color:var(--oscuro);color:var(--on-oscuro)}
.news__form .btn:hover{background:var(--oscuro-hover);border-color:var(--oscuro-hover)}
.news__error{flex-basis:100%;font-size:13px;font-weight:600;color:#fff2f1}

/* ---------- Footer ---------- */
.footer{background:var(--oscuro);color:var(--on-oscuro)}
.footer__inner{
  display:flex;justify-content:space-between;gap:24px;flex-wrap:wrap;
  padding-top:32px;padding-bottom:32px;
}
.footer p{font-size:13px;color:var(--on-oscuro);opacity:.78;line-height:1.6}
.footer b{font-weight:600;opacity:1}

/* ---------- WhatsApp flotante ---------- */
.wsp{
  position:fixed;right:22px;bottom:22px;z-index:35;
  width:58px;height:58px;display:grid;place-items:center;border-radius:999px;
  background:var(--wsp);color:#fff;box-shadow:0 6px 20px rgba(37,211,102,.42);
  transition:transform .18s;
}
.wsp:hover{transform:scale(1.06)}
.wsp svg{width:31px;height:31px;stroke:none;fill:currentColor}

/* ---------- Carrito ---------- */
.overlay{position:fixed;inset:0;background:var(--scrim);z-index:40;animation:fade .2s ease}
@keyframes fade{from{opacity:0}to{opacity:1}}

.drawer{
  position:fixed;top:0;right:0;bottom:0;width:min(410px,100%);z-index:50;
  background:var(--surface);
  display:flex;flex-direction:column;
  transform:translateX(100%);transition:transform .28s cubic-bezier(.32,.72,0,1);
}
.drawer.is-open{transform:none}
.drawer__head{
  display:flex;align-items:center;justify-content:space-between;
  padding:20px 24px;background:var(--verde);color:var(--on-verde);
}
.drawer__head h2{font-size:16px;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.icon-btn{width:34px;height:34px;display:grid;place-items:center;border:0;background:none;border-radius:6px;cursor:pointer}
.icon-btn:hover{background:rgba(255,255,255,.2)}

.drawer__body{flex:1;overflow-y:auto;padding:8px 24px}
.linea{display:flex;gap:14px;align-items:center;padding:16px 0;border-bottom:1px solid var(--line)}
.linea__emoji{width:50px;height:50px;flex:none;display:grid;place-items:center;border-radius:6px;background:var(--surface-2);font-size:24px}
.linea__info{flex:1;min-width:0}
.linea__name{font-size:14px;font-weight:600;line-height:1.35;color:var(--titulo)}
.linea__price{font-size:13px;color:var(--muted);margin-top:3px}
.linea__price b{color:var(--titulo)}
.qty{display:flex;align-items:center;gap:2px;border:1px solid var(--line);border-radius:4px;padding:2px}
.qty button{width:28px;height:28px;border:0;background:none;border-radius:4px;cursor:pointer;font-size:16px;line-height:1;color:var(--muted)}
.qty button:hover{background:var(--verde-claro);color:var(--verde-osc)}
.qty span{min-width:22px;text-align:center;font-size:13.5px;font-weight:700}

.drawer__empty{text-align:center;color:var(--muted);padding:72px 0;font-size:14.5px;line-height:1.7}

.drawer__foot{padding:20px 24px 24px;border-top:1px solid var(--line);background:var(--surface)}
.row{display:flex;justify-content:space-between;align-items:center;font-size:14px;margin-bottom:9px}
.row.muted{color:var(--muted);font-size:13px}
.row.total{font-size:19px;font-weight:800;color:var(--titulo);margin:14px 0 16px;padding-top:14px;border-top:1px solid var(--line)}
.fine{text-align:center;font-size:11.5px;color:var(--muted);margin-top:12px}

/* ---------- Toast ---------- */
.toast{
  position:fixed;left:50%;bottom:28px;transform:translate(-50%,80px);
  background:var(--oscuro);color:var(--on-oscuro);padding:13px 22px;border-radius:4px;
  font-size:14px;font-weight:500;z-index:60;opacity:0;pointer-events:none;transition:.28s;
}
.toast.is-visible{transform:translate(-50%,0);opacity:1}

/* ---------- Responsive ---------- */
@media (max-width:980px){
  .topbar{position:static}
  .topbar__inner{flex-wrap:wrap;gap:16px}
  .search{order:3;flex-basis:100%;max-width:none}
  .acciones{gap:18px}
  .accion span{display:none}
  .accion__count{left:14px}
  .nav__inner{justify-content:flex-start;flex-wrap:nowrap;overflow-x:auto}
  .chips{justify-content:flex-start;flex-wrap:nowrap}
  .chip--destacado{margin-left:0}
  .chip{white-space:nowrap;padding:13px 16px;font-size:13px}
}

@media (max-width:760px){
  .hero{padding:72px 0 60px}
  .grid{grid-template-columns:repeat(auto-fill,minmax(158px,1fr));gap:12px}
  .card{padding:14px}
  .card__thumb{height:88px;font-size:32px}
  .card__price{font-size:17px}
  .news__form{width:100%}
  .news__form input{flex:1;width:auto;min-width:0}
  .wsp{width:52px;height:52px;right:16px;bottom:16px}
  .promos{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
  .lightbox{padding:12px}
  .lightbox__nav{width:40px;height:40px}
  .lightbox__nav--prev{left:8px}
  .lightbox__nav--next{right:8px}
}

@media (prefers-reduced-motion:reduce){
  *{transition:none!important;animation:none!important}
  html{scroll-behavior:auto}
}

/* ---------- Tema oscuro ---------- */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --verde:#a8d327;
    --verde-osc:#b9e03f;
    --verde-claro:#1d2a10;
    --rojo:#f0554a;
    --rojo-osc:#d94437;
    --hero-glow:rgba(168,211,39,.16);
    --hero-cruz:rgba(168,211,39,.10);

    --bg:#12161a;
    --surface:#181d22;
    --surface-2:#1f252b;
    --line:#2a3238;
    --text:#e6ebef;
    --titulo:#eef2f5;
    --muted:#9aa7b1;
    --oscuro:#0d1114;
    --oscuro-hover:#1a2027;
    --on-oscuro:#eef2f5;

    --on-verde:#14200a;
    --on-text:#12161a;
    --disabled:#2c3439;
    --chip-hover:#3a4247;
    --scrim:rgba(0,0,0,.55);
    --error:#f0554a;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"]{
  --verde:#a8d327;
  --verde-osc:#b9e03f;
  --verde-claro:#1d2a10;
  --rojo:#f0554a;
  --rojo-osc:#d94437;
  --hero-glow:rgba(168,211,39,.16);
  --hero-cruz:rgba(168,211,39,.10);

  --bg:#12161a;
  --surface:#181d22;
  --surface-2:#1f252b;
  --line:#2a3238;
  --text:#e6ebef;
  --titulo:#eef2f5;
  --muted:#9aa7b1;
  --oscuro:#0d1114;
  --oscuro-hover:#1a2027;
  --on-oscuro:#eef2f5;

  --on-verde:#14200a;
  --on-text:#12161a;
  --disabled:#2c3439;
  --chip-hover:#3a4247;
  --scrim:rgba(0,0,0,.55);
  --error:#f0554a;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.4);
}
