/* =====================================================================
   Article pages — long-form reading
   Inherits root tokens from ../style.css. Add this file AFTER style.css.
   Optimized for: 700-720px reading column, comfortable 17px body,
   1.75 line-height, restrained accent use.
   ===================================================================== */

/* ---------- Reading-progress bar (top) ---------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 60;
}
.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.06s linear;
}

/* ---------- Article frame ---------- */
.article {
  padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(4rem, 8vw, 6rem);
}

.article__container {
  width: 100%;
  max-width: 44rem; /* ~704px reading column */
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- Breadcrumb / back link ---------- */
.article__breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.5rem 0;
}
.article__breadcrumb:hover { color: var(--accent-ink); }

/* ---------- Article header ---------- */
.article__header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}

.article__tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.article__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.875rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink-strong);
  margin: 0 0 1rem 0;
}

.article__dek {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 1.5rem 0;
  font-weight: 400;
}

.article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--soft);
}
.article__meta span { display: inline-flex; align-items: center; gap: 0.375rem; }
.article__meta-dot { color: var(--softer); }

/* ---------- Body typography ---------- */
.article__body {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink);
}

.article__body > * + * { margin-top: 1.25rem; }

.article__body p {
  margin: 0 0 1.25rem 0;
}

.article__body p:last-child { margin-bottom: 0; }

.article__body strong { color: var(--ink-strong); font-weight: 600; }
.article__body em { color: var(--ink); font-style: italic; }

.article__body a {
  color: var(--accent-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.article__body a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Headings within article body ---------- */
.article__body h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.625rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink-strong);
  margin: 2.75rem 0 1rem 0;
  scroll-margin-top: 5rem;
}

.article__body h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  margin: 2rem 0 0.75rem 0;
  scroll-margin-top: 5rem;
}

.article__body h2 + p,
.article__body h3 + p { margin-top: 0; }

/* ---------- Lists ---------- */
.article__body ul,
.article__body ol {
  margin: 0 0 1.25rem 0;
  padding-left: 1.5rem;
}

.article__body li {
  margin: 0.45rem 0;
  line-height: 1.7;
}

.article__body li > strong:first-child {
  color: var(--ink-strong);
}

.article__body ul li::marker {
  color: var(--accent);
}

/* ---------- Pull quote / callout ---------- */
.article__callout {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article__callout p {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  line-height: 1.5;
  font-weight: 500;
  color: var(--ink-strong);
  font-style: normal;
}

.article__callout--warn {
  border-left-color: #B45309;
  background: color-mix(in srgb, #FEF3C7 60%, var(--bg) 40%);
}
:root.theme-dark .article__callout--warn {
  background: color-mix(in srgb, #78350F 35%, var(--bg) 65%);
}

/* ---------- Code blocks ---------- */
.article__body pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  color: var(--ink-strong);
}

.article__body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-alt);
  color: var(--accent-ink);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.article__body pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ---------- Blockquote (different from callout) ---------- */
.article__body blockquote {
  margin: 1.75rem 0;
  padding: 0.25rem 0 0.25rem 1.5rem;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  font-style: italic;
  font-size: 1.0625rem;
}

/* ---------- Image / figure ---------- */
.article__body figure {
  margin: 2rem 0;
}
.article__body figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.article__body figcaption {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--soft);
  text-align: center;
  margin-top: 0.625rem;
}

/* ---------- Horizontal rule ---------- */
.article__body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

/* ---------- "Takeaways" closer ---------- */
.article__takeaways {
  margin: 2.5rem 0 0 0;
  padding: 1.5rem 1.75rem;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.article__takeaways h2 {
  margin-top: 0 !important;
  font-size: 1.125rem !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  color: var(--accent) !important;
  font-weight: 700 !important;
}

.article__takeaways ol,
.article__takeaways ul {
  margin: 0;
}

/* ---------- Related articles ---------- */
.related {
  padding: 4rem 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
}

.related__title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin: 0 0 2rem 0;
}

.related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 1rem;
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.related__card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
  display: block;
}
.related__card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.related__card-tag {
  font-family: var(--font-display);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-ink);
  margin: 0 0 0.5rem 0;
}
.related__card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-strong);
  margin: 0;
}

/* ---------- Author block ---------- */
.author-block {
  margin-top: 3rem;
  padding: 1.5rem 0 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.author-block__avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: var(--ink-strong);
  color: var(--bg);
  display: inline-grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.author-block__text { font-size: 0.9375rem; line-height: 1.5; color: var(--muted); }
.author-block__text strong { color: var(--ink-strong); }
.author-block__text a { color: var(--accent-ink); }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 640px) {
  .article__body { font-size: 1rem; line-height: 1.7; }
  .article__body h2 { font-size: 1.375rem; margin-top: 2rem; }
  .article__body h3 { font-size: 1.125rem; }
  .article__callout { padding: 1rem 1.25rem; }
  .article__callout p { font-size: 1rem; }
}

/* ---------- Print ---------- */
@media print {
  .nav, .progress-bar, .related, .author-block { display: none; }
  .article { padding: 0; }
  .article__body { font-size: 11pt; line-height: 1.55; }
  .article__body a { color: inherit; border: 0; }
}
