/*
 * Eiwitsnacks signature ("het etiket").
 * Everything is borrowed from the back of the pack: the nutrition table with its thick rules, the shelf label.
 * Elements: label reader (table + numbered notes), claim meter (% energy from protein vs the 12% / 20% EU thresholds),
 * gram-per-portion bars, shelf-label snack cards, rounded-square picto tiles, label-hero.
 * Load after kit.css + themes/eiwitsnacks.css. Pictograms: icons/eiwitsnacks/sprite.svg (es-*).
 * The label (.es-label) is always dark ink on white, also in dark mode: that is the recognisable object.
 */

/* Display type: condensed like label print. */
h1, h2, h3, .zs-logo { font-stretch: 82%; }

/* ---------- Picto tile: rounded square, like the icons printed on a pack ---------- */
.es-picto { --picto-bg: var(--zs-picto); display: inline-grid; place-items: center; flex: none; width: 3rem; height: 3rem; border-radius: 10px; background: var(--picto-bg); color: #fff; }
.es-picto svg { width: 68%; height: 68%; }
.es-picto--sm { width: 2.1rem; height: 2.1rem; border-radius: 7px; }
.es-picto--lg { width: 4rem; height: 4rem; border-radius: 13px; }
.es-picto--yolk { --picto-bg: var(--es-yolk); color: #142420; }

/* ---------- Label (nutrition table) ----------
 * <div class="es-label"><p class="es-label__title">Voedingswaarde</p>
 *  <table><thead><tr><th></th><th>per 100 g</th><th>per portie (30 g)</th></tr></thead>
 *  <tbody><tr class="is-energy">...</tr><tr>...</tr><tr class="is-focus"><th>Eiwitten <span class="es-note">1</span></th>...</tr></tbody></table></div>
 */
.es-label { background: var(--es-label-bg); color: var(--es-label-ink); border: 2px solid var(--es-label-ink); border-radius: 4px; padding: .7rem .9rem .8rem; font-variant-numeric: tabular-nums; box-shadow: 4px 4px 0 color-mix(in srgb, var(--es-label-ink) 18%, transparent); }
.es-label__title { margin: 0 0 .35rem; font: 800 1.45rem/1 var(--zs-font-display); font-stretch: 75%; border-bottom: 7px solid var(--es-label-ink); padding-bottom: .35rem; color: var(--es-label-ink); }
.es-label table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.es-label th, .es-label td { text-align: right; padding: .28rem 0 .28rem .6rem; border-bottom: 1px solid var(--es-label-ink); }
.es-label th:first-child { text-align: left; padding-left: 0; font-weight: 600; white-space: nowrap; }
.es-label thead th { white-space: nowrap; font-weight: 700; font-size: .8rem; border-bottom: 3px solid var(--es-label-ink); vertical-align: bottom; }
.es-label tr.is-energy th, .es-label tr.is-energy td { border-bottom: 4px solid var(--es-label-ink); }
.es-label tr.is-sub th { padding-left: .9rem; font-weight: 400; }
.es-label tr.is-focus th, .es-label tr.is-focus td { background: var(--es-yolk); font-weight: 800; }
.es-label tr.is-focus th { padding-left: .4rem; }
.es-label tr:last-child th, .es-label tr:last-child td { border-bottom: 0; }
.es-label__foot { margin: .5rem 0 0; font-size: .75rem; color: var(--es-label-ink); }
.es-note { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--es-label-ink); color: #fff; font: 700 .72rem/1 var(--zs-font-body); vertical-align: .1em; margin-left: .25rem; }

/* Label reader: the table next to numbered notes that explain each marked row. */
.es-reader { display: grid; gap: 1.2rem; align-items: start; }
@media (min-width: 50rem) { .es-reader { grid-template-columns: minmax(17rem, 23rem) minmax(0, 1fr); gap: 2rem; } }
.es-reader__notes { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.es-reader__notes li { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); gap: .7rem; align-items: start; }
.es-reader__notes .es-note { width: 1.8rem; height: 1.8rem; font-size: .9rem; margin: 0; background: var(--zs-ink); color: var(--zs-bg); }
.es-reader__notes strong { display: block; font: 800 1.1rem/1.2 var(--zs-font-display); font-stretch: 82%; }
.es-reader__notes p { margin: .2rem 0 0; color: var(--zs-muted); }

/* ---------- Claim meter: share of energy from protein, with the EU thresholds ----------
 * <figure class="es-claim" style="--pct: 24"> (0-40 scale)
 *  <div class="es-claim__track" role="img" aria-label="24% van de energie uit eiwit: rijk aan eiwit"><span class="es-claim__value"></span></div>
 *  <div class="es-claim__marks"><span class="src">12% bron van eiwit</span><span class="rich">20% rijk aan eiwit</span></div><figcaption>...</figcaption></figure>
 */
.es-claim { margin: 0; background: var(--zs-surface); border: 1px solid var(--zs-line); border-radius: var(--zs-radius); padding: 1rem 1.1rem; --max: 40; }
.es-claim__track { position: relative; height: 1.1rem; border-radius: 3px; background: linear-gradient(90deg, var(--zs-surface-alt) 0 30%, color-mix(in srgb, var(--es-bar) 22%, var(--zs-surface)) 30% 50%, color-mix(in srgb, var(--es-bar) 40%, var(--zs-surface)) 50%); border: 1px solid var(--zs-line); }
.es-claim__value { position: absolute; top: -.45rem; bottom: -.45rem; left: calc(min(var(--pct), var(--max)) / var(--max) * 100%); width: 4px; margin-left: -2px; background: var(--zs-ink); border-radius: 2px; }
.es-claim__value::after { content: attr(data-label); position: absolute; bottom: calc(100% + .2rem); left: 50%; transform: translateX(-50%); white-space: nowrap; font: 800 .95rem/1 var(--zs-font-display); font-stretch: 82%; background: var(--es-yolk); color: #142420; padding: .2rem .4rem; border-radius: 3px; }
.es-claim__marks { position: relative; height: 2.6rem; font-size: .78rem; margin-top: .2rem; }
.es-claim__marks span { position: absolute; top: 0; padding-top: .55rem; border-left: 2px solid var(--es-mark-source); padding-left: .35rem; white-space: nowrap; line-height: 1.2; }
.es-claim__marks .src { left: 30%; }
.es-claim__marks .rich { left: 50%; border-left-color: var(--es-mark-rich); }
.es-claim figcaption { margin-top: .6rem; color: var(--zs-muted); font-size: .92rem; }
.es-claim { padding-top: 2.1rem; }

/* ---------- Gram per portion: horizontal bars, picto per snack, portion size under the name ----------
 * <ul class="es-bars" style="--max: 25"><li style="--g: 18"><span class="es-bars__name">..<small>portie 150 g</small></span><span class="es-bars__bar"></span><b>18 g</b></li></ul>
 * li.is-alt for the comparison ("gewone snack") in the light bar colour.
 */
.es-bars { list-style: none; margin: 0; padding: 1rem 1.1rem; display: grid; gap: .75rem; background: var(--zs-surface); border: 1px solid var(--zs-line); border-radius: var(--zs-radius); }
.es-bars li { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr) 3.5rem; gap: .8rem; align-items: center; }
.es-bars__name { display: flex; align-items: center; gap: .6rem; font-weight: 600; line-height: 1.2; }
.es-bars__name small { display: block; font-weight: 400; font-size: .8rem; color: var(--zs-muted); }
.es-bars__bar { height: 1.15rem; position: relative; background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 1px), var(--zs-line) calc(20% - 1px) 20%); border-left: 2px solid var(--zs-ink); }
.es-bars__bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--g) / var(--max) * 100%); background: var(--es-bar); border-radius: 0 3px 3px 0; }
.es-bars li.is-alt .es-bars__bar::before { background: var(--es-bar-alt); }
.es-bars b { font: 800 1.15rem/1 var(--zs-font-display); font-stretch: 82%; text-align: right; font-variant-numeric: tabular-nums; }
.es-bars__scale { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr) 3.5rem; gap: .8rem; font-size: .75rem; color: var(--zs-muted); }
.es-bars__scale span { grid-column: 2; display: flex; justify-content: space-between; }
@media (max-width: 34rem) {
  .es-bars li { grid-template-columns: minmax(0, 1fr) auto; }
  .es-bars__bar { grid-column: 1 / -1; grid-row: 2; }
  .es-bars__scale { display: none; }
}

