/* Article page — server-rendered case study (reuses modal content classes from main.css) */

.article-page {
  background: var(--bg, #faf8f4);
  color: var(--ink, #0f0e0d);
  min-height: 100vh;
  overflow-x: clip;
  --article-content-max: min(860px, 100%);
  --article-wide-max: min(1200px, calc(100% - 2.5rem));
}

.article-shell {
  min-width: 0;
  overflow-x: clip;
}

.article-topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--explore-nav-h, 56px);
  padding: max(.75rem, env(safe-area-inset-top, 0px)) 1.25rem .75rem;
  box-sizing: border-box;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
}

.article-topnav.scrolled {
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom-color: var(--border);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--ink) 8%, transparent);
}

.article-topnav-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.015em;
  transition: color 0.2s ease;
}
.article-topnav-logo .accent {
  color: var(--accent);
  font-style: italic;
}
.article-topnav-logo:hover { color: var(--accent); }

.article-topnav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-topnav .theme-toggle {
  color: var(--ink);
  position: relative;
  z-index: 2;
}

.article-topnav .theme-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.article-topnav .theme-toggle .icon-sun,
.article-topnav .theme-toggle .icon-moon {
  display: none;
}

.article-topnav .theme-toggle .icon-moon {
  display: block;
}

[data-theme="dark"] .article-topnav .theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .article-topnav .theme-toggle .icon-sun {
  display: block;
}

.article-topnav .theme-toggle:hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
}

.article-page {
  padding-top: var(--explore-nav-h, 56px);
}

.article-topnav-back {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink);
  text-decoration: none;
}

.article-topnav-arrow {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Reading progress — fixed to viewport top */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1000;
  pointer-events: none;
  background: transparent;
}
.read-progress__bar {
  height: 100%;
  width: 100%;
  background: var(--company-color, var(--accent, #c8390a));
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.article-header {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}

.article-stripe {
  height: 4px;
  border-radius: 2px;
  margin-bottom: 1.25rem;
  max-width: var(--article-content-max);
  margin-left: auto;
  margin-right: auto;
}

.article-header-inner {
  min-width: 0;
  max-width: var(--article-content-max);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.article-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.article-breadcrumb li:not(:last-child)::after {
  content: '/';
  margin-left: .5rem;
  color: var(--muted);
}

.article-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.article-breadcrumb a:hover { color: var(--accent); }

.article-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.15;
  margin: .75rem 0;
}

.article-header-byline { margin: .5rem 0 .85rem; }

.article-meta-row {
  display: flex;
  flex-wrap: nowrap;
  gap: .5rem;
  align-items: center;
  overflow: hidden;
  min-width: 0;
}

.article-meta-row .co-badge,
.article-meta-row .cat-chip {
  text-decoration: none;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.article-meta-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .85rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem;
  color: var(--muted);
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.article-meta-item { white-space: nowrap; }
.article-meta-rating {
  font-weight: 600;
  color: var(--accent);
  padding: .18rem .55rem;
  border-radius: 999px;
  background: rgba(200, 57, 10, .1);
}

.article-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  margin-bottom: .75rem;
}

.article-byline-author {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: inherit;
}

.article-byline-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
  flex-shrink: 0;
}

.article-byline-avatar--initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  background: #1a1917;
  color: #faf8f4;
}

.article-byline-text {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}

.article-byline-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}

.article-byline-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.article-byline-reviewer {
  font-size: .85rem;
  color: var(--muted);
  text-decoration: none;
}

.article-byline-avatar--brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #d94a1a 0%, var(--accent) 55%, #a02d07 100%);
  color: #fff;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(200, 57, 10, .28);
}

.article-editorial-box {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
}
.article-editorial-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 0 0 .65rem;
}
.article-editorial-text {
  margin: 0;
  font-size: .92rem;
  line-height: 1.65;
  color: var(--ink);
}


/* Layout: TOC rail + content + share rail */
.article-layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.article-main { min-width: 0; }

.article-content {
  max-width: var(--article-content-max);
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
}

