/*
 * WrittenCheck blog: pages rendered by the CMS inside the site shell
 * (blog index, posts, categories, authors, CMS pages, comments).
 * The block styles below use these tokens, mapped onto the site's own
 * colours so light and dark mode follow the rest of the site.
 */
.blog-page {
  --ink: var(--text);
  --ink-2: var(--text-2);
  --muted: var(--text-3);
  --surface: var(--card);
  --surface-2: var(--card-2);
  --border-strong: var(--border-2);
  --brand: var(--accent);
  --brand-soft: var(--accent-soft);
  --brand-hover: var(--accent-hover);
  --action: var(--accent);
  --action-soft: var(--accent-soft);
  --action-hover: var(--accent-hover);
  --focus: var(--accent);
  --success: var(--human);
  --success-soft: var(--human-soft);
  --warning: var(--mixed);
  --warning-soft: var(--mixed-soft);
  --danger: var(--ai);
  --danger-soft: var(--ai-soft);
  --violet: #7c3aed;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --ease-out: var(--ease);
  --z-sticky: 40;
}
.blog-page .page-container { width: min(1180px, 100% - 40px); margin-inline: auto; }
.nowrap { white-space: nowrap; }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 18px; font-size: .88rem; color: var(--text-3); min-width: 0; }
.breadcrumbs > span:not([aria-current]) { color: var(--border-2); }
.breadcrumbs a { color: var(--text-2); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs [aria-current] { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; min-width: 0; }

/* ---------- Blocks and layouts ---------- */
.blog-page {
  padding-top: 20px;
  padding-bottom: 72px;
  color: var(--ink);
}

.blog-page [id] {
  scroll-margin-top: 88px;
}

.post-preview-banner {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  padding: 10px 16px;
  background: var(--warning-soft);
  color: var(--ink);
  border-bottom: 1px solid var(--border-strong);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

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

.blog-hero {
  max-width: 760px;
  margin: 12px 0 28px;
}
.blog-hero h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.blog-hero p {
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 1.1rem;
  line-height: 1.6;
}

.blog-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 28px;
}
.blog-categories a {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 550;
  text-decoration: none;
}
.blog-categories a:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.blog-categories a[aria-current="page"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-hover);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition:
    border-color 160ms var(--ease-out),
    transform 160ms var(--ease-out);
}
.blog-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.blog-card-media {
  display: block;
  aspect-ratio: 1200 / 630;
  background: var(--surface-2);
}
.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.blog-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px 20px 20px;
}
.blog-card-category {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.blog-card h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.blog-card h2 a {
  color: var(--ink);
  text-decoration: none;
}
.blog-card h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.blog-card {
  position: relative;
}
.blog-card h2 a:focus-visible {
  outline: none;
}
.blog-card:has(h2 a:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.blog-card-body > p:not(.blog-card-category):not(.blog-card-meta) {
  margin: 10px 0 0;
  color: var(--ink-2);
  line-height: 1.55;
}
.blog-card-meta {
  display: flex;
  gap: 14px;
  margin: auto 0 0;
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.85rem;
}

.blog-empty {
  padding: 32px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--ink-2);
  text-align: center;
}

.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 36px;
  color: var(--muted);
}
.blog-pagination a {
  color: var(--action);
  font-weight: 600;
}

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

.post {
  --post-measure: 70ch;
}

.post-header {
  max-width: 1000px;
  margin: 12px 0 28px;
}
.post-eyebrow {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.post-eyebrow a {
  color: var(--brand);
  text-decoration: none;
}
.post-header h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(1.8rem, 1.2rem + 1.7vw, 2.6rem);
  line-height: 1.14;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.post-dek {
  max-width: 68ch;
  margin: 16px 0 0;
  color: var(--ink-2);
  font-size: 1.15rem;
  line-height: 1.55;
}
.post-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.post-byline > span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 12px 2px;
  border-radius: 50%;
  background: var(--border-strong);
  vertical-align: middle;
}
.post-byline strong {
  color: var(--ink-2);
}

