:root {
  --bg: #12100e;
  --bg-2: #1b1714;
  --panel: #221e1a;
  --ink: #f3ebe1;
  --muted: #a89a8c;
  --line: #3a322b;
  --ember: #c45c26;
  --ember-2: #e07838;
  --steel: #8a9aa8;
  --ok: #25d366;
  --danger: #c23b3b;
  --radius: 6px;
  --max: 1120px;
  --font: "Source Sans 3", system-ui, sans-serif;
  --display: "Bebas Neue", Impact, sans-serif;
  --header-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(196, 92, 38, 0.18), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(138, 154, 168, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg), #0d0b0a 40%, var(--bg-2));
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  padding-bottom: calc(72px + var(--safe-b));
}
img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
.wrap {
  width: min(100% - 24px, var(--max));
  margin-inline: auto;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: var(--safe-t);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(18, 16, 14, 0.92);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand actions"
    "search search";
  align-items: center;
  gap: 10px 12px;
  padding: 10px 0;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; border: 1px solid var(--line);
}
.brand-text { min-width: 0; }
.brand-name {
  display: block; font-family: var(--display);
  font-size: 1.25rem; letter-spacing: 0.04em; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-motto {
  display: none;
  color: var(--muted); font-size: 0.78rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-form {
  grid-area: search;
  display: flex; width: 100%;
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
  background: var(--panel);
}
.search-form input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  padding: 11px 14px; outline: none; font: inherit; font-size: 16px;
}
.search-form button {
  border: 0; background: var(--ember); color: #fff;
  padding: 0 16px; font-weight: 600; cursor: pointer;
  min-height: 44px;
}
.header-actions {
  grid-area: actions;
  display: flex; gap: 8px; align-items: center;
}
.cart-btn, .wa-btn, .btn-primary, .btn-secondary, .admin-btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 600;
  border-radius: 999px; padding: 10px 14px;
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
}
.cart-btn {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  padding-inline: 12px;
}
.cart-btn .lbl { display: none; }
.cart-count {
  display: inline-grid; place-items: center;
  min-width: 1.35rem; height: 1.35rem; border-radius: 999px;
  background: var(--ember); color: #fff; font-size: 0.72rem; margin-left: 2px;
}
.wa-btn {
  background: var(--ok); color: #062814;
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
}
.wa-btn .lbl { display: none; }
.wa-btn .ico { display: block; font-size: 1.25rem; line-height: 1; }
.btn-primary { background: var(--ember); color: #fff; text-align: center; }
.btn-primary:hover { background: var(--ember-2); }
.btn-secondary {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: min(48vh, 380px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero picture, .hero img {
  width: 100%;
  height: min(48vh, 380px);
  object-fit: cover;
  filter: saturate(0.9) contrast(1.05);
}
.hero-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 24px;
  background: linear-gradient(180deg, transparent 15%, rgba(10, 8, 7, 0.9) 82%);
}
.hero h1 {
  margin: 0; font-family: var(--display);
  font-size: clamp(2.2rem, 11vw, 4.5rem);
  letter-spacing: 0.05em; line-height: 0.95;
  max-width: 100%;
}
.hero p {
  margin: 8px 0 14px; color: var(--muted);
  max-width: 36ch; font-size: 0.95rem;
}
.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ok); color: #062814; font-weight: 700;
  padding: 12px 16px; border-radius: 999px;
  width: 100%; max-width: 100%;
  min-height: 48px;
  font-size: 0.95rem;
  text-align: center;
}
.cta .cta-full { display: none; }
.cta .cta-short { display: inline; }

.shipping-bar {
  margin-top: 14px; padding: 10px 12px;
  border: 1px dashed color-mix(in srgb, var(--steel) 50%, transparent);
  color: var(--steel); border-radius: var(--radius); font-size: 0.85rem;
  text-align: center;
}

