/*
 * Blog styles. Loaded after the site theme (theme.css) and built only from its tokens: no colour literals here
 * (a test checks), no inline styles anywhere (the CSP forbids them). Every class starts with bl- so the theme
 * and the other sections cannot collide with it.
 *
 * The one idea: every fact carries its source. Rows on the blog home say which bodies a post rests on
 * ("Fuentes: BOE · AESAN"); in a post, each fact has a numbered pill that jumps to its source, and temperatures,
 * the numbers a food handler lives by, show as small chips coloured cold or hot.
 * Motion that answers the reader: the list reflows when you pick a topic, the contents dot rides to the section
 * you are reading, and the one key fact of a post gets a single highlighter sweep as it scrolls in.
 *
 *  Bar        .bl-bar > .bl-bar-in > .bl-bar-home (.bl-bar-mark) + .bl-bar-cats
 *  Home       .bl-hero (.bl-h1 .bl-lede .bl-filter > .bl-chip > .bl-chip-n)  .bl-list > .bl-count + .bl-rows > .bl-row
 *             .bl-row > a > .bl-row-meta + .bl-row-title + .bl-row-sum + .bl-row-src   .bl-how   .bl-cta
 *  Post       .bl-art > .bl-art-head (.bl-crumbs .bl-tags .bl-art-h1 .bl-meta) + .bl-grid > .bl-aside (.bl-toc) + .bl-main
 *             .bl-answer  .bl-toc-m  .bl-body (h2, p, ul, .bl-steps, .bl-key > .bl-hl, .bl-tbl-wrap > .bl-tbl, .bl-cite, .bl-t)
 *             .bl-byline  .bl-sources > .bl-src  .bl-note  .bl-related
 *  Tool       .bl-tool > .bl-tool-intro + .bl-tool-list (> li > .bl-tool-q + .bl-tool-a) + .bl-tool-note; with JavaScript .bl-tool-ui
 *             > .bl-tool-hint + .bl-tool-field + .bl-tool-out (data-state ok, high or low)
 */

/* ---------- tokens (all from the theme) ---------- */
:root {
  --bl-cold: var(--c-nursing);
  --bl-hot: var(--c-english);
  --bl-mid: var(--ink-2);
}

/* ---------- blog bar ---------- */
.bl-bar { border-bottom: 1px solid var(--line); background: var(--page); }
.bl-bar-in { display: flex; align-items: center; gap: 8px 20px; min-height: 56px; }
.bl-bar-home { display: inline-flex; align-items: center; gap: 9px; margin-left: -10px; padding: 8px 14px 8px 10px; border-radius: 999px; font-weight: 800; font-size: 16px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; transition: background-color 150ms var(--ease); flex: none; }
.bl-bar-home:hover { background: var(--wash); }
.bl-bar-mark { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.bl-bar-cats { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, var(--mask) 88%, transparent); mask-image: linear-gradient(90deg, var(--mask) 88%, transparent); }
.bl-bar-cats::-webkit-scrollbar { display: none; }
.bl-bar-cats a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; transition: color 150ms var(--ease), background-color 150ms var(--ease); }
.bl-bar-cats a:hover { color: var(--ink); background: var(--wash); }
.bl-bar-cats a[aria-current] { color: var(--ink); background: var(--wash-2); }
@media (min-width: 720px) { .bl-bar-cats { -webkit-mask-image: none; mask-image: none; } }

/* ---------- blog home and category pages ---------- */
.bl-hero { padding-bottom: clamp(20px, 3vw, 32px); }
.bl-h1.display { font-size: clamp(38px, 8.6vw, 80px); max-width: 15em; }
.bl-lede { max-width: 36em; }
.bl-filter { margin-top: clamp(24px, 3.6vw, 36px); }
.bl-filter ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.bl-chip { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 8px 0 18px; border-radius: 999px; background: var(--page); color: var(--ink); font-weight: 700; font-size: 15.5px; text-decoration: none; box-shadow: inset 0 0 0 1.5px var(--line-2);
  transition: background-color 200ms var(--ease), color 200ms var(--ease), box-shadow 200ms var(--ease); }
