/* =====================================================================
   Clean Wears — Storefront
   Tokens
   ===================================================================== */
:root {
  --bg:        #FAFAF7;
  --paper:     #FFFFFF;
  --ink:       #201C18;
  --muted:     #746C60;
  --line:      #E5E1D8;
  --accent:    #B84A2C;
  --accent-dk: #8F3A22;
  --on-accent: #FFF8F4;
  --error:     #B3261E;
  --error-bg:  #FCEBE9;
  --success:   #3B6E4E;
  --success-bg:#EAF3ED;

  --serif: "Fraunces", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius-sm: 3px;
  --content-width: 1180px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); font-optical-sizing: auto; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; font-weight: 500; }

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

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

button, input, select, textarea { font-family: inherit; font-size: 1rem; }

/* --- Layout shells --- */
.site-header-inner, .site-footer-inner, .site-main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 32px;
}

.site-main { padding-top: 40px; padding-bottom: 80px; }

/* --- Header --- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.site-header-inner {
  display: flex;
  align-items: center;
  gap: 40px;
  height: 76px;
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.main-nav {
  display: flex;
  gap: 28px;
  flex: 1;
  font-size: 0.9rem;
  color: var(--muted);
}
.main-nav a:hover { color: var(--ink); }
.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.9rem;
  color: var(--muted);
}
.header-actions a:hover { color: var(--ink); }
.cart-link { position: relative; color: var(--ink); font-weight: 500; }
.cart-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  margin-left: 6px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  font-size: 0.72rem;
  text-align: center;
  line-height: 18px;
}

/* --- Footer --- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; }
.site-footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 24px;
  padding-bottom: 24px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* --- Alerts / flash --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--error-bg); color: var(--error); }
.page-alert { max-width: var(--content-width); margin: 20px auto 0; padding-left: 32px; padding-right: 32px; }

/* --- Hero --- */
.hero {
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 56px;
}
.hero-copy { max-width: 560px; }
.hero-copy p { color: var(--muted); font-size: 1.05rem; }

/* --- Buttons --- */
.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover { background: var(--accent-dk); }
.btn-primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--ink); }

/* --- Product grid --- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.product-card {
  background: var(--paper);
  padding-bottom: 20px;
  display: flex;
  flex-direction: column;
}
.product-card-image {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--bg);
}
.product-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.product-card:hover .product-card-image img { transform: scale(1.03); }
.product-card-body { padding: 14px 18px 0; }
.product-card-category { font-size: 0.78rem; color: var(--muted); }
.product-card-body h3 { margin: 2px 0 6px; font-size: 1rem; }
.product-card-price { font-size: 0.95rem; color: var(--muted); }

/* --- Listing head / filters --- */
.listing-head { margin-bottom: 32px; }
.filter-bar { display: flex; gap: 20px; align-items: end; flex-wrap: wrap; margin-top: 16px; font-size: 0.85rem; color: var(--muted); }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; }
.filter-bar input, .filter-bar select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}

/* --- Product detail --- */
.product-detail {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 56px;
}
.product-gallery-main { aspect-ratio: 3 / 4; background: var(--bg); overflow: hidden; }
.product-gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.product-gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; }
.gallery-thumb { width: 64px; height: 80px; object-fit: cover; cursor: pointer; border: 1px solid var(--line); }
.product-eyebrow { font-size: 0.85rem; color: var(--muted); }
.product-price { font-size: 1.2rem; margin: 4px 0 20px; }
.product-description { color: var(--muted); max-width: 44ch; }
.out-of-stock { color: var(--error); font-weight: 500; }

.size-select { margin: 20px 0; }
.size-select > span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.size-options { display: flex; gap: 8px; flex-wrap: wrap; }
.size-pill input { position: absolute; opacity: 0; }
.size-pill span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
}
.size-pill input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.qty-row { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.qty-row input {
  width: 70px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.add-to-cart-message { font-size: 0.85rem; color: var(--success); margin-top: 10px; min-height: 1.2em; }
.add-to-cart-message.is-error { color: var(--error); }

/* --- Forms (shared) --- */
.stack-form { display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.stack-form label { font-size: 0.85rem; color: var(--muted); margin-top: 10px; }
.stack-form input, .stack-form textarea, .stack-form select {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
.stack-form input:focus, .stack-form textarea:focus, .stack-form select:focus { border-color: var(--ink); }
.form-actions { margin-top: 20px; display: flex; gap: 12px; }
.field-hint { font-size: 0.8rem; color: var(--muted); }

/* --- Auth pages --- */
.auth-panel { max-width: 420px; margin: 0 auto; }
.auth-switch { margin-top: 20px; font-size: 0.9rem; color: var(--muted); }

/* --- Cart / checkout / orders --- */
.cart-page h1, .orders-page h1, .checkout-page { margin-bottom: 24px; }
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.cart-table th, .cart-table td { text-align: left; padding: 14px 10px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.cart-table thead th { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.cart-table-compact td { padding: 8px 10px; border-bottom: none; }
.thumb { width: 56px; height: 70px; object-fit: cover; }
.cart-variant { font-size: 0.8rem; color: var(--muted); }
.cart-qty-input { width: 60px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cart-line-total { text-align: right; }
.cart-summary { display: flex; justify-content: flex-end; gap: 24px; font-size: 1.1rem; padding: 12px 10px; border-top: 1px solid var(--ink); }
.cart-actions { display: flex; justify-content: flex-end; gap: 12px; }
.link-danger { background: none; border: none; color: var(--error); cursor: pointer; font-size: 0.85rem; padding: 0; }
.link-danger:hover { text-decoration: underline; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-state h1, .empty-state h2 { color: var(--ink); }
.empty-state .cart-actions { justify-content: center; margin-top: 20px; }

.checkout-page { display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: start; }
.bank-details { margin-top: 28px; padding: 20px; background: var(--paper); border: 1px solid var(--line); }
.bank-details dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 12px 0 0; font-size: 0.92rem; }
.bank-details dt { color: var(--muted); }
.bank-details dd { margin: 0; font-weight: 500; }

.orders-page .order-detail-row td { background: var(--bg); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--line);
  color: var(--ink);
}
.badge-paid, .badge-shipped { background: var(--success-bg); color: var(--success); }
.badge-cancelled { background: var(--error-bg); color: var(--error); }
.badge-pending_confirmation { background: #F3E9D9; color: #8A5A1E; }

/* --- Responsive --- */
@media (max-width: 880px) {
  .product-detail, .checkout-page { grid-template-columns: 1fr; }
  .main-nav { display: none; }
  .site-header-inner { gap: 20px; }
}
