:root {
  --bg: #f7f6f2;
  --text: #1a1a1a;
  --accent: #e63946;
  --muted: #888;
  --border: #ddd;
  --max-width: 760px;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  padding: 1.5rem 2rem;
  border-bottom: 2px solid var(--text);
}

.brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
}

.brand:hover {
  color: var(--accent);
}

/* Main */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 2rem;
}

/* Footer */
footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Typography */
h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3.5rem, 10vw, 7rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
}

h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1rem;
  max-width: 58ch;
  font-weight: 300;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Home page */
.intro {
  margin-bottom: 3rem;
}

.intro p {
  font-size: 1.15rem;
  color: #444;
}

.products {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.products h2 {
  color: var(--muted);
  font-size: 0.8rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.product-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.product-card-thumb {
  width: 72px;
  min-width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.product-card-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
}

.product-card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
}

.product-card-sub {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 300;
  margin-top: 0.25rem;
}

/* Product gallery */
.gallery-wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 2.5rem;
}

.gallery-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.gallery-arrow {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}

.gallery-arrow:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.gallery-thumbs {
  display: flex;
  gap: 0.4rem;
  flex: 1;
  overflow-x: auto;
}

.gallery-thumb {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 4px;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  background: none;
  transition: border-color 0.15s;
}

.gallery-thumb img,
.gallery-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 2px;
}

.gallery-thumb.active {
  border-color: var(--accent);
}

.gallery-thumb:hover:not(.active) {
  border-color: var(--border);
}

/* Product page */
.product-image {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  margin: 0 auto 2.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.product-title {
  margin-bottom: 0.5rem;
}

.product-desc {
  font-size: 1rem;
  color: #444;
  margin-bottom: 2.5rem;
  max-width: 52ch;
  font-weight: 300;
}

.buy-wrap {
  margin-bottom: 2.5rem;
}

.product-price {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.5rem;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}

.checkout-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  padding: 0.85rem 2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.checkout-btn:hover {
  opacity: 0.85;
}

.checkout-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkout-error {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--accent);
}

/* Variant selector */
.variant-selector {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.variant-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.variant-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.variant-btn {
  padding: 0.45rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.variant-btn:hover {
  border-color: var(--text);
}

.variant-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.variant-height-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.variant-height-wrap input[type="range"] {
  flex: 1;
  max-width: 260px;
  height: 6px;
  accent-color: var(--accent);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.variant-height-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px var(--accent);
}

.variant-height-wrap input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px var(--accent);
}

@media (pointer: coarse) {
  .variant-height-wrap input[type="range"] {
    height: 6px;
  }

  .variant-height-wrap input[type="range"]::-webkit-slider-thumb {
    width: 30px;
    height: 30px;
    box-shadow: 0 0 0 2px var(--accent);
  }

  .variant-height-wrap input[type="range"]::-moz-range-thumb {
    width: 30px;
    height: 30px;
    box-shadow: 0 0 0 2px var(--accent);
  }
}

.variant-height-value {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  min-width: 4rem;
}

.back-link {
  font-size: 0.9rem;
  color: var(--muted);
}

.back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.snackbar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 1.5rem));
  background: var(--text);
  color: var(--bg);
  padding: 0.65rem 1.25rem;
  border-radius: 4px;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: transform 0.2s ease;
  pointer-events: none;
  z-index: 100;
}

.snackbar.visible {
  transform: translateX(-50%) translateY(0);
}

/* Cart icon in header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 0.25rem;
  position: relative;
  display: flex;
  align-items: center;
}

.cart-icon-btn:hover { color: var(--accent); }

.cart-icon-svg {
  width: 1.5rem;
  height: 1.5rem;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 1rem;
  height: 1rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

/* Add to cart button */
.add-to-cart-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  padding: 0.85rem 2rem;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.add-to-cart-btn:hover { opacity: 0.8; }

/* Cart drawer */
cart-drawer { display: contents; }

.cart-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 200;
}

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  background: var(--bg);
  border-left: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 201;
}

cart-drawer.is-open .cart-backdrop { display: block; }
cart-drawer.is-open .cart-panel { transform: translateX(0); }

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1.5px solid var(--border);
}

.cart-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
}

.cart-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0.25rem;
}

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

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.cart-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.cart-item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.cart-item-spec { font-size: 0.875rem; }

.cart-item-price {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1;
  padding: 0.1rem 0.25rem;
}

.cart-item-remove:hover { color: var(--accent); }

.cart-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cart-total {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
}

.cart-checkout-btn { max-width: none; }

@media (max-width: 600px) {
  header { padding: 1rem 1.25rem; }
  main { padding: 2.5rem 1.25rem; }
  .snackbar { white-space: normal; text-align: center; width: calc(100% - 3rem); }
}
