/* =========================================================================
   ArteRossa Recipes -- Design System
   Art direction : Italian Trattoria Editorial (bold ink linework, warm
                    terracotta/cream palette, market-poster energy)
   Type pairing  : "Fraunces" (display, warm expressive serif) +
                    "Karla" (body/UI, clean grotesque sans)
   Palette       : Rosso #B23A2E / Cream #FBF3E7 / Ink #201A14 /
                    Olive #6B7A4F / Mustard #E8A33D
   Modes         : Light (default) + Dark, both handled deliberately.
   ========================================================================= */

/* Fraunces' opsz (optical size) axis is pinned to 40 instead of left as a 9..144
   auto-interpolated range: at small sizes (card titles, buttons) the low end of that
   range renders a much more ornate, curled "f" than the calmer letterforms large
   headings get at the high end -- the same word looks like two different typefaces
   depending on font-size. Pinning opsz keeps every letterform consistent site-wide
   while ital/wght stay fully variable so existing font-weight/font-style rules are
   unaffected. */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,40,400;0,40,600;0,40,700;1,40,500&family=Karla:ital,wght@0,400;0,500;0,700;1,400&display=swap');

:root {
  --rosso: #B23A2E;
  --rosso-dark: #7A2620;
  --rosso-light: #D9695C;
  --cream: #FBF3E7;
  --cream-dim: #F1E1C9;
  --ink: #201A14;
  --ink-soft: #4A3E31;
  --olive: #6B7A4F;
  --mustard: #E8A33D;
  --white: #FFFFFF;

  --bg: var(--cream);
  --surface: var(--white);
  --surface-alt: var(--cream-dim);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --border: #E4D2B4;
  --accent: var(--rosso);
  --accent-contrast: var(--white);

  --radius-sm: 4px;
  --radius: 10px;
  --radius-lg: 18px;
  --shadow: 0 6px 24px rgba(32, 26, 20, 0.10);
  --shadow-sm: 0 2px 8px rgba(32, 26, 20, 0.08);

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Karla', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1512;
    --surface: #241D18;
    --surface-alt: #2C231C;
    --text: #F3EAD9;
    --text-soft: #CBB99E;
    --border: #3A2F26;
    --accent: #E0685A;
    --accent-contrast: #1B1512;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1B1512;
  --surface: #241D18;
  --surface-alt: #2C231C;
  --text: #F3EAD9;
  --text-soft: #CBB99E;
  --border: #3A2F26;
  --accent: #E0685A;
  --accent-contrast: #1B1512;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

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(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 600;
}
h1 { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); text-decoration: none; }
.btn-primary { background: var(--rosso); border-color: var(--rosso); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- Header / Nav ---------- */
.announce-bar {
  background: var(--ink);
  color: var(--cream);
  text-align: center;
  font-size: 0.82rem;
  padding: 8px 12px;
  letter-spacing: 0.02em;
}
.announce-bar a { color: var(--mustard); font-weight: 700; }

.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand span { color: var(--rosso); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.main-nav a {
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
}
.main-nav a:hover { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 14px; }
.icon-link {
  position: relative;
  color: var(--text);
  font-size: 1.05rem;
  text-decoration: none;
}
.cart-badge {
  position: absolute;
  top: -8px; right: -12px;
  background: var(--rosso);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50%;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
}

.search-form { display: flex; }
.search-form input {
  border: 2px solid var(--ink);
  border-right: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text);
  width: 180px;
}
.search-form button {
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  padding: 8px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
}

.mobile-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text); }

