/* ============================================================
   IT ARCHITECTURE TIMES — Article Page Styles v3
   Mobile-first · Readable · Tech-site Quality
   ============================================================ */

/* ── Article Layout ─────────────────────────────────────────── */
.article-wrapper {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 44px var(--gutter) 64px;
}

/* Offset for always-visible mobile nav */
@media (max-width: 640px) {
  .article-wrapper {
    padding-top: calc(var(--nav-h) + 24px);
  }
}

/* Two-column with sticky TOC on wide screens */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 268px;
  gap: 0 52px;
  align-items: start;
}
.article-main { min-width: 0; }

/* ── TOC Sidebar ────────────────────────────────────────────── */
.article-toc {
  display: none; /* shown by JS when headings exist */
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  max-height: calc(100vh - var(--nav-h) - 56px);
  overflow-y: auto;
  padding: 20px;
  background: var(--cream-dark);
  border: 1px solid var(--rule-light);
  border-left: 3px solid var(--ink);
  transition: background var(--transition), border-color var(--transition);
}
.toc-title {
  font-family: var(--ff-ui);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-light);
}
.toc-list { display: flex; flex-direction: column; gap: 2px; }
.toc-list a {
  display: block;
  font-family: var(--ff-ui);
  font-size: 0.8rem;
  color: var(--ink-muted);
  padding: 6px 8px;
  border-radius: 2px;
  line-height: 1.45;
  transition: color var(--transition), background var(--transition);
  min-height: 36px;
  display: flex;
  align-items: center;
}
.toc-list a:hover { color: var(--ink); background: var(--cream); }
.toc-list a.active {
  color: var(--accent);
  background: rgba(139, 26, 26, 0.07);
  font-weight: 600;
}

/* ── Article Header ─────────────────────────────────────────── */
.article-meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.article-section {
  font-family: var(--ff-ui);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.article-title {
  font-family: var(--ff-head);
  font-size: clamp(1.9rem, 4.5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.article-subtitle {
  font-family: var(--ff-body);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 18px;
  border-left: 3px solid var(--accent);
  padding-left: 16px;
}
.article-byline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-ui);
  font-size: 0.75rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.byline-read { color: var(--ink-muted); }

/* Reading time progress */
.reading-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}
.reading-bar-wrap {
  flex: 1;
  max-width: 120px;
  height: 3px;
  background: var(--rule-light);
  border-radius: 2px;
  overflow: hidden;
}
.reading-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.article-rule {
  border: none;
  border-top: 2px solid var(--ink);
  margin: 22px 0 30px;
  transition: border-color var(--transition);
}

/* ── Article Body ───────────────────────────────────────────── */
.article-body {
  font-family: var(--ff-body);
  font-size: 1.05rem;
  line-height: 1.82;
  color: var(--ink-soft);
}
.article-body p { margin-bottom: 22px; }
.article-lead {
  font-size: 1.18rem !important;
  color: var(--ink) !important;
  margin-bottom: 26px !important;
  line-height: 1.7 !important;
}
.article-body h2 {
  font-family: var(--ff-head);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ink);
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-light);
  line-height: 1.2;
}
.article-body h3 {
  font-family: var(--ff-head);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  margin: 28px 0 12px;
  line-height: 1.3;
}
.article-body ul, .article-body ol {
  padding-left: 22px;
  margin-bottom: 20px;
}
.article-body li {
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.75;
}
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }

/* Pull quote in articles */
.article-quote {
  position: relative;
  font-family: var(--ff-head);
  font-size: 1.28rem;
  font-style: italic;
  color: var(--accent);
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  padding: 22px 52px;
  margin: 36px 0;
  line-height: 1.5;
  transition: color var(--transition), border-color var(--transition);
}
.article-quote::before {
  content: '\201C';
  position: absolute;
  top: -4px; left: 10px;
  font-size: 4rem;
  line-height: 1;
  opacity: 0.2;
  font-style: normal;
}

