/* ============================================================
   FLANGU BLOG — blog.css
   Blog-specific styles that layer on top of landing.css (tokens,
   header, footer) and docs.css (article typography, TOC sidebar,
   scroll-spy).

   Architecture:
     landing.css  — loaded by landing_base.html (all design tokens)
     docs.css     — loaded by blog/base.html (article typography + TOC)
     blog.css     — THIS FILE (listing, cards, category filter, post page,
                    components: §14–§17)

   BEM prefix: bl- (blog)
   ============================================================ */

/* Text colours that pass WCAG AA (4.5:1) on every blog background
   (#fff, #f5f5f5, the light blue tints); --c-mainblue-deep is 4.36:1. */
:root {
  --bl-link: #3A66C4;
  --bl-muted: #5B6270;
}


/* ── 1. PAGE LAYOUT WRAPPER ─────────────────────────────────── */

.bl-listing {
  min-height: 60vh;
  padding-bottom: var(--sp-2xl);
}

.bl-listing__main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}


/* ── 2. LISTING HERO HEADER ─────────────────────────────────── */

.bl-listing__hero {
  padding: calc(80px + var(--sp-2xl)) var(--sp-lg) var(--sp-xl);
  max-width: 1100px;
  margin: 0 auto;
}

.bl-listing__hero-inner {
  max-width: 680px;
  margin-bottom: var(--sp-xl);
}

.bl-listing__title {
  font-family: var(--font-primary);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 900;
  color: var(--c-navy);
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin: 0 0 var(--sp-sm);
}

.bl-listing__subtext {
  font-family: var(--font-primary);
  font-size: clamp(15px, 1.6vw, 17px);
  font-weight: 400;
  color: var(--c-navy);
  opacity: 0.55;
  line-height: 1.65;
  margin: 0;
}

.bl-listing__breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-sm);
  font-size: 14px;
  font-weight: 400;
  color: var(--c-navy);
  opacity: 0.5;
}

.bl-listing__breadcrumb-link {
  color: var(--c-navy);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity var(--t-fast);
}

.bl-listing__breadcrumb-link:hover {
  opacity: 1;
}

.bl-listing__breadcrumb-sep {
  opacity: 0.35;
}

.bl-listing__breadcrumb-current {
  color: var(--c-navy);
}


/* ── 3. CATEGORY FILTER PILLS ───────────────────────────────── */

.bl-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  align-items: center;
}

.bl-filter__pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-navy);
  background: var(--c-white);
  border: 1px solid var(--c-navy-08);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--t-fast),
    color var(--t-fast),
    border-color var(--t-fast),
    box-shadow var(--t-fast);
  box-shadow: var(--shadow-soft);
}

.bl-filter__pill:hover {
  border-color: var(--c-mainblue);
  color: var(--c-mainblue);
}

.bl-filter__pill.is-active {
  background: var(--c-mainblue);
  color: #fff;
  border-color: var(--c-mainblue);
  box-shadow: 0 2px 12px rgba(86, 135, 232, 0.28);
}

.bl-filter__pill:focus-visible {
  outline: 2px solid var(--c-mainblue);
  outline-offset: 3px;
}


/* ── 4. POST GRID ───────────────────────────────────────────── */

.bl-listing__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 1023px) {
  .bl-listing__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 599px) {
  .bl-listing__grid { grid-template-columns: 1fr; }
}


/* ── 5. POST CARD ───────────────────────────────────────────── */

.bl-card {
  background: var(--c-white);
  border: 1px solid var(--c-navy-08);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform var(--t-medium) var(--ease-expo),
    box-shadow var(--t-medium) var(--ease-expo),
    border-color var(--t-medium);
}

.bl-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 32px rgba(26, 50, 98, 0.10);
  border-color: var(--c-navy-12);
}

/* Invisible full-card link overlay */
.bl-card__link {
  display: block;
  position: relative;
}

/* Cover image */
.bl-card__cover-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--c-whitesmoke);
}

.bl-card__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s var(--ease-expo);
}

.bl-card:hover .bl-card__cover {
  transform: scale(1.03);
}

