/* Seu Mercado — loja de demonstração. Sem frameworks. */
:root {
  --green: #103e2d;
  --green-2: #1b5a41;
  --green-soft: #e5efe8;
  --gold: #ecc573;
  --gold-deep: #c99a3a;
  --red: #a62d37;
  --ink: #17261f;
  --muted: #5d6d63;
  --line: #dfe6e0;
  --bg: #f4f6f3;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(16, 62, 45, .10);
  --bar: 68px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar) + 64px); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.1; margin: 0; letter-spacing: -.01em; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--green); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }
:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 3px; border-radius: 6px; }

/* Aviso de demonstração */
.demo-bar { background: #fff2d5; color: #6b4a17; font-size: 13px; text-align: center; padding: 7px 16px; border-bottom: 1px solid #f0dcae; }

/* Cabeçalho */
.top { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.top__in { height: var(--bar); display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand__logo { width: 44px; height: 44px; object-fit: contain; }
.brand__name { font-weight: 800; font-size: 19px; color: var(--green); letter-spacing: -.02em; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; max-width: 520px; margin-left: auto; }
.search:focus-within { border-color: var(--green-2); background: #fff; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--ink); outline: none; }
.cart-btn { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 12px; border: 0; border-radius: 999px; background: var(--green); color: #fff; font-weight: 700; cursor: pointer; flex-shrink: 0; }
.cart-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cart-btn__count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--green); font-size: 12px; display: grid; place-items: center; }
.cart-btn__total { font-size: 14px; font-variant-numeric: tabular-nums; }
.cart-btn__total:empty { display: none; }
.cart-btn.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.06); } }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 12px; border: 0; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn--gold { background: var(--gold); color: var(--green); }
.btn--gold:hover { background: #f2d089; }
.btn--green { background: var(--green); color: #fff; }
.btn--green:hover { background: var(--green-2); }
.btn--ghost { background: transparent; color: var(--green); border: 1px solid var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; font-size: 18px; }
.icon-btn:hover { background: var(--bg); }

/* ---------------- Topo ---------------- */
.hero { position: relative; overflow: hidden; isolation: isolate; color: #fff; background: var(--green); }
.hero__photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero__shade { position: absolute; inset: 0; z-index: -1; }
.hero__in { position: relative; min-height: clamp(420px, 58vh, 560px); display: flex; align-items: center; padding-top: 48px; padding-bottom: 48px; }
.hero--natal .hero__in { min-height: clamp(480px, 62vh, 600px); padding-top: clamp(120px, 13vw, 180px); }
.hero__copy { max-width: 560px; }
.hero__eyebrow { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--gold); }
.hero h1 { font-size: clamp(38px, 5.6vw, 64px); font-weight: 800; letter-spacing: -.03em; margin: 14px 0 16px; }
.hero p { font-size: 18px; color: #e1ebe4; max-width: 30em; margin: 0 0 26px; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__ctas .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .45); }

/* Topo padrão */
.hero--home .hero__shade { background: linear-gradient(90deg, rgba(10, 40, 28, .92) 0%, rgba(10, 40, 28, .78) 42%, rgba(10, 40, 28, .15) 80%); }

/* Topo de Natal */
.hero--natal .hero__shade { background: linear-gradient(90deg, rgba(8, 39, 26, .96) 0%, rgba(8, 39, 26, .70) 44%, rgba(8, 39, 26, 0) 76%); }
.hero__garland { position: absolute; top: 0; left: 0; width: 100%; height: clamp(96px, 13vw, 190px); object-fit: cover; object-position: center top; max-width: none; pointer-events: none; z-index: 0;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 100%); }
/* Luzinhas piscando: camada com o mesmo enquadramento da guirlanda (1920x437),
   cada luz fica sobre uma lâmpada real da imagem (posição em %). */
.hero__lights { position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 1920 / 437; pointer-events: none; z-index: 1; }
.bulb { position: absolute; width: clamp(22px, 2.6vw, 40px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; mix-blend-mode: screen; opacity: 0;
  background: radial-gradient(circle, #fff 0 12%, var(--c, #ffe4a0) 24%, color-mix(in srgb, var(--c, #ffe4a0) 45%, transparent) 46%, transparent 70%);
  animation: twinkle 1.8s ease-in-out infinite; }
.bulb:nth-child(odd) { animation-delay: -.9s; }
.bulb:nth-child(3n) { --c: #ff9f8f; animation-duration: 2.1s; }
.bulb:nth-child(5n) { --c: #fff3c4; animation-duration: 1.5s; }
.spark { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #ffe4a0; pointer-events: none; animation: glow 3.4s ease-in-out infinite alternate; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 45%, 60% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } }
@keyframes glow { from { opacity: .35; filter: brightness(.8); } to { opacity: 1; filter: brightness(1.4); } }

/* ---------------- Ofertas da semana ---------------- */
.offers { padding-top: 40px; }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sec-head__tag { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--red); }
.sec-head h2 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 800; color: var(--green); margin-top: 4px; }
.sec-head p { margin: 4px 0 0; color: var(--muted); }
.notice { background: #fff2d5; color: #6b4a17; font-size: 13px; padding: 10px 14px; border-radius: 10px; margin: 0 0 16px; }
.offers__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.offer { position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.offer__img { aspect-ratio: 1; width: 100%; height: auto; object-fit: cover; background: #f5f2ea; }
.offer__badge { position: absolute; top: 12px; left: 12px; background: var(--red); color: #fff; font-size: 13px; font-weight: 800; padding: 6px 10px; border-radius: 8px; }
.offer__body { padding: 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.offer__name { font-size: 16px; font-weight: 700; }
.offer__old { color: var(--muted); font-size: 13px; }
.offer__price { font-size: 28px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.offer__price small { font-size: 13px; color: var(--muted); font-weight: 600; }
.offer .qty, .offer .add { margin-top: auto; }

/* ---------------- Barra de departamentos ---------------- */
.depnav { position: sticky; top: var(--bar); z-index: 20; background: rgba(244, 246, 243, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); margin-top: 36px; }
.depnav__in { display: flex; gap: 8px; padding-top: 10px; padding-bottom: 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.depnav__in::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.chip:hover { border-color: var(--green-2); }
.chip.is-on { background: var(--green); border-color: var(--green); color: #fff; }
.chip__n { font-size: 12px; color: var(--muted); font-weight: 600; }
.chip.is-on .chip__n { color: var(--gold); }

/* ---------------- Departamentos ---------------- */
.dep { padding-top: 40px; }
.dep__banner { position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 16 / 5; min-height: 150px; background: var(--green); margin-bottom: 20px; }
.dep__banner img { width: 100%; height: 100%; object-fit: cover; }
.dep__banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 40, 28, .82) 0%, rgba(10, 40, 28, .35) 45%, rgba(10, 40, 28, 0) 75%); }
.dep__title { position: absolute; left: clamp(18px, 4vw, 40px); bottom: clamp(16px, 3.5vw, 32px); z-index: 1; color: #fff; }
.dep__title h2 { font-size: clamp(26px, 4vw, 42px); font-weight: 800; letter-spacing: -.02em; }
.dep__title p { margin: 6px 0 0; color: #e1ebe4; font-size: 15px; }
.dep__sub { font-size: 18px; font-weight: 800; color: var(--green); margin: 26px 0 12px; }
.dep__sub:first-of-type { margin-top: 4px; }

.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card__img { position: relative; aspect-ratio: 1; background: #eef1ec; }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__badge { position: absolute; top: 10px; left: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; padding: 4px 8px; border-radius: 7px; }
.card__body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.card__name { font-size: 15px; font-weight: 700; margin: 0 0 4px; min-height: 2.6em; }
.card__old { color: var(--muted); font-size: 12px; min-height: 1.5em; }
.card__price { font-size: 21px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.card__price small { font-size: 12px; color: var(--muted); font-weight: 600; }
.card .add, .card .qty { margin-top: auto; }

.add { width: 100%; min-height: 42px; border: 0; border-radius: 10px; background: var(--green); color: #fff; font-weight: 700; cursor: pointer; }
.add:hover { background: var(--green-2); }
.qty { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; min-height: 42px; border-radius: 10px; background: var(--green-soft); }
.qty button { height: 42px; border: 0; background: transparent; font-size: 20px; font-weight: 700; color: var(--green); cursor: pointer; border-radius: 10px; }
.qty button:hover { background: rgba(16, 62, 45, .08); }
.qty output { text-align: center; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 17px; }
.empty button { background: none; border: 0; color: var(--green); font-weight: 700; text-decoration: underline; cursor: pointer; }

/* Entrega */
.delivery { position: relative; margin-top: 56px; border-radius: 20px; overflow: hidden; isolation: isolate; color: #fff; }
.delivery img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.delivery::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(10, 40, 28, .92), rgba(10, 40, 28, .55) 55%, rgba(10, 40, 28, .1)); }
.delivery__copy { padding: clamp(28px, 5vw, 56px); max-width: 560px; }
.delivery h2 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; }
.delivery p { color: #e1ebe4; margin: 10px 0 20px; }

/* Rodapé */
.foot { margin-top: 56px; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot p { margin: 4px 0; }
.foot__note { font-size: 12px; max-width: 70em; }

/* ---------------- Carrinho ---------------- */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(8, 24, 17, .45); animation: fade .2s ease; }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: #fff; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0, 0, 0, .18); animation: slide .25s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { font-size: 22px; color: var(--green); font-weight: 800; }
.drawer__body { flex: 1; overflow-y: auto; padding: 8px 20px; }
.drawer__foot { border-top: 1px solid var(--line); padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); background: #fbfcfa; }
.line { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.line__name { font-weight: 700; font-size: 14px; }
.line__unit { font-size: 12px; color: var(--muted); }
.line__right { display: flex; flex-direction: column; align-items: end; gap: 6px; }
.line__total { font-weight: 800; font-variant-numeric: tabular-nums; }
.line .qty { grid-template-columns: 34px 52px 34px; min-height: 34px; }
.line .qty button { height: 34px; font-size: 17px; }
.line__rm { font-size: 12px; color: var(--muted); background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 0; }
.cart-empty { padding: 40px 0; text-align: center; color: var(--muted); }
.mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--bg); border-radius: 12px; margin-bottom: 12px; }
.mode button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; color: var(--muted); cursor: pointer; }
.mode button[aria-pressed="true"] { background: #fff; color: var(--green); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.sum { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 2px 0; font-variant-numeric: tabular-nums; }
.sum--total { color: var(--ink); font-size: 18px; font-weight: 800; padding-top: 8px; }
.hint { font-size: 13px; color: #8a5a12; background: #fff6e2; border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; }
.drawer__foot .btn { width: 100%; margin-top: 12px; }
.order-text { white-space: pre-wrap; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 12px 0; max-height: 46vh; overflow: auto; }

/* Aviso rápido */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--green); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 70; max-width: calc(100% - 32px); text-align: center; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Responsivo ---------------- */
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .offers__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cart-btn__label { display: none; }
}
@media (max-width: 640px) {
  :root { --bar: 112px; }
  html { scroll-padding-top: calc(var(--bar) + 60px); }
  .wrap { padding: 0 14px; }
  .top__in { height: auto; flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; padding-bottom: 10px; }
  .brand__name { font-size: 17px; }
  .brand__logo { width: 38px; height: 38px; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin: 0; height: 42px; }
  .cart-btn { margin-left: auto; height: 40px; }
  .cart-btn__total { display: none; }
  .hero__in { min-height: 520px; align-items: flex-start; padding-top: 56px; }
  .hero--natal .hero__photo, .hero--home .hero__photo { object-position: 72% center; }
  .hero--natal .hero__shade, .hero--home .hero__shade { background: linear-gradient(180deg, rgba(8, 39, 26, .95) 0%, rgba(8, 39, 26, .82) 48%, rgba(8, 39, 26, .15) 100%); }
  .hero p { font-size: 16px; }
  .hero__garland { width: 160%; left: -30%; height: 104px; }
  .hero__lights { width: 160%; left: -30%; }
  .hero--natal .hero__in { padding-top: 112px; min-height: 540px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .offers__grid { gap: 10px; }
  .card__body { padding: 10px 10px 12px; }
  .card__name { font-size: 14px; }
  .card__price { font-size: 19px; }
  .offer__body { padding: 12px; }
  .offer__name { font-size: 14px; }
  .offer__price { font-size: 22px; }
  .dep__banner { aspect-ratio: 16 / 7; }
  .sec-head { display: block; }
  .depnav { margin-top: 28px; }
  .delivery__copy { padding: 28px 22px; }
  .delivery::before { background: linear-gradient(180deg, rgba(10, 40, 28, .9), rgba(10, 40, 28, .6)); }
}
@media (max-width: 380px) {
  .qty { grid-template-columns: 36px 1fr 36px; }
  .card__price { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Ajustes de alinhamento */
.delivery.wrap { width: calc(100% - 40px); max-width: 1200px; padding: 0; }
[data-group] + [data-group] .dep__sub { margin-top: 34px; }
@media (max-width: 640px) {
  .delivery.wrap { width: calc(100% - 28px); }
  [data-group] + [data-group] .dep__sub { margin-top: 26px; }
}