.article-body {
  --company-color: var(--accent, #c8390a);
  font-size: clamp(1rem, 1.05vw, 1.0625rem);
  line-height: 1.75;
}

/* Unify modal-era body classes with article typography */
.article-body .story-body,
.article-body .story-body p,
.article-body .article-section p,
.article-body .article-section li {
  font-size: inherit;
  line-height: inherit;
  color: var(--ink);
}

.article-body .sec-hdr {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: clamp(3rem, 6vh, 4.5rem);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  max-width: none;
}

.article-body .story-body strong,
.article-body strong {
  font-weight: 600;
}

.article-body .story-lede {
  font-size: 1.12em;
  line-height: 1.65;
}

.article-body p,
.article-body > .story-body > p,
.article-body .article-section > .story-body > p {
  margin: 0 0 1.25em;
}

.article-body .story-lede + .story-body > p:first-child {
  font-size: 1.08em;
  line-height: 1.7;
}

.article-section .sec-hdr,
.article-body h2.sec-hdr {
  margin-top: clamp(3rem, 6vh, 4.5rem);
  margin-bottom: 1rem;
  max-width: 68ch;
}

.article-body h3,
.article-body h4 {
  max-width: 68ch;
}

/* Feature-width breakouts */
.article-body .metrics-band,
.article-body .compare-wrap,
.article-body .table-scroll,
.article-body .code-block-wrap,
.article-body .code-block,
.article-body .mermaid-wrap,
.article-body .timeline,
.article-body .lessons-remember {
  max-width: min(860px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.article-body a[href^="http"]:not([href*="techlogstack"])::after {
  content: " ↗";
  font-size: .75em;
  opacity: .55;
}

.heading-anchor {
  opacity: 0;
  margin-left: .35em;
  color: var(--accent);
  text-decoration: none;
  font-weight: 400;
  transition: opacity .15s;
}
.sec-hdr:hover .heading-anchor,
h3:hover .heading-anchor {
  opacity: 1;
}
.heading-anchor.is-copied::after {
  content: "Copied";
  font-family: 'IBM Plex Mono', monospace;
  font-size: .55rem;
  margin-left: .35em;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* TL;DR */
.tldr {
  margin: 1.25rem 0 0;
  padding: 1rem 1.15rem;
  background: var(--cream, #faf6f0);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  max-width: 68ch;
}
.tldr__label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: .5rem;
}
.tldr__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .92rem;
  line-height: 1.5;
}

/* Lessons — What to remember */
.lessons-remember {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  background: var(--card-bg, #fff);
  content-visibility: auto;
  contain-intrinsic-size: auto 280px;
}
.lessons-remember-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin: 0 0 .85rem;
}
.lessons-remember-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.lesson-item {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: .75rem;
  align-items: start;
}
.lesson-item .lesson-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  padding-top: .15rem;
}
.lesson-item .lesson-body {
  font-size: .95rem;
  line-height: 1.65;
}

/* FAQ */
.article-faq-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}
.article-faq-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  overflow: hidden;
}
.article-faq-q {
  padding: .85rem 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.article-faq-q::-webkit-details-marker { display: none; }
.article-faq-a {
  padding: 0 1rem 1rem;
  font-size: .95rem;
  line-height: 1.65;
  color: var(--muted);
}

/* Sources */
.article-sources-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin: 0 0 .75rem;
}
.article-sources-list {
  margin: 0;
  padding: 0 0 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}
.article-sources-item {
  font-size: .9rem;
  line-height: 1.5;
}
.article-sources-pub,
.article-sources-date {
  color: var(--muted);
  font-size: .82rem;
}
.article-sources-pub::before { content: " · "; }

/* Author social */
.article-author-box-inner {
  flex-direction: column;
  align-items: stretch;
}
.article-author-box-main {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
}
.article-author-social {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.article-author-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: color .15s, border-color .15s;
}
.article-author-social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Feedback — radio stars */
.fstar-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.article-feedback-stars .fstar {
  cursor: pointer;
}
.article-feedback-stars .fstar-radio:checked + .fstar,
.article-feedback-stars .fstar.on {
  color: var(--accent);
}
.article-feedback-submit:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.article-feedback[hidden] {
  display: none !important;
}
.feedback-hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
}

/* Adjacent nav */
.article-adjacent {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.article-adjacent-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .55rem;
  padding: 1.15rem 1.25rem 1.15rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease;
}

.article-adjacent-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--adjacent-accent, var(--accent));
  opacity: .85;
}

