:root {
  --bg: #17140f;
  --bg-alt: #211c15;
  --bg-raised: #29231a;
  --ink: #f3eee4;
  --ink-muted: #b8af9e;
  --ink-faint: #857c6c;
  --accent: #e8a33d;
  --accent-ink: #17140f;
  --line: #362f24;
  --danger: #e85c4a;
  --success: #7fb88a;
  --radius: 4px;
  --display: "Archivo Black", "Arial Black", sans-serif;
  --body: "Work Sans", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.55;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@keyframes slide-in-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.02;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2.4rem, 5vw, 4.4rem); }
h2 { font-size: 1.5rem; }

p { margin: 0 0 1em; color: var(--ink); }

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem 0.75rem;
}

.logo {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

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

.main-nav a {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  transition: color 0.15s ease;
}

.main-nav a:hover { color: var(--accent); }

.account-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-raised);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  overflow: hidden;
  text-transform: none;
  letter-spacing: normal;
}

.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }

.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0 1.5rem 0.9rem;
}

.category-bar a {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color 0.15s ease;
}

.category-bar a { position: relative; padding-bottom: 2px; }

.category-bar a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.category-bar a:hover { color: var(--accent); }
.category-bar a:hover::after { transform: scaleX(1); }

.bag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 2px;
}

.bag-count.pulse { animation: pulse 0.4s ease; }

/* ---------- page / footer ---------- */

.page {
  padding: 2.5rem 1.5rem 4rem;
  min-height: 60vh;
  animation: fade-in 0.3s ease both;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-inner .logo { font-size: 0.9rem; opacity: 0.6; }
.footer-inner p { margin: 0; }

/* ---------- buttons / links ---------- */

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.9rem 1.6rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.97); }

.btn-small { padding: 0.5rem 0.9rem; font-size: 0.75rem; }

.btn-link {
  background: none;
  border: none;
  color: var(--ink-muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  font-family: var(--body);
}

.btn-link:hover { color: var(--danger); }

/* ---------- messages ---------- */

.messages { list-style: none; padding: 0; margin: 0 0 1.5rem; }

.message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--line);
  animation: slide-in-down 0.25s ease both;
}

.message-success { border-color: var(--success); color: var(--success); }
.message-error { border-color: var(--danger); color: var(--danger); }
.message-info { color: var(--ink-muted); }

/* ---------- hero ---------- */

.hero { padding: 3rem 0 3.5rem; max-width: 640px; }

.hero-eyebrow {
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  animation: fade-up 0.5s ease both;
}

.hero h1 { animation: fade-up 0.5s ease 0.08s both; }

.hero-sub {
  color: var(--ink-muted);
  max-width: 40ch;
  animation: fade-up 0.5s ease 0.16s both;
}

.hero .btn { animation: fade-up 0.5s ease 0.24s both; }

/* ---------- category strip ---------- */

.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 3rem;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  transition: border-color 0.15s ease, color 0.15s ease;
}

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

/* ---------- product grid / cards ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.75rem;
}

.product-card { display: block; }

.product-card-image {
  aspect-ratio: 3 / 4;
  background: var(--bg-alt);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.85rem;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.product-card:hover .product-card-image img { transform: scale(1.06); }

.product-card {
  animation: fade-up 0.4s ease both;
}

.product-grid .product-card:nth-child(1) { animation-delay: 0.02s; }
.product-grid .product-card:nth-child(2) { animation-delay: 0.06s; }
.product-grid .product-card:nth-child(3) { animation-delay: 0.1s; }
.product-grid .product-card:nth-child(4) { animation-delay: 0.14s; }
.product-grid .product-card:nth-child(n+5) { animation-delay: 0.16s; }

.product-card-placeholder {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    135deg,
    var(--bg-alt) 0 10px,
    var(--bg-raised) 10px 20px
  );
}

.product-card-placeholder.large { aspect-ratio: 3 / 4; border-radius: var(--radius); }

.product-card-name { font-weight: 600; margin-bottom: 0.2em; }

.product-card-price { color: var(--accent); font-weight: 600; margin-bottom: 0.2em; }

.product-card-oos { color: var(--ink-faint); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- shop layout ---------- */

