/* Blog (/blog/, built by tools/blog/build_blog.py). Each topic has a colour (--tc)
   set inline on its card, chip and article. Uses the site tokens from styles.css. */
.bl-wide { max-width: 1320px; }
.bl-section { padding-top: clamp(28px, 4vw, 48px); }
.bl-h2 { font-family: var(--font-head); font-size: clamp(1.25rem, 2vw, 1.5rem); margin: 0 0 16px; }

/* Hero */
.bl-hero { padding: clamp(40px, 7vw, 88px) 0 clamp(20px, 3vw, 32px); position: relative; overflow: hidden; }
.bl-hero::before { content: ""; position: absolute; inset: -40% -10% auto; height: 120%; pointer-events: none;
  background: radial-gradient(50% 50% at 30% 40%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
              radial-gradient(40% 40% at 75% 30%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 70%); }
.bl-hero .container { position: relative; }
.bl-badge { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-muted); font-size: .85rem; font-weight: 600; }
.bl-hero h1 { font-family: var(--font-head); font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.08; margin: 14px 0 12px; max-width: 18ch; }
.bl-lede { color: var(--text-muted); font-size: clamp(1rem, 1.4vw, 1.15rem); max-width: 62ch; margin: 0 0 24px; line-height: 1.6; }
.bl-search { display: flex; align-items: center; gap: 10px; max-width: 560px; padding: 0 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.bl-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.bl-search svg { width: 20px; height: 20px; color: var(--text-muted); flex: none; }
.bl-search input { flex: 1; min-width: 0; height: 52px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1rem; outline: none; }

/* Topics */
.bl-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.bl-topic-card { display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-elevated); color: var(--text); font: inherit; cursor: pointer; transition: border-color .2s, transform .2s; }
.bl-topic-card:hover, .bl-topic-card:focus-visible { border-color: var(--tc); transform: translateY(-2px); }
.bl-topic-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; color: var(--tc); background: color-mix(in srgb, var(--tc) 16%, transparent); }
.bl-topic-ic svg { width: 22px; height: 22px; }
.bl-topic-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bl-topic-text strong { font-family: var(--font-head); font-size: 1rem; }
.bl-topic-text span { color: var(--text-muted); font-size: .85rem; }
.bl-topic-count { min-width: 30px; padding: 3px 8px; border-radius: 999px; text-align: center; font-size: .8rem; font-weight: 700; color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, transparent); }

/* Cards */
.bl-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-elevated); overflow: hidden; transition: border-color .2s, transform .2s; }
.bl-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); transform: translateY(-2px); }
.bl-card[hidden] { display: none; }
.bl-card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.bl-card-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bl-thumb { --tc: var(--accent); aspect-ratio: 16 / 7; display: grid; place-items: center; color: var(--tc); position: relative; overflow: hidden;
  background: radial-gradient(70% 90% at 80% 10%, color-mix(in srgb, var(--tc) 38%, transparent), transparent 70%),
              linear-gradient(135deg, color-mix(in srgb, var(--tc) 18%, var(--surface)), var(--surface)); }
