/* ==========================================================================
   Articles — editorial layout layered on the shared tokens and components.
   Loaded only on article pages, so the landing page pays nothing for it.
   ========================================================================== */

/* ------------------------------------------------------ reading progress */

.article-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 130;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 90ms linear;
}

.article-progress[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ hero */

.article-hero {
  padding-block: clamp(2.25rem, 5vw, 3.5rem) var(--sp-6);
  background: var(--white);
  border-bottom: 1px solid var(--line-100);
}

.article-hero__cat {
  margin-bottom: var(--sp-4);
}

.article-hero h1 {
  max-width: 24ch;
  font-size: clamp(1.9rem, 1.35rem + 2.4vw, 2.875rem);
}

.article-hero__lead {
  margin-top: var(--sp-5);
  max-width: 46rem;
  color: var(--ink-500);
  font-size: var(--fs-lead);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-5);
  color: var(--ink-400);
  font-size: var(--fs-xs);
}

.article-meta time {
  color: var(--ink-500);
}

/* --------------------------------------------------------------- figures */

.article-figure {
  margin-top: var(--sp-6);
}

.article-figure img {
  width: 100%;
  height: auto;
  background: var(--brand-900);
  border: 1px solid var(--line-200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
}

.figure {
  margin-block: var(--sp-6);
}

.figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line-200);
  border-radius: var(--r-md);
}

.figure figcaption {
  margin-top: var(--sp-3);
  color: var(--ink-400);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

/* ---------------------------------------------------------------- layout */

.article-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
}

.article-aside {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-4));
}

.toc {
  padding: var(--sp-5);
  background: var(--white);
  border: 1px solid var(--line-200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
}

.toc__title {
  margin-bottom: var(--sp-4);
  color: var(--ink-400);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.toc__list {
  display: grid;
  gap: var(--sp-1);
}

.toc__list a {
  display: block;
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-4);
  border-left: 2px solid var(--line-200);
  color: var(--ink-500);
  font-size: var(--fs-sm);
  line-height: 1.4;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.toc__list a:hover,
.toc__list a[aria-current="true"] {
  border-color: var(--brand-500);
  color: var(--brand-800);
}

/* ----------------------------------------------------------- article body */

.article-body {
  max-width: 70ch;
}

.article-body h2 {
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.prose ol {
  display: grid;
  gap: var(--sp-3);
  counter-reset: ordered;
}

.prose ol > li {
  position: relative;
  padding-left: var(--sp-7);
  color: var(--ink-600);
  font-size: var(--fs-sm);
  line-height: 1.68;
}

.prose ol > li::before {
  counter-increment: ordered;
  content: counter(ordered);
  position: absolute;
  left: 0;
  top: 0.05rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--r-full);
  background: var(--brand-050);
  color: var(--brand-700);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
}

.prose a {
  font-weight: var(--fw-medium);
}

/* ------------------------------------------------------------ takeaways */

.takeaways {
  padding: var(--sp-6);
  background: var(--white);
  border: 1px solid var(--brand-200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.takeaways__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--brand-700);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.takeaways ul {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.takeaways li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  color: var(--ink-600);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.takeaways li .icon {
  margin-top: 0.15rem;
  color: var(--brand-600);
}

/* -------------------------------------------------------------- callouts */

.callout {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-5);
  border: 1px solid;
  border-left-width: 4px;
  border-radius: var(--r-md);
}

.callout__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.callout__body {
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.callout--info {
  background: var(--brand-050);
  border-color: var(--brand-200);
  border-left-color: var(--brand-500);
  color: var(--brand-800);
}

.callout--warn {
  background: var(--warn-100);
  border-color: var(--warn-line);
  border-left-color: var(--accent-500);
  color: var(--warn-800);
}

.callout--success {
  background: var(--success-100);
  border-color: var(--success-line);
  border-left-color: var(--brand-600);
  color: var(--success-800);
}

/* ------------------------------------------------------------- pullquote */

.pullquote {
  padding-left: var(--sp-5);
  border-left: 3px solid var(--brand-300);
}

.pullquote p {
  color: var(--ink-800);
  font-size: var(--fs-lg);
  font-weight: var(--fw-medium);
  line-height: 1.5;
}

.pullquote cite {
  display: block;
  margin-top: var(--sp-3);
  color: var(--ink-400);
  font-size: var(--fs-xs);
  font-style: normal;
}

/* ----------------------------------------------------------- share / tags */

.article-share {
  margin-top: var(--sp-8);
  padding: var(--sp-5);
  background: var(--sand-100);
  border-radius: var(--r-lg);
}

.article-share__title {
  color: var(--ink-800);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.article-share__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.article-share__note {
  margin-top: var(--sp-3);
  color: var(--ink-500);
  font-size: var(--fs-xs);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line-200);
}

/* ----------------------------------------------------------- article cards */

.acard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-6);
}

.acard {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line-200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.acard:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}

.acard__flag {
  position: absolute;
  top: var(--sp-4);
  left: var(--sp-4);
  z-index: 2;
}

.acard__media {
  display: block;
  background: var(--brand-900);
}

.acard__media img {
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

.acard__body {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-5);
}

.acard__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  color: var(--ink-400);
  font-size: var(--fs-xs);
}

.acard__title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  line-height: 1.28;
}

.acard__title a {
  color: var(--ink-900);
  text-decoration: none;
}

.acard__title a:hover {
  color: var(--brand-800);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.acard__excerpt {
  color: var(--ink-500);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.acard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: auto;
  padding-top: var(--sp-2);
  color: var(--ink-400);
  font-size: var(--fs-xs);
}

.acard__more {
  color: var(--brand-700);
  font-weight: var(--fw-semibold);
}

.feed-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-7);
  color: var(--ink-500);
  font-size: var(--fs-sm);
}

.feed-link .icon {
  color: var(--brand-500);
}

/* ---------------------------------------------------------- responsive */

@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-aside {
    position: static;
  }
}

@media (max-width: 760px) {
  .acard-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-progress {
    transition: none;
  }
}

/* ------------------------------------------------- prose-scoped components
   Anything richer than a paragraph lives inside the `.prose` flow, and the
   element rules there (`.prose ul > li`, `.prose p`) outrank a single class.
   These scoped rules put each component back in charge of its own children. */

.article-body .takeaways__title {
  color: var(--brand-700);
}

.article-body .takeaways ul {
  display: grid;
  gap: var(--sp-3);
}

.article-body .takeaways li,
.article-body .callout li,
.article-body .tag-list li {
  padding-left: 0;
}

.article-body .takeaways li::before,
.article-body .callout li::before,
.article-body .tag-list li::before {
  content: none;
}

.article-body .callout p {
  color: inherit;
}

.article-body .tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line-200);
}

.article-body .pullquote p {
  color: var(--ink-800);
}

.article-body .article-share__title {
  color: var(--ink-800);
}

.article-body .article-share__note {
  color: var(--ink-500);
}

.article-body .figure figcaption {
  color: var(--ink-400);
}