/* ===== Categories ===== */
.cats-wrap {
  position: sticky;
  top: calc(var(--safe-t) + 108px);
  z-index: 30;
  background: rgba(18, 16, 14, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.cats-rail {
  position: relative;
  width: min(100% - 24px, var(--max));
  margin-inline: auto;
  padding: 10px 0;
}
.cats-rail::before,
.cats-rail::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.cats-rail::before {
  left: 0;
  background: linear-gradient(90deg, rgba(18, 16, 14, 1), transparent);
}
.cats-rail::after {
  right: 0;
  background: linear-gradient(270deg, rgba(18, 16, 14, 1), transparent);
}
.cats-rail.show-left::before,
.cats-rail.show-right::after {
  opacity: 1;
}
.cats-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(34, 30, 26, 0.95);
  color: var(--ink);
  cursor: pointer;
  display: none;
  place-items: center;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.cats-btn.prev { left: 0; }
.cats-btn.next { right: 0; }
.cats-btn:hover { border-color: var(--ember); color: #fff; }
.cats-rail.has-overflow .cats-btn { display: grid; }

.cats {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-width: 100%;
  padding: 2px 4px;
  cursor: grab;
  user-select: none;
}
.cats.is-centered {
  justify-content: center;
}
.cats.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}
.cats::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}
.cats a {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(34, 30, 26, 0.85);
  font-size: 0.88rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  scroll-margin-inline: 40px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.cats a.active,
.cats a:hover {
  color: var(--ink);
  border-color: var(--ember);
  background: rgba(196, 92, 38, 0.18);
}

.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin: 14px 0 12px;
}
.section-head h2 {
  margin: 0; font-family: var(--display);
  font-size: clamp(1.5rem, 6vw, 2rem); letter-spacing: 0.04em;
}
.section-head span, .empty, .hint { color: var(--muted); font-size: 0.9rem; }

/* ===== Products ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-bottom: 24px;
}
.product-card {
  background: linear-gradient(180deg, #26211c, #1a1613);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.product-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--ember) 45%, var(--line));
}
.product-media {
  position: relative; aspect-ratio: 1; background: #0f0d0b; display: block;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--ember); color: #fff; font-size: 0.68rem; font-weight: 700;
  padding: 4px 7px; border-radius: 4px;
}
.product-body {
  padding: 10px;
  display: flex; flex-direction: column; flex: 1;
}
.product-body .product-cat {
  display: none;
  color: var(--steel); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px;
}
.detail-body .product-cat {
  display: inline-block;
  color: var(--steel); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px;
}
.product-body h3 {
  margin: 0 0 6px; font-size: 0.88rem; font-weight: 600; line-height: 1.3;
  min-height: 2.5em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.price-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
  margin-bottom: 10px; margin-top: auto;
}
.price-row strong { font-size: 1rem; }
.price-row s { color: var(--muted); font-size: 0.8rem; }
.price-row.large strong { font-size: 1.45rem; }
.card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.card-actions .btn-primary,
.card-actions .btn-secondary {
  padding: 10px 8px;
  font-size: 0.82rem;
  border-radius: 8px;
  min-height: 40px;
  width: 100%;
}
.card-actions .add-cart { order: 2; }
.card-actions .btn-primary { order: 1; }

/* ===== Product detail ===== */
.product-page { padding: 16px 0 32px; }
.back-link {
  color: var(--muted); display: inline-flex; align-items: center;
  min-height: 40px; margin-bottom: 12px; font-size: 0.95rem;
}
.product-detail { display: grid; gap: 18px; }
.detail-media {
  background: #0f0d0b; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.detail-media img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.detail-body h1 {
  margin: 6px 0 12px; font-family: var(--display);
  font-size: clamp(1.8rem, 8vw, 3.2rem); letter-spacing: 0.03em; line-height: 1;
}
.desc { color: #d8cdc0; font-size: 0.95rem; }
.qty-row { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.qty-row input {
  width: 88px; padding: 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit; font-size: 16px;
  min-height: 48px;
}
.detail-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.detail-actions .btn-primary,
.detail-actions .btn-secondary {
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 calc(20px + var(--safe-b));
  margin-top: auto;
  background: rgba(0,0,0,0.25);
}
.footer-inner {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--muted); font-size: 0.92rem;
}
.footer-inner strong { color: var(--ink); display: block; margin-bottom: 4px; }
.footer-inner a { color: var(--ok); font-weight: 600; }
.footer-credit {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer-credit a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer-credit a:hover { color: var(--ember-2); }

/* ===== Cart ===== */
.cart-drawer {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 60;
}
.cart-drawer.open { opacity: 1; pointer-events: auto; }
.cart-panel {
  position: absolute; right: 0; bottom: 0; top: auto;
  height: min(88dvh, 100%);
  width: 100%;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(16px);
  transition: transform 0.25s ease;
  padding-bottom: var(--safe-b);
}
.cart-drawer.open .cart-panel { transform: translateY(0); }
.cart-head, .cart-foot { padding: 16px; border-bottom: 1px solid var(--line); }
.cart-foot { border-bottom: 0; border-top: 1px solid var(--line); margin-top: auto; }
.cart-foot .btn-primary { width: 100%; min-height: 50px; border-radius: 12px; }
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-head h2 { margin: 0; font-family: var(--display); letter-spacing: 0.04em; }
.cart-head button {
  background: transparent; border: 0; color: var(--ink);
  font-size: 1.8rem; cursor: pointer; width: 44px; height: 44px;
}
.cart-items { padding: 12px; overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.cart-line {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.cart-line img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #111;
}
.cart-line h4 { margin: 0 0 4px; font-size: 0.9rem; }
.cart-line .meta { color: var(--muted); font-size: 0.85rem; }
.cart-line button {
  background: transparent; border: 0; color: var(--danger);
  cursor: pointer; align-self: start; min-width: 44px; min-height: 44px;
}
.cart-total { margin-bottom: 12px; }
.cart-empty { color: var(--muted); padding: 20px 8px; }

/* ===== Mobile sticky WhatsApp ===== */
.mobile-wa {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + var(--safe-b));
  z-index: 45;
  display: flex;
  align-items: center; justify-content: center; gap: 8px;
  background: var(--ok); color: #062814;
  font-weight: 700; text-align: center;
  min-height: 52px; padding: 12px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}
.mobile-wa:active { transform: scale(0.98); }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-overlay, .product-card, .product-detail {
  animation: rise 0.55s ease both;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition: none !important;
  }
}

/* ===== Tablet+ ===== */
@media (min-width: 640px) {
  .wrap { width: min(100% - 32px, var(--max)); }
  body { padding-bottom: 0; }
  .mobile-wa { display: none; }
  .brand-motto { display: block; }
  .brand-logo { width: 48px; height: 48px; }
  .brand-name { font-size: 1.45rem; }
  .header-inner {
    display: flex; flex-wrap: wrap;
    min-height: 72px; gap: 16px;
  }
  .brand, .search-form, .header-actions { grid-area: unset; }
  .search-form { flex: 1; min-width: 180px; max-width: 360px; }
  .header-actions { margin-left: auto; }
  .cart-btn .lbl, .wa-btn .lbl { display: inline; }
  .wa-btn {
    width: auto; height: auto; padding: 10px 16px; border-radius: 999px;
  }
  .wa-btn .ico { display: none; }
  .cart-btn .lbl { display: inline; }
  .product-body .product-cat { display: inline-block; }
  .product-grid { gap: 14px; }
  .product-body { padding: 12px; }
  .product-body h3 { font-size: 1rem; }
  .card-actions { grid-template-columns: 1fr 1fr; }
  .card-actions .add-cart { order: 0; }
  .card-actions .btn-primary { order: 0; }
  .cta { width: fit-content; }
  .cta .cta-full { display: inline; }
  .cta .cta-short { display: none; }
  .hero, .hero picture, .hero img {
    min-height: min(52vh, 460px);
    height: min(52vh, 460px);
  }
  .hero-overlay { padding-bottom: 36px; }
  .cats-wrap {
    top: calc(var(--safe-t) + 72px);
    background: rgba(18, 16, 14, 0.94);
  }
  .cats-rail {
    width: min(100% - 32px, var(--max));
    padding: 14px 8px;
  }
  .cats-rail::before,
  .cats-rail::after {
    display: none;
  }
  .cats-rail.has-overflow .cats-btn {
    display: none;
  }
  .cats {
    flex-wrap: wrap;
    justify-content: center !important;
    overflow: visible;
    cursor: default;
    row-gap: 8px;
    padding: 0;
  }
  .cats.is-dragging {
    cursor: default;
  }
  .detail-actions {
    grid-template-columns: 1fr 1fr;
  }
  .cart-panel {
    top: 0; bottom: 0; right: 0;
    height: 100%;
    width: min(100%, 400px);
    border-radius: 0;
    border-left: 1px solid var(--line);
    border-top: 0;
    transform: translateX(12px);
  }
  .cart-drawer.open .cart-panel { transform: translateX(0); }
}

@media (min-width: 720px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
}

@media (min-width: 860px) {
  .product-detail { grid-template-columns: 1.05fr 1fr; align-items: start; }
}

@media (min-width: 980px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero, .hero picture, .hero img {
    min-height: min(58vh, 520px);
    height: min(58vh, 520px);
  }
}