@media (max-width: 860px) {
  .main-nav { display: none; width: 100%; order: 3; flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 10px; }
  .main-nav.open { display: flex; }
  .mobile-toggle { display: block; }
  .search-form input { width: 120px; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background: var(--ink);
  color: var(--cream);
  overflow: hidden;
}
.hero-media {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0.55;
}
.hero-media::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(32,26,20,0.35), rgba(32,26,20,0.85));
}
.hero-content {
  position: relative;
  padding: 80px 20px;
  max-width: 1180px;
  margin: 0 auto;
  text-align: center;
}
.hero-content h1 { color: #fff; }
.hero-content p { color: var(--cream-dim); font-size: 1.1rem; max-width: 640px; margin: 0 auto 1.5em; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.page-hero {
  background: var(--surface-alt);
  border-bottom: 3px solid var(--ink);
  padding: 48px 20px;
  text-align: center;
}
.page-hero p { color: var(--text-soft); max-width: 640px; margin: 0 auto; }

/* ---------- Cards / Grids ---------- */
.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-media { aspect-ratio: 4/3; overflow: hidden; background: var(--surface-alt); position: relative; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; font-size: 1.1rem; }
.card-body h3 a { color: var(--text); text-decoration: none; }
.card-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-soft); }
.card-desc { font-size: 0.9rem; color: var(--text-soft); flex: 1; }
.card-price { font-family: var(--font-display); font-weight: 700; color: var(--rosso); font-size: 1.15rem; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--mustard);
  color: var(--ink);
}
.badge-premium { background: var(--rosso); color: #fff; }
.badge-free { background: var(--olive); color: #fff; }
.badge-outline { background: transparent; border: 1.5px solid currentColor; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.section-alt { background: var(--surface-alt); }

/* ---------- Recipe detail ---------- */
.recipe-header { padding: 48px 0; }
.recipe-header img { border-radius: var(--radius-lg); border: 3px solid var(--ink); aspect-ratio: 4/3; object-fit: cover; }
.recipe-stats { display: flex; flex-wrap: wrap; gap: 18px; margin: 20px 0; }
.stat { background: var(--surface-alt); border: 2px solid var(--border); border-radius: var(--radius); padding: 10px 16px; min-width: 90px; text-align: center; }
.stat strong { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.stat span { font-size: 0.72rem; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.05em; }

.recipe-body { display: grid; grid-template-columns: 1fr 1.6fr; gap: 48px; padding-bottom: 60px; align-items: start; }
.ingredient-list { list-style: none; margin: 0; padding: 0; }
.ingredient-list li { padding: 9px 0; border-bottom: 1px dashed var(--border); display: flex; gap: 10px; }
.ingredient-list li strong { min-width: 96px; color: var(--rosso); }
.steps-list { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps-list li { counter-increment: step; padding: 18px 0 18px 54px; position: relative; border-bottom: 1px solid var(--border); }
.steps-list li::before {
  content: counter(step);
  position: absolute; left: 0; top: 14px;
  width: 36px; height: 36px;
  background: var(--rosso); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
}
.highlight-box { background: var(--surface-alt); border-left: 4px solid var(--olive); padding: 18px 20px; border-radius: 0 var(--radius) var(--radius) 0; margin: 20px 0; }
.highlight-box ul { margin: 0; padding-left: 20px; }
.tip-box { background: #FBEFDD; border: 1.5px dashed var(--mustard); border-radius: var(--radius); padding: 16px 20px; margin: 16px 0; }
.nutrition-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.nutrition-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); }
.nutrition-table td:last-child { text-align: right; font-weight: 700; }
.nutrition-note { font-size: 0.78rem; color: var(--text-soft); font-style: italic; }

.paywall {
  background: linear-gradient(180deg, transparent, var(--surface) 60%);
  border: 2px dashed var(--rosso);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  text-align: center;
  margin-top: 20px;
}

/* ---------- Product detail ---------- */
.product-header { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; padding: 48px 0; align-items: start; }
.product-header img { border-radius: var(--radius-lg); border: 3px solid var(--ink); aspect-ratio: 1/1; object-fit: cover; background: #fff; }
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table td { padding: 10px 6px; border-bottom: 1px solid var(--border); }
.spec-table td:first-child { color: var(--text-soft); width: 42%; }
.feature-list { list-style: none; padding: 0; margin: 16px 0; }
.feature-list li { padding: 6px 0 6px 26px; position: relative; }
.feature-list li::before { content: '\2713'; position: absolute; left: 0; color: var(--olive); font-weight: 700; }

/* ---------- Forms ---------- */
.form-field { margin-bottom: 18px; }
.form-field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 0.9rem; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-card { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius-lg); padding: 36px; max-width: 480px; margin: 0 auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; font-size: 0.9rem; }
.alert-error { background: #FCE4E1; color: var(--rosso-dark); border: 1.5px solid var(--rosso); }
.alert-success { background: #E8EEDF; color: #3E4A2C; border: 1.5px solid var(--olive); }

/* ---------- Cart / checkout ---------- */
.cart-row { display: grid; grid-template-columns: 80px 1fr auto auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border); }
.cart-row img { border-radius: var(--radius-sm); aspect-ratio: 1/1; object-fit: cover; }
.cart-summary { background: var(--surface-alt); border-radius: var(--radius-lg); padding: 26px; border: 2px solid var(--ink); }
.cart-summary .line { display: flex; justify-content: space-between; padding: 8px 0; }
.cart-summary .total { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; border-top: 2px solid var(--ink); margin-top: 10px; padding-top: 14px; }

/* ---------- Table (search/pricing/faq) ---------- */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 28px; max-width: 780px; margin: 0 auto; }
.price-card { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius-lg); padding: 32px; text-align: center; }
.price-card.featured { border-color: var(--rosso); box-shadow: var(--shadow); position: relative; }
.price-card .amount { font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; color: var(--rosso); }
.price-card .amount span { font-size: 1rem; color: var(--text-soft); font-family: var(--font-body); }

.faq-item { border-bottom: 1px solid var(--border); padding: 18px 0; }
.faq-item summary { cursor: pointer; font-weight: 700; font-family: var(--font-display); font-size: 1.05rem; }
.faq-item p { margin-top: 10px; color: var(--text-soft); }

/* ---------- About page ---------- */
.value-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 28px; }
.value-card { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); padding: 28px 26px; }
.value-card h2 { margin-top: 6px; font-size: 1.5rem; }
.value-card p { color: var(--text-soft); margin-bottom: 0; }
.history-body { max-width: 760px; }
.history-body p { color: var(--text-soft); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--cream-dim); padding: 56px 0 24px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 28px; }
.footer-grid h4 { color: #fff; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px; }
.footer-grid a { color: var(--cream-dim); display: block; padding: 4px 0; font-size: 0.88rem; }
.footer-grid a:hover { color: var(--mustard); }
.footer-bottom { border-top: 1px solid #3A2F26; margin-top: 36px; padding-top: 20px; font-size: 0.8rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; color: #A79684; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ink); color: var(--cream);
  padding: 18px 20px; z-index: 100;
  display: none;
}
.cookie-banner.show { display: block; }
.cookie-banner .container { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.cookie-banner p { margin: 0; font-size: 0.85rem; max-width: 700px; }
.cookie-banner a { color: var(--mustard); }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; top: 90px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: var(--cream); padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 0.88rem; opacity: 0; transform: translateX(20px); transition: all 0.25s ease; }
.toast.show { opacity: 1; transform: translateX(0); }

/* ---------- Misc ---------- */
.divider { border: none; border-top: 2px solid var(--border); margin: 40px 0; }
.text-center { text-align: center; }
.muted { color: var(--text-soft); }
.legal-body h2 { margin-top: 1.6em; font-size: 1.3rem; }
.legal-body ul { padding-left: 22px; }
.breadcrumb { font-size: 0.82rem; color: var(--text-soft); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-soft); }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 36px; }
.pagination a, .pagination span { padding: 8px 14px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-weight: 700; font-size: 0.85rem; color: var(--text); }
.pagination .current { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 28px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.filter-bar select, .filter-bar input { padding: 8px 10px; border-radius: var(--radius-sm); border: 2px solid var(--border); background: var(--surface); color: var(--text); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-soft); }
