/* ============================================================================
   DESIGN SYSTEM: "EMBER & IRON"
   Art direction : industrial smokehouse - charred-oak dark surfaces, stamped
                   brass/ember accents, high-contrast rustic-luxe. Distinct
                   from typical warm-minimal food-blog or retro-diner styles.
   Type pairing  : Anton (condensed block slab, stamped-label feel) for
                   display/headings; Inter (clean grotesque) for body/UI;
                   JetBrains Mono for prices, SKUs, nutrition figures, timers.
   Color system  : charred oak dark mode by default, warm parchment light
                   mode; ember-orange primary accent, brass-gold secondary.
   ========================================================================= */

:root {
  --bg: #f4ede4;
  --surface: #ffffff;
  --surface-2: #efe6d8;
  --text: #241d18;
  --muted: #6b5c4f;
  --ember: #d9541f;
  --ember-hover: #b8461a;
  --brass: #a3820f;
  --iron: #ded1c2;
  --danger: #a5261d;
  --success: #2f6b3a;
  --radius: 10px;
  --font-display: 'Anton', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --shadow: 0 4px 20px rgba(0,0,0,0.12);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1512;
    --surface: #241d18;
    --surface-2: #2c241e;
    --text: #f4ede4;
    --muted: #b8a99a;
    --ember: #ff6b35;
    --ember-hover: #ff8558;
    --brass: #c9a227;
    --iron: #3a322c;
    --danger: #d9534f;
    --success: #57b56a;
    --shadow: 0 4px 24px rgba(0,0,0,0.45);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1b1512;
  --surface: #241d18;
  --surface-2: #2c241e;
  --text: #f4ede4;
  --muted: #b8a99a;
  --ember: #ff6b35;
  --ember-hover: #ff8558;
  --brass: #c9a227;
  --iron: #3a322c;
  --danger: #d9534f;
  --success: #57b56a;
  --shadow: 0 4px 24px rgba(0,0,0,0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--ember); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--text);
}
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.4rem); }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.5rem); }
code, .mono, .price, .sku { font-family: var(--font-mono); }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: 20px; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

