:root { --ink: #18211f; --muted: #68736e; --line: #d9e1dc; --paper: #f8faf8; --accent: #087f5b; --accent-dark: #056145; --warm: #e9c46a; --max: 1080px; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.55 Inter, ui-sans-serif, system-ui, sans-serif; }
a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
header, main, footer { max-width: var(--max); margin: auto; padding-left: 24px; padding-right: 24px; }
header { height: 72px; display: flex; gap: 24px; align-items: center; border-bottom: 1px solid var(--line); }
.brand-wrap { display: flex; flex-direction: column; }
.brand { color: var(--ink); font-weight: 800; font-size: 20px; text-decoration: none; white-space: nowrap; line-height: 1.15; }
.brand-tagline { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.header-search { position: relative; margin-left: auto; max-width: 340px; width: 100%; }
input { width: 100%; border: 1px solid #b8c6bf; border-radius: 5px; background: #fff; color: var(--ink); padding: 10px 12px; font: inherit; }
main { min-height: calc(100vh - 154px); padding-top: 36px; padding-bottom: 64px; }
footer { color: var(--muted); border-top: 1px solid var(--line); font-size: 14px; padding-top: 24px; padding-bottom: 30px; line-height: 1.6; }
h1, h2, h3 { line-height: 1.16; letter-spacing: 0; }
h1 { max-width: 780px; font-size: 40px; margin: 8px 0 12px; }
h2 { font-size: 25px; margin: 0 0 16px; }
h3 { font-size: 18px; margin: 28px 0 8px; }
section { margin-top: 50px; }
.hero { margin-top: 0; padding: 48px 0 30px; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: 46px; }
.hero-subtitle { font-size: 18px; line-height: 1.5; color: #374151; max-width: 720px; margin: 12px 0 20px; }
.eyebrow { color: var(--accent-dark); font-size: 13px; font-weight: 700; margin: 0; text-transform: uppercase; letter-spacing: .08em; }
.hero-search { max-width: 650px; position: relative; margin-top: 24px; }
.hero-search input { padding: 15px 17px; font-size: 17px; }
.search-results { display: none; position: absolute; z-index: 10; width: 100%; top: calc(100% + 5px); background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 24px #18211f1c; }
.search-results.active { display: block; }
.search-results a { display: block; padding: 9px 12px; text-decoration: none; }
.search-results a:hover { background: #edf5f0; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.category-grid a { background: #fff; min-height: 102px; padding: 17px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-decoration: none; }
.category-grid strong, .category-grid span { display: block; }
.category-grid span, .link-list span { color: var(--muted); font-size: 14px; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.columns { columns: 2; }
.columns li { break-inside: avoid; }
.breadcrumbs { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.breadcrumbs span { padding: 0 7px; }

/* Food detail page */
.food-intro { margin-top: 0; }
.hero-hook { font-size: 17px; font-weight: 600; color: #111827; line-height: 1.55; margin: 14px 0 18px; max-width: 820px; background: #ecfdf5; border-left: 4px solid var(--accent); padding: 12px 18px; border-radius: 0 6px 6px 0; }
.hero-badge-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 18px 0 24px; max-width: 820px; }
.badge-pill { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 15px; display: flex; flex-direction: column; }
.badge-pill .pill-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 3px; }
.badge-pill strong { font-size: 18px; font-weight: 800; color: var(--ink); }
.pill-density { background: #ecfdf5; border-color: #a7f3d0; }
.pill-density .pill-label { color: #065f46; }
.pill-density strong { color: #047857; }
.pill-netcarbs strong { color: #2563eb; }
.pill-caldensity strong { color: #d97706; }

.intro-summary { font-size: 16px; line-height: 1.65; color: #2e3834; margin: 16px 0 20px; max-width: 820px; }
.diet-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 20px; }
.tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px; border-radius: 999px; background: #e8f3ed; color: var(--accent-dark); border: 1px solid #c2ded0; }
.tag-keto-friendly { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tag-high-protein { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tag-heart-healthy { background: #fdf2f8; color: #be185d; border-color: #fbcfe8; }
.tag-low-calorie { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.calories { margin-top: 24px; font-size: 18px; }
.calories strong { display: block; font-size: 58px; line-height: 1; }
.calories span { color: var(--muted); font-size: 14px; }
.macros { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 820px; border-top: 1px solid var(--line); margin-top: 32px; }
.macros div { padding: 14px 10px 0 0; }
dt { color: var(--muted); font-size: 14px; }
dd { margin: 3px 0 0; font-weight: 700; }

/* Derived metrics */
.derived-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 28px; max-width: 820px; }
.metric-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; display: flex; flex-direction: column; }
.metric-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.metric-value { font-size: 22px; font-weight: 800; color: var(--ink); margin: 4px 0 2px; }
.metric-sub { font-size: 12px; color: var(--muted); }

/* Category-specific feature banners */
.category-feature { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 0 6px 6px 0; padding: 20px 24px; margin-top: 40px; max-width: 820px; }
.category-feature h2 { font-size: 20px; margin: 0 0 8px; }
.category-feature p { margin: 0; font-size: 15px; line-height: 1.55; color: #374151; }
.feature-produce { border-left-color: #059669; }
.feature-protein { border-left-color: #dc2626; }
.feature-lipid { border-left-color: #d97706; }
.feature-grain { border-left-color: #2563eb; }

/* Insights grid */
.insights-section { margin-top: 48px; max-width: 820px; }
.insights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.insight-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; }
.insight-card h3 { margin: 0 0 8px; font-size: 16px; color: var(--accent-dark); }
.insight-card p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink); }

/* Dynamic comparisons */
.comparisons-section { margin-top: 48px; max-width: 820px; }
.comparisons-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.comparison-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 16px 20px; }
.comparison-card h3 { margin: 0 0 6px; font-size: 16px; }
.comparison-metric { margin: 0; font-size: 14px; color: #374151; line-height: 1.45; }

/* Dynamic FAQs */
.faq-section { margin-top: 52px; max-width: 820px; }
.faq-list { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.faq-item { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 20px 22px; }
.faq-item h3 { margin: 0 0 10px; font-size: 17px; color: var(--ink); }
.faq-answer { font-size: 15px; line-height: 1.6; color: #2e3834; }
.faq-answer p { margin: 0 0 10px; }
.faq-answer p:last-child { margin-bottom: 0; }
.faq-answer ul { margin: 8px 0 10px; padding-left: 20px; }
.faq-answer li { margin-bottom: 4px; }

/* Calculator & Tables */
.calculator { background: #e8f3ed; padding: 24px; max-width: 680px; }
.calculator label { display: flex; align-items: center; gap: 10px; max-width: 250px; }
.calculator input { width: 100px; }
.calculated-values { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 18px; font-weight: 700; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: #fff; }
table { border-collapse: collapse; width: 100%; min-width: 470px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 13px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
.source { color: var(--muted); font-size: 14px; margin-top: 36px; }

@media (max-width: 640px) {
  header { padding-left: 16px; padding-right: 16px; }
  .header-search { display: none; }
  main, footer { padding-left: 16px; padding-right: 16px; }
  h1, .hero h1 { font-size: 32px; }
  .macros { grid-template-columns: repeat(2, 1fr); }
  .hero-badge-bar { grid-template-columns: 1fr 1fr; }
  .derived-metrics { grid-template-columns: 1fr; }
  .columns { columns: 1; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}
