/*
 * Blog / resource hub styles.
 *
 * Kept out of styles.css deliberately: that file is ~90KB of page-specific
 * rules, and the blog only needs a reading column plus a card grid. Loaded
 * on /blog routes only, and picked up by the existing /*.css rule in
 * public/_headers, so it revalidates on every load like the rest.
 *
 * All colour, font and spacing values come from the tokens defined at the
 * top of styles.css — nothing new is invented here.
 */

/* ---------- Index hero ---------- */

.blog-hero {
  padding: 4rem 0 2rem;
}

.blog-hero .eyebrow {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-on-light);
  margin: 0 0 0.75rem;
}

.blog-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  margin: 0 0 1rem;
}

.blog-hero__desc {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 46ch;
  margin: 0;
}

/* ---------- Index listing ---------- */

.blog-list {
  padding: 2rem 0 5rem;
}

.blog-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
}

.blog-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.blog-card:hover,
.blog-card:focus-within {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .blog-card {
    transition: none;
  }
  .blog-card:hover,
  .blog-card:focus-within {
    transform: none;
  }
}

.blog-card__image {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.blog-card__body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.blog-card__date {
  font-size: 0.875rem;
  color: var(--muted);
}

.blog-card__title {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.blog-card__title a {
  color: var(--text);
  text-decoration: none;
}

.blog-card__title a:hover {
  color: var(--accent-on-light);
  text-decoration: underline;
}

/* The whole card is clickable, but the link keeps its own focus ring. */
.blog-card__title a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.blog-card {
  position: relative;
}

.blog-card__desc {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

.blog-card__draft {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
  border: 1px solid var(--tag-border);
  border-radius: 999px;
  padding: 0.125rem 0.625rem;
}

.blog-empty {
  color: var(--muted);
  font-size: 1.125rem;
}

/* ---------- Single post ---------- */

.post {
  padding: 2.5rem 0 5rem;
}

/* A measured reading column. 68ch keeps line length in the 60-75 range that
   reads comfortably; the container still governs the outer gutter. */
.post__inner {
  max-width: 68ch;
}

.post__breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 2rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.post__breadcrumb li + li::before {
  content: '/';
  margin-right: 0.5rem;
  color: var(--line);
}

.post__breadcrumb a {
  color: var(--muted);
}

.post__title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  margin: 0 0 1rem;
}

.post__meta {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.post__tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 2rem;
}

.post__tags li {
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--soft);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
}

.post__hero {
  width: 100%;
  height: auto;
  border-radius: 1rem;
  margin: 0 0 2.5rem;
  display: block;
}

.post__toc {
  background: var(--faq-bg);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin: 0 0 2.5rem;
}

.post__toc-title {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.post__toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.post__toc a {
  color: var(--text);
  text-decoration: none;
}

.post__toc a:hover {
  color: var(--accent-on-light);
  text-decoration: underline;
}

/* ---------- Markdown body ---------- */

.prose {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
}

.prose > * + * {
  margin-top: 1.25em;
}

.prose h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 2.5em;
  /* Anchor links from the ToC shouldn't land flush against the viewport. */
  scroll-margin-top: 2rem;
}

.prose h3 {
  font-family: var(--font-heading);
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2em;
  scroll-margin-top: 2rem;
}

.prose a {
  color: var(--accent-on-light);
  /* Same reason as .legal a — body-copy links need a non-colour
     distinguisher, and these run inside long paragraphs. */
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
}

.prose li + li {
  margin-top: 0.5em;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin-left: 0;
  color: var(--muted);
  font-style: italic;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
}

.prose code {
  font-size: 0.9em;
  background: var(--faq-bg);
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  padding: 0.125em 0.375em;
}

.prose pre {
  background: var(--dark);
  color: var(--white);
  border-radius: 0.75rem;
  padding: 1.25rem;
  overflow-x: auto;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}

/* Wide tables scroll rather than forcing the page sideways — the same fix
   already applied to the pricing comparison table. */
.prose .table-wrap {
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 0.625rem 0.875rem;
  text-align: left;
}

.prose th {
  background: var(--soft);
  font-weight: 700;
}

/* ---------- Post footer ---------- */

.post__footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: flex-start;
}