/* ---- Marquee ---- */
.marquee { background: var(--ember); color: #1b1512; overflow: hidden; white-space: nowrap; padding: 6px 0; font-size: 0.8rem; font-weight: 700; }
.marquee-track { display: inline-block; padding-left: 100%; animation: marquee 28s linear infinite; }
.marquee-track span { margin: 0 14px; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ---- Header ---- */
.site-header { background: var(--surface); border-bottom: 3px solid var(--ember); position: sticky; top: 0; z-index: 40; }
.site-header-inner { display: flex; align-items: center; gap: 14px; padding-block: 14px; flex-wrap: nowrap; max-width: 1400px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.3rem; text-transform: uppercase; flex: none; }
.brand-mark { background: var(--ember); color: #1b1512; padding: 4px 8px; border-radius: 6px; font-size: 0.9rem; }
.main-nav { display: flex; gap: 14px; flex-wrap: nowrap; margin-left: 8px; flex: none; }
.main-nav a { color: var(--text); font-weight: 600; font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
.main-nav a:hover { color: var(--ember); text-decoration: none; }
.header-search { margin-left: auto; display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--iron); border-radius: 20px; padding: 4px 6px 4px 14px; flex: 0 0 220px; min-width: 0; }
.header-search input { border: none; background: transparent; color: var(--text); font-family: var(--font-body); width: 100%; min-width: 0; }
.header-search input:focus { outline: none; }
.header-search button { border: none; background: var(--ember); color: #1b1512; border-radius: 16px; width: 30px; height: 30px; flex: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.header-search button svg { display: block; }
.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.cart-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text); position: relative; }
.cart-icon { display: block; flex: none; }
.cart-count { background: var(--ember); color: #1b1512; border-radius: 999px; padding: 1px 7px; font-size: 0.7rem; font-weight: 800; margin-left: 2px; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.4rem; color: var(--text); cursor: pointer; }

/* ---- Buttons ---- */
.btn { display: inline-block; padding: 10px 20px; border-radius: var(--radius); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; font-size: 0.85rem; cursor: pointer; border: 2px solid transparent; transition: all .15s ease; }
.btn-ember { background: var(--ember); color: #1b1512; }
.btn-ember:hover { background: var(--ember-hover); text-decoration: none; }
.btn-brass { background: var(--brass); color: #1b1512; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--iron); }
.btn-ghost:hover { border-color: var(--ember); color: var(--ember); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 0.75rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Cards / grids ---- */
.card { background: var(--surface); border: 1px solid var(--iron); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease; }
.card:hover { transform: translateY(-3px); }
.card-img { aspect-ratio: 4/3; overflow: hidden; background: var(--surface-2); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px 16px; }
.card-title { font-family: var(--font-display); font-size: 1rem; text-transform: uppercase; margin: 0 0 6px; }
.card-meta { font-size: 0.8rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.badge { display: inline-block; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; letter-spacing: 0.04em; }
.badge-premium { background: var(--brass); color: #1b1512; }
.badge-free { background: var(--success); color: #fff; }
.stars { color: var(--brass); }

/* ---- Hero ---- */
.hero { position: relative; background: var(--surface-2); }
.hero-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(27,21,18,0.85), rgba(27,21,18,0.15)); display: flex; align-items: flex-end; }
.hero-content { padding: 40px 20px; max-width: 1240px; margin: 0 auto; width: 100%; color: #f4ede4; }
.hero-content h1 { color: #f4ede4; }
.hero-content p { color: #e6dccd; max-width: 600px; }

/* ---- Sections ---- */
section { padding-block: 48px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 24px; flex-wrap: wrap; gap: 10px; }
.eyebrow { color: var(--ember); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }

/* ---- Recipe detail ---- */
.recipe-head { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 800px) { .recipe-head { grid-template-columns: 1fr; } }
.recipe-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-block: 16px; }
.stat-pill { background: var(--surface-2); border: 1px solid var(--iron); border-radius: 8px; padding: 8px 14px; font-size: 0.82rem; }
.stat-pill b { display: block; font-family: var(--font-mono); font-size: 1rem; }
.ingredients-list, .steps-list { background: var(--surface); border: 1px solid var(--iron); border-radius: var(--radius); padding: 20px 24px; }
.ingredients-list li { margin-bottom: 8px; }
.steps-list li { margin-bottom: 16px; padding-left: 4px; }
.nutrition-panel { background: var(--surface-2); border: 1px dashed var(--iron); border-radius: var(--radius); padding: 18px; font-family: var(--font-mono); font-size: 0.85rem; }
.nutrition-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.paywall { background: var(--surface-2); border: 2px solid var(--brass); border-radius: var(--radius); padding: 28px; text-align: center; }

/* ---- Product detail ---- */
.product-head { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
@media (max-width: 800px) { .product-head { grid-template-columns: 1fr; } }
.spec-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.spec-table td { padding: 8px 10px; border-bottom: 1px solid var(--iron); }
.spec-table td:first-child { color: var(--muted); width: 40%; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.88rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--iron); background: var(--surface); color: var(--text); font-family: var(--font-body); margin-bottom: 16px;
}
textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: rgba(165,38,29,0.12); border: 1px solid var(--danger); color: var(--danger); }
.alert-success { background: rgba(47,107,58,0.12); border: 1px solid var(--success); color: var(--success); }

/* ---- Cart / cookie banner ---- */
.cart-drawer { position: fixed; top: 0; right: -420px; width: 380px; max-width: 90vw; height: 100%; background: var(--surface); box-shadow: -6px 0 24px rgba(0,0,0,0.3); z-index: 100; transition: right .25s ease; display: flex; flex-direction: column; }
.cart-drawer.open { right: 0; }
.cart-drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--iron); }
.cart-drawer-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 3px solid var(--ember); padding: 14px 20px; z-index: 200; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; font-size: 0.85rem; flex: 1; min-width: 220px; }
.cookie-banner-actions { display: flex; gap: 10px; }
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--surface); border-left: 4px solid var(--ember); padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow); font-size: 0.88rem; }

/* ---- Footer ---- */
.site-footer { background: var(--surface); border-top: 3px solid var(--ember); margin-top: 60px; padding-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-col h4 { text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.05em; color: var(--brass); margin-bottom: 12px; }
.footer-col a { display: block; color: var(--muted); margin-bottom: 8px; font-size: 0.88rem; }
.footer-col a:hover { color: var(--ember); }
.footer-tagline { color: var(--muted); font-style: italic; }
.footer-legal { font-size: 0.8rem; color: var(--muted); }
.footer-bottom { border-top: 1px solid var(--iron); margin-top: 30px; padding-block: 18px; text-align: center; color: var(--muted); font-size: 0.8rem; }

/* ---- Utility ---- */
.text-muted { color: var(--muted); }
.mb-0 { margin-bottom: 0; }
.center { text-align: center; }
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--iron); border-radius: 6px; padding: 3px 10px; font-size: 0.78rem; margin: 2px 4px 2px 0; }
table.simple { width: 100%; border-collapse: collapse; }
table.simple td, table.simple th { padding: 8px; border-bottom: 1px solid var(--iron); text-align: left; }

/* ---- Responsive nav ---- */
@media (max-width: 1300px) {
  .site-header-inner { flex-wrap: wrap; }
  .nav-toggle { display: block; }
  .main-nav { display: none; flex-direction: column; width: 100%; order: 5; }
  .main-nav.open { display: flex; }
  .header-search { order: 4; width: 100%; flex-basis: 100%; margin-left: 0; }
  .header-search input { flex: 1; width: auto; }
}
