/* ==================== BLOG ====================
   Static pages generated by backend/build-blog.js: an editorial layout on
   plain white. Self-contained (no Tailwind, no styles.css). */

:root {
  --ink: #1b2a4a;
  --text: #2a3552;
  --muted: #5a6680;
  --line: #e4e8f0;
  --accent: #230871;
  --accent-tint: #f5f3fc;
  --orange: #ff6f00;
  /* Orange dark enough for small text on white */
  --orange-text: #b34a00;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: "Lexend", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { max-width: 1120px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }

@media (min-width: 768px) {
  .wrap { padding-left: 40px; padding-right: 40px; }
}

/* ---------- Header (same look as the other pages) ---------- */

.site-header { position: relative; background: #ffffff; border-bottom: 1px solid var(--line); }
.site-header .wrap { max-width: none; height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { height: 40px; width: auto; }
.brand span { font-size: 18px; font-weight: 700; color: var(--accent); }

.main-nav { display: none; align-items: center; gap: 24px; font-size: 15px; }
.main-nav a {
  color: var(--ink);
  text-decoration: underline 2px transparent;
  text-underline-offset: 8px;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}
.main-nav a:hover,
.main-nav a:focus-visible { color: var(--accent); text-decoration-color: var(--orange); }
.main-nav a[aria-current] { color: var(--accent); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.btn:hover { background: var(--ink); }
.header-cta { display: none; }

.site-menu summary { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; cursor: pointer; list-style: none; }
.site-menu summary::-webkit-details-marker { display: none; }
.site-menu[open] summary { background: var(--accent-tint); }
.mobile-nav {
  position: absolute; left: 0; right: 0; top: 80px; z-index: 50;
  display: flex; flex-direction: column;
  padding: 8px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
.mobile-nav a { padding: 12px 0; color: var(--ink); text-decoration: none; }
.mobile-nav a[aria-current],
.mobile-nav .mobile-cta { color: var(--accent); font-weight: 600; }

@media (min-width: 640px) {
  .header-cta { display: inline-block; }
}

@media (min-width: 768px) {
  .site-header .wrap { padding-left: 40px; padding-right: 40px; }
  .brand span { font-size: 20px; }
  .main-nav { display: flex; }
  .site-menu { display: none; }
}

/* ---------- Shared pieces ---------- */

/* "EXAMS · 3 MIN READ" */
.kicker {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker .tag { color: var(--orange-text); }

.byline { margin-top: 16px; font-size: 14px; line-height: 1.5; color: var(--muted); }

.section-label {
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Whole card clickable through its title link */
.featured, .story, .related-card { position: relative; }
.featured h2 a, .story h3 a, .related-card h3 a { text-decoration: none; transition: color 0.2s ease; }
.featured h2 a::after, .story h3 a::after, .related-card h3 a::after { content: ""; position: absolute; inset: 0; }
.featured:hover h2 a, .story:hover h3 a, .related-card:hover h3 a { color: var(--accent); }
.featured h2 a:focus-visible, .story h3 a:focus-visible, .related-card h3 a:focus-visible { outline: none; }
.featured:focus-within, .story:focus-within, .related-card:focus-within { outline: 3px solid var(--orange); outline-offset: 6px; border-radius: 4px; }

.featured-media, .story-thumb, .related-thumb { overflow: hidden; background: #f2f4f8; }
.featured-media img, .story-thumb img, .related-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.featured:hover .featured-media img, .story:hover .story-thumb img, .related-card:hover .related-thumb img { transform: scale(1.03); }

/* Stand-in for posts without a cover: the topic on a purple panel */
.placeholder { display: flex; align-items: flex-end; padding: 24px; background: var(--accent); }
.placeholder span { color: #ffffff; font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.placeholder span::before { content: ""; display: block; width: 40px; height: 4px; margin-bottom: 12px; border-radius: 2px; background: var(--orange); }
.story-thumb.placeholder { padding: 12px; }
.story-thumb.placeholder span { font-size: 14px; }
.story-thumb.placeholder span::before { width: 24px; height: 3px; margin-bottom: 8px; }

/* ---------- Blog index ---------- */

.blog-hero { padding: 56px 0 40px; border-bottom: 1px solid var(--line); }
.blog-hero h1 { font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; }
.blog-hero p { max-width: 36rem; margin-top: 12px; font-size: 18px; line-height: 1.6; color: var(--muted); }

.featured { display: grid; gap: 24px; margin: 48px 0 72px; }
.featured-media { aspect-ratio: 16 / 10; border-radius: 12px; }
.featured h2 { margin: 12px 0 16px; font-size: 28px; line-height: 1.18; font-weight: 700; letter-spacing: -0.02em; }
.featured-desc { font-size: 17px; line-height: 1.65; color: var(--muted); }

.stories { margin-bottom: 80px; }
.story { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 20px; align-items: start; padding: 28px 0; border-bottom: 1px solid var(--line); }
.story h3 { margin: 8px 0; font-size: 19px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
.story-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}
.story-thumb { aspect-ratio: 1 / 1; border-radius: 8px; }

@media (min-width: 768px) {
  .blog-hero { padding: 72px 0 48px; }
  .blog-hero h1 { font-size: 56px; }
  .story { grid-template-columns: minmax(0, 1fr) 240px; gap: 40px; padding: 32px 0; }
  .story h3 { font-size: 24px; }
  .story-desc { font-size: 16px; }
  .story-thumb { aspect-ratio: 4 / 3; }
  .story-thumb.placeholder { padding: 20px; }
  .story-thumb.placeholder span { font-size: 20px; }
}

@media (min-width: 900px) {
  .featured { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; align-items: center; margin: 56px 0 88px; }
  .featured h2 { font-size: 38px; }
  .featured-desc { font-size: 18px; }
}

.empty { margin: 48px 0 80px; color: var(--muted); }

/* ---------- Post page ---------- */

.post { padding: 40px 20px 0; }
/* Title, cover, text and newsletter share one 800px column */
.post-head, .post-cover, .post-body, .post-end { max-width: 800px; margin-left: auto; margin-right: auto; }

.back-link { display: inline-block; margin-bottom: 32px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; transition: color 0.2s ease; }
.back-link:hover { color: var(--accent); }
.post-head h1 { margin-top: 12px; font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
.post-desc { margin-top: 16px; font-size: 19px; line-height: 1.55; color: var(--muted); }
.post-head .byline { margin-top: 24px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.post-head .byline strong { color: var(--ink); font-weight: 600; }

.post-cover { margin-top: 40px; }
.post-cover img { width: 100%; border-radius: 12px; }

.post-body { margin-top: 40px; font-size: 18px; line-height: 1.75; color: var(--text); overflow-wrap: break-word; }
.post-body > * { margin-bottom: 1.4em; }
.post-body > :first-child { margin-top: 0; }
.post-body h2 { margin-top: 2em; margin-bottom: 0.6em; font-size: 26px; line-height: 1.3; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }
.post-body h3 { margin-top: 1.6em; margin-bottom: 0.4em; font-size: 20px; line-height: 1.4; font-weight: 700; color: var(--ink); }
.post-body strong { font-weight: 700; color: var(--ink); }
.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}
.post-body a:hover { text-decoration-color: var(--orange); text-decoration-thickness: 2px; }
.post-body ul, .post-body ol { padding-left: 1.4em; }
.post-body li { margin-bottom: 0.4em; padding-left: 0.2em; }
.post-body li::marker { color: var(--orange-text); font-weight: 600; }
.post-body li p { margin: 0; }
.post-body img { margin: 0 auto; border-radius: 8px; }
.post-body blockquote { padding: 0.2em 0 0.2em 1.2em; border-left: 3px solid var(--orange); font-style: italic; color: var(--ink); }
.post-body blockquote p { margin: 0; }
.post-body hr { height: 0; margin: 2.5em 0; border: 0; border-top: 1px solid var(--line); }
.post-body code { padding: 0.1em 0.35em; border-radius: 4px; background: #f2f4f8; font-size: 0.88em; }

/* Tables scroll sideways on phones instead of widening the page */
.post-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 16px; line-height: 1.5; }
.post-body th, .post-body td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.post-body th { background: #f6f7fb; font-weight: 600; color: var(--ink); }

/* [[interactive: ...]] embeds; height is set from the frame's own size report */
.post-body .interactive-embed iframe { display: block; width: 100%; height: 600px; border: 1px solid var(--line); border-radius: 12px; }

/* [[consultation]]: free guidance request form inside a post */
.post-body .consult { margin: 2.5em 0; padding: 28px 24px; border: 1px solid var(--line); border-radius: 16px; background: #ffffff; box-shadow: 0 8px 24px rgba(27, 42, 74, 0.06); }
.post-body .consult > * { margin: 0; }
.post-body .consult h3 { margin: 8px 0 8px; font-size: 22px; line-height: 1.3; }
.consult-intro { font-size: 16px; line-height: 1.6; color: var(--muted); }
.consult-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 24px !important; }
.consult-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.consult-field > label, .consult-field legend { padding: 0; font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.consult-field input[type="text"], .consult-field input[type="tel"], .consult-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d5dae6;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}
.consult-field textarea { resize: vertical; min-height: 104px; }
.consult-field input:focus, .consult-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.consult-roles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.consult-roles label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid #d5dae6; border-radius: 8px; font-size: 15px; cursor: pointer; transition: border-color 0.2s ease, background-color 0.2s ease; }
.consult-roles label:hover { border-color: var(--accent); }
.consult-roles label:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.consult-roles input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.consult-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.consult-actions button { height: 48px; padding: 0 24px; border: 0; border-radius: 8px; background: var(--accent); color: #ffffff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: background-color 0.2s ease; }
.consult-actions button:hover { background: var(--ink); }
.consult-actions button:disabled { opacity: 0.6; cursor: default; }
.consult-actions button:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.consult-status { font-size: 14px; line-height: 1.5; color: var(--orange-text); }
.consult-status:empty { display: none; }
.post-body .consult-alt { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.post-body .consult-done { margin-top: 24px; padding: 16px 20px; border-radius: 8px; background: var(--accent-tint); color: var(--accent); font-weight: 600; font-size: 16px; }

@media (min-width: 640px) {
  .post-body .consult { padding: 36px 40px; }
  .consult-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 24px; }
  .consult-wide { grid-column: 1 / -1; }
}

/* "Was this helpful? 👍 Helpful 24" */
.post-reactions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; max-width: 800px; margin: 48px auto 0; padding-top: 32px; border-top: 1px solid var(--line); }
.post-reactions p { font-size: 16px; font-weight: 600; color: var(--ink); }
.upvote {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #d5dae6;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.upvote[hidden] { display: none; }
.upvote:hover { border-color: var(--accent); color: var(--accent); }
.upvote:active { transform: scale(0.96); }
.upvote:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.upvote[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }
.upvote[aria-pressed="true"] svg { fill: currentColor; }
.upvote-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.upvote-count:empty { display: none; }

.post-end { margin-top: 48px; }
.post-end .newsletter { margin-bottom: 0; }

@media (min-width: 768px) {
  .post { padding-top: 56px; }
  .post-head h1 { font-size: 46px; }
  .post-desc { font-size: 21px; }
  .post-body h2 { font-size: 28px; }
}

/* Keep reading */
.related { margin-top: 80px; padding-top: 0; padding-bottom: 88px; }
.related-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; margin-top: 32px; }
.related-thumb { aspect-ratio: 16 / 10; margin-bottom: 16px; border-radius: 8px; }
.related-card h3 { margin-top: 6px; font-size: 18px; line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }

@media (min-width: 640px) {
  .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Newsletter ---------- */

.newsletter { display: grid; gap: 20px; margin-bottom: 88px; padding: 32px 24px; border-radius: 16px; background: var(--accent-tint); scroll-margin-top: 96px; }
.newsletter h2 { font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
.newsletter p { margin-top: 6px; font-size: 15px; line-height: 1.6; color: var(--muted); }
.newsletter-row { display: flex; flex-direction: column; gap: 12px; }
.newsletter input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid #d5dae6;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.newsletter input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.newsletter button {
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.newsletter button:hover { background: var(--ink); }
.newsletter button:disabled { opacity: 0.6; }
.newsletter .newsletter-status { min-height: 1.6em; margin-top: 8px; font-size: 14px; }
.newsletter .newsletter-fine { margin-top: 0; font-size: 12px; }
.newsletter-fine a { text-decoration: underline; }

@media (min-width: 640px) {
  .newsletter-row { flex-direction: row; }
}

@media (min-width: 900px) {
  .newsletter { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: 40px; }
  .post-end .newsletter { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

/* ---------- Footer ---------- */

.site-footer { background: #ffffff; border-top: 1px solid var(--line); }
.site-footer .wrap { max-width: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; padding-bottom: 24px; font-size: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .featured-media img, .story-thumb img, .related-thumb img { transition: none; }
  .featured:hover .featured-media img, .story:hover .story-thumb img, .related-card:hover .related-thumb img { transform: none; }
  .upvote, .upvote:active { transition: none; transform: none; }
}
