/* ===== DESIGN TOKENS ===== */
:root, [data-theme="light"] {
  /* Type Scale */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Colors — Clean white/charcoal, Quince-inspired */
  --color-bg: #ffffff;
  --color-surface: #f8f8f6;
  --color-surface-2: #f0efed;
  --color-border: #e0ddd8;
  --color-divider: #eae8e4;

  --color-text: #1a1a1a;
  --color-text-muted: #6b6b6b;
  --color-text-faint: #a8a8a4;

  --color-primary: #2d5a4a;
  --color-primary-hover: #1e4236;
  --color-accent: #e8835a;
  --color-accent-hover: #d4724c;

  --color-badge-bg: rgba(255,255,255,0.9);
  --color-badge-sale: #e8835a;
  --color-badge-bestseller: #2d5a4a;

  --color-star: #d4a017;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);

  /* Fonts */
  --font-body: 'General Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Cabinet Grotesk', 'General Sans', sans-serif;

  /* Content widths */
  --content-wide: 1320px;
}

/* Dark Mode */
[data-theme="dark"] {
  --color-bg: #141414;
  --color-surface: #1c1c1c;
  --color-surface-2: #252525;
  --color-border: #333;
  --color-divider: #2a2a2a;

  --color-text: #e8e8e6;
  --color-text-muted: #8a8a88;
  --color-text-faint: #5a5a58;

  --color-primary: #5eaa8a;
  --color-primary-hover: #4d9477;
  --color-accent: #e8835a;
  --color-accent-hover: #f09570;

  --color-badge-bg: rgba(30,30,30,0.9);
  --color-badge-sale: #e8835a;
  --color-badge-bestseller: #5eaa8a;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #141414;
    --color-surface: #1c1c1c;
    --color-surface-2: #252525;
    --color-border: #333;
    --color-divider: #2a2a2a;
    --color-text: #e8e8e6;
    --color-text-muted: #8a8a88;
    --color-text-faint: #5a5a58;
    --color-primary: #5eaa8a;
    --color-primary-hover: #4d9477;
    --color-accent: #e8835a;
    --color-accent-hover: #f09570;
    --color-badge-bg: rgba(30,30,30,0.9);
    --color-badge-sale: #e8835a;
    --color-badge-bestseller: #5eaa8a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  }
}

/* ===== ANNOUNCEMENT BAR ===== */
.announcement-bar {
  background: var(--color-accent);
  color: #fff;
  text-align: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-divider);
}

.header__inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.header__menu-toggle {
  display: none;
  color: var(--color-text);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--color-text);
  flex-shrink: 0;
}

.header__logo-img {
  height: 44px;
  width: auto;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-left: var(--space-8);
}

.header__nav-link {
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  padding: var(--space-1) 0;
}

.header__nav-link:hover,
.header__nav-link--active {
  color: var(--color-text);
}

.header__nav-link--active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--color-text);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.header__action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text);
}

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

.header__cart-btn {
  position: relative;
}

.header__cart-count {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ===== SEARCH OVERLAY ===== */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--color-bg);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  transform: translateY(-100%);
  transition: transform 300ms ease;
}

.search-overlay--open {
  transform: translateY(0);
}

.search-overlay__inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.search-overlay__input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--text-lg);
  outline: none;
  color: var(--color-text);
}

.search-overlay__input::placeholder {
  color: var(--color-text-faint);
}

.search-overlay__close {
  color: var(--color-text-muted);
}

/* ===== MOBILE NAV ===== */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  z-index: 310;
  background: var(--color-bg);
  transform: translateX(-100%);
  transition: transform 300ms ease;
  border-right: 1px solid var(--color-divider);
  pointer-events: auto;
}

.mobile-nav--open {
  transform: translateX(0);
}

.mobile-nav__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
}

.mobile-nav__title {
  font-weight: 600;
  font-size: var(--text-lg);
}

.mobile-nav__close {
  color: var(--color-text-muted);
  position: relative;
  z-index: 311;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav__links {
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0;
}

.mobile-nav__link {
  text-decoration: none;
  color: var(--color-text);
  font-size: var(--text-base);
  font-weight: 500;
  padding: var(--space-3) var(--space-6);
}

.mobile-nav__link:hover,
.mobile-nav__link--active {
  color: var(--color-primary);
  background: var(--color-surface);
}

/* Mobile overlay backdrop */
.mobile-nav-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 300;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.mobile-nav-backdrop--visible {
  opacity: 1;
  pointer-events: auto;
}

/* Visually Hidden (for screen readers) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip Navigation */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 999;
  padding: var(--space-2) var(--space-4);
  background: var(--color-text);
  color: var(--color-bg);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 200ms ease;
}

.skip-link:focus {
  top: 8px;
}

/* ===== MAIN CONTENT ===== */
.main {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: var(--space-4) var(--space-6) var(--space-16);
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.breadcrumb__sep {
  margin: 0 var(--space-2);
}

/* ===== CATEGORY TITLE ===== */
.category-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-8);
  color: var(--color-text);
}

/* ===== SUBCATEGORIES ===== */
.subcategories {
  display: flex;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-2);
}

.subcategories::-webkit-scrollbar { display: none; }

