/* ============================================================
   StartStore Demo — Main Stylesheet
   Design System: Japandi (Charcoal, Oat, Stone, Moss, Clay)
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--oat);
  color: var(--primary);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --primary:  #2C3632;
  --accent:   #8A9A5B;
  --oat:      #F4F1EA;
  --stone:    #E5E1D8;
  --ink:      #4A5450;
  --clay:     #B87D64;
  --white:    #FFFFFF;
  --dark:     #1C2220;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* Border radius */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(44,54,50,.06);
  --shadow-md: 0 4px 16px rgba(44,54,50,.1);
  --shadow-lg: 0 12px 32px rgba(44,54,50,.12);

  /* Transitions */
  --transition: .15s ease;
  --transition-md: .25s ease;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Source Serif 4', serif;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
}
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3.5vw, 1.9rem); }
h3 { font-size: 1.1rem; }
h4 { font-size: .95rem; }

.label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Layout ───────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-lg); }
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 var(--space-lg); }

.section { padding: var(--space-2xl) var(--space-lg); }
.section-sm { padding: var(--space-xl) var(--space-lg); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-md); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-md); }

/* ── Material Symbols ─────────────────────────────────────── */
.ms {
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  font-family: 'Material Symbols Outlined';
  line-height: 1;
  display: inline-block;
}
.ms-filled { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  border: none;
  border-radius: var(--radius-full);
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform .1s;
  min-height: 44px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--primary); color: var(--oat); }
.btn-primary:hover { background: var(--accent); }
.btn-accent    { background: var(--accent); color: var(--white); }
.btn-accent:hover { background: #6d7d48; }
.btn-outline   { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--oat); }
.btn-ghost     { background: transparent; color: var(--ink); border: 1.5px solid var(--stone); }
.btn-ghost:hover { background: var(--stone); }
.btn-danger    { background: transparent; color: var(--clay); border: 1.5px solid #FFDAD6; }
.btn-danger:hover { background: #FFDAD6; }
.btn-sm        { padding: 7px 16px; font-size: 12px; min-height: 36px; }
.btn-lg        { padding: 14px 32px; font-size: 15px; }
.btn-full      { width: 100%; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--stone);
  overflow: hidden;
}
.card-oat { background: var(--oat); }
.card-body { padding: var(--space-lg); }
.card-sm .card-body { padding: var(--space-md); }

/* ── Product Card ─────────────────────────────────────────── */
.product-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--stone);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-md), box-shadow var(--transition-md);
  -webkit-tap-highlight-color: transparent;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.product-card:active { transform: scale(.97); }

.product-card__img {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  height: 180px;
  background: var(--stone);
}
.product-card__img .product-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.product-card:hover .product-card__img .product-img { transform: scale(1.05); }
.product-card__badge {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--primary);
  color: var(--oat);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  letter-spacing: .04em;
}
.product-card__out {
  position: absolute; inset: 0;
  background: rgba(244,241,234,.75);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--ink); letter-spacing: .08em;
}
.product-card__quick-add {
  position: absolute;
  bottom: 10px; left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: var(--oat);
  border: none;
  border-radius: var(--radius-full);
  padding: 7px 16px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  opacity: 0;
  transition: opacity var(--transition);
}
.product-card:hover .product-card__quick-add { opacity: 1; }
.product-card__info { padding: 13px 14px 15px; }
.product-card__name { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 6px; line-height: 1.4; }
.product-card__prices { display: flex; align-items: center; gap: var(--space-sm); }
.product-card__price { font-size: 15px; font-weight: 700; color: var(--primary); }
.product-card__compare { font-size: 12px; color: var(--ink); text-decoration: line-through; }
.product-card__low-stock { font-size: 11px; color: var(--clay); margin-top: 4px; font-weight: 500; }

