/* Blog list and article pages. Tokens come from site.css. */
.blog-main { padding-block: 64px 96px; }
.blog-main h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 1.3rem + 3.6vw, 4rem);
  line-height: 1.04;
  letter-spacing: -.02em;
  hyphens: auto;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.blog-main .lede { margin: 20px 0 0; }
.article-note { color: var(--muted); font-size: 15px; line-height: 1.5; }

/* Shared article entry */
.article-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; color: var(--muted); font: 500 14px/1.45 var(--font-text); }
.article-card { position: relative; }
.article-card h2, .article-card h3 { margin: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: 0; hyphens: auto; overflow-wrap: break-word; text-wrap: balance; }
.article-card h2 a, .article-card h3 a { color: var(--ink); text-decoration: none; }
.article-card h2 a::after, .article-card h3 a::after { content: ""; position: absolute; inset: 0; }
.article-card:hover h2 a, .article-card:hover h3 a, .article-card:focus-within h2 a, .article-card:focus-within h3 a {
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px;
}
.article-card a:focus-visible { outline: none; }
.article-card:has(a:focus-visible) { outline: 3px solid var(--ink); outline-offset: 4px; }
.article-card p { margin: 0; color: var(--muted); text-wrap: pretty; }

/* Blog index */
.blog-intro { margin-bottom: 40px; }
.blog-intro .article-note { margin: 16px 0 0; }
.cat-filter { display: flex; flex-wrap: wrap; gap: 0 4px; margin: 0 0 24px -10px; }
.cat-filter::-webkit-scrollbar { display: none; }
.cat-filter a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; flex-shrink: 0;
  color: var(--ink); text-decoration: none; font: 600 15px/1.3 var(--font-text); white-space: nowrap;
}
.cat-filter a span { padding-block: 4px; }
.cat-filter a:hover span, .cat-filter a[aria-current="page"] span { box-shadow: inset 0 -3px 0 var(--signal); }

.article-list { border-top: 2px solid var(--ink); }
.article-list .article-card {
  display: grid; grid-template-columns: 9rem minmax(0, 1fr); column-gap: var(--col-gap); row-gap: 10px;
  padding: 32px 0; border-bottom: 1px solid var(--line);
}
.article-list .article-card[hidden] { display: none; }
.article-list .article-meta { display: contents; }
.article-list time { grid-column: 1; grid-row: 1; padding-top: 4px; color: var(--muted); font-size: 15px; }
.article-list .tag { grid-column: 1; grid-row: 2; justify-self: start; align-self: start; white-space: normal; }
.article-list .article-card h2, .article-list .article-card h3 { grid-column: 2; grid-row: 1 / 3; align-self: start; max-width: 30ch; font-size: 26px; line-height: 1.2; }
.article-list .article-card p { grid-column: 2; grid-row: 3; font-size: 17px; max-width: 60ch; }
.article-list .article-card[data-variant="related"] h3 { max-width: none; font-size: 20px; }

@media (max-width: 959px) {
  .article-list .article-card { display: flex; flex-direction: column; gap: 8px; padding: 24px 0; }
  .article-list .article-meta { display: flex; }
  .article-list time, .article-list .tag { padding: 0; margin: 0; }
  .article-list .article-meta .tag { order: -1; }
  .article-list .article-card h2, .article-list .article-card h3 { font-size: 20px; }
}
@media (max-width: 599px) {
  .cat-filter {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: calc(-1 * var(--gutter));
    mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
  }
  .cat-filter::-webkit-scrollbar { display: none; }
}
@media (max-width: 599px) { .blog-main { padding-block: 40px 64px; } }

