@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Plus+Jakarta+Sans:wght@300;400;500;600&display=swap');

:root {
  --cream:   #FAF8F4;
  --paper:   #F2EEE7;
  --light:   #E8E2D9;
  --stone:   #9A9087;
  --ink:     #1A1714;
  --rust:    #C8512E;
  --rust-dk: #A3401F;
  --rust-lt: #F0E0D8;
  --radius:  4px;
  --shadow:  0 2px 16px rgba(26,23,20,0.08);
  --shadow-lg: 0 8px 40px rgba(26,23,20,0.12);
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Subtle grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.6;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4 { font-family: 'Cormorant Garamond', serif; font-weight: 500; line-height: 1.15; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
h3 { font-size: clamp(1.3rem, 2vw, 1.7rem); }
p  { line-height: 1.7; color: #4A4540; }
a  { color: inherit; text-decoration: none; }

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,248,244,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--light);
  padding: 0 clamp(1rem, 4vw, 3rem);
  height: 68px;
  display: flex; align-items: center; justify-content: space-between;
}

.nav-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.nav-brand span { color: var(--rust); }

.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--ink); }

.nav-cart {
  position: relative;
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--ink);
  color: var(--cream);
  padding: 0.5rem 1.1rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: background var(--transition), transform var(--transition);
  cursor: pointer;
}
.nav-cart:hover { background: var(--rust); transform: translateY(-1px); }
.nav-cart svg { width: 15px; height: 15px; }
.cart-count {
  background: var(--rust);
  color: white;
  border-radius: 100px;
  padding: 0 5px;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
  display: none;
}
.cart-count.visible { display: inline-block; }

/* ── HERO ── */
.hero {
  padding: clamp(3rem, 8vw, 7rem) clamp(1rem, 4vw, 3rem);
  position: relative;
  overflow: hidden;
}
.hero-inner { max-width: 680px; }
.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 1.2rem;
  display: flex; align-items: center; gap: 0.8rem;
}
.hero-eyebrow::before {
  content: '';
  width: 32px; height: 1px;
  background: var(--rust);
}
.hero h1 { margin-bottom: 1.5rem; }
.hero p { font-size: 1.05rem; max-width: 500px; }
.hero-deco {
  position: absolute;
  right: -80px; top: 50%;
  transform: translateY(-50%);
  width: 420px; height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--rust-lt) 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

/* ── LAYOUT ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem); }
main { flex: 1; }

/* ── SECTION HEADER ── */
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--light);
}
.section-header h2 { font-size: 1.9rem; }
.section-header a {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rust);
  display: flex; align-items: center; gap: 0.4rem;
}

/* ── PRODUCT GRID ── */
.products-section { padding: 3rem 0 5rem; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem;
}

.product-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.product-card-img {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--paper);
  position: relative;
}
.product-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}
.product-card:hover .product-card-img img { transform: scale(1.04); }
.product-card-img .placeholder-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 3rem;
  color: var(--light);
}
.product-card-body { padding: 1.2rem 1.4rem 1.5rem; }
.product-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--ink);
}
.product-card-price {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--rust);
}

/* ── PRODUCT DETAIL ── */
.product-detail { padding: 3rem 0 5rem; }
.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: start;
}
@media (max-width: 768px) { .product-detail-grid { grid-template-columns: 1fr; gap: 2rem; } }

.product-detail-img {
  aspect-ratio: 1;
  background: var(--paper);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.product-detail-img img { width: 100%; height: 100%; object-fit: cover; }

.product-detail-info { padding-top: 1rem; }
.product-detail-info .eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 0.8rem;
}
.product-detail-info h1 { margin-bottom: 1rem; }
.product-price-display {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  color: var(--rust);
  font-weight: 500;
  margin-bottom: 1.5rem;
}
.product-desc { margin-bottom: 2rem; }

