/* ============================================
   SKIP LINK — Accessibility
   ============================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  padding: 10px 20px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 0 0 6px 6px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 0;
}

/* ============================================
   ARTICLE BODY — Markdown Content Styles
   ============================================ */

/* Article page wrapper — tiny gap after divider + visible bg */
.article-section {
  padding: 6px 0 var(--section-pad);
  position: relative;
  /* Dot-grid background — visible texture in the side margins */
  background-color: #eaecf0;
  background-image: radial-gradient(circle, rgba(13, 27, 42, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
}
.article-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--lime), var(--purple-light), var(--teal));
}

/* ── Two-column article layout ── */
.article-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 18px;
  position: relative;
}
@media (min-width: 940px) {
  .article-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
}

/* Article content column — white card */
.article-content {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--gray100);
  padding: 2px 30px 28px;
  box-shadow: 0 2px 12px rgba(13, 27, 42, 0.04);
}
@media (min-width: 940px) {
  .article-content {
    margin: 0;
    max-width: 800px;
  }
}

/* Remove top margin/padding on the first element in the article body */
.article-body > :first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
.article-body > figure:first-child {
  margin-top: 0 !important;
}
.article-body > figure:first-child img {
  border-radius: 8px 8px 8px 8px;
}

/* Smaller title on article pages so header height stays consistent */
.page-header--article .page-header__title {
  font-size: clamp(24px, 3.2vw, 34px);
  margin-bottom: 12px;
}

/* ── Sidebar TOC ── */
.article-sidebar {
  width: 200px;
}
@media (min-width: 940px) {
  .article-sidebar {
    position: sticky;
    top: 72px;
    z-index: 10;
    align-self: start;
  }
}
.article-sidebar--hidden {
  display: none !important;
}
.article-sidebar__label {
  font-family: 'Roboto', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.article-sidebar__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.article-sidebar__item {
  margin-bottom: 2px;
}
.article-sidebar__item a {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: all 0.15s ease;
}
.article-sidebar__item a:hover {
  color: var(--navy);
  border-left-color: var(--gray200);
}
.article-sidebar__item--active a {
  color: var(--navy);
  font-weight: 500;
  border-left-color: var(--teal);
  background: rgba(0, 212, 200, 0.05);
}
.article-sidebar__item--h3 a {
  padding-left: 24px;
  font-size: 12px;
}

/* ── Sidebar meta info ── */
.article-sidebar__meta {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--gray100);
}
.article-sidebar__meta-item {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.5;
}
.article-sidebar__meta-item strong {
  color: var(--text-light);
  font-weight: 500;
}

/* ── Responsive: collapse sidebar on smaller screens ── */
@media (max-width: 939px) {
  .article-sidebar {
    display: none !important;
  }
}
@media (max-width: 700px) {
  .article-content {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 2px 16px 24px;
  }
  .article-layout {
    padding: 0;
  }
}

/* Featured image */
.article-featured-image {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 24px;
  border: 1px solid var(--gray100);
}

/* Article body base */
.article-body {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-light);
  padding: 8px 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Headings */
.article-body h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 32px;
  margin-bottom: 16px;
  line-height: 1.3;
}

.article-body h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--navy);
  margin-top: 26px;
  margin-bottom: 12px;
  line-height: 1.35;
}

.article-body h4 {
  font-size: 17px;
  font-weight: 600;
  color: var(--navy);
  margin-top: 20px;
  margin-bottom: 10px;
}

/* Paragraphs */
.article-body p {
  margin-bottom: 14px;
}

/* Links */
.article-body a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}
.article-body a:hover {
  color: var(--lime);
}

/* Lists */
.article-body ul,
.article-body ol {
  margin-bottom: 14px;
  padding-left: 24px;
}

.article-body li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.article-body ul li::marker {
  color: var(--lime);
}

.article-body ol li::marker {
  color: var(--teal);
  font-weight: 600;
}

/* Blockquotes */
.article-body blockquote {
  border-left: 3px solid var(--teal);
  margin: 20px 0;
  padding: 12px 18px;
  background: var(--teal-muted);
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: var(--text);
}

.article-body blockquote p {
  margin-bottom: 0;
}

/* Code */
.article-body code {
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  background: var(--gray50);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--purple);
}

.article-body pre {
  background: var(--navy);
  color: var(--text-bright);
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--navy-mid);
}

.article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.65;
}

/* Horizontal rule */
.article-body hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, var(--teal), var(--lime), var(--purple-light), var(--teal));
  margin: 30px 0;
  border-radius: 2px;
}

/* Images inside articles */
.article-body img {
  max-width: 100%;
  border-radius: 8px;
  margin: 20px 0;
  border: 1px solid var(--gray100);
}

/* Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14.5px;
}

.article-body th {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
}

.article-body td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray100);
  color: var(--text-light);
}

.article-body tr:hover td {
  background: var(--gray50);
}

/* Strong / Bold */
.article-body strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Author byline + reading time ── */
.article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--text-muted);
}
.article-meta__author {
  font-weight: 500;
  color: var(--text-light);
}
.article-meta__sep {
  color: var(--teal);
  font-weight: 700;
}
.article-meta__time {
  color: var(--text-muted);
}
.article-meta__tag {
  font-family: 'Roboto', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--teal-muted);
  padding: 2px 8px;
  border-radius: 3px;
}