.subcategory {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--color-text-muted);
}

.subcategory:hover {
  color: var(--color-text);
}

.subcategory--active {
  color: var(--color-text);
}

.subcategory__circle {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}

.subcategory--active .subcategory__circle {
  border-color: var(--color-text);
}

.subcategory:hover .subcategory__circle {
  background: var(--color-surface-2);
}

.subcategory__label {
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.filter-bar__left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.filter-bar__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.filter-bar__count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  cursor: pointer;
}

.filter-pill:hover {
  background: var(--color-surface);
  border-color: var(--color-text-muted);
}

.filter-pill--main {
  border-color: var(--color-text);
}

.filter-pills {
  display: flex;
  gap: var(--space-2);
}

/* ===== PRODUCT GRID ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

/* ===== PRODUCT CARD ===== */
.product-card {
  cursor: pointer;
}

.product-card__image-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  aspect-ratio: 3 / 4;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.product-card:hover .product-card__image {
  transform: scale(1.03);
}

.product-card__wishlist {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-badge-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  color: var(--color-text);
  backdrop-filter: blur(4px);
}

.product-card:hover .product-card__wishlist {
  opacity: 1;
}

.product-card__wishlist:hover {
  background: var(--color-bg);
  color: var(--color-accent);
}

.product-card__wishlist.active svg {
  fill: var(--color-accent);
  stroke: var(--color-accent);
}

.product-card__badges {
  position: absolute;
  bottom: var(--space-3);
  left: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.product-card__badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--color-badge-bg);
  color: var(--color-text);
  backdrop-filter: blur(4px);
}

.product-card__badge--bestseller {
  background: var(--color-badge-bestseller);
  color: #fff;
}

.product-card__badge--sale {
  background: var(--color-badge-sale);
  color: #fff;
}

.product-card__badge--low {
  background: var(--color-badge-bg);
  color: var(--color-text-muted);
}

.product-card__badge--bundle {
  background: var(--color-badge-bg);
  color: var(--color-text);
}

/* Card info */
.product-card__info {
  padding: var(--space-3) var(--space-1) var(--space-2);
}

.product-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.product-card__name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__price {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.product-card__price--original {
  text-decoration: line-through;
  color: var(--color-text-faint);
  font-weight: 400;
  margin-right: var(--space-1);
}

.product-card__rating {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.product-card__rating span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}

.product-card__rating svg {
  flex-shrink: 0;
}

.product-card__swatches {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.product-card__swatch {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: inline-block;
  cursor: pointer;
  transition: transform var(--transition);
}

.product-card__swatch:hover {
  transform: scale(1.2);
}

.product-card__swatch-more {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--color-bg);
  border-top: 1px solid var(--color-divider);
  padding: var(--space-16) 0 var(--space-8);
}

.footer__inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

.footer__heading {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.footer__text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

.footer__form {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.footer__input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  color: var(--color-text);
  outline: none;
  min-width: 0;
}

.footer__input::placeholder {
  color: var(--color-text-faint);
}

.footer__submit {
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
}

.footer__submit:hover {
  color: var(--color-text);
}

.footer__links li {
  margin-bottom: var(--space-2);
}

.footer__links a {
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.footer__links a:hover {
  color: var(--color-text);
}

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-divider);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer__bottom-left {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.footer__logo-img {
  height: 36px;
  width: auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.footer__copyright {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.footer__attribution {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-decoration: none;
}

.footer__attribution:hover {
  color: var(--color-text-muted);
}

.footer__social {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.footer__social-link:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .header__nav {
    display: none;
  }

  .header__menu-toggle {
    display: flex;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .filter-pills {
    display: none;
  }

  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }

  .subcategory__circle {
    width: 60px;
    height: 60px;
  }

  .subcategories {
    gap: var(--space-4);
  }

  .category-title {
    font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  }

  .product-card__wishlist {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .header__inner {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }

  .header__actions {
    gap: var(--space-1);
  }

  .header__action-btn {
    width: 36px;
    height: 36px;
  }

  .main {
    padding: var(--space-3) var(--space-4) var(--space-12);
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-bar__right {
    width: 100%;
    justify-content: space-between;
  }

  .subcategory__circle {
    width: 52px;
    height: 52px;
  }

  .subcategory__circle svg {
    width: 28px;
    height: 28px;
  }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card {
  animation: fadeInUp 400ms ease both;
}

.product-card:nth-child(1) { animation-delay: 0ms; }
.product-card:nth-child(2) { animation-delay: 60ms; }
.product-card:nth-child(3) { animation-delay: 120ms; }
.product-card:nth-child(4) { animation-delay: 180ms; }
.product-card:nth-child(5) { animation-delay: 240ms; }
.product-card:nth-child(6) { animation-delay: 300ms; }
.product-card:nth-child(7) { animation-delay: 360ms; }
.product-card:nth-child(8) { animation-delay: 420ms; }
.product-card:nth-child(9) { animation-delay: 480ms; }
.product-card:nth-child(10) { animation-delay: 540ms; }
.product-card:nth-child(11) { animation-delay: 600ms; }
.product-card:nth-child(12) { animation-delay: 660ms; }