:root {
  --color-bg: #ffffff;
  --color-heading: #1c1f23;
  --color-text: #6f7173;
  --color-text-soft: rgba(111, 113, 115, 0.8);
  --color-text-muted: rgba(111, 113, 115, 0.35);
  --color-border: #e6e8ea;
  --color-primary: #1d1f23;
  --color-primary-hover: #45484b;
  --color-highlight: #e91e63;
  --shadow-elevated: 0 4px 14px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.3);
  --radius-card: 12px;
  --radius-badge: 4px;
  --radius-pill: 999px;
  --radius-btn: 6px;
  --header-h: 56px;
  --page-pad: 10px;
  --grid-gap-x: 8px;
  --grid-gap-y: 10px;
  --font: "Lexend", system-ui, -apple-system, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.4;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
  border-bottom-color: var(--color-border);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  padding: 0 var(--page-pad);
  gap: 12px;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--color-heading);
  transition: background 0.2s ease;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.brand {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--color-heading);
  line-height: 1;
}

.brand img {
  height: 22px;
  width: auto;
}

.cart-btn {
  position: relative;
}

.cart-count {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  display: none;
}

.cart-count.is-on {
  display: block;
}

/* Toolbar */
.toolbar {
  padding: 8px var(--page-pad) 4px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.toolbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--color-heading);
}

.toolbar-link svg {
  width: 18px;
  height: 18px;
}

.sort-select {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--color-heading);
  padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231c1f23' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  cursor: pointer;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: #fff;
  font-size: 13px;
  color: var(--color-heading);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pill:hover,
.pill.is-open {
  border-color: #c9ccd1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pill svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.pill-panel {
  display: none;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
}

.pill-panel.is-open {
  display: block;
}

.pill-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--color-heading);
}

.pill-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: #fff;
  border-color: var(--color-border);
  color: var(--color-heading);
}

.result-hint {
  font-size: 12px;
  color: var(--color-text);
  padding: 0 var(--page-pad) 8px;
}

/* Product grid */
.collection {
  padding: 0 var(--page-pad) 40px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--grid-gap-y) var(--grid-gap-x);
}

.product-card {
  min-width: 0;
}

.card-media {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #f7f7f8;
  aspect-ratio: 1 / 1.08;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.35s ease, transform 0.45s ease;
}

.card-media .img-hover {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.product-card:hover .img-main {
  opacity: 0;
}

.product-card:hover .img-hover {
  opacity: 1;
  transform: scale(1.02);
}

.badge-save {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 2px 6px;
  border-radius: var(--radius-badge);
  background: #fff;
  color: var(--color-text);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.quick-add {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-elevated);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.product-card:hover .quick-add,
.quick-add:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.quick-add:hover {
  background: var(--color-primary-hover);
}

.quick-add svg {
  width: 18px;
  height: 18px;
}

.card-body {
  padding: 10px 2px 4px;
}

.card-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: var(--color-heading);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}

.card-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.price {
  font-size: 14px;
  color: var(--color-heading);
}

.compare {
  font-size: 14px;
  color: var(--color-text-muted);
  text-decoration: line-through;
}

/* Floating cart */
.float-cart {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 35;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  color: var(--color-heading);
  box-shadow: var(--shadow-elevated);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.float-cart svg {
  width: 22px;
  height: 22px;
}

.float-cart .cart-count {
  top: 6px;
  right: 6px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 36px var(--page-pad) 24px;
  background: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 16px;
  max-width: 1100px;
  margin: 0 auto;
}

.footer-col h4 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-heading);
}

.footer-col a,
.footer-col p {
  display: block;
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--color-text);
}

.footer-col p {
  margin-bottom: 14px;
}

.newsletter {
  display: flex;
  gap: 8px;
}

.newsletter input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.newsletter input:focus {
  border-color: #bbb;
}

.newsletter button {
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.footer-bottom {
  max-width: 1100px;
  margin: 28px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--color-text);
}

.payment-icons {
  height: 22px;
  width: auto;
  max-width: 100%;
}

/* Drawers / overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 60;
  width: min(430px, 100%);
  background: #fff;
  box-shadow: var(--shadow-elevated);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0, 0, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.drawer-left {
  left: 0;
  transform: translateX(-100%);
}

.drawer-right {
  right: 0;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border);
}

.drawer-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--color-heading);
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.drawer-footer {
  padding: 12px 16px 20px;
  border-top: 1px solid var(--color-border);
}

.menu-list a {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 16px;
  color: var(--color-heading);
}

.cart-empty {
  text-align: center;
  padding: 48px 12px;
  color: var(--color-text);
}

.cart-empty p {
  margin: 0 0 16px;
  font-size: 15px;
}

.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.cart-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: #f5f5f5;
}

.cart-item-title {
  font-size: 14px;
  color: var(--color-heading);
  margin: 0 0 6px;
}

.cart-item-price {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-heading);
}

.cart-item-remove {
  font-size: 12px;
  color: var(--color-text);
  align-self: start;
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 15px;
  color: var(--color-heading);
}

.cart-summary strong {
  font-weight: 500;
}

.checkout-btn {
  width: 100%;
  min-height: 44px;
}

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-box input {
  flex: 1;
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 0 16px;
  font: inherit;
  outline: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 80;
  transform: translateX(-50%) translateY(12px);
  background: var(--color-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 768px) {
  :root {
    --page-pad: 20px;
    --grid-gap-x: 16px;
    --grid-gap-y: 20px;
    --header-h: 64px;
  }

  .brand {
    font-size: 22px;
  }

  .footer-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .quick-add {
    opacity: 0;
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .collection,
  .toolbar,
  .result-hint,
  .header-bar {
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (hover: none) {
  .quick-add {
    opacity: 1;
    transform: none;
  }

  .product-card:hover .img-main {
    opacity: 1;
  }

  .product-card:hover .img-hover {
    opacity: 0;
  }
}