/* Card body */
.bl-card__body {
  padding: var(--sp-md) var(--sp-lg) var(--sp-lg);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--sp-xs);
}

/* Category pills on card */
.bl-card__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bl-card__cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-primary);
  font-size: 11px;
  font-weight: 700;
  color: var(--bl-link);
  background: rgba(86, 135, 232, 0.08);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background var(--t-fast);
}

.bl-card__cat-pill:hover {
  background: rgba(86, 135, 232, 0.16);
}

/* Card title */
.bl-card__title {
  font-family: var(--font-primary);
  font-size: clamp(16px, 1.8vw, 19px);
  font-weight: 700;
  color: var(--c-navy);
  line-height: 1.35;
  margin: 0;
  /* Two-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bl-card__title-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--t-fast);
}

.bl-card__title-link:hover {
  color: var(--c-mainblue);
}

/* Card excerpt */
.bl-card__excerpt {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 400;
  color: var(--bl-muted);
  line-height: 1.6;
  margin: 0;
  flex: 1;
  /* Three-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card meta row */
.bl-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-xs);
}

.bl-card__date,
.bl-card__reading-time {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--bl-muted);
}

.bl-card__meta-sep {
  font-size: 12px;
  color: var(--c-navy);
  opacity: 0.3;
}


/* ── 6. PAGINATION ──────────────────────────────────────────── */

.bl-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  margin-top: var(--sp-2xl);
}

.bl-pagination__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-navy);
  background: var(--c-white);
  border: 1px solid var(--c-navy-08);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition:
    background var(--t-fast),
    border-color var(--t-fast),
    color var(--t-fast);
}

.bl-pagination__btn:not(.is-disabled):hover {
  border-color: var(--c-mainblue);
  color: var(--c-mainblue);
}

.bl-pagination__btn.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.bl-pagination__info {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 400;
  color: var(--c-navy);
  opacity: 0.5;
}


/* ── 7. EMPTY STATE ─────────────────────────────────────────── */

.bl-empty {
  text-align: center;
  padding: var(--sp-2xl) var(--sp-lg);
}

.bl-empty__text {
  font-family: var(--font-primary);
  font-size: 17px;
  color: var(--c-navy);
  opacity: 0.6;
  line-height: 1.65;
  margin: 0 0 var(--sp-lg);
}

.bl-empty__link {
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 600;
  color: var(--c-mainblue);
  text-decoration: none;
  transition: opacity var(--t-fast);
}

.bl-empty__link:hover {
  opacity: 0.75;
}


/* ── 8. ARTICLE LAYOUT (two-column) ────────────────────────── */

.bl-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  /* docs.css gives .dc-article and .dc-otp named grid areas; name them here
     too, or the browser adds implicit columns and the TOC covers the post. */
  grid-template-areas: "article otp";
  gap: 0 48px;
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(80px + var(--sp-xl)) var(--sp-lg) var(--sp-2xl);
  align-items: start;
}

/* On tablet and below: single column (TOC shown in <details> at top) */
@media (max-width: 1279px) {
  .bl-article-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "article";
  }
}


/* ── 9. ARTICLE ELEMENT OVERRIDES ──────────────────────────── */

/* Cover hero */
.bl-article__hero-wrap {
  margin-bottom: var(--sp-xl);
  border-radius: var(--r-card);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--c-navy-08);
}

.bl-article__hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Article header */
.bl-article__header {
  margin-bottom: var(--sp-lg);
}

/* Meta row */
.bl-article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-sm);
  margin-bottom: var(--sp-md);
}

.bl-article__meta-item {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 400;
  color: var(--bl-muted); /* 5.6:1 on the page background */
}

.bl-article__meta-item--updated {
  font-style: italic;
}

.bl-article__meta-sep {
  font-size: 13px;
  color: var(--c-navy);
  opacity: 0.3;
}

/* Category pills row below title */
.bl-article__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--sp-xs);
}


/* ── 10. RIGHT TOC SIDEBAR (blog overrides to dc-otp) ──────── */

.bl-otp {
  position: sticky;
  top: calc(80px + var(--sp-lg));
  max-height: calc(100vh - 80px - var(--sp-lg) * 2);
  overflow-y: auto;
  scrollbar-width: thin;
  /* Hide on narrow viewports */
}