/* Product grid */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-md); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.form-input {
  width: 100%;
  background: var(--white);
  border: 1.5px solid #D9D5CC;
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 14px;
  color: var(--primary);
  outline: none;
  transition: border-color var(--transition);
  min-height: 44px;
}
.form-input:focus { border-color: var(--primary); }
.form-input--error { border-color: var(--clay); }
.form-hint { font-size: 11px; color: var(--ink); margin-top: 3px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.form-span-2 { grid-column: 1 / -1; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-md);
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}
.alert-error   { background: #FFDAD6; color: #93000A; }
.alert-success { background: #D6E7A1; color: #3A5A1A; }
.alert-warning { background: #F4DFCB; color: #7A5C48; }
.alert-info    { background: var(--stone); color: var(--primary); }

/* ── Badges ───────────────────────────────────────────────── */
.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-full); letter-spacing: .05em; }
.badge-pending    { background: #F4DFCB; color: #7A5C48; }
.badge-confirmed  { background: #D6E7A1; color: #3A5A1A; }
.badge-processing { background: #D6E7A1; color: #3A5A1A; }
.badge-shipped    { background: var(--stone); color: var(--primary); }
.badge-delivered  { background: var(--primary); color: var(--oat); }
.badge-cancelled  { background: #FFDAD6; color: #93000A; }

/* ── Nav ──────────────────────────────────────────────────── */
.topnav {
  background: var(--oat);
  border-bottom: 1px solid var(--stone);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.nav-logo { display: flex; align-items: center; gap: var(--space-sm); }
.logo-mark {
  width: 30px; height: 30px;
  background: var(--primary);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--oat);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.logo-name { font-family: 'Source Serif 4', serif; font-weight: 600; font-size: 1.1rem; color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { font-size: 13px; font-weight: 500; color: var(--ink); transition: color var(--transition); }
.nav-links a:hover { color: var(--primary); }
.nav-actions { display: flex; align-items: center; gap: var(--space-sm); }

/* Cart button */
.cart-btn { position: relative; padding: var(--space-sm); background: none; border: none; display: flex; align-items: center; }
.cart-badge {
  position: absolute; top: -2px; right: -4px;
  background: var(--accent); color: var(--white);
  border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* Hamburger */
.ham-btn { display: none; background: none; border: none; padding: var(--space-sm); }

/* Mobile menu */
.mob-menu {
  display: none;
  position: fixed; inset: 0;
  background: var(--oat);
  z-index: 80;
  flex-direction: column;
  padding: 80px 28px 28px;
  overflow-y: auto;
}
.mob-menu.open { display: flex; }
.mob-menu a {
  font-family: 'Source Serif 4', serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--primary);
  padding: 14px 0;
  border-bottom: 1px solid var(--stone);
  display: block;
}

/* ── Announce Bar ─────────────────────────────────────────── */
.announce-bar {
  background: var(--primary);
  color: var(--oat);
  font-size: 12px;
  text-align: center;
  padding: 9px var(--space-lg);
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}
.announce-bar__close {
  background: none; border: none; color: inherit;
  opacity: .6; cursor: pointer; padding: 2px;
  display: flex; align-items: center;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer { background: var(--dark); color: #94A09A; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 36px; }
.footer-heading { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--oat); margin-bottom: 14px; }
.footer-links { display: flex; flex-direction: column; gap: 9px; }
.footer-links a { font-size: 13px; transition: color var(--transition); }
.footer-links a:hover { color: var(--oat); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding-top: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-md); }
.payment-badges { display: flex; gap: var(--space-sm); }
.payment-badge { font-size: 10px; font-weight: 700; background: rgba(255,255,255,.1); padding: 3px 7px; border-radius: 4px; }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--primary); color: var(--oat);
  padding: 11px 20px;
  border-radius: var(--radius-full);
  font-size: 13px; font-weight: 500;
  z-index: 999;
  transition: transform .3s;
  white-space: nowrap;
  display: flex; align-items: center; gap: var(--space-sm);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb { font-size: 12px; color: var(--ink); margin-bottom: var(--space-md); }
.breadcrumb a { color: var(--ink); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--primary); }

/* ── Status badge helper ──────────────────────────────────── */
.status-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider { height: 1px; background: var(--stone); }

/* ── Bottom Navigation (PWA) ──────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--oat);
  border-top: 1px solid var(--stone);
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(60px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(44,54,50,.08);
}
.bottom-nav__inner { display: flex; height: 60px; }
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition);
  position: relative;
}
.bottom-nav__item.active { color: var(--primary); }
.bottom-nav__item:active .ms { transform: scale(.88); }
.bottom-nav__badge {
  position: absolute; top: 6px; right: calc(50% - 18px);
  background: var(--accent); color: var(--white);
  border-radius: var(--radius-full);
  font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* ── Page-specific ────────────────────────────────────────── */

/* Homepage collections grid */
.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-md);
}
.collection-card {
  display: block;
  text-decoration: none;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--white);
  border: 1.5px solid var(--stone);
  transition: transform var(--transition), box-shadow var(--transition);
  color: inherit;
}
.collection-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,.1);
}
.collection-card__img {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
}
.collection-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.collection-card__info {
  padding: 14px 16px;
}
.collection-card__info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