.article-adjacent-link:hover {
  border-color: color-mix(in srgb, var(--adjacent-accent, var(--accent)) 45%, var(--border));
  box-shadow: 0 10px 28px rgba(0, 0, 0, .07);
  transform: translateY(-2px);
}

.article-adjacent-prev:hover { transform: translateY(-2px) translateX(-2px); }
.article-adjacent-next:hover { transform: translateY(-2px) translateX(2px); }

.article-adjacent-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
}

.article-adjacent-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}

.article-adjacent-co {
  display: inline-flex;
  align-self: flex-start;
  max-width: 100%;
  padding: .22rem .65rem;
  border-radius: 999px;
  background: var(--adjacent-accent, var(--accent));
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-adjacent-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.article-adjacent-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.article-adjacent-next {
  align-items: flex-end;
  text-align: right;
  padding: 1.15rem 1.4rem 1.15rem 1.25rem;
}

.article-adjacent-next::before {
  left: auto;
  right: 0;
  border-radius: 3px 0 0 3px;
}

.article-adjacent-next .article-adjacent-top {
  flex-direction: row-reverse;
}

.article-adjacent-next .article-adjacent-co {
  align-self: flex-end;
}

.article-adjacent-spacer { display: none; }

/* Mermaid — static server-rendered SVG (no pan/zoom) */
.mermaid-wrap {
  margin: 1.25rem 0;
  padding: 1.15rem 1.25rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg, var(--paper));
  overflow: hidden;
}

.mermaid-title {
  margin: 0 0 .85rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.mermaid-diagram {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  line-height: 0;
  overflow: hidden;
}

.mermaid-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.mermaid-caption {
  margin: .85rem 0 0;
  font-size: .82rem;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
}

.mermaid-diagram--fallback {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  border-radius: 8px;
}

.mermaid-fallback-msg {
  margin: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem;
  color: var(--muted);
}

.mermaid-wrap--fallback .mermaid-zoom-bar {
  display: none;
}

/* Articles: responsive SVG only — no pan/zoom chrome from explore modal */
.article-body .mermaid-pan-viewport {
  max-height: none;
  min-height: 0;
  overflow: visible;
  background: transparent;
}

.article-body .mermaid-pan-stage {
  display: block;
  width: 100%;
  transform: none !important;
}

.article-body .mermaid-zoom-bar {
  display: none !important;
}

/* Code blocks — subtle scrollbars inside dark panels */
.article-body .code-block-wrap {
  margin: 1.25rem 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  overflow: hidden;
  background: #1a1917;
}

.article-body .code-block-wrap .code-block {
  margin: 0;
  border-radius: 0;
  max-height: min(420px, 52vh);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
}

.article-body .code-block-wrap .code-block::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.article-body .code-block-wrap .code-block::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .22);
  border-radius: 999px;
}

.article-body .code-block-wrap .code-block::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .35);
}

.article-body pre.code-block:not(.code-block-wrap pre) {
  border-radius: 10px;
  max-height: min(420px, 52vh);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
}

.article-body pre.code-block:not(.code-block-wrap pre)::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.article-body pre.code-block:not(.code-block-wrap pre)::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .22);
  border-radius: 999px;
}

/* Legacy duplicate — keep minimal */
.article-body .code-block-wrap,
.article-body .code-block,
pre.code-block {
  tab-size: 2;
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.table-scroll::after {
  content: "";
  position: sticky;
  right: 0;
  display: block;
  height: 1px;
  pointer-events: none;
}

.article-end .article-faq {
  content-visibility: auto;
  contain-intrinsic-size: auto 240px;
}

.article-end {
  max-width: none;
  margin: 0 auto;
  padding: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  box-sizing: border-box;
}

.article-end > * {
  max-width: var(--article-content-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  box-sizing: border-box;
}

/* Feedback card — override article-end child width (specificity beats `.article-end > *`) */
.article-end > .article-feedback {
  --feedback-max: 32rem;
  max-width: var(--feedback-max);
  width: min(100%, var(--feedback-max));
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--ink) 5%, transparent) inset,
    0 10px 36px color-mix(in srgb, var(--ink) 7%, transparent);
}

.article-end-wide {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  box-sizing: border-box;
}