/* ── VARIANTS ── */
.variants-section { margin-bottom: 2rem; }
.variants-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 0.8rem;
}
.variant-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.variant-btn {
  padding: 0.45rem 1rem;
  border: 1.5px solid var(--light);
  border-radius: var(--radius);
  background: white;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--ink);
}
.variant-btn:hover { border-color: var(--ink); }
.variant-btn.active { border-color: var(--ink); background: var(--ink); color: var(--cream); }

/* ── QTY ── */
.qty-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.qty-control {
  display: flex; align-items: center;
  border: 1.5px solid var(--light);
  border-radius: var(--radius);
  overflow: hidden;
}
.qty-btn {
  width: 38px; height: 38px;
  border: none; background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--ink);
  transition: background var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { background: var(--paper); }
.qty-value { padding: 0 1rem; font-weight: 500; min-width: 2.5rem; text-align: center; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.8rem;
  border-radius: var(--radius);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--cream);
}
.btn-primary:hover { background: var(--rust); transform: translateY(-1px); }
.btn-rust {
  background: var(--rust);
  color: white;
}
.btn-rust:hover { background: var(--rust-dk); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--light);
}
.btn-outline:hover { border-color: var(--ink); }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── CART ── */
.cart-page { padding: 3rem 0 5rem; }
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 3rem; align-items: start; }
@media (max-width: 900px) { .cart-layout { grid-template-columns: 1fr; } }

.cart-items { display: flex; flex-direction: column; gap: 1px; }
.cart-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 1.2rem;
  align-items: center;
  background: white;
  padding: 1.2rem;
  border-radius: 6px;
  margin-bottom: 0.6rem;
  box-shadow: 0 1px 6px rgba(26,23,20,0.05);
}
.cart-item-img {
  width: 80px; height: 80px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper);
  flex-shrink: 0;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-title { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; font-weight: 500; margin-bottom: 0.25rem; }
.cart-item-variant { font-size: 0.8rem; color: var(--stone); }
.cart-item-price { font-weight: 600; color: var(--rust); white-space: nowrap; }
.cart-item-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.6rem; }
.remove-btn { background: none; border: none; color: var(--stone); cursor: pointer; font-size: 0.78rem; text-decoration: underline; padding: 0; }
.remove-btn:hover { color: var(--rust); }

.cart-summary {
  background: white;
  border-radius: 8px;
  padding: 1.8rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 88px;
}
.cart-summary h3 { font-size: 1.3rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--light); }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 0.8rem; font-size: 0.9rem; }
.summary-row.total { font-weight: 600; font-size: 1rem; padding-top: 1rem; border-top: 1px solid var(--light); margin-top: 0.5rem; }
.summary-row.total .price { color: var(--rust); font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; }

.cart-empty {
  text-align: center;
  padding: 5rem 2rem;
  grid-column: 1 / -1;
}
.cart-empty h2 { font-size: 2rem; margin-bottom: 1rem; }
.cart-empty p { color: var(--stone); margin-bottom: 2rem; }

/* ── CHECKOUT ── */
.checkout-page { padding: 3rem 0 5rem; }
.checkout-layout { display: grid; grid-template-columns: 1fr 380px; gap: 3rem; align-items: start; }
@media (max-width: 900px) { .checkout-layout { grid-template-columns: 1fr; } }

.form-section {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.form-section h3 { font-size: 1.2rem; margin-bottom: 1.5rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--light); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); }
.form-group input, .form-group select {
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--light);
  border-radius: var(--radius);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  background: white;
  transition: border-color var(--transition);
  width: 100%;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--ink);
}
.form-group.full { grid-column: 1 / -1; }

#stripe-card-element {
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--light);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
#stripe-card-element.StripeElement--focus { border-color: var(--ink); }
#stripe-card-element.StripeElement--invalid { border-color: #E53935; }
#card-errors { color: #E53935; font-size: 0.82rem; margin-top: 0.4rem; min-height: 1.2em; }