.post-cover {
  margin: 0 0 36px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.post-cover img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: cover;
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, var(--post-measure));
  gap: 56px;
  align-items: start;
}
.post-layout-single {
  grid-template-columns: minmax(0, var(--post-measure));
}

.post-aside {
  position: sticky;
  top: 88px;
}
.post-toc summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  list-style: none;
  cursor: pointer;
}
.post-toc summary::-webkit-details-marker {
  display: none;
}
.post-toc-count {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.post-toc-progress {
  display: none;
}
.post-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--border);
}
.post-toc li a {
  display: block;
  padding: 6px 0 6px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.4;
  text-decoration: none;
}
.post-toc li a:hover,
.post-toc li a[aria-current] {
  border-left-color: var(--brand);
  color: var(--ink);
}
.post-toc li a[aria-current] {
  font-weight: 600;
}

/* Body typography ------------------------------------------------------- */

.post-body {
  font-size: 1.075rem;
  line-height: 1.75;
  color: var(--ink);
  overflow-wrap: break-word;
}
.post-body > :first-child {
  margin-top: 0;
}
.post-body p {
  margin: 0 0 1.25em;
}
.post-body h2 {
  margin: 2.2em 0 0.7em;
  font-size: 1.65rem;
  line-height: 1.25;
  letter-spacing: -0.025em;
}
.post-body h3 {
  margin: 1.8em 0 0.6em;
  font-size: 1.3rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.post-body h4 {
  margin: 1.6em 0 0.5em;
  font-size: 1.1rem;
}
.post-body a {
  color: var(--action);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.post-body a:hover {
  color: var(--action-hover);
}
.post-body ul,
.post-body ol {
  margin: 0 0 1.25em;
  padding-left: 1.4em;
}
.post-body li {
  margin: 0.35em 0;
}
.post-body li > p {
  margin: 0;
}
.post-body blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--brand);
  color: var(--ink-2);
  font-size: 1.1rem;
}
.post-body blockquote p:last-child {
  margin-bottom: 0;
}
.post-body code {
  padding: 0.12em 0.35em;
  border-radius: 5px;
  background: var(--surface-2);
  font-size: 0.9em;
}
.post-body pre {
  margin: 1.5em 0;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 0.9rem;
  line-height: 1.6;
}
.post-body pre code {
  padding: 0;
  background: none;
}
.post-body hr {
  margin: 2.5em 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.post-body mark {
  padding: 0 0.15em;
  border-radius: 3px;
  background: var(--warning-soft);
  color: inherit;
}
.post-figure {
  margin: 2em 0;
}
.post-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.post-figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
}
.post-table {
  margin: 1.8em 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.post-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
}
.post-table th,
.post-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.post-table th {
  background: var(--surface-2);
  font-weight: 650;
}
.post-table tr:last-child td {
  border-bottom: 0;
}
.post-table p {
  margin: 0;
}

.post-callout {
  margin: 1.8em 0;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--action);
  border-radius: var(--radius-md);
  background: var(--action-soft);
}
.post-callout-tip {
  border-left-color: var(--success);
  background: var(--success-soft);
}
.post-callout-warning {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}
.post-callout-key {
  border-left-color: var(--brand);
  background: var(--brand-soft);
}
.post-callout-label {
  margin: 0 0 6px !important;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.post-callout > :last-child {
  margin-bottom: 0;
}
/* Links on tinted callouts need the darker shade for 4.5:1 contrast. */
.post-body .post-callout a {
  color: var(--action-hover);
}

.post-faq {
  margin: 2em 0;
  border-top: 1px solid var(--border);
}
.post-faq-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.post-body .post-faq-item h3 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}
.post-faq-answer > :last-child {
  margin-bottom: 0;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2.5em 0 0;
  padding: 0;
  list-style: none;
}
.post-tags li {
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.85rem;
}