.article-end-wide .related-stories,
.article-end-wide .article-adjacent {
  width: 100%;
  max-width: var(--article-wide-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  box-sizing: border-box;
}

/* Mobile TOC accordion */
.article-toc-mobile {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.article-toc-mobile > summary,
.article-toc-mobile-nav {
  max-width: var(--article-content-max);
  margin-left: auto;
  margin-right: auto;
}
.article-toc-mobile-summary {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink);
  padding: .85rem 0;
  cursor: pointer;
  list-style: none;
}
.article-toc-mobile-summary::-webkit-details-marker { display: none; }
.article-toc-mobile-nav {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 0 0 1rem;
}
.article-toc-desktop { display: none; }

.article-toc-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 0 0 .75rem;
}
.article-toc-desktop-nav,
.article-toc-mobile-nav {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.article-toc-link {
  font-size: .78rem;
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  padding: .28rem 0 .28rem .65rem;
  border-left: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.article-toc-link:hover { color: var(--ink); }
.article-toc-link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.article-share-rail { display: none; }
.article-share-mobile { display: block; }

/* Share buttons */
.article-share {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .65rem;
}
.article-share--rail {
  position: sticky;
  top: 5.5rem;
  align-items: center;
}
.article-share-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.article-share-buttons {
  display: flex;
  flex-direction: row;
  gap: .45rem;
}
.article-share--rail .article-share-buttons {
  flex-direction: column;
}
.article-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg, #fff);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .2s, background .2s;
}
.article-share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}
.article-share-copy.is-copied {
  border-color: #639922;
  color: #639922;
  background: #eaf3de;
}
.article-share-check-icon[hidden] { display: none; }
.article-share-copy.is-copied .article-share-copy-icon { display: none; }
.article-share-copy.is-copied .article-share-check-icon { display: block; }

/* Takeaways */
.article-takeaways {
  background: var(--cream, #f2ede4);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 1.35rem 1.5rem;
}
.article-takeaways-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  margin: 0 0 .85rem;
}
.article-takeaways-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.article-takeaways-list li {
  font-size: .9rem;
  line-height: 1.6;
  color: var(--ink);
}

/* Author end box */
.article-author-box-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 0 0 .75rem;
}
.article-author-box-inner {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  transition: border-color .2s, box-shadow .2s;
}
.article-author-box-main:hover .article-author-box-name {
  color: var(--accent);
}
.article-author-box-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.article-author-box-photo--initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  background: #1a1917;
  color: #faf8f4;
}
.article-author-box-body {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
}
.article-author-box-name { font-weight: 700; font-size: 1.05rem; }
.article-author-box-role {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
}
.article-author-box-bio {
  font-size: .88rem;
  line-height: 1.55;
  color: var(--muted);
  margin-top: .15rem;
}
.article-author-box-link {
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: .35rem;
}

/* Inline feedback */
.article-feedback-accent {
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 72%, #ef9f27)
  );
}

.article-feedback-head {
  padding: 1.35rem 1.5rem 0;
  text-align: center;
}

.article-feedback-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .55rem;
}

.article-feedback-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.15rem, 2.5vw, 1.3rem);
  font-weight: 700;
  margin: 0 0 .4rem;
  color: var(--ink);
  line-height: 1.25;
}

.article-feedback-sub {
  font-size: .88rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
  max-width: 26rem;
  margin-inline: auto;
}

.article-feedback-panel {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.25rem 1.5rem 1.5rem;
}

.article-feedback-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  padding: .95rem 1rem 1rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--cream) 72%, var(--card-bg));
}

.article-feedback-rating-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.article-feedback-stars {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: .35rem;
  margin: 0;
}

.article-feedback-stars .fstar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  font-size: 1.55rem;
  line-height: 1;
  color: color-mix(in srgb, var(--muted) 45%, var(--border));
  border-radius: 999px;
  cursor: pointer;
  transition: color .18s ease, transform .18s ease, background .18s ease;
}

.article-feedback-stars .fstar:hover {
  color: color-mix(in srgb, var(--accent) 65%, var(--muted));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  transform: scale(1.06);
}

.article-feedback-stars .fstar-radio:checked + .fstar,
.article-feedback-stars .fstar.on {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.article-feedback-field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.article-feedback-field-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.article-feedback-comment {
  display: block;
  width: 100%;
  min-height: 4.75rem;
  padding: .75rem .85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: .88rem;
  line-height: 1.55;
  resize: none;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}

.article-feedback-comment::placeholder {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}

.article-feedback-comment:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.article-feedback-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: .15rem;
}