@media (max-width: 1279px) {
  .bl-otp {
    display: none;
  }
}


/* ── 11. SHARE BUTTON ───────────────────────────────────────── */

.bl-share-btn {
  /* A <button> that looks exactly like the Discord and Contact links
     (.dc-otp__util-link): reset the button chrome, keep their padding,
     size, gap and colour. */
  width: 100%;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-family: var(--font-primary);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.bl-share-btn:hover {
  background: rgba(86, 135, 232, 0.06);
}

.bl-share-btn:focus-visible {
  outline: 2px solid var(--c-mainblue);
  outline-offset: 3px;
  border-radius: 4px;
}

.bl-share-btn__text {
  transition: color var(--t-fast);
}

/* "Copied!" feedback state */
.bl-share-btn.is-copied .bl-share-btn__text::after {
  content: " — Copied!";
  color: var(--c-mainblue);
  font-weight: 600;
}


/* ── 12. RELATED ARTICLES SECTION ───────────────────────────── */

.bl-related {
  background: var(--c-whitesmoke);
  border-top: 1px solid var(--c-navy-08);
  padding: var(--sp-2xl) var(--sp-lg);
}

.bl-related__inner {
  max-width: 1100px;
  margin: 0 auto;
}

.bl-related__heading {
  font-family: var(--font-primary);
  font-size: clamp(20px, 2.5vw, 24px);
  font-weight: 700;
  color: var(--c-navy);
  letter-spacing: -0.02em;
  margin: 0 0 var(--sp-xl);
}

.bl-related__grid {
  /* Inherits .bl-listing__grid grid spec */
}


/* ── 13. RESPONSIVE ARTICLE ADJUSTMENTS ─────────────────────── */

@media (max-width: 767px) {
  .bl-article-layout {
    padding: calc(72px + var(--sp-lg)) var(--sp-md) var(--sp-xl);
  }

  .bl-listing__hero {
    padding: calc(72px + var(--sp-xl)) var(--sp-md) var(--sp-lg);
  }

  .bl-listing__hero-inner {
    margin-bottom: var(--sp-lg);
  }

  .bl-related {
    padding: var(--sp-xl) var(--sp-md);
  }

  .bl-related__heading {
    margin-bottom: var(--sp-lg);
  }
}


/* ── 14. BYLINE, UPDATE BADGE, UPDATED NOTE ──────────────────── */

.bl-byline {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-top: var(--sp-md);
}

.bl-byline__photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

.bl-byline__author {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-navy);
}

.bl-byline__author a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--c-navy-12);
  text-underline-offset: 3px;
}

.bl-byline .bl-article__meta {
  margin: 2px 0 0;
}

.bl-article__cats {
  margin-top: var(--sp-md);
}

.bl-update-badge {
  display: inline-block;
  margin-bottom: var(--sp-md);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--c-mainblue-08);
  color: var(--bl-link);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.bl-update-badge:hover { background: var(--c-navy-08); }

.bl-updated-note {
  margin: var(--sp-xl) 0 0;
  padding-top: var(--sp-md);
  border-top: 1px solid var(--c-navy-08);
  font-size: 15px;
  color: var(--c-navy);
}


/* ── 15. END OF POST: STORE CARD, STORE LINE, LEARN-MORE BOX, AUTHOR ── */

.bl-store-card,
.bl-end-box,
.bl-author {
  margin-top: var(--sp-xl);
  padding: var(--sp-lg);
  border: 1px solid var(--c-navy-08);
  border-radius: var(--r-card);
  background: var(--c-white);
}

.bl-store-card {
  background: var(--c-mainblue-04);
}

.bl-store-card__title,
.bl-end-box__title {
  margin: 0 0 var(--sp-xs);
  font-size: 19px;
  font-weight: 700;
  color: var(--c-navy);
}

.bl-store-card__text {
  margin: 0 0 var(--sp-md);
  font-size: 16px;
  line-height: 1.6;
  color: var(--c-navy);
}

.bl-store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin: 0;
}

.bl-store-badges__link {
  display: inline-flex;
  flex: none;
  border-radius: 8px;
}