/* Author: avatar, byline, card ------------------------------------------ */
.author-avatar {
  display: block;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}
.author-avatar-initials {
  display: inline-grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
}
.byline-who {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.byline-avatar {
  width: 36px;
  height: 36px;
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 3px var(--border);
  font-size: 0.8rem;
}
.post-byline {
  align-items: center;
}

.post-author {
  position: relative;
  display: flex;
  gap: 22px;
  margin: 2.5em 0 0;
  padding: 26px 26px 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: 0.98rem;
  line-height: 1.6;
}
.post-author::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--brand);
}
.post-author-photo .author-avatar {
  width: 88px;
  height: 88px;
  box-shadow:
    0 0 0 3px var(--surface),
    0 0 0 5px var(--brand-soft);
  font-size: 1.6rem;
}
.post-author-body {
  min-width: 0;
  flex: 1;
}
.post-author p {
  margin: 0;
}
.post-author-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.post-author-name {
  margin-top: 2px !important;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
}
.post-author-name a {
  color: var(--ink);
  text-decoration: none;
}
.post-author-name a:hover {
  color: var(--brand);
}
.post-author-role {
  margin-top: 2px !important;
  color: var(--brand);
  font-size: 0.92rem;
  font-weight: 600;
}
.post-author-bio {
  margin-top: 10px !important;
  color: var(--ink-2);
}
.author-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.author-skills li {
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-hover);
  font-size: 0.8rem;
  font-weight: 600;
}
.post-author-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.author-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.author-links li {
  margin: 0;
}
.author-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.author-links a:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.author-links svg {
  opacity: 0.6;
}
.post-author-more {
  margin-left: auto;
  color: var(--action);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}
.post-author-more:hover {
  text-decoration: underline;
}
@media (max-width: 600px) {
  .post-author {
    flex-direction: column;
    gap: 14px;
    padding: 22px 18px 18px;
  }
  .post-author-photo .author-avatar {
    width: 72px;
    height: 72px;
  }
}

/* Author page hero */
.author-hero {
  position: relative;
  display: flex;
  gap: 36px;
  align-items: flex-start;
  margin: 12px 0 40px;
  padding: 36px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
}
.author-hero-photo .author-avatar {
  width: 148px;
  height: 148px;
  box-shadow:
    0 0 0 5px var(--surface),
    0 0 0 7px var(--brand-soft),
    0 18px 40px -18px rgb(15 23 42 / 0.45);
  font-size: 2.6rem;
}
.author-hero-body {
  min-width: 0;
  flex: 1;
}
.author-hero h1 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 1.5rem + 1.6vw, 2.8rem);
  line-height: 1.1;
}
.author-hero-role {
  margin: 8px 0 0;
  color: var(--brand);
  font-size: 1.05rem;
  font-weight: 700;
}
.author-hero-location {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.author-hero-bio {
  max-width: 70ch;
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 1.05rem;
  line-height: 1.65;
}
.author-hero .author-links {
  margin-top: 16px;
}
.author-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.author-stats li {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in oklch, var(--surface) 80%, transparent);
}
.author-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
}
.author-stats span {
  color: var(--muted);
  font-size: 0.82rem;
}
.author-posts-title {
  margin: 0 0 18px;
  font-size: 1.35rem;
}
@media (max-width: 760px) {
  .author-hero {
    flex-direction: column;
    gap: 18px;
    padding: 24px 20px;
  }
  .author-hero-photo .author-avatar {
    width: 112px;
    height: 112px;
  }
}

.post-cta {
  margin: 2em 0 0;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
  font-size: 0.98rem;
  line-height: 1.6;
}
.post-cta p {
  margin: 0;
}

.post-related {
  margin-top: 64px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}