/* Collections sidebar */
.collections-layout { display: flex; gap: 28px; align-items: flex-start; }
.collections-sidebar { width: 200px; flex-shrink: 0; }
.sidebar-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink);
  transition: all var(--transition);
}
.sidebar-nav a:hover { background: var(--stone); color: var(--primary); }
.sidebar-nav a.active { background: var(--primary); color: var(--oat); font-weight: 600; }

/* Cart & Checkout layout */
.two-col-layout { display: grid; grid-template-columns: 1fr 360px; gap: var(--space-lg); align-items: start; }
.checkout-layout { display: grid; grid-template-columns: 1fr 360px; gap: var(--space-lg); align-items: start; }

/* Product detail */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }

/* Order progress tracker */
.progress-track { position: relative; display: flex; justify-content: space-between; }
.progress-track__line {
  position: absolute; top: 20px; left: 20px; right: 20px;
  height: 2px; background: var(--stone); z-index: 0;
}
.progress-track__fill {
  position: absolute; top: 20px; left: 20px;
  height: 2px; background: var(--accent); z-index: 1;
  transition: width .5s;
}
.progress-step { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; position: relative; z-index: 2; }
.progress-step__dot {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  transition: background .3s;
}
.progress-step__dot--done { background: var(--accent); }
.progress-step__dot--pending { background: var(--stone); }
.progress-step__dot--current { background: var(--accent); box-shadow: 0 0 0 3px var(--oat), 0 0 0 5px var(--primary); }
.progress-step__label { font-size: 10px; font-weight: 600; text-align: center; line-height: 1.3; }

/* ── Utilities ────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--ink); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: #C3C8C4; border-radius: 10px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .two-col-layout,
  .checkout-layout { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  /* Nav */
  .nav-links { display: none !important; }
  .ham-btn { display: flex !important; }
  .nav-inner { height: 52px; }
  .cart-btn { display: none !important; } /* use bottom nav instead */

  /* Bottom nav visible */
  .bottom-nav { display: block !important; }

  /* Body padding for bottom nav */
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  /* Layouts */
  .collections-layout { display: block; }
  .collections-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  /* Account page: stack profile below orders on mobile */
  .account-layout { grid-template-columns: 1fr !important; }
  .collections-sidebar { display: none; }
  .product-detail { grid-template-columns: 1fr !important; gap: var(--space-lg) !important; }
  .form-grid-2 { grid-template-columns: 1fr !important; }
  .footer-grid { grid-template-columns: 1fr 1fr !important; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }

  /* Product grid 2 col */
  .product-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
  .product-card__img { height: 140px !important; }

  /* Typography */
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }

  /* Sections */
  .section { padding: var(--space-xl) var(--space-md); }
  .section-sm { padding: var(--space-lg) var(--space-md); }
  .container { padding: 0 var(--space-md); }

  /* Toast above bottom nav */
  .toast { bottom: 80px !important; }

  /* Announce bar */
  .announce-bar { font-size: 11px; padding: 7px var(--space-md); }

  /* Buttons full width on mobile forms */
  .btn-mobile-full { width: 100%; }

  /* App-like tap feedback */
  .product-card:hover { transform: none; box-shadow: none; }
  .product-card:active { transform: scale(.97); }

  /* Page fade-in */
  main { animation: fadeIn .2s ease; }
}

@media (max-width: 480px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .footer-grid { grid-template-columns: 1fr !important; }
  .form-grid-2 { grid-template-columns: 1fr !important; }
  .nav-inner { padding: 0 var(--space-md); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Performance ─────────────────────────────────────────── */
/* Ensure system fonts render immediately while web fonts load */
body { font-display: swap; }

/* Off-screen sections paint lazily (supported Chrome/Edge) */
.collections-section,
.features-section,
footer { content-visibility: auto; contain-intrinsic-size: 0 400px; }

/* Smooth image loading */
img { color: transparent; }
.product-img { transition: opacity .3s ease; }