/* ── Code Block in Articles ─────────────────────────────────── */
.article-body .code-block { margin: 28px 0; }

/* Inline code */
.article-body code {
  font-family: var(--ff-mono);
  font-size: 0.85em;
  background: var(--cream-dark);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 2px;
}
html.dark .article-body code {
  background: #1e1e1e;
  color: #c97050;
}

/* Code inside .code-block */
.article-body .code-block code { background: none; color: var(--code-text); padding: 0; }

/* ── Benchmark Table ────────────────────────────────────────── */
.article-body .bench-table-wrap { margin: 32px 0; }
.article-body .bench-table { font-size: 0.87rem; }

/* ── Key Points Grid ────────────────────────────────────────── */
.article-keypoints {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}
.keypoint {
  background: var(--cream-dark);
  border-left: 3px solid var(--accent);
  padding: 16px 18px;
  transition: background var(--transition);
}
.keypoint strong {
  display: block;
  font-family: var(--ff-ui);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--ink);
  margin-bottom: 7px;
}
.keypoint p {
  font-size: 0.85rem !important;
  color: var(--ink-muted) !important;
  line-height: 1.55 !important;
  margin: 0 !important;
}

/* ── Info Box ───────────────────────────────────────────────── */
.info-box {
  background: var(--cream-dark);
  border: 1px solid var(--rule-light);
  border-left: 4px solid var(--accent-alt);
  padding: 18px 22px;
  margin: 24px 0;
  transition: background var(--transition);
}
.info-box-title {
  font-family: var(--ff-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-alt);
  margin-bottom: 9px;
}
.info-box p { font-size: 0.9rem !important; color: var(--ink-soft) !important; margin: 0 !important; line-height: 1.65 !important; }

/* ── Article Nav ────────────────────────────────────────────── */
.article-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 4px;
  gap: 16px;
}

/* ── Related Articles ───────────────────────────────────────── */
.related-section { margin-top: 52px; }
.related-title {
  font-family: var(--ff-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.related-card {
  padding: 0 22px;
  border-right: 1px solid var(--rule-light);
}
.related-card:first-child { padding-left: 0; }
.related-card:last-child  { padding-right: 0; border-right: none; }
.related-tag {
  font-family: var(--ff-ui);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 7px;
}
.related-card h4 {
  font-family: var(--ff-head);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 7px;
  transition: color 0.2s;
}
.related-card:hover h4 { color: var(--accent); }
.related-card p {
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.55;
}

/* ── Responsive: Tablet ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-toc {
    position: static;
    max-height: none;
    margin-bottom: 36px;
    order: -1;
  }
  .article-toc .toc-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .article-toc .toc-list a {
    white-space: nowrap;
    min-height: 36px;
  }
}

/* ── Responsive: Mobile ─────────────────────────────────────── */
@media (max-width: 640px) {
  .article-title {
    font-size: clamp(1.7rem, 7.5vw, 2.4rem);
  }
  .article-subtitle {
    font-size: 1rem;
  }
  .article-body {
    font-size: 1rem;
    line-height: 1.8;
  }
  .article-body h2 {
    font-size: 1.4rem;
    margin: 32px 0 12px;
  }
  .article-body h3 {
    font-size: 1.1rem;
  }

  /* Disable drop cap on mobile */
  .article-body > p.article-lead::first-letter {
    float: none;
    font-size: inherit;
    line-height: inherit;
    margin: 0;
    font-weight: inherit;
    color: inherit;
  }

  .article-keypoints { grid-template-columns: 1fr; }
  .article-nav { flex-direction: column; gap: 12px; }
  .related-grid { grid-template-columns: 1fr; gap: 20px; }
  .related-card {
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--rule-light);
    padding-bottom: 20px;
  }
  .related-card:last-child { border-bottom: none; padding-bottom: 0; }
  .article-quote {
    padding: 16px 20px;
    font-size: 1.05rem;
  }
  .article-quote::before { font-size: 2.8rem; }
}