.bl-chip:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.bl-chip-n { min-width: 30px; padding: 3px 8px; border-radius: 999px; background: var(--wash-2); color: var(--ink); font-size: 13.5px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; transition: background-color 200ms var(--ease), color 200ms var(--ease); }
.bl-chip[aria-current] { background: var(--ink); color: var(--page); box-shadow: none; }
.bl-chip[aria-current] .bl-chip-n { background: var(--accent); color: var(--accent-ink); }
.bl-chip:active { transform: scale(0.97); }
/* On a phone the topics sit on one line that scrolls sideways, so the first posts show sooner; the fade says there is more. */
@media (max-width: 559px) {
  .bl-filter { margin-inline: -16px; }
  .bl-filter ul { flex-wrap: nowrap; overflow-x: auto; padding: 2px 56px 6px 16px; scrollbar-width: none; scroll-padding-inline: 16px;
    -webkit-mask-image: linear-gradient(90deg, var(--mask) 86%, transparent); mask-image: linear-gradient(90deg, var(--mask) 86%, transparent); }
  .bl-filter ul::-webkit-scrollbar { display: none; }
  .bl-chip { min-height: 42px; white-space: nowrap; font-size: 15px; padding-left: 16px; }
}

.bl-list { padding-block: 8px clamp(56px, 8vw, 104px); }
.bl-count { padding: 12px 0 14px; border-bottom: 1.5px solid var(--ink); }
.bl-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0 56px; }
@media (min-width: 960px) { .bl-rows:not(.bl-rows-rel) { grid-template-columns: 1fr 1fr; } }
.bl-row { border-bottom: 1px solid var(--line); }
.bl-row > a { display: grid; gap: 6px; padding: 20px 0 22px; color: var(--ink); text-decoration: none; }
.bl-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.bl-row-title { justify-self: start; font-weight: 750; font-size: clamp(19px, 2.1vw, 23px); line-height: 1.25; letter-spacing: -0.018em; text-wrap: balance;
  background: linear-gradient(var(--accent-mid), var(--accent-mid)) no-repeat 0 92% / 0% 0.42em; transition: background-size 320ms var(--ease); }
.bl-row > a:hover .bl-row-title, .bl-row > a:focus-visible .bl-row-title { background-size: 100% 0.42em; }
.bl-row-sum { color: var(--ink-2); font-size: 16px; line-height: 1.5; max-width: 38em; }
.bl-row-src { display: inline-flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 14px; font-weight: 600; color: var(--ink); }
.bl-row-src::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c-food); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-food) 18%, transparent); }

.bl-how-in { display: grid; gap: 10px 48px; max-width: 60rem; }
@media (min-width: 900px) { .bl-how-in { grid-template-columns: 0.42fr 1fr; align-items: baseline; } }
.bl-how p { color: var(--ink-2); max-width: 40em; }
.bl-how a { color: var(--ink); font-weight: 700; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.bl-how.band { padding-block: clamp(44px, 6vw, 72px); }

.bl-cta { background: var(--accent-soft); padding-block: clamp(48px, 7vw, 88px); }
.bl-cta-in { display: grid; gap: 24px 48px; align-items: center; }
@media (min-width: 960px) { .bl-cta-in { grid-template-columns: minmax(0, 1fr) auto; } }
.bl-cta .lede { margin-top: 14px; }
.bl-cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 559px) { .bl-cta-actions .btn { width: 100%; } }