/* ---------- Shelf-label snack card: the price tag on the supermarket shelf, with protein instead of price ---------- */
.es-shelf { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); }
.es-tag { position: relative; background: var(--es-label-bg); color: var(--es-label-ink); border-radius: 6px; border-top: 7px solid var(--es-yolk); box-shadow: 0 1px 0 var(--zs-line), 0 6px 16px -10px rgb(0 0 0 / .35); padding: .9rem 1rem 1rem; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .8rem; align-items: start; }
.es-tag .es-picto { grid-row: span 2; }
.es-tag h3 { margin: 0; font-size: 1.15rem; color: var(--es-label-ink); }
.es-tag__portion { margin: 0; font-size: .82rem; color: #45574f; }
.es-tag__g { grid-column: 1 / -1; display: flex; align-items: baseline; gap: .35rem; margin-top: .4rem; border-top: 1px dashed #9db3a9; padding-top: .5rem; }
.es-tag__g b { font: 800 2.3rem/1 var(--zs-font-display); font-stretch: 75%; font-variant-numeric: tabular-nums; }
.es-tag__g span { font-size: .85rem; font-weight: 600; }
.es-tag__per100 { grid-column: 1 / -1; margin: 0; font-size: .78rem; color: #45574f; }

/* ---------- Hero: photo with a nutrition label as the card ----------
 * <section class="es-hero" style="--hero-img: url(...)"><div class="zs-wrap es-hero__grid"><div class="es-hero__text">h1, lead, actions</div><div class="es-label">..</div></div><p class="es-hero__credit">..</p></section>
 */
.es-hero { position: relative; isolation: isolate; color: #fff; background: var(--zs-brand-deep) var(--hero-img) center / cover no-repeat; padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(3rem, 7vw, 5rem); }
.es-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgb(8 40 34 / .92) 0%, rgb(8 40 34 / .8) 45%, rgb(8 40 34 / .35) 100%); }
.es-hero__grid { display: grid; gap: 1.6rem; align-items: center; }
@media (min-width: 54rem) { .es-hero__grid { grid-template-columns: minmax(0, 1.3fr) minmax(16rem, 21rem); gap: 3rem; } }
.es-hero h1 { color: #fff; font-size: clamp(2.3rem, 3.2vw + 1.2rem, 4rem); line-height: 1; max-width: 16ch; }
.es-hero__lead { font-size: 1.12rem; margin: 1rem 0 0; max-width: 34rem; color: #e3efe9; }
.es-hero__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.es-hero .zs-btn--primary { background: var(--es-yolk); color: #142420; border-color: var(--es-yolk); }
.es-hero .zs-btn--ghost { color: #fff; border-color: rgb(255 255 255 / .7); }
.es-hero__credit { position: absolute; left: 1rem; right: 1rem; bottom: .5rem; margin: 0; text-align: right; font-size: .72rem; color: #dbe9e3; }
.es-hero__credit a { color: inherit; }
.es-hero .es-label { transform: rotate(1.2deg); }
@media (max-width: 54rem) { .es-hero .es-label { transform: none; } }

/* ---------- Fact note: "goed om te weten", label-style box with a yolk corner ---------- */
.es-fact { display: flex; gap: .9rem; align-items: flex-start; background: var(--zs-surface); border: 2px solid var(--zs-ink); border-radius: 6px; padding: .9rem 1rem; position: relative; }
.es-fact::before { content: ""; position: absolute; top: -2px; left: -2px; width: 2.2rem; height: .55rem; background: var(--es-yolk); border-radius: 4px 0 4px 0; }
.es-fact p { margin: 0; }

/* Photo tiles (zs-tile) get the picto badge top-left. */
.zs-tile .es-picto { position: absolute; top: .8rem; left: .8rem; }

/* ---------- Dark mode (rule 8): the label stays white; page parts follow the tokens ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .es-label { box-shadow: 4px 4px 0 rgb(0 0 0 / .45); }
  :root:not([data-theme="light"]) .es-fact { border-color: var(--zs-line); }
}
:root[data-theme="dark"] .es-label { box-shadow: 4px 4px 0 rgb(0 0 0 / .45); }
:root[data-theme="dark"] .es-fact { border-color: var(--zs-line); }

/* Narrow phones: let the label headers wrap again so the table fits at 360. */
.es-reader > * { min-width: 0; }
@media (max-width: 26rem) {
  .es-label { padding: .6rem .7rem .7rem; }
  .es-label table { font-size: .84rem; }
  .es-label thead th { white-space: normal; }
}
.es-bars li.es-bars__scale { font-size: .75rem; color: var(--zs-muted); }
@media (max-width: 34rem) {
  .es-bars li.es-bars__scale { display: none; }
  .es-claim__marks { height: 3.6rem; }
  .es-claim__marks .rich { top: 1.5rem; }
}

/* ---------- Header logo mark A "Etiket" (kit bdce436), site addition ---------- */
.zs-logo:has(.es-mark) { display: inline-flex; align-items: center; gap: .55rem; }
.es-mark { width: 2rem; height: 2rem; flex: none; }

/* ---------- Source badges on the home (site addition, same pattern as havermoutpap .hp-sources) ---------- */
.es-sources { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.es-sources li { display: flex; gap: .7rem; align-items: center; background: var(--zs-surface); border: 1px solid var(--zs-line); border-radius: 10px; padding: .8rem 1rem; }
.es-sources li > span:last-child { display: grid; gap: .1rem; font-size: .9rem; color: var(--zs-muted); }
.es-sources strong { color: var(--zs-ink); font-size: 1rem; }

/* Article tables (e.g. /snacks): full width without wrapping cells on desktop.
 * On phones the table keeps its natural width and scrolls sideways inside its own box (site.css sets overflow-x). */
.prose table th, .prose table td { white-space: nowrap; }
@media (min-width: 48rem) {
  .prose table { display: table; }
}
@media (max-width: 47.99rem) {
  .prose table { max-width: 100%; -webkit-overflow-scrolling: touch; border: 1px solid var(--zs-line, #d9ddd6); border-radius: 8px; }
}
