/* ============================================================
   Leanse — Hi-Fi Design System
   Warm cream paper · sage accent · editorial typography
   ============================================================ */

:root {
  /* ---- Palette ---- */
  --paper:        #f8f3e7;
  --paper-2:      #f1ead9;
  --surface:      #fefcf7;
  --surface-2:    #fbf6e9;
  --ink:          #1a1612;
  --ink-2:        #3d362e;
  --ink-3:        #6f665a;
  --ink-4:        #a39a8b;
  --hairline:     rgba(26, 22, 18, 0.10);
  --hairline-strong: rgba(26, 22, 18, 0.20);

  --sage:         #5a6b3a;
  --sage-dark:    #3f4d24;
  --sage-soft:    #cdd4b1;
  --sage-bg:      #e8ecd8;

  --terra:        #b8623d;
  --gold:         #c89a3a;
  --berry:        #8e3a4f;

  /* ---- Typography ---- */
  --font-display: "Instrument Serif", "Source Serif 4", Georgia, serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;

  /* ---- Spacing scale ---- */
  --s-0: 4px;
  --s-1: 8px;
  --s-2: 12px;
  --s-3: 16px;
  --s-4: 24px;
  --s-5: 32px;
  --s-6: 48px;
  --s-7: 64px;
  --s-8: 96px;
  --s-9: 128px;

  /* ---- Radii ---- */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-xl: 22px;
  --r-full: 999px;

  /* ---- Shadow ---- */
  --shadow-sm: 0 1px 2px rgba(26,22,18,0.05);
  --shadow-md: 0 6px 24px -8px rgba(26,22,18,0.12), 0 2px 6px -2px rgba(26,22,18,0.06);
  --shadow-lg: 0 24px 60px -20px rgba(26,22,18,0.20), 0 4px 12px -4px rgba(26,22,18,0.08);

  /* ---- Layout ---- */
  --content-max: 1180px;
  --content-wide: 1320px;
  --content-narrow: 720px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--sage-soft); color: var(--ink); }

/* paper grain texture */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(58, 46, 30, 0.025) 1px, transparent 1px),
    radial-gradient(rgba(58, 46, 30, 0.02) 1px, transparent 1px);
  background-size: 24px 24px, 13px 13px;
  background-position: 0 0, 6px 7px;
  z-index: 1;
}
body > * { position: relative; z-index: 2; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0;
}
.display em { font-style: italic; color: var(--sage); }
.display .terra { color: var(--terra); font-style: italic; }

.h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(40px, 5.5vw, 72px); line-height: 1.04; letter-spacing: -0.02em; margin: 0; }
.h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(32px, 3.8vw, 48px); line-height: 1.05; letter-spacing: -0.015em; margin: 0; }
.h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.1; letter-spacing: -0.01em; margin: 0; }
.h4 { font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 1.2; margin: 0; }
.h5 { font-family: var(--font-body); font-weight: 600; font-size: 17px; line-height: 1.3; letter-spacing: -0.005em; margin: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sage);
  margin: 0;
}
.eyebrow-ink { color: var(--ink-3); }

.meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.lede {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
}
.muted { color: var(--ink-3); }
.italic { font-style: italic; }

/* ============================================================
   LAYOUT WRAPPERS
   ============================================================ */
.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--s-4); }
.wrap-wide { max-width: var(--content-wide); margin: 0 auto; padding: 0 var(--s-4); }
.wrap-narrow { max-width: var(--content-narrow); margin: 0 auto; padding: 0 var(--s-4); }

.section { padding: var(--s-7) 0; }
.section-lg { padding: var(--s-8) 0; }
.section-sm { padding: var(--s-5) 0; }

.divider-line { border-top: 1px solid var(--hairline); margin: 0; }

/* ============================================================
   HEADER (shared)
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 243, 231, 0.85);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}
.header-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 18px var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
}
.logo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.logo .logo-mark {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--sage);
  position: relative;
  transform: translateY(-2px);
}
.logo .logo-mark::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--paper);
  clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
}
.logo-text { font-style: italic; }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--s-5);
}
.site-nav a {
  position: relative;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 6px 2px;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.is-active { color: var(--ink); }
.site-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--sage);
  border-radius: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 10px 18px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); box-shadow: var(--shadow-md); }
.btn-accent {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}
.btn-accent:hover { background: var(--sage-dark); box-shadow: var(--shadow-md); }
.btn-outline {
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
  background: transparent;
}
.btn-outline:hover { border-color: var(--ink); background: var(--surface); }
.btn-ghost {
  color: var(--ink-2);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--ink); background: var(--paper-2); }
.btn-sm { padding: 6px 12px; font-size: 13.5px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-icon { padding: 8px; border-radius: 50%; }
.btn-cart {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--hairline);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}
.btn-cart:hover { background: var(--surface); border-color: var(--hairline-strong); }
.btn-cart .cart-badge {
  position: absolute;
  top: -3px; right: -3px;
  background: var(--sage);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--paper);
}

/* ============================================================
   CHIPS / TAGS
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--hairline-strong);
  color: var(--ink-2);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.chip-sage {
  background: var(--sage-bg);
  border-color: var(--sage-soft);
  color: var(--sage-dark);
}
.chip-gold {
  background: rgba(200, 154, 58, 0.12);
  border-color: rgba(200, 154, 58, 0.4);
  color: #8a6818;
}
.chip-terra {
  background: rgba(184, 98, 61, 0.10);
  border-color: rgba(184, 98, 61, 0.35);
  color: #8a4527;
}
.chip-icon { width: 13px; height: 13px; }

.badge-star { color: var(--gold); font-size: 12px; }
.badge-new { color: var(--terra); }

/* ============================================================
   IMAGE PLACEHOLDERS (hi-fi tasteful)
   ============================================================ */