.post-related h2 {
  margin: 0 0 20px;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

@media (max-width: 960px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .post-aside {
    position: static;
  }
  .post-toc {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
  }
}

@media (max-width: 600px) {
  .post-body {
    font-size: 1.02rem;
  }
  .post-body h2 {
    font-size: 1.4rem;
  }
}

/* Layouts ---------------------------------------------------------------- */

.post-wide {
  --post-measure: 92ch;
}
.post-wide .post-layout-single {
  grid-template-columns: minmax(0, var(--post-measure));
}
.post-toc-inline {
  margin: 0 0 2em;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.post-minimal {
  --post-measure: 64ch;
}
.post-minimal .post-header,
.post-minimal .post-layout {
  max-width: var(--post-measure);
  margin-left: auto;
  margin-right: auto;
}
.post-minimal .post-layout-single {
  display: block;
}
.post-summary {
  margin-top: 0;
}

/* Buttons, video and image sizes ---------------------------------------- */

.post-button-row {
  margin: 1.6em 0;
}
.post-body a.post-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-md);
  font-weight: 650;
  text-decoration: none;
}
.post-body a.post-button-primary {
  background: var(--brand);
  color: var(--surface);
}
.post-body a.post-button-primary:hover {
  background: var(--brand-hover);
  color: var(--surface);
}
.post-body a.post-button-secondary {
  background: transparent;
  color: var(--brand-hover);
}
.post-video {
  margin: 2em 0;
}
.post-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.post-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.post-figure-medium {
  max-width: 66%;
  margin-left: auto;
  margin-right: auto;
}
.post-figure-small {
  max-width: 42%;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 1100px) {
  .post-figure-wide {
    margin-left: -8%;
    margin-right: -8%;
  }
}
@media (max-width: 600px) {
  .post-figure-medium,
  .post-figure-small {
    max-width: 100%;
  }
}

/* Image alignment (text wraps around medium and small images) */
@media (min-width: 601px) {
  .post-figure-left {
    float: left;
    margin: 4px 24px 12px 0;
  }
  .post-figure-right {
    float: right;
    margin: 4px 0 12px 24px;
  }
  .post-body h2,
  .post-body h3,
  .post-body .post-columns,
  .post-body .post-gallery,
  .post-body .post-faq {
    clear: both;
  }
}
.post-figure a {
  display: block;
}

/* Columns */
.post-columns {
  display: grid;
  gap: 24px;
  margin: 24px 0;
}
.post-columns-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.post-columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.post-columns-2.post-columns-wide-left {
  grid-template-columns: 2fr 1fr;
}
.post-columns-2.post-columns-wide-right {
  grid-template-columns: 1fr 2fr;
}
.post-column > :first-child {
  margin-top: 0;
}
.post-column > :last-child {
  margin-bottom: 0;
}
@media (max-width: 700px) {
  .post-columns,
  .post-columns-2.post-columns-wide-left,
  .post-columns-2.post-columns-wide-right {
    grid-template-columns: 1fr;
  }
}

/* Gallery */
.post-gallery {
  display: grid;
  gap: 10px;
  margin: 24px 0;
}
.post-gallery-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.post-gallery-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.post-gallery-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.post-gallery figure {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  aspect-ratio: 4 / 3;
}
.post-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 600px) {
  .post-gallery-3,
  .post-gallery-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Accordion */
.post-accordion {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.post-accordion summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 650;
  list-style-position: inside;
}
.post-accordion summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}
.post-accordion-body {
  padding: 0 18px 14px;
}
.post-accordion-body > :first-child {
  margin-top: 0;
}

/* Pros and cons */
.post-proscons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.post-pros,
.post-cons {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.post-pros {
  background: var(--success-soft);
}
.post-cons {
  background: var(--danger-soft);
}
.post-proscons-title {
  margin: 0 0 8px;
  font-weight: 700;
}
.post-pros .post-proscons-title {
  color: var(--success);
}
.post-cons .post-proscons-title {
  color: var(--danger);
}
.post-proscons ul {
  margin: 0;
  padding-left: 1.2em;
}
@media (max-width: 600px) {
  .post-proscons {
    grid-template-columns: 1fr;
  }
}

/* Pull quote */
.post-pullquote {
  margin: 32px 0;
  padding: 8px 0 8px 24px;
  border-left: 4px solid var(--brand);
}
.post-pullquote blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
.post-pullquote blockquote p {
  margin: 0;
  font-size: 1.35em;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink);
}
.post-pullquote figcaption {
  margin-top: 10px;
  color: var(--muted);
}
.post-pullquote figcaption::before {
  content: "\2013  ";
}