/* The badges also sit inside .dc-article__body (cta component), whose
   docs.css image rule adds a margin, border and max-width. */
.bl-store-badges__link img,
.dc-article__body .bl-store-badges__link img {
  display: block;
  height: 40px;
  width: auto;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.bl-store-line {
  margin: var(--sp-xl) 0 0;
  font-size: 15px;
  color: var(--c-navy);
}

.bl-end-box__links {
  margin: 0;
  padding-left: 1.2em;
  font-size: 16px;
  line-height: 1.7;
}

.bl-author {
  display: flex;
  gap: var(--sp-md);
  align-items: flex-start;
}

.bl-author__photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

.bl-author__name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--c-navy);
}

.bl-author__bio {
  margin: 2px 0 var(--sp-xs);
  font-size: 15px;
  color: var(--bl-muted);
}

.bl-author__links {
  margin: 0;
  font-size: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bl-store-line a,
.bl-end-box a,
.bl-author__links a {
  color: var(--bl-link);
  font-weight: 600;
}

/* Readers who came from the app (?from=app): no download prompts. */
.bl-from-app .bl-download,
.bl-from-app .lp-header__cta,
.bl-from-app .lp-mobile-nav__cta,
.bl-from-app .lp-footer__badges,
.bl-from-app .lp-qr--footer {
  display: none !important;
}


/* ── 16. TABLES (scroll wrapper) ──────────────────────────────── */
/* Every table in a post sits in .bl-table-scroll, so a wide table scrolls
   sideways on phones instead of being cut off. */

.dc-article__body .bl-table-scroll {
  margin: var(--sp-lg) 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--c-navy-08);
  border-radius: var(--r-md);
}

.dc-article__body .bl-table-scroll:focus-visible {
  outline: 2px solid var(--c-mainblue);
  outline-offset: 2px;
}

.dc-article__body .bl-table-scroll table {
  display: table;
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  white-space: normal;
}

.dc-article__body .bl-table-scroll th,
.dc-article__body .bl-table-scroll td {
  min-width: 7.5em;
  vertical-align: top;
}

.dc-article__body .bl-table-scroll tbody tr + tr > * {
  border-top: 1px solid var(--c-navy-08);
}


/* ── 17. COMPONENTS (blog/templates/blog/components/) ─────────── */

.dc-article__body figure {
  margin: var(--sp-lg) 0;
}

.dc-article__body figcaption,
.bl-compare__note,
.bl-chart__source,
.bl-chart__axes {
  margin-top: var(--sp-xs);
  font-size: 14px;
  line-height: 1.5;
  color: var(--bl-muted);
}

.dc-article__body img {
  max-width: 100%;
  height: auto;
}

/* figure */
.dc-article__body .bl-figure img {
  display: block;
  width: 100%;
  margin: 0;
}

.bl-figure__credit { font-style: italic; }

/* video */
.bl-video__media {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-md);
  background: var(--c-gray-100);
}

/* callout: uses the docs .admonition styles */
.dc-article__body .bl-callout > :last-child { margin-bottom: 0; }

/* key-points */
.bl-key-points {
  margin: var(--sp-lg) 0;
  padding: var(--sp-md) var(--sp-lg);
  border-left: 4px solid var(--c-mainblue);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--c-mainblue-04);
}

.bl-key-points__title {
  margin: 0 0 var(--sp-xs);
  font-weight: 700;
}

.bl-key-points__list {
  margin: 0;
  padding-left: 1.2em;
}

.bl-key-points__list li + li { margin-top: 4px; }

/* compare */
.bl-compare { margin: var(--sp-lg) 0; }
.dc-article__body .bl-compare .bl-table-scroll { margin: 0; }

.bl-compare__table caption {
  caption-side: top;
  padding: 10px var(--sp-md);
  text-align: left;
  font-weight: 700;
  color: var(--c-navy);
  background: var(--c-navy-06);
  border-bottom: 1px solid var(--c-navy-08);
}

.bl-compare__table tbody th {
  font-size: 15px;
  letter-spacing: 0;
}