.article-feedback-submit {
  margin: 0;
  padding: .65rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  width: auto;
  transition: background .15s ease, opacity .15s ease;
}

.article-feedback-submit:hover:not(:disabled) {
  background: #b8320a;
}

[data-theme="dark"] .article-feedback-submit:hover:not(:disabled) {
  background: #c93f10;
}

.article-feedback-thanks {
  margin: 0;
  padding: 1.25rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  text-align: center;
}

[data-theme="dark"] .article-end > .article-feedback {
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--ink) 8%, transparent) inset,
    0 12px 40px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .article-feedback-rating {
  background: color-mix(in srgb, var(--paper) 55%, var(--card-bg));
  border-color: var(--border);
}

/* Prev / next — base grid (detailed styles above) */

/* In-body motion hooks */
.article-content .js-article-reveal {
  opacity: 0;
  transform: translateY(18px);
}
.article-content .js-article-reveal.is-revealed {
  opacity: 1;
  transform: none;
}

/* Pull quotes */
.article-content .pull-quote,
.article-content .bq-text,
.article-content blockquote.bq-text {
  position: relative;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.65;
  color: var(--ink);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem 1rem 3.25rem;
  margin: 1.35rem 0;
  background: linear-gradient(to right, rgba(200, 57, 10, .06), transparent);
  border-radius: 0 10px 10px 0;
}
.article-content .fun-quote {
  position: relative;
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding-left: 3.25rem;
}
.pull-quote-mark {
  position: absolute;
  left: .85rem;
  top: .15rem;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3.25rem;
  line-height: 1;
  color: var(--accent);
  opacity: .35;
  pointer-events: none;
  transform-origin: left top;
}

/* Timeline scrub */
.article-content .timeline {
  --tl-progress: 0;
}
.article-content .timeline::before {
  transform: scaleY(var(--tl-progress));
  transform-origin: top center;
}
.article-content .tl-node {
  opacity: 0;
  transform: translateY(14px);
}
.article-content .tl-node.is-revealed {
  opacity: 1;
  transform: none;
}

/* Code copy */
.code-block-wrap,
.article-content pre.code-block {
  position: relative;
}
.code-copy-btn {
  position: absolute;
  top: .45rem;
  right: .45rem;
  z-index: 2;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .28rem .55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(250, 248, 244, .92);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.code-block-wrap .code-copy-btn { top: 2.15rem; }
.code-copy-btn:hover { color: var(--ink); border-color: var(--ink); }
.code-copy-btn.is-copied {
  color: #27500a;
  border-color: #639922;
  background: #eaf3de;
}

@media (min-width: 768px) {
  .article-adjacent {
    grid-template-columns: 1fr 1fr;
  }
  .article-adjacent-spacer { display: block; }
}

@media (min-width: 1100px) {
  .article-header {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 0;
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) 56px;
    column-gap: 2.5rem;
  }

  .article-stripe,
  .article-header-inner {
    grid-column: 2;
    max-width: var(--article-content-max);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .article-toc-mobile { display: none; }
  .article-toc-desktop {
    display: block;
    position: sticky;
    top: 5.5rem;
    align-self: start;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding-top: 1.5rem;
    transition: opacity .4s ease, visibility .4s ease;
  }
  .article-toc-desktop.is-toc-faded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .article-share-rail { display: block; }
  .article-share-mobile { display: none; }
  .article-layout {
    grid-template-columns: 200px minmax(0, 1fr) 56px;
    gap: 2rem 2.5rem;
  }
  .article-content,
  .article-end {
    max-width: none;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }
  .article-end > * {
    max-width: var(--article-content-max);
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .article-end > .article-feedback {
    max-width: 32rem;
    width: min(100%, 32rem);
    padding: 0;
  }

  .article-layout > .article-end-wide {
    grid-column: 1 / -1;
    padding-bottom: 2rem;
  }

  .article-end-wide .related-stories,
  .article-end-wide .article-adjacent {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-adjacent-link:hover,
  .article-adjacent-prev:hover,
  .article-adjacent-next:hover { transform: none; }
  .article-toc-desktop {
    transition: none;
  }
  .article-content .js-article-reveal {
    opacity: 1;
    transform: none;
  }
  .article-content .tl-node {
    opacity: 1;
    transform: none;
  }
}

.article-section { margin-bottom: 2.5rem; }

.article-section .sec-hdr {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
  margin: 0 0 1rem;
}

/* Hub pages */
.hub-page {
  background: var(--bg, #faf8f4);
  min-height: 100vh;
  padding-top: var(--explore-nav-h, 56px);
}

.hub-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 1rem;
  text-align: center;
}

.hub-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin: 0 0 .75rem;
}

.hub-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin: 0 0 1rem;
}

.hub-intro {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
  margin: 0;
}

.hub-grid-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

.hub-grid { margin-top: 1rem; }

.hub-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}

