:root {
  --ink: #14382c;
  --ink-soft: #526b62;
  --cream: #f5f2e9;
  --paper: #fffdf7;
  --green: #1d5a44;
  --green-light: #d8e7cb;
  --lime: #d9ee75;
  --orange: #e87f4a;
  --line: #d8ddd2;
  --shadow: 0 18px 45px rgba(27, 61, 48, .12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: "DM Sans", sans-serif; line-height: 1.5; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header {
  height: 76px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 76px); background: rgba(245, 242, 233, .92);
  border-bottom: 1px solid rgba(20, 56, 44, .12); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px);
}
.brand { display: inline-flex; gap: 10px; align-items: center; font-family: "Fraunces", serif; font-size: 20px; font-weight: 700; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 42% 58%; background: var(--green); color: var(--lime); transform: rotate(-7deg); }
.brand-mark + span { transform: translateY(-1px); }
nav { display: flex; gap: 34px; }
nav a { text-decoration: none; font-size: 14px; font-weight: 600; }
nav a:hover { color: var(--orange); }
.icon-button, .view-button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }

.hero { min-height: 680px; padding: 74px clamp(22px, 7vw, 110px) 68px; display: grid; grid-template-columns: 1.04fr .96fr; align-items: center; gap: 7vw; overflow: hidden; }
.eyebrow { color: var(--orange); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 16px; }
h1, h2 { font-family: "Fraunces", serif; letter-spacing: -.035em; line-height: 1.02; }
h1 { max-width: 720px; margin: 0; font-size: clamp(52px, 6.2vw, 92px); font-weight: 600; }
h1 em { color: var(--green); font-style: italic; }
.hero-lead { max-width: 620px; font-size: clamp(17px, 1.45vw, 21px); color: var(--ink-soft); margin: 28px 0 32px; }
.hero-actions { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 22px; min-height: 50px; padding: 0 22px; border: 0; border-radius: 99px; font-weight: 700; text-decoration: none; cursor: pointer; }
.button.primary { background: var(--green); color: white; box-shadow: 0 9px 24px rgba(20, 56, 44, .18); }
.button.primary:hover { background: #0d4935; transform: translateY(-1px); }
.text-link { font-weight: 700; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 3px; }
.hero-facts { display: flex; gap: clamp(22px, 4vw, 54px); margin-top: 56px; }
.hero-facts div { display: grid; }
.hero-facts strong { font-family: "Fraunces", serif; font-size: 30px; line-height: 1; }
.hero-facts span { color: var(--ink-soft); font-size: 12px; margin-top: 7px; }
.hero-visual { position: relative; aspect-ratio: 1 / 1; max-width: 570px; width: 100%; margin: auto; border-radius: 50%; background: radial-gradient(circle at 52% 48%, #eef5c7 0 33%, #d8e7cb 34% 57%, transparent 58%); }
.orbit { position: absolute; inset: 10%; border: 1px dashed rgba(20,56,44,.25); border-radius: 50%; }
.orbit-two { inset: 27%; }
.food-glyph { position: absolute; display: grid; place-items: center; background: var(--paper); border-radius: 50%; box-shadow: var(--shadow); }
.food-main { font-size: clamp(78px, 10vw, 140px); inset: 31%; z-index: 2; }
.food-a, .food-b { width: 88px; height: 88px; font-size: 43px; }
.food-a { left: 3%; bottom: 26%; transform: rotate(-8deg); }
.food-b { right: 4%; top: 21%; transform: rotate(7deg); }
.metric-bubble { position: absolute; z-index: 3; background: var(--paper); border: 1px solid rgba(20,56,44,.08); box-shadow: 0 10px 30px rgba(20,56,44,.11); border-radius: 16px; padding: 12px 16px; display: grid; min-width: 128px; }
.metric-bubble b { font-size: 13px; }
.metric-bubble span { font-size: 10px; color: var(--ink-soft); }
.metric-protein { top: 6%; left: 14%; }
.metric-vitamins { right: 0; bottom: 17%; }
.metric-fiber { left: 26%; bottom: 0; }

.principles { background: var(--green); color: white; padding: 36px clamp(22px, 7vw, 110px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 5vw; }
.principles article { display: flex; gap: 18px; align-items: flex-start; }
.principle-number { color: var(--lime); font-family: "Fraunces", serif; font-size: 18px; }
.principles h2 { font: 600 17px "DM Sans", sans-serif; letter-spacing: 0; margin: 0 0 6px; }
.principles p { color: rgba(255,255,255,.67); margin: 0; font-size: 13px; }

.explorer, .sources { padding: 100px clamp(20px, 5vw, 76px); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; margin-bottom: 44px; }
.section-heading h2, .method h2 { font-size: clamp(38px, 4vw, 58px); margin: 0; }
.section-heading > p { max-width: 540px; color: var(--ink-soft); margin: 0; }
.goal-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.goal-tab { border: 1px solid var(--line); color: var(--ink); background: transparent; padding: 10px 16px; border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 700; }
.goal-tab span { color: var(--orange); margin-right: 5px; }
.goal-tab:hover, .goal-tab.active { border-color: var(--green); background: var(--green); color: white; }
.explorer-layout { display: grid; grid-template-columns: 250px 1fr; gap: 34px; }
.filters { background: rgba(255,255,255,.45); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; align-self: start; position: sticky; top: 96px; }
.filter-top, .results-toolbar { display: flex; justify-content: space-between; align-items: center; }
.filter-top h3 { margin: 0; font-size: 16px; }
.reset-button { background: none; border: 0; text-decoration: underline; color: var(--ink-soft); font-size: 12px; cursor: pointer; }
.search-field { height: 44px; display: flex; gap: 8px; align-items: center; padding: 0 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; margin: 18px 0; }
.search-field input { min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink); outline: 0; font-size: 13px; }
fieldset { border: 0; border-top: 1px solid var(--line); padding: 18px 0 8px; margin: 0; }
legend { padding: 16px 0 2px; font-size: 13px; font-weight: 700; }
.check-list { display: grid; gap: 9px; }
.check-list label { display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); font-size: 13px; cursor: pointer; }
.check-label { display: flex; align-items: center; gap: 8px; }
input[type="checkbox"] { accent-color: var(--green); }
.category-count { color: #829088; font-size: 11px; }
.range-label { display: flex; justify-content: space-between; font-size: 12px; margin: 10px 0 2px; color: var(--ink-soft); }
.range-label output { color: var(--ink); font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--green); }
.switch-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.switch-row input { width: 38px; height: 20px; }
.filter-note { display: flex; gap: 10px; background: var(--green-light); border-radius: 12px; padding: 12px; margin-top: 10px; }
.filter-note span { width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: white; display: grid; place-items: center; flex: 0 0 auto; font-size: 11px; }
.filter-note p { margin: 0; font-size: 10px; color: var(--ink-soft); }
.results-toolbar { margin: 4px 0 18px; }
.results-toolbar p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.results-toolbar p strong { color: var(--ink); }
.view-controls { display: flex; gap: 7px; align-items: center; }
.view-controls label { color: var(--ink-soft); font-size: 12px; margin-right: 8px; }
select { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 9px; padding: 9px 30px 9px 10px; margin-left: 7px; font-size: 12px; }
.view-button { border-radius: 10px; width: 38px; height: 38px; }
.view-button.active { color: white; background: var(--green); border-color: var(--green); }
.food-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.food-card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; transition: transform .2s, box-shadow .2s; cursor: pointer; }
.food-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.food-card:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.food-art { height: 140px; display: grid; place-items: center; position: relative; font-size: 70px; background: var(--card-bg); }
.food-art::after { content: ""; width: 78px; height: 14px; background: rgba(20,56,44,.1); filter: blur(8px); border-radius: 50%; position: absolute; bottom: 20px; }
.food-art span { position: relative; z-index: 1; filter: drop-shadow(0 10px 6px rgba(20,56,44,.15)); }
.score-badge { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--paper); padding: 5px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; box-shadow: 0 4px 14px rgba(20,56,44,.1); }
.score-badge i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--score-color); margin-right: 4px; }
.food-card-body { padding: 16px; }
.card-category { color: var(--orange); font-size: 9px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.food-card h3 { font-family: "Fraunces", serif; font-size: 21px; margin: 2px 0 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.card-metric { background: var(--cream); padding: 8px; border-radius: 9px; display: grid; }
.card-metric b { font-size: 14px; }
.card-metric span { font-size: 9px; color: var(--ink-soft); }
.card-footer { border-top: 1px solid var(--line); margin-top: 13px; padding-top: 11px; display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 10px; }
.card-footer strong { color: var(--green); font-size: 11px; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 80px 20px; background: var(--paper); border-radius: var(--radius); border: 1px dashed var(--line); }
.empty-state span { font-size: 48px; }
.empty-state h3 { margin-bottom: 4px; }
.empty-state p { color: var(--ink-soft); margin-top: 0; }
.chart-panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.chart-head { display: flex; justify-content: space-between; gap: 30px; }
.chart-head h3 { font-family: "Fraunces", serif; font-size: 25px; margin: 0 0 4px; }
.chart-head p { color: var(--ink-soft); margin: 0; font-size: 12px; max-width: 530px; }
.chart-legend { display: flex; align-items: center; gap: 12px; font-size: 10px; color: var(--ink-soft); white-space: nowrap; }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.legend-good { background: var(--green); } .legend-mid { background: var(--orange); }
.canvas-wrap { position: relative; height: 500px; margin-top: 20px; }
#foodChart { width: 100%; height: 100%; }
.chart-tooltip { position: absolute; pointer-events: none; background: var(--ink); color: white; padding: 8px 10px; border-radius: 8px; font-size: 11px; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }

.method { min-height: 560px; padding: 90px clamp(24px, 9vw, 140px); background: var(--green); color: white; display: grid; grid-template-columns: .9fr 1.1fr; align-items: center; gap: 80px; overflow: hidden; }
.eyebrow.light { color: var(--lime); }
.method-copy > p:not(.eyebrow) { color: rgba(255,255,255,.7); max-width: 540px; font-size: 16px; }
.button.secondary { margin-top: 16px; background: var(--lime); color: var(--green); }
.score-wheel { position: relative; width: min(440px, 80vw); aspect-ratio: 1; margin: auto; border-radius: 50%; background: conic-gradient(var(--lime) 0 35%, #a4cf84 35% 60%, #72ad7c 60% 85%, #e6a56b 85% 100%); box-shadow: inset 0 0 0 70px var(--green), 0 0 0 1px rgba(255,255,255,.12); }
.score-center { position: absolute; inset: 31%; display: grid; place-content: center; text-align: center; border-radius: 50%; background: #164936; }
.score-center strong { font: 700 58px/1 "Fraunces", serif; }
.score-center span { font-size: 10px; color: rgba(255,255,255,.6); }
.score-label { position: absolute; display: grid; background: white; color: var(--ink); padding: 9px 13px; border-radius: 10px; min-width: 120px; box-shadow: var(--shadow); }
.score-label b { font-size: 16px; color: var(--green); }
.score-label span { font-size: 9px; }
.label-one { top: 6%; right: -14%; } .label-two { bottom: 7%; right: -11%; } .label-three { bottom: 2%; left: -8%; } .label-four { top: 12%; left: -16%; }

.sources { background: var(--paper); }
.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.source-grid a { display: flex; gap: 16px; text-decoration: none; padding: 22px; border: 1px solid var(--line); border-radius: 16px; transition: .2s; }
.source-grid a:hover { border-color: var(--green); transform: translateY(-2px); }
.source-logo { flex: 0 0 58px; height: 58px; display: grid; place-items: center; background: var(--green-light); color: var(--green); border-radius: 50%; font: 700 13px "Fraunces", serif; }
.source-grid h3 { margin: 2px 0 5px; font-size: 15px; }
.source-grid p { color: var(--ink-soft); font-size: 11px; margin: 0 0 8px; }
.source-grid b { color: var(--green); font-size: 10px; }
.disclaimer { margin: 32px auto 0; max-width: 850px; color: var(--ink-soft); text-align: center; font-size: 11px; }
footer { min-height: 120px; padding: 30px clamp(20px,5vw,76px); background: #102e24; color: white; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
footer p { color: rgba(255,255,255,.58); font-size: 12px; }
footer > a:last-child { font-size: 12px; }

dialog { width: min(680px, calc(100% - 32px)); max-height: 88vh; overflow: auto; border: 0; border-radius: 24px; padding: 34px; color: var(--ink); background: var(--paper); box-shadow: 0 30px 100px rgba(0,0,0,.32); }
dialog::backdrop { background: rgba(9, 29, 22, .72); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 18px; top: 16px; border: 0; background: transparent; color: var(--ink); font-size: 28px; cursor: pointer; }
.dialog-hero { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; }
.dialog-emoji { width: 100px; height: 100px; border-radius: 20px; display: grid; place-items: center; font-size: 60px; background: var(--green-light); }
.dialog-hero h2 { font-size: 36px; margin: 4px 0; }
.dialog-score { color: var(--green); font-weight: 700; }
.nutrient-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nutrient-item { background: var(--cream); border-radius: 10px; padding: 10px; display: grid; }
.nutrient-item b { font-size: 14px; }
.nutrient-item span { font-size: 10px; color: var(--ink-soft); }
.why-box { background: var(--green-light); padding: 16px; border-radius: 14px; margin-top: 18px; }
.why-box h3 { margin: 0 0 5px; font-size: 14px; }
.why-box p { margin: 0; font-size: 12px; color: var(--ink-soft); }
.formula-list { padding-left: 22px; }
.formula-list li { padding: 10px 0; }
.formula-list li b, .formula-list li span { display: block; }
.formula-list li span, .method-caveat { color: var(--ink-soft); font-size: 13px; }
.method-caveat { border-top: 1px solid var(--line); padding-top: 18px; }

[data-theme="dark"] { --ink: #e8f0e9; --ink-soft: #a8b8af; --cream: #12281f; --paper: #183329; --green: #8fbe83; --green-light: #27493b; --lime: #d9ee75; --orange: #f29a68; --line: #365044; --shadow: 0 18px 45px rgba(0,0,0,.25); }
[data-theme="dark"] .site-header { background: rgba(18,40,31,.92); }
[data-theme="dark"] .principles, [data-theme="dark"] .method { background: #0d2119; }
[data-theme="dark"] .button.primary { color: #102e24; }
[data-theme="dark"] .score-wheel { box-shadow: inset 0 0 0 70px #0d2119; }
[data-theme="dark"] .score-center { background: #17372a; }
[data-theme="dark"] .score-label { color: #14382c; }
[data-theme="dark"] footer { background: #091a14; }

@media (max-width: 1050px) {
  .food-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { gap: 2vw; }
  .hero-visual { transform: scale(.9); }
  .source-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  nav { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .hero-visual { max-width: 480px; }
  .principles { grid-template-columns: 1fr; gap: 26px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 14px; }
  .explorer-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .method { grid-template-columns: 1fr; text-align: center; gap: 70px; }
  .method-copy > p:not(.eyebrow) { margin-left: auto; margin-right: auto; }
}
@media (max-width: 520px) {
  .site-header { height: 64px; }
  .hero { padding-left: 20px; padding-right: 20px; }
  h1 { font-size: 48px; }
  .hero-facts { justify-content: space-between; }
  .hero-visual { margin-top: -20px; }
  .food-a, .food-b { width: 64px; height: 64px; font-size: 32px; }
  .metric-bubble { padding: 8px 10px; min-width: 104px; }
  .explorer, .sources { padding-top: 70px; padding-bottom: 70px; }
  .goal-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
  .goal-tab { flex: 0 0 auto; }
  .results-toolbar { align-items: flex-start; gap: 12px; }
  .view-controls { flex-wrap: wrap; justify-content: flex-end; }
  .view-controls label { width: 100%; text-align: right; }
  .food-grid { grid-template-columns: 1fr; }
  .food-art { height: 160px; }
  .chart-head { display: block; }
  .chart-legend { margin-top: 12px; }
  .canvas-wrap { height: 430px; }
  .score-wheel { transform: scale(.82); margin: -30px auto; }
  .score-label { min-width: 105px; }
  footer { flex-direction: column; text-align: center; }
  .nutrient-grid { grid-template-columns: repeat(2, 1fr); }
  dialog { padding: 28px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