/* ---------- post pages ---------- */
.bl-art-head { padding-bottom: clamp(20px, 3vw, 36px); }
.bl-crumbs { margin-bottom: 18px; }
.bl-crumbs a { color: var(--ink-2); }
.bl-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.bl-tags a.tag { text-decoration: none; transition: background-color 150ms var(--ease); }
.bl-tags a.tag:hover { background: var(--line-2); }
.bl-art-h1.display { font-size: clamp(32px, 6.2vw, 58px); max-width: 17em; }
.bl-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 18px; }
.bl-meta > span { display: inline-flex; align-items: center; gap: 7px; }
.bl-meta svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bl-grid { display: grid; gap: 40px; padding-bottom: clamp(48px, 7vw, 96px); }
.bl-main { min-width: 0; max-width: 44rem; }
.bl-aside { display: none; min-width: 0; }
@media (min-width: 1000px) {
  .bl-grid { grid-template-columns: 236px minmax(0, 44rem); gap: 72px; }
  .bl-aside { display: block; }
  .bl-toc-m { display: none; }
}

.bl-answer { padding: 20px 24px 22px; border-radius: 22px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-mid); }
.bl-answer-h { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 800; color: var(--accent-deep); }
.bl-answer-h::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.bl-answer p { margin-top: 8px; color: var(--ink); font-size: clamp(19px, 2vw, 21px); line-height: 1.5; font-weight: 500; text-wrap: pretty; }

.bl-toc { position: sticky; top: 100px; padding-left: 18px; border-left: 1.5px solid var(--line); }
.bl-toc-h { margin-bottom: 8px; font-weight: 700; font-size: 14.5px; color: var(--ink); }
.bl-toc ol, .bl-toc-m ol { list-style: none; margin: 0; padding: 0; }
.bl-toc a { display: block; padding: 6px 0; font-size: 15px; line-height: 1.35; color: var(--ink-2); text-decoration: none; transition: color 200ms var(--ease); }
.bl-toc a:hover, .bl-toc a[aria-current] { color: var(--ink); }
.bl-toc a[aria-current] { font-weight: 700; }
.bl-toc-dot { position: absolute; left: -5.75px; top: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); opacity: 0; pointer-events: none; transition: transform 380ms var(--ease), opacity 200ms var(--ease); }
.bl-toc-dot.on { opacity: 1; }

.bl-toc-m { margin-top: 20px; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line-2); }
.bl-toc-m summary { cursor: pointer; list-style: none; position: relative; padding: 15px 52px 15px 18px; font-weight: 700; }
.bl-toc-m summary::-webkit-details-marker { display: none; }
.bl-toc-m summary::after { content: "+"; position: absolute; right: 12px; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; display: grid; place-items: center; background: var(--wash); font-size: 20px; line-height: 1; transition: transform 250ms var(--ease); }
.bl-toc-m[open] summary::after { transform: rotate(45deg); }
.bl-toc-m ol { padding: 0 18px 12px; }
.bl-toc-m a { display: block; padding: 9px 0; color: var(--ink); border-top: 1px solid var(--line); text-decoration: none; }

.bl-body h2 { margin: 44px 0 12px; font-weight: 800; font-size: clamp(22px, 2.6vw, 28px); line-height: 1.15; letter-spacing: -0.02em; scroll-margin-top: 96px; text-wrap: balance; }
.bl-body p + p, .bl-body p + ul, .bl-body p + ol, .bl-body ul + p, .bl-body ol + p, .bl-body .bl-tbl-wrap + p, .bl-body p + .bl-key, .bl-body .bl-key + p { margin-top: 14px; }
.bl-body ul { padding-left: 1.2em; margin-top: 12px; }
.bl-body li + li { margin-top: 8px; }
.bl-body li::marker { color: var(--accent); }
.bl-body a { text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; }
.bl-steps { list-style: none; margin: 14px 0 0; padding: 0; counter-reset: st; display: grid; gap: 12px; }
.bl-steps li { counter-increment: st; position: relative; padding-left: 46px; min-height: 32px; }
.bl-steps li + li { margin-top: 0; }
.bl-steps li::before { content: counter(st); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 15px; }