.bl-thumb::after { content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: radial-gradient(color-mix(in srgb, var(--tc) 45%, transparent) 1px, transparent 1.5px); background-size: 16px 16px;
  mask-image: linear-gradient(90deg, transparent 30%, #000); -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000); }
.bl-thumb svg { width: 56px; height: 56px; position: relative; z-index: 1; filter: drop-shadow(0 6px 18px color-mix(in srgb, var(--tc) 50%, transparent)); }
.bl-card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.bl-topic { align-self: flex-start; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, transparent); }
.bl-card-title { font-family: var(--font-head); font-size: 1.12rem; line-height: 1.3; margin: 0; }
.bl-excerpt { color: var(--text-muted); font-size: .93rem; line-height: 1.55; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bl-meta { display: flex; flex-wrap: wrap; gap: 6px; color: var(--text-muted); font-size: .84rem; margin: auto 0 0; }

.bl-top { display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; align-items: start; }
.bl-featured .bl-thumb { aspect-ratio: 16 / 8; }
.bl-featured .bl-thumb svg { width: 88px; height: 88px; }
.bl-featured .bl-card-title { font-size: clamp(1.3rem, 2.2vw, 1.7rem); }
.bl-featured .bl-excerpt { -webkit-line-clamp: 4; font-size: 1rem; }
.bl-picks { display: grid; gap: 12px; }
.bl-pick .bl-card-link { flex-direction: row; }
.bl-pick .bl-thumb { aspect-ratio: auto; width: 110px; flex: none; }
.bl-pick .bl-thumb svg { width: 36px; height: 36px; }
.bl-pick .bl-excerpt { -webkit-line-clamp: 2; }
.bl-pick .bl-card-body { padding: 14px 16px; }

/* Latest */
.bl-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bl-toolbar .bl-h2 { margin: 0; }
.bl-toolbar-right { display: flex; align-items: center; gap: 12px; }
.bl-count { color: var(--text-muted); font-size: .9rem; }
#blSort { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.bl-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; scrollbar-width: thin; }
.bl-chip { flex: none; height: 38px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-muted); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.bl-chip:hover { color: var(--text); border-color: var(--accent); }
.bl-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.bl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.bl-empty { text-align: center; padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius-md); color: var(--text-muted); }
.bl-empty h3 { color: var(--text); margin: 0 0 6px; font-family: var(--font-head); }
.bl-empty button { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.bl-more-row { display: flex; justify-content: center; margin-top: 24px; }
.bl-more-row[hidden] { display: none; }

/* CTA */
.bl-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; margin: 40px 0 8px; padding: clamp(20px, 3vw, 32px);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: var(--radius-lg);
  background: radial-gradient(80% 120% at 100% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%), var(--bg-elevated); }
.bl-cta > div:first-child { flex: 1 1 340px; }
.bl-cta h2 { font-family: var(--font-head); font-size: clamp(1.3rem, 2.4vw, 1.75rem); margin: 0 0 6px; }
.bl-cta p { color: var(--text-muted); margin: 0; line-height: 1.6; }
.bl-cta p a { color: var(--accent); }
.bl-cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.bl-cta-loop { margin-bottom: clamp(40px, 6vw, 72px); }

/* Article */
.bl-post-narrow { max-width: 780px; }
.bl-post-head { padding: clamp(32px, 6vw, 72px) 0 24px; position: relative; overflow: hidden; }
.bl-post-head::before { content: ""; position: absolute; inset: -50% -10% auto; height: 140%; pointer-events: none;
  background: radial-gradient(45% 45% at 50% 50%, color-mix(in srgb, var(--tc) 20%, transparent), transparent 70%); }
.bl-post-head .container { position: relative; }
.bl-crumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: .9rem; color: var(--text-muted); }
.bl-crumb a { color: var(--text-muted); text-decoration: none; }
.bl-crumb a:last-child { color: var(--tc); font-weight: 600; }
.bl-crumb a:hover { text-decoration: underline; }
.bl-post-head h1 { font-family: var(--font-head); font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.12; margin: 14px 0 12px; }
.bl-post-lede { color: var(--text-muted); font-size: clamp(1.02rem, 1.5vw, 1.18rem); line-height: 1.6; margin: 0 0 16px; }
.bl-prose { font-size: 1.06rem; line-height: 1.75; overflow-wrap: anywhere; }
.bl-prose h2 { font-family: var(--font-head); font-size: clamp(1.35rem, 2.6vw, 1.7rem); line-height: 1.25; margin: 2em 0 .5em; scroll-margin-top: 90px; }
.bl-prose h3 { font-family: var(--font-head); font-size: 1.2rem; margin: 1.6em 0 .4em; }
.bl-prose p, .bl-prose ul, .bl-prose ol { margin: 0 0 1.1em; }
.bl-prose ul, .bl-prose ol { padding-left: 1.3em; }
.bl-prose li { margin: .35em 0; }
.bl-prose li::marker { color: var(--tc); font-weight: 700; }
.bl-prose a { color: var(--accent); text-underline-offset: 3px; }
.bl-prose strong { color: var(--text); }
.bl-prose code { padding: 2px 6px; border-radius: 6px; background: var(--surface); font-size: .92em; }
.bl-prose blockquote { margin: 0 0 1.1em; padding: 14px 18px; border-left: 4px solid var(--tc); border-radius: 0 12px 12px 0; background: color-mix(in srgb, var(--tc) 8%, var(--bg-elevated)); }
.bl-prose blockquote p { margin: 0; }
.bl-note { font-size: .92rem; color: var(--text-muted); }

.bl-video { display: block; position: relative; width: 100%; aspect-ratio: 16 / 9; margin: 8px 0 12px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: #000; cursor: pointer; }
.bl-video img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .2s; }
.bl-video:hover img { opacity: 1; }
.bl-video-play { position: absolute; inset: 0; margin: auto; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.bl-video-play svg { width: 32px; height: 32px; margin-left: 4px; }
.bl-video iframe { width: 100%; height: 100%; border: 0; display: block; }

.bl-quiz { display: grid; gap: 14px; }
.bl-q { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-elevated); }
.bl-q-text { margin: 0 0 10px; }
.bl-q-opts { display: grid; gap: 8px; }
.bl-q-opt { text-align: left; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: .98rem; cursor: pointer; }
.bl-q-opt:hover:not(:disabled) { border-color: var(--accent); }
.bl-q-opt:disabled { cursor: default; }
.bl-q-opt.is-right { border-color: var(--success); background: color-mix(in srgb, var(--success) 16%, var(--surface)); }
.bl-q-opt.is-wrong { border-color: #f05d6c; background: color-mix(in srgb, #f05d6c 14%, var(--surface)); }
.bl-q-result { margin: 10px 0 0; font-weight: 600; min-height: 1.2em; }

.bl-share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.bl-share span { color: var(--text-muted); font-weight: 600; margin-right: 4px; }
.bl-share a, .bl-share button { height: 38px; padding: 0 16px; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.bl-share a:hover, .bl-share button:hover { border-color: var(--accent); }
.bl-related { padding: 24px 24px clamp(48px, 7vw, 80px); max-width: 1320px; }

@media (max-width: 900px) {
  .bl-top { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .bl-pick .bl-thumb { width: 84px; }
  .bl-toolbar-right { width: 100%; justify-content: space-between; }
  .bl-cta-actions, .bl-cta-actions .btn { width: 100%; }
  .bl-cta-actions .btn { justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .bl-card, .bl-topic-card { transition: none; }
  .bl-card:hover, .bl-topic-card:hover { transform: none; }
}
#latest { scroll-margin-top: 90px; }
.bl-prose ul { list-style: disc; }
.bl-prose ol { list-style: decimal; }
.bl-thumb-video { background: #000; }
.bl-thumb-video::after { display: none; }
.bl-thumb-video img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.bl-thumb-play { position: relative; z-index: 1; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.bl-thumb-play svg { width: 22px; height: 22px; margin-left: 3px; filter: none; }
.bl-pick .bl-thumb-play { width: 36px; height: 36px; }