.shop-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
}

.filters h2 {
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: 1rem;
}

.filter-list { list-style: none; padding: 0; margin: 0 0 2rem; }

.filter-list li { margin-bottom: 0.5rem; }

.filter-list a { color: var(--ink-muted); font-size: 0.9rem; }

.filter-list a.active, .filter-list a:hover { color: var(--accent); }

.search-form { display: flex; gap: 0.5rem; }

.search-form input {
  flex: 1;
  min-width: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.pagination a {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  transition: color 0.15s ease;
}

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

.pagination-status { font-size: 0.8rem; color: var(--ink-faint); }

/* ---------- forms ---------- */

input, textarea, select {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
  font-family: var(--body);
  font-size: 0.9rem;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

form p { margin-bottom: 1rem; }

form label { display: block; margin-bottom: 0.35rem; font-size: 0.85rem; color: var(--ink-muted); }

form input, form textarea, form select { width: 100%; }

/* ---------- auth ---------- */

.auth-form { max-width: 380px; }

.auth-switch { color: var(--ink-muted); font-size: 0.9rem; }

/* ---------- profile ---------- */

.profile-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
  align-items: start;
}

.profile-card {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: center;
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--bg-raised);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  overflow: hidden;
  margin: 0 auto 1rem;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-card h1 { font-size: 1.3rem; margin-bottom: 0.2em; }

.profile-email { color: var(--ink-muted); font-size: 0.85rem; word-break: break-all; }

.avatar-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1.25rem 0;
}

.avatar-form input[type="file"] {
  padding: 0.4rem;
  font-size: 0.75rem;
}

.profile-orders h2 { font-size: 1.1rem; }

/* ---------- product detail ---------- */

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.product-detail-image img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}

.product-detail-category {
  color: var(--ink-muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.product-detail-price {
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 600;
}

.product-detail-description { color: var(--ink-muted); max-width: 48ch; }

fieldset { border: none; padding: 0; margin: 0 0 1.25rem; }

legend {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0;
  margin-bottom: 0.6rem;
}

.size-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  margin: 0 0.5rem 0.5rem 0;
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.size-option:active { transform: scale(0.96); }

.size-option:has(input:checked) { border-color: var(--accent); color: var(--accent); }

.size-option.disabled { opacity: 0.4; cursor: not-allowed; }

.size-option input { width: auto; margin: 0; }

.quantity-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 160px;
  margin-bottom: 1.25rem;
}

.quantity-field input { width: 80px; }

/* ---------- cart table ---------- */

.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }

.cart-table th, .cart-table td {
  text-align: left;
  padding: 0.9rem 0.6rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.cart-table th { color: var(--ink-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }

.quantity-update-form { display: flex; gap: 0.4rem; }

.quantity-update-form input { width: 60px; }

.cart-summary { display: flex; align-items: center; justify-content: flex-end; gap: 1.5rem; }

.cart-total { font-size: 1.2rem; font-weight: 600; }

/* ---------- checkout ---------- */

.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 3rem;
  align-items: start;
}

.payment-note {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1rem 0 1.5rem;
  font-size: 0.85rem;
}

.payment-note p:last-child { margin-bottom: 0; color: var(--ink-muted); }

.order-summary {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.order-summary ul { list-style: none; padding: 0; margin: 0 0 1rem; font-size: 0.85rem; color: var(--ink-muted); }
.order-summary li { margin-bottom: 0.5rem; }

/* ---------- confirmation ---------- */

.confirmation ul { padding-left: 1.2rem; color: var(--ink-muted); }

/* ---------- error page ---------- */

.error-page {
  max-width: 480px;
  padding: 3rem 0;
  animation: fade-up 0.4s ease both;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .shop-layout, .product-detail, .checkout-layout, .profile-layout {
    grid-template-columns: 1fr;
  }
}