.bl-compare__mark { white-space: nowrap; font-weight: 600; }
.bl-compare__mark--yes span { color: #1F7A4D; }
.bl-compare__mark--no span { color: #B4232C; }
.bl-compare__mark--partly span { color: #8A5A00; }

/* card: a flangu flashcard mockup */
.bl-flashcard__faces {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}

.bl-flashcard__face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: var(--sp-lg) var(--sp-md);
  border: 1px solid var(--c-navy-08);
  border-radius: var(--r-card);
  background: var(--c-white);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.bl-flashcard__face--back {
  background: var(--c-whitesmoke);
}

.dc-article__body .bl-flashcard__side {
  margin: 0 0 var(--sp-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bl-muted);
}

.dc-article__body .bl-flashcard__word {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-navy);
  overflow-wrap: anywhere;
}

.dc-article__body .bl-flashcard__example {
  margin: var(--sp-sm) 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-navy);
}

@media (max-width: 479px) {
  .bl-flashcard__faces { grid-template-columns: 1fr; }
  .bl-flashcard__face { min-height: 140px; }
}

/* chart: two drawings, one shown per width */
.bl-chart__title {
  margin: 0;
  font-weight: 700;
  font-size: 17px;
  color: var(--c-navy);
}

.dc-article__body .bl-chart__desc {
  margin: 4px 0 var(--sp-sm);
  font-size: 15px;
  line-height: 1.5;
  color: var(--bl-muted);
}

.bl-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--sp-md);
  margin: 0 0 var(--sp-xs);
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--c-navy);
}

.bl-chart__legend li { display: flex; align-items: center; gap: 6px; margin: 0; }

.bl-chart__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}

.bl-chart__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.bl-chart__svg--wide { display: none; }

@media (min-width: 600px) {
  .bl-chart__svg--narrow { display: none; }
  .bl-chart__svg--wide { display: block; }
}

.bl-chart__svg text {
  font-family: var(--font-primary);
  font-size: 12px;
  fill: var(--bl-muted);
}

.bl-chart__grid line { stroke: var(--c-gray-200); stroke-width: 1; }
.bl-chart__baseline { stroke: var(--c-gray-400); stroke-width: 1; }

.bl-chart__data {
  margin-top: var(--sp-sm);
  font-size: 15px;
}

.bl-chart__data summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--bl-link);
}

.dc-article__body .bl-chart__data .bl-table-scroll { margin: var(--sp-sm) 0 0; }

/* cta */
.bl-cta {
  margin: var(--sp-lg) 0;
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-card);
  background: var(--c-mainblue-04);
  border: 1px solid var(--c-mainblue-08);
}

.dc-article__body .bl-cta__title {
  margin: 0 0 4px;
  font-weight: 700;
}

.dc-article__body .bl-cta__text { margin: 0 0 var(--sp-sm); }

.dc-article__body .bl-cta__button {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  background: var(--bl-link);
  color: var(--c-white);
  font-weight: 700;
  text-decoration: none;
}

.dc-article__body .bl-cta__button:hover { background: var(--c-navy); }

/* youtube */
.bl-youtube__link,
.bl-youtube__frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-navy);
}

.dc-article__body .bl-youtube__link img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  object-fit: cover;
}

.bl-youtube__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bl-youtube__link:hover .bl-youtube__play svg path:first-child { fill: var(--bl-link); }

.bl-youtube__link:focus-visible {
  outline: 3px solid var(--c-mainblue);
  outline-offset: 2px;
}

.bl-youtube__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* A broken component in a local preview (never on the live site). */
.bl-component-error {
  margin: var(--sp-lg) 0;
  padding: var(--sp-sm) var(--sp-md);
  border: 2px dashed #B4232C;
  border-radius: var(--r-md);
  background: #FFF1F1;
  color: #7A1219;
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .bl-chart__data summary,
  .bl-cta__button { transition: none; }
}


/* ── 18. WIDGETS (fsrs-workload, forgetting-curve, flip-quiz) ──── */
/* Scripts in assets/_site/widgets/. Each widget shows .bl-widget__fallback
   until its script removes `hidden` from .bl-widget__app. */