.post__footer p {
  margin: 0;
}

/* ---------- Post body components ----------
   Markdown alone gives headings, lists and paragraphs, which is not enough
   for a research post: these carry the summary boxes, stat tiles, figures
   and comparison blocks that break up a long read. Authored as raw HTML in
   the markdown body, so they need no plugin — only these class names.

   Everything is built from the tokens in styles.css; nothing new is
   invented. Chart colours are the three validated categorical hues:
   #FE3F00 (brand orange), #8B3CC4 (brand purple), #2E7D32. */

/* Summary box that opens a post. */
.tldr {
  background: var(--soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
}

.tldr__title {
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-on-light);
  margin: 0 0 0.625rem;
}

.tldr ul {
  margin: 0;
  padding-left: 1.25rem;
}

.tldr li {
  font-size: 1rem;
  line-height: 1.6;
}

/* Aside for a caveat, definition or piece of context. */
.callout {
  background: var(--faq-bg);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
}

.callout--accent {
  background: #fff4ee;
  border-color: var(--accent-soft);
}

.callout__title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.callout p:last-child,
.callout ul:last-child {
  margin-bottom: 0;
}

/* A row of headline numbers. Each tile names its own source, because a
   figure without one is the thing this whole site argues against. */
.stat-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  margin-top: 1.5em;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.stat-tile__value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--accent-on-light);
  display: block;
}

.stat-tile__label {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  display: block;
  margin-top: 0.375rem;
}

.stat-tile__source {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted);
  display: block;
  margin-top: 0.5rem;
}

.stat-tile__source a {
  color: var(--muted);
}

/* Chart and image wrapper. The caption carries the source line. */
.figure {
  margin-top: 2em;
}

.figure svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.figure__caption {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 0.75rem;
}

.figure__caption strong {
  color: var(--text);
}

/* Louder than a blockquote — used once per post at most. */
.pullquote {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  padding: 1.5rem 0;
  margin: 2.5em 0;
}

/* Numbered process. The counter keeps the numbering in the markup rather
   than typed into each heading, so reordering steps cannot desync them. */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  min-height: 2rem;
}

.steps > li + li {
  margin-top: 1.5em;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 700;
}

.steps__title {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 0.25rem;
}

/* Two-column contrast: what people do vs what works. */
.contrast {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  margin-top: 1.5em;
}

.contrast__card {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.25rem;
  background: var(--card);
}

.contrast__card--no {
  background: var(--faq-bg);
}

.contrast__card--yes {
  background: #fff4ee;
  border-color: var(--accent-soft);
}

.contrast__label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.contrast__card--yes .contrast__label {
  color: var(--accent-on-light);
}

.contrast__card p:last-child,
.contrast__card ul:last-child {
  margin-bottom: 0;
}

/* Question-and-answer block, mirroring the FAQ pattern used site-wide. */
.qa {
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
  margin-top: 1.5em;
}

.qa__q {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.qa__a {
  margin: 0;
  color: var(--text);
}

/* Source list at the foot of a post. */
.sources {
  margin-top: 2.5em;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.sources__title {
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.sources ol {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--muted);
  padding-left: 1.25rem;
}

.sources li + li {
  margin-top: 0.5rem;
}

/* Card tags. Sliced to three in the template — a fourth wraps the card and
   the listing loses its even rhythm. */
.blog-card__tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0;
  margin: 0.25rem 0 0;
}

.blog-card__tags li {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--soft);
  border-radius: 999px;
  padding: 0.1875rem 0.625rem;
}

/* Table captions read as part of the figure, not as a heading. */
.prose caption {
  caption-side: bottom;
  padding-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: left;
}
