/* ============================================================
   Dietly — generated food detail pages ("fresh" design).
   White canvas, big display type with one vivid green accent,
   pill search bar, soft rounded cards, charcoal-green footer.
   Flat, no gradients. Fonts come from /fonts/fonts.css.
   Browse/category pages keep using pages.css — this file is
   linked by food detail pages only.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --paper:     #FFFFFF;
  --paper-2:   #F6F7F4;
  --ink:       #131712;
  --ink-2:     #4E574F;
  --mute:      #8B948C;
  --line:      #E8EAE4;

  --green:     #23A943;
  --green-ink: #0E3D20;
  --green-bg:  #E9F6ED;
  --amber:     #DFA33C;
  --amber-bg:  #FBF3E1;
  --coral:     #E2764F;
  --coral-bg:  #FCEEE7;

  --r-lg:      28px;
  --r-md:      18px;
  --r-pill:    999px;
  --shadow:    0 2px 4px rgba(19, 23, 18, .04), 0 14px 34px -22px rgba(19, 23, 18, .18);
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-head: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-ink); text-decoration: none; }

h1, h2, h3 {
  font-family: var(--font-head);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 .4em;
}

img { max-width: 100%; }

/* ===== Nav ===== */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: rgba(251, 253, 251, 0.78);
  border-bottom: 1px solid #E3ECE6;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 16px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 700;
  font-size: 1.25rem; color: #06351A;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px; display: block;
  box-shadow: 0 1px 2px rgba(13,31,23,.04), 0 2px 6px rgba(13,31,23,.04);
  transform: rotate(-6deg);
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.brand:hover .brand-mark { transform: rotate(0deg) scale(1.05); }
.nav-links { display: flex; gap: 26px; font-size: .92rem; }
.nav-links a { color: #2B3A32; font-weight: 400; transition: color .2s; }
.nav-links a:hover { color: #087025; }
.nav-cta {
  background: var(--green);
  color: #fff !important;
  padding: 10px 22px;
  border-radius: var(--r-pill);
  font-weight: 700; font-size: 14px;
  transition: background .15s;
}
.nav-cta:hover { background: #1B8D36; }
@media (max-width: 700px) { .nav-links { display: none; } }

/* ===== Search pill ===== */
.search-strip { max-width: 1120px; margin: 0 auto; padding: 6px 28px 0; }
.search-pill {
  display: flex; align-items: center; gap: 12px;
  max-width: 560px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 13px 22px;
  box-shadow: var(--shadow);
  color: var(--mute); font-size: .92rem;
}
.search-pill svg { flex: none; }
.search-pill .go { margin-left: auto; color: var(--green); font-weight: 700; font-size: .9rem; }
.search-pill:hover { border-color: #D7DBD2; }

/* ===== Hero ===== */
.hero { max-width: 1120px; margin: 0 auto; padding: 34px 28px 8px; }
.crumb {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-size: .82rem; color: var(--mute); margin-bottom: 26px;
}
.crumb a { color: var(--ink-2); font-weight: 500; }
.crumb a:hover { color: var(--green); }

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 52px;
  align-items: center;
}
.kicker {
  font-family: var(--font-head);
  font-size: .76rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--green);
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  font-weight: 800;
  color: var(--ink);
}
.hero h1 .accent { color: var(--green); }
.byline { color: var(--ink-2); font-size: 1.05rem; font-weight: 500; margin: 2px 0 18px; }
.lede { color: var(--ink-2); font-size: 1rem; max-width: 52ch; margin: 0 0 20px; }
.lede strong { color: var(--ink); }
.lede .accent { color: var(--green); }

.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.nutri-score { display: inline-flex; border-radius: var(--r-pill); overflow: hidden; border: 1px solid var(--line); }
.ns-cell {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  font-size: .74rem; font-weight: 700; color: #fff;
  opacity: .3;
}
.ns-cell.on { opacity: 1; width: 36px; font-size: .88rem; outline: 2px solid var(--ink); outline-offset: -2px; border-radius: var(--r-pill); }
.ns-a { background: #038141; } .ns-b { background: #85BB2F; }
.ns-c { background: #FECB02; color: #5A4B00; } .ns-d { background: #EE8100; }
.ns-e { background: #E63E11; }
.serving-chip {
  font-size: .82rem; font-weight: 600; color: var(--ink-2);
  background: var(--paper-2);
  border-radius: var(--r-pill);
  padding: 7px 15px;
}
.barcode-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-variant-numeric: tabular-nums;
}
.barcode-chip svg { flex: none; color: var(--mute); }
.hero-photo .compare-float {
  position: absolute; right: 18px; bottom: 18px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green); color: #fff;
  border-radius: var(--r-pill); padding: 9px 17px;
  font-family: var(--font-head); font-weight: 800; font-size: .85rem;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(11, 34, 18, .28);
  transition: background .15s, transform .15s, box-shadow .15s;
}
.hero-photo .compare-float svg { flex: none; }
.hero-photo .compare-float:hover {
  background: #1B8D36;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(11, 34, 18, .35);
}

.compare-btn {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 18px; padding: 12px 22px;
  border: 1.5px solid var(--green); border-radius: var(--r-pill);
  color: var(--green-ink); background: var(--green-bg);
  font-family: var(--font-head); font-weight: 700; font-size: .89rem;
  text-decoration: none;
  transition: background .15s, color .15s, transform .15s, box-shadow .15s;
}
.compare-btn svg { flex: none; }
.compare-btn:hover {
  background: var(--green); color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(35, 169, 67, .3);
}

.signal-row { display: flex; flex-wrap: wrap; gap: 8px; }
.signal-row span {
  font-size: .74rem; font-weight: 700;
  padding: 6px 13px; border-radius: var(--r-pill);
  background: var(--paper-2); color: var(--ink-2);
}
.signal-row span.s-green { background: var(--green-bg); color: var(--green-ink); }
.signal-row span.s-amber { background: var(--amber-bg); color: #7C5A15; }
.signal-row span.s-coral { background: var(--coral-bg); color: #93482B; }

.hero-photo {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 380px;
  background: var(--paper-2);
  box-shadow: var(--shadow);
  display: grid; place-items: center;
  padding: 34px;
}
.hero-photo img {
  max-width: 100%; max-height: 310px;
  object-fit: contain;
  border-radius: 14px;
}
.hero-photo .img-fallback {
  font: 800 5rem var(--font-head);
  color: var(--mute);
}
.hero-photo .score-float {
  position: absolute; left: 18px; bottom: 18px;
  background: rgba(255,255,255,.94);
  border-radius: var(--r-pill);
  padding: 8px 16px;
  font-family: var(--font-head); font-weight: 800; font-size: .9rem;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.hero-photo .score-float b { color: var(--green); }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 26px; }
  .hero-photo { order: -1; min-height: 260px; padding: 22px; }
  .hero-photo img { max-height: 210px; }
}

/* ===== Shell ===== */
.shell { max-width: 1120px; margin: 0 auto; padding: 34px 28px 70px; }

/* ===== Amount pills ===== */
.amounts {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  margin-bottom: 16px;
}
.amounts .lbl, .split .lbl {
  font-family: var(--font-head);
  font-size: .74rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--mute);
  margin-right: 5px;
}
.amt-btn {
  font-family: var(--font-body);
  font-size: .86rem; font-weight: 600;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 9px 18px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.amt-btn:hover { border-color: var(--green); color: var(--green-ink); }
.amt-btn.active { background: var(--green); border-color: var(--green); color: #fff; }
.amt-custom {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 7px 16px; margin-left: auto;
  color: var(--mute); font-size: .82rem; font-weight: 600;
}
.amt-custom input {
  width: 52px; border: 0; outline: 0;
  font: 600 .88rem var(--font-body); color: var(--ink);
}
.showing { font-size: .84rem; color: var(--mute); margin: 0 0 14px; }
.showing strong { color: var(--ink); }

/* ===== Stat tiles ===== */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.tile {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px 12px;
  border-top: 3px solid var(--green-ink);
}
.tile .n {
  font-family: var(--font-head);
  font-size: 1.45rem; font-weight: 800; color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.tile .n .u { font-size: .8rem; font-weight: 600; color: var(--mute); }
.tile .l {
  font-size: .7rem; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--mute); margin-top: 3px;
}
.tile .pct { font-size: .74rem; color: var(--mute); margin-top: 4px; }
.tile.protein { border-top-color: var(--green); }
.tile.carbs { border-top-color: var(--amber); }
.tile.fat { border-top-color: var(--coral); }

.split { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 18px 2px 0; }
.split-bar {
  flex: 1; min-width: 220px;
  display: flex; height: 9px; border-radius: var(--r-pill); overflow: hidden;
  background: var(--paper-2);
}
.split-bar i { display: block; }
.sp-p { background: var(--green); }
.sp-c { background: var(--amber); }
.sp-f { background: var(--coral); }
.split-legend { display: flex; gap: 16px; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.split-legend b { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.split-legend .lg-p { background: var(--green); }
.split-legend .lg-c { background: var(--amber); }
.split-legend .lg-f { background: var(--coral); }

/* ===== Section cards ===== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 30px 34px;
  margin-top: 26px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.card-head h2 { font-size: 1.35rem; font-weight: 800; margin: 0; }
.card-head .sub { font-size: .82rem; color: var(--mute); font-weight: 500; }
.card-head a { color: var(--green); font-weight: 700; font-size: .86rem; }

/* Facts */
.fact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 52px; margin-top: 8px; }
.fact {
  display: flex; flex-wrap: wrap; align-items: baseline;
  padding: 12px 2px 10px;
  border-bottom: 1px solid var(--paper-2);
  font-size: .93rem;
}
.fact .l { color: var(--ink-2); font-weight: 500; }
.fact .v { margin-left: auto; color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.fact .u { color: var(--mute); font-size: .8rem; font-weight: 600; margin-left: 4px; min-width: 22px; }
.fact .dv { margin-left: 10px; min-width: 52px; text-align: right; color: var(--mute); font-size: .78rem; font-weight: 700; }
.fact .track {
  flex-basis: 100%; height: 5px; margin-top: 8px;
  border-radius: var(--r-pill); background: var(--paper-2); overflow: hidden;
}
.fact .track b { display: block; height: 100%; border-radius: var(--r-pill); background: var(--green); transition: width .25s ease; }
.dv-note, .source { font-size: .78rem; color: var(--mute); margin: 14px 0 0; }
.source strong { color: var(--ink-2); }
@media (max-width: 720px) { .fact-grid { grid-template-columns: 1fr; } }

/* Barcode card */
.barcode-render {
  display: flex; justify-content: center;
  background: #fff;
  padding: 18px 26px 10px;
}
.barcode-render svg { display: block; }
.barcode-num {
  margin: 0; text-align: center;
  font-size: .95rem; font-weight: 600; color: var(--ink);
  letter-spacing: .18em; font-variant-numeric: tabular-nums;
}

/* FAQ */
.faq details { border-bottom: 1px solid var(--paper-2); }
.faq details:last-of-type { border-bottom: 0; }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  list-style: none; cursor: pointer;
  padding: 15px 0;
  font-family: var(--font-head); font-weight: 700; font-size: .98rem; color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  flex: none; width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--green-bg); color: var(--green-ink);
  font: 800 15px var(--font-head);
}
.faq details[open] summary::after { content: '\2212'; }
.faq .answer { margin: 0 0 16px; max-width: 66ch; color: var(--ink-2); font-size: .92rem; }
.faq .answer strong { color: var(--ink); }

/* API CTA */
.cta-card {
  background: var(--green-bg);
  border: none;
  text-align: center;
  padding: 44px 30px 42px;
}
.cta-card h2 { font-size: 1.5rem; font-weight: 800; }
.cta-card p { margin: 0 auto 22px; max-width: 52ch; color: var(--ink-2); font-size: .95rem; }
.cta-btn {
  display: inline-block;
  background: var(--green); color: #fff !important;
  font-weight: 700; font-size: .95rem;
  padding: 13px 30px; border-radius: var(--r-pill);
  transition: background .15s;
}
.cta-btn:hover { background: #1B8D36; }

/* Related */
.related { margin-top: 34px; }
.rel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.rel-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 15px 17px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.rel-card:hover { border-color: #D2D7CC; box-shadow: var(--shadow); transform: translateY(-2px); }
.rel-thumb {
  position: relative; flex: none;
  width: 58px; height: 58px;
  border-radius: 14px; background: var(--paper-2);
  display: grid; place-items: center; overflow: hidden;
}
.rel-thumb img { max-width: 48px; max-height: 48px; object-fit: contain; }
.rel-thumb .img-fallback { font: 800 1.4rem var(--font-head); color: var(--mute); }
.rel-badge {
  position: absolute; top: 0; left: 0;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 0 0 10px 0;
  font: 800 .64rem var(--font-head); color: #fff;
}
.rb-a { background: #038141; } .rb-b { background: #85BB2F; }
.rb-c { background: #FECB02; color: #5A4B00; } .rb-d { background: #EE8100; }
.rb-e { background: #E63E11; }
.rel-card strong { display: block; font: 700 .88rem/1.3 var(--font-head); color: var(--ink); }
.rel-card small { color: var(--mute); font-size: .76rem; }
.rel-card em { display: block; margin-top: 4px; color: var(--ink-2); font-size: .78rem; font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .rel-grid { grid-template-columns: 1fr; }
  .stat-tiles { grid-template-columns: 1fr 1fr; }
  .amt-custom { margin-left: 0; }
  .card { padding: 22px 20px; }
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid #E3ECE6;
  background: #06351A;
  color: #97EFB0;
  padding: 50px 28px 28px;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
}
/* h3 is current (heading-order a11y fix); h4 kept for pages built before
   template fresh-10-perf, drop after the next full rebuild. */
.footer h3, .footer h4 {
  color: #fff; font-family: var(--font-head);
  font-size: .95rem; font-weight: 700; margin: 0 0 14px;
  text-transform: uppercase; letter-spacing: .1em;
}
.footer a { display: block; padding: 4px 0; font-size: .9rem; color: inherit; opacity: .85; transition: opacity .2s; }
.footer a:hover { opacity: 1; color: #fff; }
.footer p { font-size: .92rem; opacity: .85; line-height: 1.7; margin: 0; }
.footer p a { display: inline; padding: 0; color: #97EFB0; }
.footer-bottom {
  max-width: 1200px; margin: 36px auto 0;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .82rem; opacity: .7;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; gap: 26px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── App download CTA (hero badges + green card, fresh-9) ──────────────── */
.hero-app { margin-top: 20px; }
.hero-app-label {
  display: block; font-size: .72rem; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--mute); margin-bottom: 9px;
}
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; }

.store-badge {
  display: flex; align-items: center; gap: 11px;
  background: #0C0F0D; color: #fff !important;
  border-radius: 13px; padding: 10px 22px 10px 16px; min-width: 196px;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(11, 34, 18, .28);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.store-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(11, 34, 18, .4);
  background: #000;
}
.store-badge svg { flex: none; }
.store-badge > span { display: flex; flex-direction: column; line-height: 1.16; min-width: 0; }
.store-badge small { font-size: .6rem; font-weight: 500; letter-spacing: .35px; opacity: .85; }
.store-badge strong { font-size: 1.08rem; font-weight: 600; letter-spacing: .2px; white-space: nowrap; }

.hero-badges .store-badge {
  border-radius: 11px; padding: 7px 16px 7px 12px; min-width: 0;
  box-shadow: 0 2px 8px rgba(19, 23, 18, .18);
}
.hero-badges .store-badge:hover { box-shadow: 0 8px 18px rgba(19, 23, 18, .28); }
.hero-badges .store-badge small { font-size: .52rem; }
.hero-badges .store-badge strong { font-size: .95rem; }

.app-cta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 30px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--green) 0%, #1B8D36 100%);
  border: none; color: #fff;
  padding: 36px 38px; position: relative; overflow: hidden;
}
.app-cta::before {
  content: ""; position: absolute; left: -90px; bottom: -120px;
  width: 280px; height: 280px; border-radius: 50%;
  background: rgba(255, 255, 255, .07); pointer-events: none;
}
.app-cta::after {
  content: ""; position: absolute; right: -70px; top: -90px;
  width: 250px; height: 250px; border-radius: 50%;
  background: rgba(255, 255, 255, .09); pointer-events: none;
}
.app-cta-copy { flex: 1 1 340px; min-width: 0; position: relative; z-index: 1; }
.app-cta-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .72rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: #fff; background: rgba(255, 255, 255, .16);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.app-cta-kicker svg { flex: none; }
.app-cta h2 { font-size: 1.55rem; font-weight: 800; margin: 0 0 8px; color: #fff; letter-spacing: -.01em; }
.app-cta p { margin: 0 0 16px; font-size: .94rem; line-height: 1.55; color: rgba(255, 255, 255, .92); max-width: 46ch; }
.app-feats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none; }
.app-feats li { display: flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 600; color: #fff; }
.app-feats li::before {
  content: ""; flex: none; width: 17px; height: 17px; border-radius: 50%;
  background: rgba(255, 255, 255, .22) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>') center/10px no-repeat;
}
.app-badges { display: flex; flex-direction: column; gap: 12px; flex: none; position: relative; z-index: 1; }

@media (max-width: 640px) {
  .hero-badges { width: 100%; }
  .hero-badges .store-badge { flex: 1 1 150px; justify-content: center; }
  .app-cta { padding: 30px 22px; }
  .app-cta h2 { font-size: 1.35rem; }
  .app-badges { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .app-badges .store-badge { flex: 1 1 170px; justify-content: center; }
}