/* The one key fact: a calm box, and a highlighter that sweeps across it once as it scrolls into view. */
.bl-key { margin-top: 20px; padding: 18px 20px; border-radius: 18px; background: var(--wash); font-weight: 650; font-size: 1.04em; line-height: 1.55; }
.bl-hl { color: inherit; padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background: linear-gradient(var(--accent-mid), var(--accent-mid)) no-repeat 0 88% / 100% 0.5em; }
.bl-key.is-pending .bl-hl { background-size: 0% 0.5em; }
.bl-key.is-in .bl-hl { transition: background-size 750ms var(--ease) 120ms; }

.bl-cite { font-size: 0.66em; line-height: 1; vertical-align: 0.42em; margin-left: 3px; white-space: nowrap; }
.bl-cite a { padding: 0.1em 0.5em; border-radius: 999px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-mid); color: var(--accent-deep); font-weight: 800; text-decoration: none; transition: background-color 150ms var(--ease); }
.bl-cite a + a { margin-left: 3px; }
.bl-cite a:hover, .bl-cite a:focus-visible { background: var(--accent-mid); }
.bl-answer .bl-cite a, .bl-key .bl-cite a { background: var(--page); }

/* Temperatures: cold, hot, or neither, so a reader scanning the page sees which side of the line a rule sits on. */
/* display: inline (not inline-flex) so a comma or full stop after the chip never wraps onto the next line alone. */
.bl-t { display: inline; padding: 0.06em 0.4em 0.08em; border-radius: 7px; font-weight: 750; white-space: nowrap; font-variant-numeric: tabular-nums; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background: color-mix(in srgb, var(--bl-tc) 10%, var(--page)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bl-tc) 32%, var(--page)); color: var(--ink); }
.bl-t::before { content: ""; display: inline-block; width: 0.42em; height: 0.42em; margin-right: 0.32em; border-radius: 50%; background: var(--bl-tc); vertical-align: 0.1em; }
.bl-t-cold { --bl-tc: var(--bl-cold); }
.bl-t-hot { --bl-tc: var(--bl-hot); }
.bl-t-mid { --bl-tc: var(--bl-mid); }
.bl-val { font-weight: 700; }

.bl-tbl-wrap { margin-top: 16px; overflow-x: auto; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line-2); -webkit-overflow-scrolling: touch; }
.bl-tbl { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.45; }
.bl-tbl th, .bl-tbl td { padding: 12px 16px; text-align: left; vertical-align: top; }
.bl-tbl thead th { background: var(--wash); color: var(--ink-2); font-size: 14.5px; font-weight: 700; }
.bl-tbl tbody tr + tr > * { border-top: 1px solid var(--line); }
.bl-tbl tbody th { font-weight: 700; }
@media (max-width: 559px) {
  .bl-tbl { font-size: 15px; } .bl-tbl th, .bl-tbl td { padding: 11px 12px; }
  .bl-tbl-wrap:not(.cols-2) .bl-tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bl-tbl-wrap:not(.cols-2) .bl-tbl tr, .bl-tbl-wrap:not(.cols-2) .bl-tbl th, .bl-tbl-wrap:not(.cols-2) .bl-tbl td { display: block; }
  .bl-tbl-wrap:not(.cols-2) .bl-tbl tbody th { padding: 14px 16px 4px; font-size: 16.5px; }
  .bl-tbl-wrap:not(.cols-2) .bl-tbl td { padding: 4px 16px; }
  .bl-tbl-wrap:not(.cols-2) .bl-tbl td:last-child { padding-bottom: 14px; }
  .bl-tbl-wrap:not(.cols-2) .bl-tbl td::before { content: attr(data-label) ": "; font-weight: 700; color: var(--ink-2); }
  .bl-tbl-wrap:not(.cols-2) .bl-tbl tbody tr + tr > * { border-top: 0; }
  .bl-tbl-wrap:not(.cols-2) .bl-tbl tbody tr + tr { border-top: 1px solid var(--line); }
}