.bl-widget {
  margin: var(--sp-xl) 0;
  padding: var(--sp-lg);
  border: 1px solid var(--c-navy-08);
  border-radius: var(--r-card);
  background: var(--c-white);
  box-shadow: var(--shadow-soft);
}

.dc-article__body .bl-widget__title {
  margin: 0 0 var(--sp-md);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--c-navy);
}

.bl-widget__fallback > :last-child { margin-bottom: 0; }

.dc-article__body .bl-widget__method {
  margin: var(--sp-md) 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--bl-muted);
}

.bl-widget__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  margin-top: var(--sp-md);
}

.dc-article__body .bl-widget__button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--c-navy-12);
  border-radius: var(--r-pill);
  background: var(--c-white);
  color: var(--c-navy);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.dc-article__body .bl-widget__button:hover:not(:disabled) { background: var(--c-mainblue-04); }
.dc-article__body .bl-widget__button:disabled { opacity: 0.45; cursor: default; }

.dc-article__body .bl-widget__button--primary {
  border-color: var(--bl-link);
  background: var(--bl-link);
  color: var(--c-white);
}

.dc-article__body .bl-widget__button--primary:hover:not(:disabled) { background: var(--c-navy); }

.dc-article__body .bl-widget__button--quiet {
  margin-top: var(--sp-sm);
  border-color: transparent;
  color: var(--bl-link);
  padding-left: 0;
  padding-right: 0;
}

.bl-widget button:focus-visible,
.bl-widget input:focus-visible,
.flc__svg:focus-visible {
  outline: 3px solid var(--c-mainblue);
  outline-offset: 2px;
}

/* Inputs */
.bl-workload__inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--sp-md) var(--sp-lg);
}

.bl-field label,
.bl-segmented legend {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-navy);
}

.bl-field__row {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  min-height: 44px;
}

.bl-field__row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--bl-link);
  height: 28px;
}

.bl-field__row output {
  min-width: 3.2em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-navy);
  text-align: right;
}

.dc-article__body .bl-field__hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--bl-muted);
}

/* Stat tiles */
.bl-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp-sm);
  margin: var(--sp-lg) 0 var(--sp-sm);
}

.bl-stats__item {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-md);
  background: var(--c-mainblue-04);
}

.bl-stats dt {
  font-size: 13px;
  line-height: 1.3;
  color: var(--bl-muted);
}

.bl-stats dd {
  margin: 4px 0 0;
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-navy);
}

.dc-article__body .bl-workload__summary {
  margin: 0 0 var(--sp-md);
  font-size: 15px;
}

/* Segmented control (radio buttons) */
.bl-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 var(--sp-sm);
  padding: 0;
  border: 0;
}

.bl-segmented legend { width: 100%; margin-bottom: 4px; }

.bl-segmented label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--c-navy-12);
  border-radius: var(--r-pill);
  font-size: 14px;
  cursor: pointer;
}

.bl-segmented label:has(input:checked) {
  border-color: var(--bl-link);
  background: var(--c-mainblue-08);
  font-weight: 600;
}

.bl-segmented input { accent-color: var(--bl-link); margin: 0; }
.bl-segmented label:has(input:focus-visible) { outline: 3px solid var(--c-mainblue); outline-offset: 2px; }

/* Chart helper (widgets/chart.js) */
.flc__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--sp-md);
  margin: 0 0 var(--sp-xs);
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.flc__legend li { display: flex; align-items: center; gap: 6px; margin: 0; }
.flc__legend[hidden],
.bl-widget [hidden] { display: none; }
.flc__swatch { width: 12px; height: 12px; border-radius: 3px; }
.flc__frame { position: relative; }

.flc__svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: pan-y;
  border-radius: 8px;
}

.flc__svg text { font-family: var(--font-primary); font-size: 12px; fill: var(--bl-muted); }
.flc__grid line { stroke: var(--c-gray-200); stroke-width: 1; }
.flc__baseline { stroke: var(--c-gray-400); stroke-width: 1; }
.flc__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.flc__area { fill-opacity: 0.1; stroke: none; }
.flc__rule { stroke: var(--c-navy); stroke-width: 1; stroke-dasharray: 4 4; }
.flc__svg .flc__rule-label { fill: var(--c-navy); font-weight: 600; }
.flc__marker { stroke: var(--c-gray-400); stroke-width: 1; }
.flc__svg .flc__marker-label { fill: var(--c-navy); font-weight: 700; }
.flc__cross { stroke: var(--c-navy-12); stroke-width: 1; }

