/* ============================================================
   Culture & Crumb — Design System & Main Stylesheet
   ============================================================ */

/* --- Self-hosted fonts (GDPR-safe, no Google Fonts CDN) --- */
@font-face {
  font-family: 'DM Serif Display';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/dm-serif-display/dm-serif-display-v17-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter/inter-v20-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/inter/inter-v20-latin-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter/inter-v20-latin-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/inter/inter-v20-latin-700.woff2') format('woff2');
}

/* --- Design Tokens (CSS Custom Properties) --- */
:root {
  /* Color palette — warm, artisanal, food-inspired */
  --color-primary:        #7B5B3A;   /* toasted crust brown */
  --color-primary-dark:   #5C3D1E;   /* deep walnut */
  --color-primary-light:  #A8845A;   /* light caramel */
  --color-secondary:      #5B7553;   /* sage green */
  --color-secondary-dark: #3F5339;   /* deep moss */
  --color-accent:         #C8763E;   /* fermented amber */
  --color-accent-light:   #E8A96B;   /* honey glow */

  --color-bg:             #FAF6F1;   /* warm cream */
  --color-surface:        #FFFFFF;
  --color-surface-alt:    #F3EDE5;   /* oat */
  --color-text:           #2D2A26;   /* warm charcoal */
  --color-text-muted:     #6B6560;
  --color-text-inverse:   #FAF6F1;
  --color-border:         #E0D8CE;
  --color-border-strong:  #C4B8AA;

  --color-success:        #5B7553;
  --color-warning:        #C8763E;
  --color-error:          #B04A3A;
  --color-info:           #4A6FA5;

  /* Typography — editorial + readable */
  --font-heading:  'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', monospace;

  --fs-xs:    0.75rem;    /* 12px */
  --fs-sm:    0.875rem;   /* 14px */
  --fs-base:  1rem;       /* 16px */
  --fs-md:    1.125rem;   /* 18px */
  --fs-lg:    1.25rem;    /* 20px */
  --fs-xl:    1.5rem;     /* 24px */
  --fs-2xl:   1.875rem;   /* 30px */
  --fs-3xl:   2.25rem;    /* 36px */
  --fs-4xl:   3rem;       /* 48px */

  --fw-normal:    400;
  --fw-medium:    500;
  --fw-semibold:  600;
  --fw-bold:      700;

  --lh-tight:   1.25;
  --lh-normal:  1.6;
  --lh-relaxed: 1.75;

  /* Spacing scale */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;

  /* Layout */
  --max-width:     1200px;
  --max-width-narrow: 800px;
  --radius-sm:  0.375rem;
  --radius-md:  0.5rem;
  --radius-lg:  0.75rem;
  --radius-xl:  1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(45,42,38,0.06);
  --shadow-md:  0 4px 6px rgba(45,42,38,0.07), 0 1px 3px rgba(45,42,38,0.06);
  --shadow-lg:  0 10px 15px rgba(45,42,38,0.08), 0 4px 6px rgba(45,42,38,0.04);
  --shadow-xl:  0 20px 25px rgba(45,42,38,0.10), 0 8px 10px rgba(45,42,38,0.04);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}
a:hover, a:focus-visible {
  color: var(--color-primary-dark);
}

/* --- Skip link (accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  background: var(--color-primary-dark);
  color: var(--color-text-inverse);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  z-index: 1000;
  font-weight: var(--fw-semibold);
  text-decoration: none;
}
.skip-link:focus {
  top: var(--sp-4);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-normal); /* DM Serif Display is already bold-looking */
  line-height: var(--lh-tight);
  color: var(--color-text);
}
h1 { font-size: var(--fs-4xl); margin-bottom: var(--sp-6); }
h2 { font-size: var(--fs-3xl); margin-bottom: var(--sp-4); }
h3 { font-size: var(--fs-2xl); margin-bottom: var(--sp-3); }
h4 { font-size: var(--fs-xl);  margin-bottom: var(--sp-3); }
h5 { font-size: var(--fs-lg);  margin-bottom: var(--sp-2); }
h6 { font-size: var(--fs-md);  margin-bottom: var(--sp-2); }

p { margin-bottom: var(--sp-4); }
p:last-child { margin-bottom: 0; }

.overline {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
  color: var(--color-text-muted);
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}
.container-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

section {
  padding: var(--sp-16) 0;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-8);
}
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
  white-space: nowrap;
}
.site-logo svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.site-logo:hover { color: var(--color-primary); }

.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}
.nav-menu a {
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
  padding: var(--sp-1) 0;
}
.nav-menu a:hover,
.nav-menu a[aria-current="page"] {
  color: var(--color-primary);
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--sp-2);
  color: var(--color-text);
}
.nav-toggle svg { width: 24px; height: 24px; }

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .site-header nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-4) var(--sp-6);
  }
  .site-header nav.is-open { display: block; }
  .nav-menu {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-4);
  }
  .nav-menu a { font-size: var(--fs-base); }
}