.bl-byline { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; margin-top: 44px; padding: 18px 20px; border-radius: 18px; background: var(--wash); font-size: 15.5px; color: var(--ink-2); }
.bl-byline svg { width: 22px; height: 22px; margin-top: 2px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bl-byline a { color: var(--ink); font-weight: 700; text-decoration-color: var(--accent); }

.bl-sources { margin-top: 36px; padding-top: 26px; border-top: 1.5px solid var(--ink); }
.bl-sources h2 { font-weight: 800; font-size: 20px; letter-spacing: -0.01em; margin-bottom: 8px; }
.bl-src { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; font-size: 15px; color: var(--ink-2); }
.bl-src li { position: relative; scroll-margin-top: 100px; padding: 6px 8px 6px 44px; margin-left: -8px; border-radius: 12px; transition: background-color 300ms var(--ease); }
.bl-src-n { position: absolute; left: 8px; top: 6px; min-width: 26px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-mid); color: var(--accent-deep); font-weight: 800; font-size: 13px; text-align: center; }
.bl-src li:target { background: var(--accent-soft); }
.bl-src a { color: var(--ink); overflow-wrap: anywhere; }
.bl-note { margin-top: 24px; }

.bl-related { padding-block: clamp(48px, 6vw, 80px); border-top: 1px solid var(--line); }
.bl-related .h3 { margin-bottom: 4px; }
@media (min-width: 960px) { .bl-rows-rel { grid-template-columns: repeat(3, 1fr); gap: 0 40px; } }
.bl-back { margin-top: 20px; font-weight: 700; }

/* ---------- small tools (blog-tools.js): a list that reads on its own, swapped for a picker when JavaScript runs ---------- */
.bl-tool { margin-top: 16px; padding: 18px; border-radius: 22px; background: var(--wash); box-shadow: inset 0 0 0 1px var(--line-2); }
.bl-tool [hidden] { display: none !important; }
.bl-body .bl-tool-intro { color: var(--ink-2); }
.bl-body .bl-tool-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.bl-body .bl-tool-list li { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--page); box-shadow: inset 0 0 0 1px var(--line-2); }
.bl-tool-q { display: block; font-weight: 700; }
.bl-tool-a { display: block; margin-top: 2px; color: var(--ink-2); }
.bl-tool-ui { display: grid; gap: 16px; }
.bl-body .bl-tool-hint { font-weight: 650; }
.bl-tool-field { display: grid; gap: 6px; }
.bl-tool-field label { font-weight: 700; font-size: 15.5px; }
.bl-tool select, .bl-tool input { width: 100%; min-height: 52px; padding: 10px 16px; border: 0; border-radius: 14px; background: var(--page); color: var(--ink); font-weight: 650; font-size: 17px; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.bl-tool select:hover, .bl-tool input:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.bl-tool select:focus-visible, .bl-tool input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (min-width: 640px) { .bl-tool[data-kind="check"] .bl-tool-ui { grid-template-columns: 1fr 14rem; } .bl-tool-hint, .bl-tool-out { grid-column: 1 / -1; } }
.bl-tool-out { min-height: 3.4em; padding: 14px 16px; border-radius: 14px; background: var(--page); box-shadow: inset 0 0 0 1.5px var(--line-2); transition: box-shadow 200ms var(--ease); }
.bl-body .bl-tool-out p + p { margin-top: 10px; }
.bl-tool-empty { color: var(--ink-2); }
.bl-tool-ans { font-weight: 650; }
.bl-tool-out[data-state="ok"] { box-shadow: inset 0 0 0 2.5px var(--c-food); }
.bl-tool-out[data-state="high"], .bl-tool-out[data-state="low"] { box-shadow: inset 0 0 0 2.5px var(--bl-hot); }
.bl-body .bl-tool-note { margin-top: 14px; }

/* ---------- motion: the list reflow (blog.js) runs only when motion is welcome ---------- */
@media (prefers-reduced-motion: reduce) {
  .bl-chip, .bl-chip-n, .bl-row-title, .bl-toc-dot, .bl-toc a, .bl-src li, .bl-bar-home, .bl-bar-cats a, .bl-tool-out { transition: none; }
  .bl-key.is-pending .bl-hl { background-size: 100% 0.5em; }
  .bl-key.is-in .bl-hl { transition: none; }
}