.flc__tip {
  position: absolute;
  top: 0;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--c-navy);
  color: var(--c-white);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-110%);
}

.dc-article__body .flc__hint,
.dc-article__body .flc__live,
.dc-article__body .bl-curve__live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.bl-workload__chart,
.bl-curve__chart { margin-top: var(--sp-lg); }

/* Forgetting curve */
.dc-article__body .bl-curve__prompt {
  margin: var(--sp-md) 0 var(--sp-sm);
  font-size: 15px;
  font-weight: 600;
}

.bl-curve__ratings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-xs);
}

.dc-article__body .bl-curve__rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 56px;
  padding: 8px 6px;
  border: 1px solid var(--c-navy-12);
  border-radius: var(--r-md);
  background: var(--c-white);
  color: var(--c-navy);
  font: inherit;
  cursor: pointer;
}

.dc-article__body .bl-curve__rating:hover:not(:disabled) { background: var(--c-mainblue-04); border-color: var(--bl-link); }
.dc-article__body .bl-curve__rating:disabled { opacity: 0.45; cursor: default; }
.bl-curve__name { font-weight: 700; font-size: 15px; }
.bl-curve__effect { font-size: 12px; color: var(--bl-muted); }

@media (max-width: 479px) {
  .bl-curve__ratings { grid-template-columns: repeat(2, 1fr); }
}

.bl-curve__history { margin-top: var(--sp-md); font-size: 15px; }
.bl-curve__history summary { cursor: pointer; font-weight: 600; color: var(--bl-link); }
.dc-article__body .bl-curve__log { margin: var(--sp-xs) 0 0; padding-left: 1.4em; font-size: 14px; }

/* Flip quiz */
.dc-article__body .bl-quiz__progress { margin: 0 0 var(--sp-sm); font-size: 14px; font-weight: 600; color: var(--bl-muted); }

.bl-quiz__card {
  position: relative;
  min-height: 180px;
  perspective: 1000px;
  cursor: pointer;
}

.bl-quiz__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xs);
  padding: var(--sp-lg);
  border: 1px solid var(--c-navy-08);
  border-radius: var(--r-card);
  background: var(--c-white);
  box-shadow: var(--shadow-soft);
  text-align: center;
  backface-visibility: hidden;
  transition: transform 0.45s var(--ease-expo);
}

.bl-quiz__back { background: var(--c-whitesmoke); transform: rotateY(180deg); }
.bl-quiz__card.is-flipped .bl-quiz__front { transform: rotateY(-180deg); }
.bl-quiz__card.is-flipped .bl-quiz__back { transform: rotateY(0deg); }
.bl-quiz__side { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bl-muted); }
.bl-quiz__front-text, .bl-quiz__back-text { font-size: 26px; font-weight: 700; line-height: 1.25; color: var(--c-navy); overflow-wrap: anywhere; }

.dc-article__body .bl-quiz__done { margin: 0; padding: var(--sp-md); border-radius: var(--r-md); background: var(--c-mainblue-04); font-weight: 600; }

.bl-quiz__list { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-xs) var(--sp-md); }
.bl-quiz__item { display: flex; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--c-navy-08); }
.bl-quiz__item dt { font-weight: 700; }
.bl-quiz__item dt::after { content: ":"; }
.bl-quiz__item dd { margin: 0; }

@media (max-width: 479px) {
  .bl-widget { padding: var(--sp-md); }
}

@media (prefers-reduced-motion: reduce) {
  .bl-quiz__face { transition: none; }
}

/* Breadcrumb on post pages: docs.css fades the whole row (2.5:1 here). */
.bl-article .dc-article__breadcrumb { opacity: 1; color: var(--bl-muted); }
.bl-article .dc-article__breadcrumb-link { color: var(--bl-muted); }
.bl-article .dc-article__breadcrumb-link:hover { color: var(--c-navy); }