.ph {
  position: relative;
  background: var(--sage-bg);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage-dark);
}
.ph::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(90,107,58,0.18), transparent 60%),
    linear-gradient(135deg, transparent 0%, rgba(26,22,18,0.04) 100%);
  pointer-events: none;
}
.ph-label {
  position: relative;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(63, 77, 36, 0.65);
  padding: 8px 14px;
  border: 1px dashed rgba(63, 77, 36, 0.35);
  border-radius: var(--r-sm);
  background: rgba(248, 243, 231, 0.6);
  backdrop-filter: blur(2px);
  z-index: 2;
}

.ph-warm { background: #efe1c5; color: #6b5630; }
.ph-warm .ph-label { color: rgba(107, 86, 48, 0.7); border-color: rgba(107, 86, 48, 0.35); }
.ph-warm::before {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.6), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(184, 98, 61, 0.15), transparent 60%);
}
.ph-cool { background: #e0e6e0; color: #4a5a4a; }
.ph-product {
  background: linear-gradient(135deg, #f1ead9 0%, #e8ecd8 100%);
}

/* aspect ratio helpers */
.ar-16x9 { aspect-ratio: 16/9; }
.ar-4x3  { aspect-ratio: 4/3; }
.ar-3x2  { aspect-ratio: 3/2; }
.ar-1x1  { aspect-ratio: 1/1; }
.ar-2x3  { aspect-ratio: 2/3; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  padding: var(--s-4);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--hairline-strong); }
.card-flat {
  background: transparent;
  border: none;
  padding: 0;
}
.card-flat:hover { box-shadow: none; transform: none; }

.product-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 0;
  overflow: hidden;
  transition: all 0.22s ease;
  position: relative;
}
.product-card:hover {
  border-color: var(--hairline-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.product-card .ph { aspect-ratio: 4/3; border-radius: 0; }
.product-card-body {
  padding: 16px 18px 18px;
  display: flex; flex-direction: column; gap: 10px;
  flex: 1;
}
.product-card-title {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}
.product-card-meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; }
.product-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto;
}
.product-card .price { font-family: var(--font-display); font-size: 22px; }
.product-card .price em { font-style: normal; color: var(--sage); font-size: 16px; margin-left: 2px; }

.product-card-badge {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 3;
}

/* ============================================================
   FORMS
   ============================================================ */
.input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--sage);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--sage-bg);
}
.input::placeholder { color: var(--ink-4); }
.label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
  display: block;
}
.field { display: flex; flex-direction: column; }

.checkbox-row { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; }
.checkbox-row input { margin-top: 4px; accent-color: var(--sage); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  margin-top: var(--s-8);
  background: var(--paper-2);
  border-top: 1px solid var(--hairline);
  padding: var(--s-7) 0 var(--s-4);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--s-5);
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 var(--s-4);
}
.footer-col h6 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin: 0 0 16px;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--ink-2); font-size: 14.5px; }
.footer-col a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom {
  max-width: var(--content-wide);
  margin: var(--s-6) auto 0;
  padding: var(--s-3) var(--s-4) 0;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}
.footer-brand-line p {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.1;
  margin: 0 0 12px;
  max-width: 24ch;
  color: var(--ink);
}
.newsletter-inline {
  display: flex; gap: 8px; margin-top: 16px;
}
.newsletter-inline .input { font-size: 14px; padding: 10px 14px; }

/* ============================================================
   PAGE TRANSITIONS / ROUTER
   ============================================================ */
.page-view { animation: pageIn 0.32s ease both; }
@keyframes pageIn {
  0%   { opacity: 0.7; }
  100% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .page-view { animation: none; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-5 { gap: var(--s-5); }
.gap-6 { gap: var(--s-6); }
.grow { flex: 1; min-width: 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: var(--s-1); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.mt-6 { margin-top: var(--s-6); }
.mb-1 { margin-bottom: var(--s-1); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-5 { margin-bottom: var(--s-5); }
.mb-6 { margin-bottom: var(--s-6); }
.relative { position: relative; }
.hidden { display: none; }

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--hairline-strong);
}

.price-tag {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
}
.price-tag em { font-style: normal; color: var(--sage); font-size: 20px; margin-left: 2px; }
.price-old { font-size: 16px; color: var(--ink-3); text-decoration: line-through; margin-left: 8px; font-family: var(--font-body); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .site-nav { display: none; }
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; }
  .header-actions .btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
