/* FoodFactly: one small stylesheet, system fonts, no external requests. */
:root {
  --bg: #fbfaf6; --panel: #fff; --ink: #18211c; --muted: #5b6760; --line: #e2e6df; --soft: #f1f4ee;
  --brand: #1d6b47; --brand-ink: #fff; --brand-soft: #e5f2ea; --accent: #d4622a;
  --protein: #2f6fb0; --carbs: #d99a1b; --fat: #c4502a; --alcohol: #7b5ea7;
  --radius: 12px; --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111613; --panel: #18201b; --ink: #e7ece8; --muted: #9aa8a0; --line: #2a352e; --soft: #1d2620;
    --brand: #4fb383; --brand-ink: #0b1a12; --brand-soft: #1c3127; --accent: #f08a50; --shadow: none; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: .4em 0 .3em; }
h2 { font-size: 1.35rem; margin: 1.8em 0 .6em; }
h3, .h3 { font-size: 1.08rem; margin: 1em 0 .5em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 8px; z-index: 10; }
.muted { color: var(--muted); font-weight: normal; }
.note { color: var(--muted); font-size: .86rem; }
.na { color: var(--muted); font-style: italic; }
.lead { font-size: 1.06rem; max-width: 78ch; }
.lead p, .intro p { margin: 0 0 .7em; }
.notice { background: var(--brand-soft); border-left: 4px solid var(--brand); padding: 10px 14px; border-radius: 6px; }

/* header */
.site-header { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-top: 10px; padding-bottom: 10px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-size: 1.25rem; }
.logo b, .footer-brand b { color: var(--brand); }
.nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .95rem; width: 100%; }
.nav a { color: var(--ink); text-decoration: none; padding: 2px 0; }
.nav a:hover { color: var(--brand); }
@media (min-width: 960px) { .nav { width: auto; margin-left: auto; } }
.search { position: relative; display: flex; flex: 1 1 260px; max-width: 460px; }
.search input { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px 0 0 10px; background: var(--bg); color: var(--ink); }
.search input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.search button { font: inherit; border: 0; background: var(--brand); color: var(--brand-ink); padding: 0 14px; border-radius: 0 10px 10px 0; cursor: pointer; }
.search-hero { max-width: 640px; margin: 1em 0; }
.search-hero input { padding: 13px 16px; font-size: 1.05rem; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 20; max-height: 70vh; overflow: auto; }
.suggest li a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.suggest li a span { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.suggest li.on a, .suggest li a:hover { background: var(--soft); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 12px 0 0; font-size: .86rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 4px; color: var(--line); }
.crumbs a { color: var(--muted); }

/* building blocks */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.grid-2 { display: grid; gap: 18px; grid-template-columns: 1fr; margin: 18px 0; }
.grid-3 { display: grid; gap: 18px; grid-template-columns: 1fr; margin: 18px 0; }
@media (min-width: 820px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-2 > section > h2:first-child, .panel > h2:first-child { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; align-items: center; }
.chip { display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .92rem; }
.chip:hover { border-color: var(--brand); }
.cards { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card { display: flex; flex-direction: column; padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--ink); height: 100%; }
.card:hover { border-color: var(--brand); }
.card span { color: var(--muted); font-size: .88rem; }
.list { padding-left: 1.1em; } .list li { margin: .25em 0; }
.cols { columns: 260px; padding: 0; list-style: none; } .cols li { break-inside: avoid; padding: 3px 0; }
.cats { list-style: none; padding: 0; display: grid; gap: 14px; } .cats h2 { margin: 0 0 .3em; }
.guides { list-style: none; padding: 0; display: grid; gap: 12px; }
.letters { display: flex; flex-wrap: wrap; gap: 4px; } .letters a { padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; } .letters a.on { background: var(--brand); color: var(--brand-ink); }
.rank { padding-left: 1.4em; margin: 0; } .rank li { margin: .3em 0; }
.results { list-style: none; padding: 0; } .results li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.btn { font: inherit; border-radius: 10px; padding: 8px 14px; cursor: pointer; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--brand); }
.hero { padding: 18px 0 8px; } .hero h1 { max-width: 22ch; } .hero p { max-width: 70ch; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
.data { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: .95rem; }
.data th, .data td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data thead th { background: var(--soft); font-size: .84rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.data tbody th { font-weight: 500; }
.data.compact th, .data.compact td { padding: 4px 8px; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp td.more { font-weight: 700; }
.tag { display: inline-block; font-size: .72rem; padding: 1px 6px; border-radius: 5px; background: var(--soft); color: var(--muted); vertical-align: middle; }
.tag-raw { background: #e3f3e8; color: #1b6b3f; } .tag-cooked { background: #fbe9dd; color: #9a3f12; } .tag-dried { background: #f6eed6; color: #7a5a06; }
.tag-frozen { background: #e1eefa; color: #1f5a8e; } .tag-canned { background: #ece7f6; color: #5a3f8c; }
@media (prefers-color-scheme: dark) { .tag-raw, .tag-cooked, .tag-dried, .tag-frozen, .tag-canned { background: var(--soft); color: var(--ink); } }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 18px 0; }
.sort { font-size: .92rem; } .sort a, .sort b { margin-left: 8px; }

/* food page */
.food-head { display: flex; gap: 20px; align-items: flex-start; }
.food-head-text { flex: 1; min-width: 0; }
.food-photo { margin: 18px 0 0; width: 200px; flex: none; text-align: center; font-size: .75rem; color: var(--muted); }
.food-photo img { width: 200px; height: 200px; object-fit: contain; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); }
@media (max-width: 640px) { .food-head { flex-direction: column-reverse; } .food-photo { margin: 8px auto 0; } }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.badge { font-size: .8rem; padding: 3px 9px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.badge-link:hover { border-color: var(--brand); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 16px 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; }
.kpi-v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-l { color: var(--muted); font-size: .85rem; }
.kpi-kcal { border-top-color: var(--accent); } .kpi-protein { border-top-color: var(--protein); } .kpi-carbs { border-top-color: var(--carbs); } .kpi-fat { border-top-color: var(--fat); } .kpi-serving { border-top-color: var(--brand); }
.calc label { font-weight: 600; font-size: .9rem; }
.calc-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.calc select, .calc input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); max-width: 100%; }
.calc input { width: 7em; }
.label { font-size: .95rem; }
.label th, .label td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.label thead th { font-size: .8rem; color: var(--muted); border-bottom: 2px solid var(--ink); }
.label tbody th { font-weight: 600; }
.label .row-kcal th, .label .row-kcal td { font-size: 1.15rem; font-weight: 800; border-bottom: 3px solid var(--ink); }
.label .indent-1 th { padding-left: 18px; font-weight: 400; } .label .indent-2 th { padding-left: 34px; font-weight: 400; }
.label .micro th { font-weight: 400; }
.label .micro:first-of-type th { border-top: 3px solid var(--ink); }
.dv-tag { display: inline-block; min-width: 1.3em; text-align: center; font-size: .66rem; font-weight: 700; border-radius: 4px; padding: 0 3px; text-decoration: none; vertical-align: 1px; cursor: help; }
.d-measured { background: #dcefe4; color: #1b6b3f; } .d-calculated { background: #f3ead2; color: #7a5a06; } .d-label { background: #e1eaf7; color: #1f4f8e; }
.d-assumed_zero, .d-imputed, .d-unknown { background: #ebe8ef; color: #514a5e; }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.donut { width: 180px; height: 180px; }
.donut-track { stroke: var(--soft); }
.donut-num { font-size: 30px; font-weight: 800; fill: var(--ink); } .donut-sub { font-size: 12px; fill: var(--muted); }
.legend { list-style: none; padding: 0; margin: 0; } .legend li { margin: 6px 0; display: flex; align-items: center; gap: 8px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-protein { background: var(--protein); } .sw-carbohydrates { background: var(--carbs); } .sw-fat { background: var(--fat); } .sw-alcohol { background: var(--alcohol); }
.dvbars { width: 100%; max-width: 460px; height: auto; }
.dvbar-label { font-size: 12px; fill: var(--ink); } .dvbar-val { font-size: 11px; fill: var(--muted); } .dvbar-in { fill: #fff; font-weight: 700; }
.dvbar-track { fill: var(--soft); } .dvbar { fill: #7fbf9c; } .dvbar-hi { fill: var(--brand); }
.insights { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ins { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; border-left: 4px solid var(--line); }
.ins-up { border-left-color: var(--brand); } .ins-down { border-left-color: var(--carbs); } .ins-info { border-left-color: var(--protein); }
.ins-t { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ins-v { font-size: 1.25rem; font-weight: 700; } .ins-x { font-size: .9rem; }
details.panel { margin: 10px 0; padding: 0; } details.panel > summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
details.panel > table { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; } .faq summary { cursor: pointer; font-weight: 600; } .faq p { margin: .5em 0 0; max-width: 80ch; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; } .dl dt { color: var(--muted); } .dl dd { margin: 0; }
.ingredients { font-size: .94rem; }
.nutri { display: inline-block; width: 1.6em; text-align: center; color: #fff; font-weight: 800; border-radius: 4px; }
.nutri-a { background: #038141; } .nutri-b { background: #85bb2f; } .nutri-c { background: #c9a400; } .nutri-d { background: #ee8100; } .nutri-e { background: #e63e11; }
.sources ul { padding-left: 1.1em; }
.prose { max-width: 78ch; } .prose li { margin: .35em 0; }

/* footer */
.site-footer { margin-top: 48px; background: var(--panel); border-top: 1px solid var(--line); font-size: .92rem; }
.footer-grid { display: grid; gap: 20px; grid-template-columns: 1fr; padding-top: 26px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.langs a[aria-current] { font-weight: 700; text-decoration: none; }
.footer-grid a { display: block; padding: 2px 0; }
.footer-brand { font-size: 1.2rem; margin: 0 0 .4em; } .footer-h { font-weight: 700; margin: 0 0 .4em; }
.footer-legal { color: var(--muted); font-size: .82rem; padding-bottom: 26px; border-top: 1px solid var(--line); margin-top: 18px; }
.ios-hint { position: fixed; left: 12px; right: 12px; bottom: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 10px 44px 10px 14px; z-index: 30; }
.ios-hint p { margin: 0; } .ios-hint button { position: absolute; right: 8px; top: 6px; font-size: 1.4rem; background: none; border: 0; color: var(--muted); cursor: pointer; }
@media print { .site-header, .site-footer, .calc, .ios-hint { display: none; } }
