/*
 * The blog: the index at /blog/ and each article under it.
 *
 * Loaded after styles.css, on blog pages only, so the rest of the site does
 * not carry it. Uses the site's tokens (--ink, --body, --orange, --cream...)
 * rather than its own colours, so the blog cannot drift into a different brand.
 */

/* ------------------------------------------------------------------ index */
.blog-hero { background: var(--cream); border-bottom: 1px solid var(--line); padding: 64px 0 52px; }
.blog-list { padding: 0; }
.blog-hero .crumb { margin-bottom: 18px; }
.blog-hero h1 { max-width: 760px; }
.blog-hero .lede { max-width: 680px; font-size: 1.12rem; }

.blog-feature {
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 40px; align-items: center;
  margin: 56px 0 24px; color: inherit;
}
.blog-feature .blog-card-media { border-radius: 22px; }
.blog-feature h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 10px 0 14px; }
.blog-feature p { font-size: 1.05rem; }

.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin: 40px 0 96px; }
.blog-card { display: flex; flex-direction: column; color: inherit; }
.blog-card-media {
  display: block; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: var(--cream-deep);
  box-shadow: 0 1px 0 rgba(28, 37, 41, .04), 0 18px 40px -26px rgba(28, 37, 41, .45);
  transition: transform .25s ease, box-shadow .25s ease;
}
.blog-card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.blog-card:hover .blog-card-media, .blog-feature:hover .blog-card-media {
  transform: translateY(-3px); box-shadow: 0 1px 0 rgba(28, 37, 41, .04), 0 26px 50px -26px rgba(28, 37, 41, .55);
}
.blog-card h3 { font-size: 1.22rem; margin: 16px 0 8px; line-height: 1.3; }
.blog-card:hover h3, .blog-feature:hover h2 { color: var(--orange-ink); }
.blog-card p { font-size: .95rem; }
.blog-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  font-size: .82rem; color: var(--muted); font-weight: 500;
}
.blog-meta .cat {
  color: var(--orange-ink); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem;
}
.blog-card .blog-meta { margin-top: auto; padding-top: 12px; }

/* ---------------------------------------------------------------- article */
.post-hero { background: var(--cream); padding: 56px 0 0; position: relative; overflow: hidden; }
.post-hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 160px; background: var(--white);
}
.post-hero .wrap { position: relative; z-index: 1; }
.post-head { max-width: 820px; }
.post-head .crumb { margin-bottom: 18px; }
.post-head h1 { font-size: clamp(2rem, 4.4vw, 3.15rem); margin: 14px 0 18px; }
.post-head .dek { font-size: 1.2rem; line-height: 1.6; color: var(--body); max-width: 760px; }
.post-head .blog-meta { margin: 22px 0 36px; font-size: .88rem; }
.post-head .blog-meta .by { color: var(--ink); }
.post-cover {
  margin: 0; border-radius: 24px; overflow: hidden; background: var(--cream-deep);
  box-shadow: 0 30px 70px -40px rgba(28, 37, 41, .55);
}
.post-cover img { display: block; width: 100%; height: auto; }

.post-layout { max-width: 720px; margin: 0 auto; padding: 48px 0 40px; }

/* Contents: a box after the short answer, not a sticky column, so wide
 * figures and tables can break out of the reading column on both sides. */
.post-toc {
  display: block; height: auto; gap: 0;
  border: 1px solid var(--line); border-radius: 18px; padding: 18px 24px 20px; background: var(--white);
}
.prose .post-toc .toc-title {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px;
}
.post-toc ol { columns: 2; column-gap: 32px; padding-left: 1.2em; font-size: .92rem; line-height: 1.45; }
.post-toc li { break-inside: avoid; margin: 0 0 .5em; }
.post-toc li + li { margin-top: 0; }
.post-toc a { color: var(--body) !important; text-decoration: none !important; }
.post-toc a:hover { color: var(--orange-ink) !important; }