/* --- Hero --- */
.hero {
  position: relative;
  overflow: hidden;
  padding: var(--sp-24) 0 var(--sp-20);
  text-align: center;
}
.hero-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(250,246,241,0.92) 0%,
    rgba(250,246,241,0.85) 50%,
    rgba(250,246,241,0.95) 100%
  );
  z-index: -1;
}
.hero h1 {
  font-size: clamp(var(--fs-3xl), 5vw, var(--fs-4xl));
  max-width: 700px;
  margin: 0 auto var(--sp-6);
}
.hero .lead {
  max-width: 600px;
  margin: 0 auto var(--sp-8);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-text-inverse);
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-secondary:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn-amazon {
  background: #FF9900;
  color: #111;
  border-color: #FF9900;
  font-weight: var(--fw-bold);
}
.btn-amazon:hover {
  background: #E68A00;
  border-color: #E68A00;
  color: #111;
}

.btn-lg {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--fs-base);
  border-radius: var(--radius-lg);
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-6);
}

/* --- Category cards (homepage) --- */
.category-card {
  text-decoration: none;
  color: inherit;
}
.category-card .card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--sp-4);
  color: var(--color-accent);
}
.category-card h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-2);
}
.category-card p {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

/* --- Product card (Phase 3 template) --- */
.product-card {
  display: flex;
  flex-direction: column;
}
.product-card .product-image {
  aspect-ratio: 4/3;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}
.product-card h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-2);
}
.product-card .product-description {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-2);
  flex-grow: 1;
}
.product-card .product-benefit {
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--color-secondary-dark);
  margin-bottom: var(--sp-3);
  padding-left: var(--sp-4);
  border-left: 3px solid var(--color-secondary);
}
.product-card .product-meta {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-3);
}
.product-card .amazon-disclosure {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  margin-top: var(--sp-2);
}

/* --- Comparison table --- */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-8) 0;
  font-size: var(--fs-sm);
}
.comparison-table th,
.comparison-table td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.comparison-table thead th {
  background: var(--color-surface-alt);
  font-weight: var(--fw-semibold);
  font-family: var(--font-body);
  position: sticky;
  top: 60px;
}
.comparison-table tbody tr:hover {
  background: var(--color-surface-alt);
}

/* --- Footer --- */
.site-footer {
  background: var(--color-text);
  color: var(--color-text-inverse);
  padding: var(--sp-16) 0 var(--sp-8);
  margin-top: var(--sp-20);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-8);
  margin-bottom: var(--sp-12);
}
.footer-brand {
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
  margin-bottom: var(--sp-3);
}
.footer-tagline {
  font-size: var(--fs-sm);
  color: rgba(250,246,241,0.7);
  max-width: 300px;
  line-height: var(--lh-relaxed);
}
.footer-heading {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(250,246,241,0.5);
  margin-bottom: var(--sp-4);
}
.footer-links {
  list-style: none;
}
.footer-links li { margin-bottom: var(--sp-2); }
.footer-links a {
  color: rgba(250,246,241,0.8);
  text-decoration: none;
  font-size: var(--fs-sm);
  transition: color var(--transition-fast);
}
.footer-links a:hover { color: var(--color-accent-light); }

.footer-disclosure {
  border-top: 1px solid rgba(250,246,241,0.15);
  padding-top: var(--sp-6);
  font-size: var(--fs-xs);
  color: rgba(250,246,241,0.5);
  line-height: var(--lh-relaxed);
}
.footer-disclosure p { margin-bottom: var(--sp-2); }

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-8);
  }
}

/* --- Content pages (legal, about) --- */
.content-page {
  padding: var(--sp-12) 0 var(--sp-20);
}
.content-page h1 {
  font-size: var(--fs-3xl);
  margin-bottom: var(--sp-8);
}
.content-page h2 {
  font-size: var(--fs-xl);
  margin-top: var(--sp-10);
  margin-bottom: var(--sp-4);
}
.content-page p,
.content-page li {
  line-height: var(--lh-relaxed);
  color: var(--color-text-muted);
}
.content-page ul, .content-page ol {
  margin-left: var(--sp-6);
  margin-bottom: var(--sp-4);
}
.content-page li { margin-bottom: var(--sp-2); }

/* --- Methodology note (Phase 3) --- */
.methodology-note {
  background: var(--color-surface-alt);
  border-left: 4px solid var(--color-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--sp-4) var(--sp-6);
  margin: var(--sp-8) 0;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

/* --- Utility --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.mt-4 { margin-top: var(--sp-4); }
.mt-8 { margin-top: var(--sp-8); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-8 { margin-bottom: var(--sp-8); }

/* --- Section: Featured/How-it-works --- */
.section-heading {
  text-align: center;
  margin-bottom: var(--sp-12);
}
.section-heading .overline {
  display: block;
  margin-bottom: var(--sp-2);
}
.section-heading h2 {
  margin-bottom: var(--sp-4);
}
.section-heading p {
  max-width: 600px;
  margin: 0 auto;
  color: var(--color-text-muted);
}

/* --- Print --- */
@media print {
  .site-header, .site-footer, .nav-toggle, .btn-amazon { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