.checkout-summary { position: sticky; top: 88px; }
.checkout-summary .cart-summary { margin-bottom: 1rem; }
.checkout-items { margin-bottom: 1rem; }
.checkout-item {
  display: flex; gap: 0.8rem; align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--light);
  font-size: 0.88rem;
}
.checkout-item:last-child { border-bottom: none; }
.checkout-item-img { width: 44px; height: 44px; border-radius: 4px; overflow: hidden; background: var(--paper); flex-shrink: 0; }
.checkout-item-img img { width: 100%; height: 100%; object-fit: cover; }
.checkout-item-info { flex: 1; }
.checkout-item-name { font-weight: 500; }
.checkout-item-qty { color: var(--stone); font-size: 0.8rem; }
.checkout-item-price { font-weight: 600; color: var(--rust); white-space: nowrap; }

/* ── AUTH PAGES ── */
.auth-page {
  min-height: calc(100vh - 68px);
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 1rem;
}
.auth-card {
  background: white;
  border-radius: 12px;
  padding: clamp(2rem, 5vw, 3rem);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
}
.auth-card .logo { text-align: center; margin-bottom: 2rem; }
.auth-card .logo span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  font-weight: 600;
}
.auth-card h2 { text-align: center; margin-bottom: 0.5rem; }
.auth-card .subtitle { text-align: center; color: var(--stone); font-size: 0.9rem; margin-bottom: 2rem; }
.auth-card .form-group { margin-bottom: 1rem; }
.auth-switch { text-align: center; margin-top: 1.5rem; font-size: 0.88rem; color: var(--stone); }
.auth-switch a { color: var(--rust); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }
.divider { text-align: center; color: var(--stone); font-size: 0.8rem; margin: 1.2rem 0; position: relative; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--light); }
.divider::before { left: 0; } .divider::after { right: 0; }

/* ── ORDER PAGES ── */
.orders-page { padding: 3rem 0 5rem; }
.order-card {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
}
.order-id { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 500; }
.order-date { font-size: 0.82rem; color: var(--stone); margin-top: 0.2rem; }
.order-total { font-weight: 600; color: var(--rust); font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; }

.status-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status-pending       { background: #FEF3C7; color: #92400E; }
.status-payment_processing { background: #FEF3C7; color: #92400E; }
.status-paid          { background: #D1FAE5; color: #065F46; }
.status-submitted_to_gelato { background: #DBEAFE; color: #1E40AF; }
.status-in_production { background: #DBEAFE; color: #1E40AF; }
.status-shipped       { background: #EDE9FE; color: #5B21B6; }
.status-delivered     { background: #D1FAE5; color: #065F46; }
.status-cancelled     { background: #FEE2E2; color: #991B1B; }
.status-failed        { background: #FEE2E2; color: #991B1B; }

/* ── CONFIRM PAGE ── */
.confirm-page { padding: 5rem 0; text-align: center; }
.confirm-icon {
  width: 72px; height: 72px;
  background: #D1FAE5;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
}
.confirm-page h1 { margin-bottom: 1rem; }
.confirm-page p { color: var(--stone); max-width: 420px; margin: 0 auto 2rem; }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.6rem; }
.toast {
  background: var(--ink);
  color: var(--cream);
  padding: 0.8rem 1.3rem;
  border-radius: 8px;
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease-out;
  max-width: 320px;
}
.toast.success { background: #065F46; }
.toast.error   { background: #991B1B; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(20px); } }

/* ── LOADING ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--paper) 25%, var(--light) 50%, var(--paper) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-card { height: 340px; border-radius: 8px; }

/* ── BREADCRUMB ── */
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--stone); margin-bottom: 2rem; }
.breadcrumb a:hover { color: var(--rust); }
.breadcrumb span { color: var(--light); }

/* ── FOOTER ── */
footer {
  background: var(--ink);
  color: rgba(250,248,244,0.6);
  padding: 3rem clamp(1rem, 4vw, 3rem);
  margin-top: auto;
}
.footer-inner { max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-brand { font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; color: var(--cream); }
.footer-brand span { color: var(--rust); }
footer p { font-size: 0.8rem; }

/* ── UTILITIES ── */
.text-rust   { color: var(--rust); }
.text-stone  { color: var(--stone); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* ── PAGE FADE IN ── */
.page-content { animation: fadeUp 0.35s ease-out both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