.hub-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  margin: 0 0 1rem;
}

/* Author page */
.author-header {
  max-width: 560px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  text-align: center;
}

.author-photo {
  border-radius: 50%;
  margin-bottom: 1rem;
}

.author-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  margin: 0 0 .35rem;
}

.author-role {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin: 0 0 1rem;
}

.author-bio {
  line-height: 1.65;
  color: var(--muted);
  margin: 0 0 1rem;
}

.author-social {
  display: flex;
  justify-content: center;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.author-social a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink);
  text-decoration: none;
}

.author-social a:hover { color: var(--accent); }

/* Related stories */
.related-stories {
  margin: 0;
  padding: 0;
  width: 100%;
}

.related-stories-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
  margin: 0 0 1.25rem;
}

.related-stories-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: stretch;
  width: 100%;
}

.related-stories-grid .case-card {
  height: 100%;
  min-width: 0;
}

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

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

/* Newsletter inline */
.newsletter-inline {
  background: var(--cream);
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.25rem;
}

.newsletter-inline-inner {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.newsletter-inline-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin: 0 0 .5rem;
}

.newsletter-inline-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 .5rem;
}

.newsletter-inline-sub {
  color: var(--muted);
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

.newsletter-inline-form {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

@media (min-width: 480px) {
  .newsletter-inline-form {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .newsletter-inline-field { flex: 1 1 140px; max-width: 200px; }
}

.newsletter-inline-field {
  padding: .65rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--card-bg);
  color: var(--ink);
}
.newsletter-inline-field::placeholder {
  color: var(--muted);
  opacity: .85;
}
.newsletter-inline-msg {
  color: var(--ink);
}

.newsletter-inline-submit {
  padding: .65rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.newsletter-inline-msg { margin-top: .75rem; font-size: .9rem; }
.newsletter-inline-error { margin-top: .5rem; font-size: .85rem; color: var(--accent); }
.newsletter-inline-error[hidden] { display: none !important; }
.newsletter-inline-proof {
  margin: .75rem 0 0;
  font-size: .78rem;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
}
.newsletter-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.newsletter-inline-submit.is-success {
  background: var(--accent);
  border-color: var(--accent);
}

/* Newsletter slide-in (articles only) */
.newsletter-slidein {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 150;
  width: min(320px, calc(100vw - 2rem));
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  transform: translateY(120%);
  opacity: 0;
  transition: transform .35s ease, opacity .35s ease;
}

.newsletter-slidein.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .newsletter-slidein { transition: opacity .2s ease; transform: none; }
  .newsletter-slidein:not(.is-visible) { opacity: 0; pointer-events: none; }
}

.newsletter-slidein-close {
  position: absolute;
  top: .5rem;
  right: .65rem;
  border: none;
  background: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted);
}

.newsletter-slidein-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin: 0 0 .35rem;
}

.newsletter-slidein-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  margin: 0 0 .35rem;
}

.newsletter-slidein-sub {
  font-size: .88rem;
  color: var(--muted);
  margin: 0 0 .75rem;
}

.newsletter-slidein-form {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.newsletter-slidein-field {
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.newsletter-slidein-submit {
  padding: .55rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* Landing founders */
.land-founders {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 2rem;
}

@media (min-width: 600px) {
  .land-founders { grid-template-columns: 1fr 1fr; }
}

.land-founder-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--border, #e2ddd8);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s ease;
}

.land-founder-card:hover { border-color: var(--accent); }

.land-founder-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
}

.land-founder-name {
  display: block;
  font-weight: 700;
  margin-bottom: .15rem;
}

.land-founder-role {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: .35rem;
}

.land-founder-bio {
  font-size: .9rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}