.prose { font-size: 1.07rem; line-height: 1.78; color: #46505a; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.95rem); margin-top: 2.2em; scroll-margin-top: 100px;
}
.prose h3 { font-size: 1.28rem; margin-top: 1.8em; scroll-margin-top: 100px; }
.prose h2 + *, .prose h3 + * { margin-top: .6em; }
.prose a:not(.btn) { color: var(--orange-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:not(.btn):hover { text-decoration-thickness: 2px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .45em; }
.prose li::marker { color: var(--orange); }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em;
  background: var(--cream); border: 1px solid var(--line); border-radius: 6px; padding: .08em .4em; color: var(--ink);
}
.prose sup { line-height: 0; font-size: .7em; vertical-align: super; }
.prose sup a { text-decoration: none; font-weight: 600; }

/* The short answer, first, for the reader who came with a question. */
.answer {
  background: linear-gradient(135deg, #fff8f0, #fff3e6); border: 1px solid #ffd9b0; border-radius: 18px;
  padding: 22px 26px;
}
.answer > b:first-child {
  display: block; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 8px;
}
.answer p + p, .answer ul { margin-top: .7em; }

.callout { border-left: 3px solid var(--orange); background: var(--cream); padding: 16px 20px; border-radius: 0 14px 14px 0; font-size: 1rem; }
.callout.plain { border-left-color: #b9c1c9; }
.callout > b:first-child { color: var(--ink); }

/* Figures break out of the reading column on wide screens. */
.figure { margin: 2.2em 0; }
.figure.wide { margin-left: -130px; margin-right: -130px; }
.figure img, .figure svg { display: block; width: 100%; height: auto; border-radius: 18px; }
.figure .frame { border-radius: 20px; overflow: hidden; background: var(--cream); }
.figure figcaption {
  margin-top: 12px; font-size: .88rem; line-height: 1.55; color: var(--muted); display: flex; gap: 10px; align-items: baseline;
}
.figure figcaption .src {
  flex: none; font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--orange-ink);
}

/* Comparison tables: scroll sideways on a phone, first column pinned. */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; -webkit-overflow-scrolling: touch; }
.table-wrap.wide { margin-left: -130px; margin-right: -130px; }
.compare { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.45; min-width: 640px; }
.compare th, .compare td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.compare thead th {
  background: var(--cream); color: var(--ink); font-weight: 600; font-size: .78rem; letter-spacing: .04em; white-space: nowrap;
}
.compare tbody th { color: var(--ink); font-weight: 600; background: var(--white); position: sticky; left: 0; min-width: 150px; }
.compare tbody tr:last-child th, .compare tbody tr:last-child td { border-bottom: 0; }
.compare tr.us th, .compare tr.us td { background: #fff8f0; }
.compare .y, .compare .n, .compare .p, .compare .u {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap;
}
.compare .y { color: #13804f; } .compare .n { color: #b4472b; } .compare .p { color: #a76b00; } .compare .u { color: var(--muted); }
.compare small { display: block; color: var(--muted); font-size: .78rem; margin-top: 3px; }
.table-note { font-size: .82rem; color: var(--muted); margin-top: 10px; }

.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li { position: relative; padding-left: 46px; }
.steps li + li { margin-top: 1em; }
.steps li::before {
  counter-increment: step; content: counter(step); position: absolute; left: 0; top: .05em;
  width: 30px; height: 30px; border-radius: 50%; background: var(--orange-soft); color: var(--orange-ink);
  font-weight: 700; font-size: .9rem; display: grid; place-items: center;
}

.faq details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--orange); font-weight: 700; font-size: 1.2em; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin-top: .6em; }

.sources { font-size: .86rem; line-height: 1.55; color: var(--body); }
.sources ol { padding-left: 1.4em; }
.sources li + li { margin-top: .5em; }
.sources a { word-break: break-word; }
.sources .checked { color: var(--muted); }

.post-cta {
  margin: 3em 0 1em; padding: 30px 32px; border-radius: 22px; color: #fff;
  background: radial-gradient(600px 300px at 90% 0%, rgba(255, 176, 74, .35), transparent 60%), linear-gradient(135deg, #1c2529, #11171a);
}
.post-cta h3 { color: #fff; font-size: 1.4rem; margin: 0 0 8px; }
.post-cta p { color: #c9d1d8; margin: 0 0 18px; }
.post-cta .btn + .btn { margin-left: 8px; }
.post-cta .btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .35); box-shadow: none; }
.post-cta .btn-ghost:hover { background: rgba(255, 255, 255, .08); }

.post-related { border-top: 1px solid var(--line); padding: 48px 0 96px; }
.post-related h2 { font-size: 1.5rem; margin-bottom: 8px; }
.post-related .blog-grid { margin: 24px 0 0; }

@media (max-width: 1040px) {
  .figure.wide, .table-wrap.wide { margin-left: 0; margin-right: 0; }
}
@media (max-width: 980px) {
  .blog-feature { grid-template-columns: 1fr; gap: 22px; }
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .blog-hero { padding: 40px 0 36px; }
  .post-hero { padding: 36px 0 0; }
  .post-hero::after { height: 70px; }
  .post-head .dek { font-size: 1.07rem; }
  .prose { font-size: 1.02rem; }
  .blog-grid { grid-template-columns: 1fr; }
  .post-toc ol { columns: 1; }
  .post-cover, .figure img, .figure svg, .figure .frame { border-radius: 14px; }
  .answer { padding: 18px 18px; }
  .post-cta { padding: 24px 22px; }
  .post-cta .btn { display: block; text-align: center; }
  .post-cta .btn + .btn { margin: 10px 0 0; }
}
