@font-face { font-family: Figtree; src: url('/figtree.woff2') format('woff2'); font-weight: 300 900; font-display: swap; }

:root {
  color-scheme: light;
  --page: #f5f4f0;
  --white: #ffffff;
  --ink: #1b1a17;
  --ink-2: #57534b;
  --line: #e6e3db;
  --line-2: #cdc9be;
  --tint: #efede7;
  --sun: #ffc21a;
  --sun-soft: #fff3cc;
  --sun-ink: #6b4d00;
  --over: #d2462d;
  --good: #2f6b4a;
  --good-soft: #e3f0e8;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(27 26 23 / .06), 0 4px 14px rgb(27 26 23 / .05);
  color: var(--ink);
  background: var(--page);
  font-family: Figtree, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
img { display: block; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
input, select, button { font: inherit; color: inherit; }
button, summary, select { cursor: pointer; }
a, button, select, summary, label { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--sun); color: var(--ink); }
.wrap { width: min(80rem, calc(100% - 3rem)); margin-inline: auto; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; white-space: nowrap; clip-path: inset(50%); }
.skip:focus { position: absolute; top: .5rem; left: .5rem; background: var(--white); padding: .6rem .9rem; z-index: 10; }

/* Top bar */
.bar { background: var(--white); border-bottom: 1px solid var(--line); position: relative; z-index: 3; }
.bar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; text-decoration: none; }
.bar-links { display: flex; gap: 1.4rem; font-weight: 650; font-size: .95rem; }
.bar-links a { text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; }
.bar-links a:hover { text-decoration: underline; }
.count-pill { background: var(--sun); color: var(--ink); font-size: .75rem; font-weight: 800; min-width: 1.35rem; height: 1.35rem; border-radius: 1rem; display: inline-grid; place-items: center; padding: 0 .35rem; }

/* Intro */
.intro { padding: clamp(2rem, 5vw, 3.4rem) 0 clamp(1.4rem, 3vw, 2rem); }
.intro h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); line-height: 1.02; letter-spacing: -.035em; font-weight: 850; max-width: 18ch; }
.intro p { margin-top: .8rem; color: var(--ink-2); font-size: clamp(1rem, 1.6vw, 1.12rem); max-width: 60ch; }