/* ── Table of contents ── */
.article-toc {
  background: var(--off-white);
  border: 1px solid var(--gray100);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 24px;
}
.article-toc__title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-family: 'Roboto', sans-serif;
}
.article-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.article-toc__item {
  margin-bottom: 4px;
}
.article-toc__item a {
  font-size: 14px;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.15s;
  line-height: 1.5;
}
.article-toc__item a:hover {
  color: var(--teal);
}
.article-toc__item--h3 {
  padding-left: 16px;
}

/* ── Related articles ── */
.article-related {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--gray100);
}
.article-related__title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.article-related__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.article-related__card {
  display: block;
  padding: 16px 18px;
  background: var(--gray50);
  border: 1px solid var(--gray100);
  border-radius: 8px;
  text-decoration: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.article-related__card:hover {
  border-color: var(--teal);
  box-shadow: 0 2px 8px rgba(0, 212, 200, 0.1);
}
.article-related__date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.article-related__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.35;
}

/* ── Share buttons ── */
.article-share {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--gray100);
  display: flex;
  align-items: center;
  gap: 16px;
}
.article-share--spaced {
  margin-top: 24px;
}
.article-share__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.article-share__buttons {
  display: flex;
  gap: 8px;
}
.article-share__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--gray100);
  color: var(--text-light);
  background: var(--gray50);
  transition: all 0.2s ease;
  text-decoration: none;
}
.article-share__btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-muted);
}
.article-share__btn--linkedin:hover {
  color: #0077b5;
  border-color: #0077b5;
}
.article-share__btn--x:hover {
  color: var(--navy);
  border-color: var(--navy);
}
.article-share__btn--email:hover {
  color: var(--purple);
  border-color: var(--purple);
}

.article-back-nav {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--gray100);
}
.article-back-nav--lg {
  margin-top: 30px;
  padding-top: 20px;
}

.substack-source-box {
  margin-top: 24px;
  padding: 16px;
  background: var(--off-white);
  border: 1px solid var(--gray100);
  border-radius: 8px;
  text-align: center;
}
.substack-source-note {
  font-size: 14px;
  color: var(--text-light);
  margin: 0 0 8px;
}
.substack-source-link {
  font-size: 13px;
}

/* back-to-top styles are in main.css */

@media (max-width: 600px) {
  .article-share {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .article-related__grid {
    grid-template-columns: 1fr;
  }
}

/* ── Substack content — figures & images ── */
.article-body figure {
  margin: 22px 0;
}
.article-body figure img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--gray100);
}
.article-body figcaption {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
}

/* ── Print stylesheet ── */
@media print {
  .nav,
  .footer,
  .back-to-top,
  .article-share,
  .skip-link,
  .article-related,
  .btn--ghost,
  .article-sidebar {
    display: none !important;
  }
  .article-layout {
    display: block;
  }
  .article-content {
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: 100%;
  }
  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }
  .page-header {
    background: none !important;
    padding: 20px 0;
  }
  .page-header__title {
    color: #000;
    font-size: 24pt;
  }
  .page-header__subtitle {
    color: #333;
  }
  .article-body {
    font-size: 11pt;
    line-height: 1.6;
    color: #000;
  }
  .article-body a {
    color: #000;
    text-decoration: underline;
  }
  .article-body a::after {
    content: ' (' attr(href) ')';
    font-size: 9pt;
    color: #666;
  }
  .article-body img {
    max-width: 100%;
    page-break-inside: avoid;
  }
  .article-body h2,
  .article-body h3 {
    page-break-after: avoid;
    color: #000;
  }
  .article-body blockquote {
    border-left-color: #999;
    background: none;
  }
  .article-body table {
    border: 1px solid #ccc;
  }
  .article-body th {
    background: #eee;
    color: #000;
  }
  .article-body td {
    border-bottom: 1px solid #ccc;
  }
  .article-toc {
    border: 1px solid #ccc;
    background: #f5f5f5;
  }
  .section {
    padding: 20px 0;
  }
}

/* ── Article subscribe nudge (small inline) ── */
.article-subscribe-nudge {
  margin-top: 24px;
  padding: 12px 16px;
  background: var(--off-white);
  border: 1px solid var(--gray100);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.article-subscribe-nudge__text {
  font-size: 13.5px;
  color: var(--text-light);
  font-weight: 500;
}
.article-subscribe-nudge__btn {
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 18px;
  border-radius: 4px;
  border: 1.5px solid var(--lime);
  background: transparent;
  color: var(--lime);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.article-subscribe-nudge__btn:hover {
  background: var(--lime-muted);
  color: var(--navy);
}
@media (max-width: 500px) {
  .article-subscribe-nudge {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
}

/* ── Newsletter bar ── */
.newsletter-bar {
  background: var(--off-white);
  border-top: 1px solid var(--gray100);
  border-bottom: 1px solid var(--gray100);
  padding: 24px 0;
}
.newsletter-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.newsletter-bar__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.newsletter-bar__subtitle {
  font-size: 14px;
  color: var(--text-light);
}
.newsletter-bar__btn {
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .newsletter-bar__inner {
    flex-direction: column;
    text-align: center;
  }
}

/* Footer legal row */
.footer-legal {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}
.footer-legal__link {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}
.footer-legal__link:hover {
  color: var(--teal);
}