/* Table of contents block */
.post-toc-block {
  margin: 24px 0;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.post-toc-block-title {
  margin: 0 0 6px;
  font-weight: 700;
}
.post-toc-block ol {
  margin: 0;
  padding-left: 1.3em;
}

/* Featured post and author pages */
.blog-card-featured {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  margin-bottom: 24px;
}
.blog-card-featured .blog-card-media {
  aspect-ratio: auto;
  min-height: 100%;
}
.blog-card-featured .blog-card-body {
  justify-content: center;
  padding: 28px 32px;
}
.blog-card-featured h2 {
  font-size: clamp(1.35rem, 1rem + 1.2vw, 1.75rem);
  line-height: 1.22;
}
.blog-card-flag {
  align-self: flex-start;
  margin: 0 0 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
}
@media (max-width: 760px) {
  .blog-card-featured {
    grid-template-columns: 1fr;
  }
  .blog-card-featured .blog-card-media {
    aspect-ratio: 1200 / 630;
  }
}
.blog-author-org {
  font-weight: 600;
  color: var(--ink-2);
}
.post-byline a {
  color: inherit;
}

/* Custom pages ---------------------------------------------------------- */
.custom-page {
  padding-bottom: 64px;
}
.custom-page-page .custom-page-header,
.custom-page-page .custom-page-body,
.custom-page-page .post-comments {
  max-width: 760px;
}
.custom-page-wide .custom-page-header,
.custom-page-wide .custom-page-body {
  max-width: 1040px;
}
.custom-page-full .custom-page-body {
  max-width: none;
}
.custom-page-landing {
  padding-top: 32px;
}
.custom-page-header {
  margin: 8px 0 24px;
}
.custom-page-header h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.custom-page .post-cover {
  margin: 0 0 32px;
}

/* Reader comments ------------------------------------------------------- */
.post-comments-wrap {
  max-width: 760px;
}
.post-comments {
  margin: 48px 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.post-comments h2 {
  margin: 0 0 20px;
  font-size: 1.4rem;
}
.comment-list,
.comment-children {
  display: grid;
  gap: 16px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}
.comment-children {
  margin: 14px 0 0 22px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}
.comment {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.comment-owner {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface));
}
.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.comment-head time {
  color: var(--muted);
  font-size: 0.85rem;
}
.comment-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}
.comment-body p {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.comment-body p:last-child {
  margin-bottom: 0;
}
.comment-reply {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--action);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.comment-form {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.comment-form h3 {
  margin: 0;
  font-size: 1.1rem;
}
.comment-form label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 600;
}
.comment-form label small {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}
.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}
.comment-form input:focus-visible,
.comment-form textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
.comment-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.comment-hp {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.comment-note,
.comment-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.comment-status:empty {
  display: none;
}
.comment-submit {
  justify-self: start;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.comment-submit:hover {
  background: var(--brand-hover);
}
.comment-submit:disabled {
  opacity: 0.6;
}
.comment-replying {
  margin: 0;
  font-size: 0.9rem;
}
.comment-cancel {
  border: 0;
  background: none;
  color: var(--action);
  font: inherit;
  cursor: pointer;
}
@media (max-width: 600px) {
  .comment-fields {
    grid-template-columns: 1fr;
  }
  .comment-children {
    margin-left: 8px;
    padding-left: 10px;
  }
}

/* Article + sticky sidebar ---------------------------------------------- */

.post-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  grid-template-areas:
    "cover rail"
    "main rail";
  column-gap: 48px;
  align-items: start;
}
.post-shell-nocover {
  grid-template-areas: "main rail";
}
.post-shell > .post-cover {
  grid-area: cover;
}
.post-main {
  grid-area: main;
  min-width: 0;
}
.post-main .post-body {
  max-width: var(--post-measure);
}
.post-rail {
  grid-area: rail;
  position: sticky;
  top: 84px;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 4px 16px 2px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.post-rail:hover,
.post-rail:focus-within {
  scrollbar-color: var(--border-strong) transparent;
}
.post-rail-extra {
  display: grid;
  gap: 16px;
}

.post-toc-rail,
.rail-card {
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.post-toc-rail summary {
  margin: 0;
  color: var(--ink);
  font-size: 0.8rem;
}
.post-toc-rail[open] summary {
  margin-bottom: 10px;
}
.post-toc-rail .post-toc-count {
  color: var(--muted);
  font-size: 0.8rem;
}
.post-toc-rail .post-toc-progress {
  display: block;
  height: 3px;
  margin: 0 0 12px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-2);
}
.post-toc-progress span {
  display: block;
  height: 100%;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 120ms linear;
}
.post-toc-rail ol {
  max-height: min(34vh, 300px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.post-toc-rail li a {
  padding: 5px 0 5px 12px;
  font-size: 0.875rem;
}

.rail-card h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rail-card ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail-tools a {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 12px;
  margin: 0 -10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
  transition: background 140ms var(--ease-out);
}
.rail-tools a:hover {
  background: var(--surface-2);
}
.rail-tool-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
}
.rail-tool-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.rail-tool-text strong {
  font-size: 0.95rem;
  line-height: 1.3;
}
.rail-tool-text span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.rail-arrow {
  color: var(--muted);
  transition:
    transform 140ms var(--ease-out),
    color 140ms var(--ease-out);
}
.rail-tools a:hover .rail-arrow {
  color: var(--brand);
  transform: translateX(2px);
}
.rail-note {
  margin: 10px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.rail-card .rail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.rail-chips a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.85rem;
  font-weight: 550;
  text-decoration: none;
}
.rail-chips a span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.rail-chips a:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.rail-chips a[aria-current] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-hover);
}
.rail-posts a {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 0 -10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
}
.rail-posts a:hover {
  background: var(--surface-2);
}
.rail-posts img,
.rail-post-ph {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-2);
}
.rail-post-ph {
  display: grid;
  place-items: center;
  color: var(--brand);
  font-weight: 700;
}
.rail-posts strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.9rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.rail-posts small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}
.rail-all {
  display: inline-block;
  margin-top: 12px;
  color: var(--action);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Wide and minimal layouts show the same cards under the article. */
.post-explore {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  max-width: var(--post-measure);
  margin: 40px 0 0;
}
.post-minimal .post-explore {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1079px) {
  .post-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "cover"
      "toc"
      "main"
      "extra";
  }
  .post-shell-nocover {
    grid-template-areas:
      "toc"
      "main"
      "extra";
  }
  .post-rail {
    display: contents;
  }
  .post-toc-rail {
    grid-area: toc;
    margin: 0 0 28px;
  }
  .post-toc-rail .post-toc-progress {
    display: none;
  }
  .post-toc-rail ol {
    max-height: none;
  }
  .post-rail-extra {
    grid-area: extra;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    margin-top: 40px;
  }
}
@media (max-width: 600px) {
  .post-toc-rail,
  .rail-card {
    padding: 14px 16px;
  }
}
@media print {
  .post-rail,
  .post-explore {
    display: none;
  }
}
.post .post-author ul.author-skills,
.post .post-author ul.author-links {
  margin-left: 0;
  padding-left: 0;
}
.post .post-author ul.author-skills {
  margin-top: 12px;
}
.post .post-author ul.author-links {
  margin-top: 0;
  margin-bottom: 0;
}
.post .post-author ul li::before,
.author-hero ul li::before {
  content: none;
}