/* Chain + category pickers */
.pickers { position: sticky; top: 0; z-index: 2; background: var(--page); }
.picker-row { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; padding: .35rem 0 .75rem; scroll-snap-type: x proximity; }
.picker-row::-webkit-scrollbar { display: none; }
.pick { flex: none; scroll-snap-align: start; display: inline-flex; align-items: baseline; gap: .4rem; border: 1.5px solid var(--line-2); background: var(--white); border-radius: 999px; padding: .55rem 1rem; min-height: 44px; font-weight: 700; font-size: .95rem; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.pick small { font-size: .78rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pick:hover { border-color: var(--ink); }
.pick[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.pick[aria-pressed=true] small { color: #c9c5bb; }
.cats-band { background: var(--white); border-block: 1px solid var(--line); }
.cats { padding: 0; gap: 0; }
.cats .pick { border: 0; border-radius: 0; background: transparent; padding: .9rem .95rem .8rem; box-shadow: inset 0 -3px 0 transparent; font-size: .92rem; }
.cats .pick:hover { box-shadow: inset 0 -3px 0 var(--line-2); }
.cats .pick[aria-pressed=true] { background: transparent; color: var(--ink); box-shadow: inset 0 -3px 0 var(--sun); }
.cats .pick[aria-pressed=true] small { color: var(--ink-2); }

/* Workspace */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(20rem, 25rem); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; padding-top: 1.4rem; }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .75rem; align-items: center; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: .95rem; top: 50%; translate: 0 -50%; color: var(--ink-2); pointer-events: none; }
input[type=search] { width: 100%; min-height: 48px; border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--white); padding: .5rem 1rem .5rem 2.7rem; font-size: 1rem; }
input[type=search]:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--sun-soft); }
input::placeholder { color: #8a857a; }
select { appearance: none; border: 1.5px solid var(--line-2); background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%231b1a17' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right .8rem center / 12px; border-radius: 10px; min-height: 44px; padding: .45rem 2.2rem .45rem .8rem; font-weight: 600; font-size: .92rem; max-width: 100%; }
select:hover { border-color: var(--ink); }
.sort { display: flex; align-items: center; gap: .5rem; font-weight: 650; font-size: .9rem; color: var(--ink-2); }
.check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 650; font-size: .9rem; min-height: 44px; white-space: nowrap; }
input[type=checkbox] { accent-color: var(--ink); width: 1.1rem; height: 1.1rem; margin: 0; }
.status { color: var(--ink-2); font-size: .88rem; }
#catalog-status { min-height: 2.8rem; display: flex; align-items: center; }

/* Product tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: .85rem; }
.tile { position: relative; display: flex; flex-direction: column; background: var(--white); border: 1.5px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; min-width: 0; }
.tile:hover { border-color: var(--line-2); }
.tile.picked { border-color: var(--ink); }
.tile.pop { animation: pop .28s cubic-bezier(.22, 1, .36, 1); }
@keyframes pop { 40% { transform: scale(.97); } }
.tile-add { flex: 1; display: grid; grid-template-rows: auto auto 1fr auto; text-align: left; border: 0; background: none; padding: .85rem .95rem .6rem; border-radius: var(--radius) var(--radius) 0 0; min-width: 0; }
.tile-img { display: flex; align-items: center; justify-content: center; height: 8.5rem; margin-bottom: .6rem; }
.tile-img img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transition: transform .25s ease; }
.tile-add:hover .tile-img img { transform: scale(1.04); }
.tile-img.empty, .row-img.empty { display: grid; place-items: center; background: var(--tint); border-radius: 50%; width: 6.5rem; height: 6.5rem; justify-self: center; font-weight: 800; font-size: 1.4rem; color: #8a857a; letter-spacing: .02em; margin-block: 1rem 1.6rem; }
.tile-chain { font-size: .76rem; font-weight: 700; color: var(--ink-2); text-transform: none; }
.tile-name { font-weight: 750; font-size: 1rem; line-height: 1.22; margin-top: .1rem; overflow-wrap: anywhere; padding-right: 2.2rem; }
.tile-kcal { font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; margin-top: .45rem; }
.tile-kcal.missing { color: var(--ink-2); font-weight: 600; }
.tile-plus { position: absolute; right: .8rem; bottom: 3.05rem; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--ink); transition: background-color .15s, transform .15s; }
.tile-plus::before, .tile-plus::after { content: ''; position: absolute; inset: 50% auto auto 50%; width: 12px; height: 2px; background: var(--white); border-radius: 2px; translate: -50% -50%; }
.tile-plus::after { rotate: 90deg; }
.tile-add:hover .tile-plus { background: #000; transform: scale(1.08); }
.tile-count { position: absolute; top: .65rem; right: .65rem; min-width: 1.7rem; height: 1.7rem; padding: 0 .4rem; border-radius: 1rem; background: var(--sun); font-weight: 800; font-size: .85rem; display: grid; place-items: center; font-variant-numeric: tabular-nums; pointer-events: none; }
.tile-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; border-top: 1px solid var(--line); padding: .2rem .4rem .2rem .95rem; font-size: .78rem; color: var(--ink-2); min-width: 0; }
.tile-source { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-foot .link-button { flex: none; }
.more { display: block; margin: 1.3rem auto 0; }

/* Buttons */
.button { border: 1.5px solid var(--ink); background: var(--ink); color: var(--white); border-radius: 999px; padding: .6rem 1.2rem; min-height: 44px; font-weight: 750; }
.button.ghost { background: var(--white); color: var(--ink); }
.button.ghost:hover { background: var(--tint); }
.link-button { border: 0; background: none; padding: .55rem .5rem; min-height: 40px; font-weight: 700; font-size: .85rem; text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
.link-button:hover { text-decoration-thickness: 2px; }
.link-button[aria-pressed=true] { text-decoration: none; background: var(--sun-soft); color: var(--sun-ink); border-radius: 8px; }

/* Meal panel */
.meal { position: sticky; top: 7.9rem; background: var(--white); border-radius: 18px; box-shadow: var(--shadow); overflow: auto; max-height: calc(100dvh - 8.8rem); scrollbar-width: thin; }
.meal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.2rem 0; }
.meal-head h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; }
.meal-energy { padding: .5rem 1.2rem 0; display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.energy { font-size: 3rem; line-height: 1; font-weight: 850; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.energy small { font-size: 1.05rem; letter-spacing: 0; font-weight: 700; }
.kj { color: var(--ink-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.meal > .status { padding: .35rem 1.2rem 1.1rem; }
.meal-items:not(:empty) { border-top: 1px solid var(--line); }
.meal-items:empty { display: none; }
.meal-row { padding: .85rem 1.2rem; border-bottom: 1px solid var(--line); }
.row-main { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; gap: .75rem; align-items: start; }
.row-img { width: 3.4rem; height: 3.4rem; display: flex; align-items: center; justify-content: center; }
.row-img img { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.row-img.empty { width: 3.4rem; height: 3.4rem; margin: 0; font-size: .85rem; }
.row-info { min-width: 0; }
.tag { display: block; font-size: .75rem; font-weight: 700; color: var(--ink-2); }
.row-info h3 { font-size: .98rem; font-weight: 750; line-height: 1.25; overflow-wrap: anywhere; }
.row-numbers { font-size: .86rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: .1rem; }
.remove { border: 0; background: none; width: 40px; height: 40px; margin: -.5rem -.6rem 0 0; display: grid; place-items: center; color: var(--ink-2); border-radius: 50%; }
.remove:hover { background: var(--tint); color: var(--ink); }
.row-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .8rem; margin-top: .5rem; padding-left: 4.15rem; }
.details { flex: 1; min-width: 0; font-size: .88rem; }
.details[open] { flex-basis: 100%; order: 2; }
.details summary { font-weight: 750; min-height: 40px; display: inline-flex; align-items: center; gap: .35rem; list-style: none; }
.details summary::-webkit-details-marker { display: none; }
.details summary::after { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; rotate: 45deg; translate: 0 -2px; transition: rotate .15s; }
.details[open] summary::after { rotate: 225deg; translate: 0 2px; }
.settings { display: grid; gap: .7rem; padding: .3rem 0 .4rem; }
.settings > label:not(.check) { display: grid; gap: .25rem; font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.settings select { width: 100%; color: var(--ink); font-size: .88rem; }
.settings .check { white-space: normal; min-height: 0; }
.settings ul { margin: 0; padding-left: 1rem; display: grid; gap: .35rem; font-size: .8rem; color: var(--ink-2); }
.line-nutrition summary { font-weight: 700; font-size: .85rem; min-height: 36px; display: flex; align-items: center; }
.source-links { font-size: .8rem; color: var(--ink-2); }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line-2); border-radius: 999px; padding: 2px; }
.step { width: 38px; height: 38px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; }
.step:hover { background: var(--tint); }
.qty { min-width: 1.8rem; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.amount { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .88rem; }
.amount input { width: 5.2rem; min-height: 40px; border: 1.5px solid var(--line-2); border-radius: 10px; padding: .3rem .6rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-size: .72rem; font-weight: 800; padding: .08rem .45rem; border-radius: 999px; background: var(--sun-soft); color: var(--sun-ink); vertical-align: 1px; }
.badge.calculated { background: var(--good-soft); color: var(--good); }
.meal-values { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .8rem; margin: .3rem 0 0; font-size: .84rem; }
.meal-values dt { color: var(--ink-2); }
.meal-values dd { margin: 0; font-weight: 750; font-variant-numeric: tabular-nums; }

/* Reference-intake table */
#meal-nutrition { padding: .4rem 1.2rem 1.2rem; }
#meal-nutrition:empty { display: none; }
.meal-items:empty + #meal-nutrition:empty { display: none; }
.ri-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.ri-table th, .ri-table td { padding: .5rem 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 600; vertical-align: top; }
.ri-table thead th { font-size: .78rem; color: var(--ink-2); font-weight: 700; padding-top: .7rem; }
.ri-table tbody th { font-weight: 750; }
.ri-table .sub th { font-weight: 500; padding-left: .9rem; color: var(--ink-2); }
.ri-table .num { text-align: right; padding-left: .6rem; white-space: nowrap; }
.ri-table td.ri { width: 5.2rem; }
.ri-bar { display: block; height: 4px; margin-top: .3rem; border-radius: 4px; background: linear-gradient(90deg, var(--sun) var(--w), var(--tint) var(--w)); }
.ri-bar.over { background: var(--over); }
.ri-note { font-size: .76rem; color: var(--ink-2); margin-top: .6rem; }

/* Lower sections */
.lower { margin-top: clamp(2.8rem, 6vw, 4.5rem); }
.lower-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.lower h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 850; letter-spacing: -.03em; }
.lower > .status { margin-top: .4rem; }
.inline-select { display: inline-flex; align-items: center; gap: .6rem; margin-top: .9rem; font-weight: 650; font-size: .9rem; flex-wrap: wrap; }
.compare-overflow { overflow-x: auto; margin-top: 1rem; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.compare-table { width: 100%; border-collapse: collapse; min-width: 30rem; font-size: .9rem; font-variant-numeric: tabular-nums; }
.compare-table th, .compare-table td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 8rem; }
.compare-table thead th { background: var(--tint); }
.compare-table tbody th { font-weight: 700; color: var(--ink-2); }
.compare-table tr > :first-child { position: sticky; left: 0; background: var(--white); min-width: 7.5rem; box-shadow: 1px 0 0 var(--line); }
.compare-table thead tr > :first-child { background: var(--tint); }
.compare-name .link-button { padding-left: 0; }
.compare-name strong { display: block; font-size: 1rem; line-height: 1.25; }
.compare-name > * { display: block; }
.compare-name .badge { display: inline-block; }
.compare-estimate { display: flex; margin-top: .25rem; min-height: 0; font-size: .82rem; }
.prose > p { max-width: 70ch; color: var(--ink-2); margin-top: .75rem; }
.prose > h2 + p { margin-top: .9rem; }
.downloads { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; font-weight: 700; }
.downloads a { color: var(--ink); }
.disclosure { margin-top: 1.1rem; border-top: 1px solid var(--line-2); padding-top: .4rem; max-width: 52rem; }
.disclosure summary { font-weight: 750; min-height: 44px; display: flex; align-items: center; }
.disclosure ul { margin: .3rem 0 .6rem; padding-left: 1.1rem; display: grid; gap: .35rem; }
.coverage article { padding: .8rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.coverage article p { color: var(--ink-2); margin-top: .15rem; }
.coverage article a { margin-right: 1rem; color: var(--ink); }
.foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--line-2); margin-top: 3.5rem; padding: 1.2rem 0 2rem; font-size: .85rem; color: var(--ink-2); }
.mobile-meal { display: none; }

@media (max-width: 1080px) {
  .toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .toolbar .check { grid-column: 1 / -1; min-height: 32px; }
}
@media (max-width: 860px) {
  .wrap { width: calc(100% - 2rem); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .meal { position: static; max-height: none; }
  .pickers { position: static; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .tile-img { height: 6.5rem; }
  .tile-img.empty { width: 5rem; height: 5rem; }
  .tile-add { padding: .7rem .75rem .5rem; }
  .tile-name { font-size: .94rem; padding-right: 0; }
  .tile-plus { width: 2rem; height: 2rem; right: .6rem; bottom: auto; top: 6.6rem; }
  .tile-foot { padding-left: .75rem; }
  .mobile-meal { display: flex; position: fixed; z-index: 4; left: .75rem; right: .75rem; bottom: max(.75rem, env(safe-area-inset-bottom)); justify-content: space-between; align-items: center; gap: 1rem; background: var(--ink); color: var(--white); text-decoration: none; padding: .85rem 1.1rem; border-radius: 999px; font-weight: 750; box-shadow: 0 6px 20px rgb(27 26 23 / .25); }
  .mobile-meal b { background: var(--sun); color: var(--ink); border-radius: 1rem; padding: 0 .45rem; margin-left: .3rem; font-size: .82rem; }
  .mm-value { font-variant-numeric: tabular-nums; }
  .foot { padding-bottom: 6rem; }
}
@media (max-width: 520px) {
  .brand { font-size: 1rem; gap: .5rem; }
  .bar-links { gap: .9rem; font-size: .9rem; }
  .toolbar { grid-template-columns: 1fr; }
  .sort { justify-content: space-between; }
  .sort select { flex: 1; }
  .tile-foot { flex-direction: column; align-items: flex-start; gap: 0; padding: .45rem .75rem .1rem; }
  .tile-source { max-width: 100%; }
  .tile-foot .link-button { padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
section[id], aside[id] { scroll-margin-top: 8.5rem; }
@media (max-width: 860px) { section[id], aside[id] { scroll-margin-top: 1rem; } }
