:root {
  /* Soft Warm Stone Palette */
  --dark: #1c1b19;
  --light: #efece4;
  --mid-gray: #9e9b91;
  --light-gray: #dedad0;
  --accent-orange: #d97757;
  --accent-orange-hover: #c46343;
  --accent-blue: #6a9bcc;
  --accent-green: #788c5d;

  --surface: #f6f4ee;
  --text-muted: #5a5852;
  --font-heading: "Poppins", Arial, sans-serif;
  --font-body: "Lora", Georgia, serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --dark: #eceae4;
  --light: #16171a;
  --mid-gray: #7c7e85;
  --light-gray: #2c2f36;
  --accent-orange: #e08262;
  --accent-orange-hover: #ea9274;
  --surface: #202227;
  --text-muted: #a5a7ae;
}

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

body {
  font-family: var(--font-body);
  background: var(--light);
  color: var(--dark);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand, .nav-link, .icon-btn, .add-btn, .primary-btn, .filter-chip, .product-price, .product-counter {
  font-family: var(--font-heading);
}

:focus-visible {
  outline: 2px solid var(--accent-orange);
  outline-offset: 2px;
}

.container {
  width: min(1200px, 92%);
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(239, 236, 228, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--light-gray);
}

[data-theme="dark"] .site-header {
  background: rgba(22, 23, 26, 0.92);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--accent-orange);
  display: inline-block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--dark);
  border-bottom-color: var(--accent-orange);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  color: var(--dark);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--mid-gray);
  background: var(--light);
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-orange);
  color: var(--light);
  font-size: 0.72rem;
  font-weight: 600;
}

.menu-toggle {
  display: none;
}

/* Main Content */
.main-content {
  padding: 2.5rem 0 4.5rem;
}

.hero-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--light-gray);
  margin-bottom: 1.5rem;
}

.hero-copy {
  max-width: 660px;
}

.hero-copy h1 {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

.product-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Toolbar & Filters */
.catalog-toolbar {
  margin-bottom: 1.75rem;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  min-height: 40px;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--light-gray);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--mid-gray);
  color: var(--dark);
}

.filter-chip.active {
  background: var(--dark);
  border-color: var(--dark);
  color: var(--light);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

/* Product Card */
.product-card {
  background: var(--surface);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.product-card:hover {
  border-color: var(--mid-gray);
  transform: translateY(-2px);
}

.product-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--light-gray);
}

.product-body {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.product-title {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--dark);
}

.product-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--light-gray);
}

.product-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
}

.add-btn,
.primary-btn {
  min-height: 40px;
  padding: 0.45rem 1rem;
  background: var(--accent-orange);
  color: var(--light);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.add-btn:hover,
.primary-btn:hover {
  background: var(--accent-orange-hover);
}

.full-width {
  width: 100%;
}

/* Fade-in Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Skeleton Loader */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    var(--light-gray) 25%,
    var(--light) 50%,
    var(--light-gray) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-image {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.skeleton-body {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.skeleton-line {
  height: 14px;
  border-radius: 6px;
}

.skeleton-line.title {
  width: 72%;
  height: 18px;
}

.skeleton-line.short {
  width: 48%;
}

.skeleton-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.65rem;
}

.skeleton-price {
  width: 64px;
  height: 20px;
  border-radius: 6px;
}

.skeleton-btn {
  width: 88px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.scroll-sentinel {
  height: 24px;
  margin-top: 1.25rem;
}

.end-message {
  text-align: center;
  color: var(--text-muted);
  margin-top: 1.5rem;
  font-size: 0.95rem;
}

/* Cart Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 19, 0.4);
  z-index: 60;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(390px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--light-gray);
  z-index: 70;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s ease;
}

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

.drawer-header,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--light-gray);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart-empty {
  color: var(--text-muted);
  text-align: center;
  margin-top: 2rem;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--light-gray);
}

.cart-item-info h3 {
  font-size: 0.92rem;
  font-weight: 600;
}

.cart-item-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.remove-item-btn {
  background: transparent;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.remove-item-btn:hover {
  color: var(--dark);
  border-color: var(--mid-gray);
}

.drawer-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--light-gray);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-heading);
}

/* Login Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 19, 0.45);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.login-form {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 500;
}

.field-input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--light);
  color: var(--dark);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--dark);
  color: var(--light);
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--light-gray);
    flex-direction: column;
    padding: 1rem;
    gap: 0.75rem;
  }

  .main-nav.open {
    display: flex;
  }

  .action-label {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }
}