/* Article */
.article-head { margin-bottom: 48px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin: 0 0 20px; font: 500 14px/1.4 var(--font-text); color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.article-head .lede { max-width: 46ch; }
.article-head .article-meta { margin-top: 24px; }
.article-head .byline::before { content: ""; }

.article-layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); align-items: start; }
.article-body { grid-column: 3 / 11; max-width: 68ch; font-size: 18px; line-height: 1.7; overflow-wrap: break-word; }
.article-head, .article-cta, .article .article-note, .related { margin-left: calc((100% + var(--col-gap)) * 2 / 12); max-width: min(68ch, calc((100% + var(--col-gap)) * 8 / 12 - var(--col-gap))); }
@media (min-width: 1200px) {
  /* Close on the same right edge as the body column (grid columns 3 to 9). */
  .article-cta, .article .article-note, .related { max-width: min(68ch, calc((100% + var(--col-gap)) * 7 / 12 - var(--col-gap))); }
}
.article-head { max-width: calc((100% + var(--col-gap)) * 9 / 12 - var(--col-gap)); }
.article-head h1 { font-size: clamp(2rem, 1.3rem + 2.8vw, 3.5rem); }
.article-toc { grid-column: 11 / 13; grid-row: 1; display: none; }
@media (min-width: 1200px) {
  .article-body { grid-column: 3 / 10; }
  .article-toc { display: block; position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: thin; font: 500 15px/1.4 var(--font-text); }
  .article-toc p { margin: 0 0 8px; font-weight: 600; color: var(--ink); }
  .article-toc ol { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
  .article-toc a { display: flex; align-items: center; min-height: 44px; padding: 6px 0; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
  .article-toc a:hover { text-decoration: underline; text-underline-offset: 4px; }
  .article-toc a { padding-left: 12px; box-shadow: inset 3px 0 0 transparent; transition: box-shadow 120ms ease-out; }
  .article-toc a[aria-current="true"] { box-shadow: inset 3px 0 0 var(--signal); font-weight: 600; }
  .article-toc { grid-column: 10 / 13; padding-left: 24px; }
}
.article-body p { margin: 0 0 24px; }
.article-body a { padding-block: .15em; color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.article-body a:hover { text-decoration-thickness: 2px; }
.article-body h2 {
  margin: 56px 0 16px; padding-top: 16px; border-top: 2px solid var(--ink);
  font: 700 28px/1.2 var(--font-display); letter-spacing: -.01em;
  hyphens: auto; overflow-wrap: break-word; text-wrap: balance; scroll-margin-top: 96px;
}
.article-body h3 { margin: 32px 0 8px; font: 700 20px/1.35 var(--font-text); }
.article-body ul, .article-body ol { margin: 0 0 24px; padding: 0; list-style: none; }
.article-body ol { counter-reset: li; }
.article-body li { position: relative; padding-left: 24px; margin-bottom: 10px; }
.article-body ul > li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 6px; height: 6px; background: var(--ink); }
.article-body ol > li { counter-increment: li; padding-left: 32px; }
.article-body ol > li::before { content: counter(li) "."; position: absolute; left: 0; font-weight: 700; }
.article-body code { font: inherit; font-weight: 600; white-space: normal; }
.article-body .button { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; background: var(--ink); color: var(--paper); border-radius: var(--r-control); font-weight: 600; text-decoration: none; }
.article-body .button:hover { background: var(--signal); color: var(--ink); }

.example {
  margin: 28px 0; padding: 24px 28px;
  background-color: var(--sheet);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 8px 8px;
  border: 1px solid var(--ink);
  border-top-width: 2px;
  font-weight: 600;
}
.example p { margin: 0 0 12px; }
.example ul, .example ol { margin-bottom: 12px; }
.example > :last-child { margin-bottom: 0; font: 700 22px/1.35 var(--font-display); }
/* The worked example ends on its answer, filled in yellow like the result of the hero formula. */
.example > p:last-child { margin: 16px -28px -24px; padding: 14px 28px; background: var(--signal); }
.example > ul:last-child, .example > ol:last-child { font: inherit; font-weight: 600; }
.example > ul:last-child > li:last-child, .example > ol:last-child > li:last-child { font: 700 20px/1.35 var(--font-display); margin-bottom: 0; }

.table-wrap { margin: 28px 0; overflow-x: auto; }
.article-body table { width: 100%; border-collapse: collapse; font-size: 16px; }
.article-body th, .article-body td { padding: 12px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.article-body th { font-weight: 700; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.article-body td:not(:first-child), .article-body th:not(:first-child) { text-align: right; }
.article-body th:first-child, .article-body td:first-child { padding-left: 0; }
.article-body th:last-child, .article-body td:last-child { padding-right: 0; }

.article-cta { margin-top: 56px; margin-bottom: 24px; padding: 40px; background: var(--navy-2); color: var(--on-navy); }
.article-cta h2 { margin: 0 0 12px; font: 700 26px/1.2 var(--font-display); letter-spacing: -.01em; hyphens: auto; overflow-wrap: break-word; text-wrap: balance; }
.article-cta p { margin: 0 0 24px; color: var(--on-navy-muted); max-width: 52ch; }
.article-cta .btn { white-space: normal; text-align: left; }
.article-cta .secondary-links { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-top: 12px; }
.article-cta .secondary-links { gap: 12px; }
.article-cta .secondary-links a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  color: var(--on-navy); font-weight: 600; text-decoration: none;
  border: 1.5px solid var(--on-navy); border-radius: var(--r-control);
  transition-property: background-color, color, border-color; transition-duration: 120ms; transition-timing-function: ease-out;
}
.article-cta .secondary-links a:hover { background: var(--on-navy); color: var(--ink); }

.related { margin-top: 72px; }
.related > h2 { margin: 0 0 24px; padding-top: 16px; border-top: 2px solid var(--ink); font: 700 24px/1.2 var(--font-display); }
.related .article-list { border-top: 0; }
.related .article-list .article-card { padding: 20px 0; }
.related .article-list .article-card h3 { grid-column: 2; }

@media (max-width: 959px) {
  .article-head, .article-cta, .article .article-note, .related { margin-left: 0; max-width: 68ch; }
  .article-body { grid-column: 1 / -1; }
}
@media (max-width: 599px) {
  .article-body { font-size: 17px; }
  .article-body h2 { font-size: 22px; margin-top: 44px; }
  .example { padding: 20px 16px; }
  .example > p:last-child { margin: 16px -16px -20px; padding: 12px 16px; }
  .article-body td { font-size: 15px; }
  .article-body td:first-child { width: 34%; }
  .article-cta .secondary-links a { flex: 1 1 0; }
  .example > :last-child { font-size: 19px; }
  .article-cta { padding: 28px 16px; margin-inline: calc(-1 * var(--gutter)); }
  .article-cta h2 { font-size: 22px; }
  .article-cta .btn { width: 100%; justify-content: center; }
}

/* The app's own category art: a real product icon beside each entry, never a caption. */
.card-art, .head-art { display: block; width: 112px; height: 112px; pointer-events: none; }
.article-list .article-card { grid-template-columns: 9rem minmax(0, 1fr) 112px; }
.article-list .card-art { grid-column: 3; grid-row: 1 / 4; align-self: start; transition: transform 240ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .article-list .article-card:hover .card-art { transform: translateY(-3px); } }
.article-list .article-card[data-variant="related"] .card-art { width: 72px; height: 72px; }
.article-list .article-card[data-variant="related"] { grid-template-columns: 9rem minmax(0, 1fr) 72px; }
.article-head { position: relative; padding-right: 168px; }
.head-art { position: absolute; top: 56px; right: 0; width: 144px; height: 144px; }
@media (prefers-reduced-motion: no-preference) {
  .head-art { animation: art-in 700ms var(--ease-out) 120ms both; }
  @keyframes art-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }
}
@media (max-width: 959px) {
  .article-list .article-card { position: relative; padding-right: 76px; }
  .article-list .card-art, .article-list .article-card[data-variant="related"] .card-art { position: absolute; top: 20px; right: 0; width: 64px; height: 64px; }
  .article-head { padding-right: 0; }
  .head-art { top: -4px; width: 56px; height: 56px; }
}

/* FAQ block: visible questions and answers, same rhythm as the body */
.article-faq { margin-top: 48px; }
.article-faq .faq-item { padding: 16px 0; border-top: 1px solid var(--line, rgba(0, 0, 0, .12)); }
.article-faq .faq-item h3 { margin: 0 0 8px; }
.article-faq .faq-item p { margin: 0; }
