/* Article — one reading page per topic and language. A narrow left rail (back link,
   then the sticky contents) beside a wide column: the text keeps a reading measure,
   figures and tables use the full column so the infographics stay legible. */

/* reading progress: a coral hairline on the top edge of the viewport */
.art-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 120;
  height: 2px;
  pointer-events: none;
}

.art-progress__bar {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.art-top {
  padding-top: calc(var(--header-h) + var(--tank-inset) + 34px);
}

.art-crumbs .crumbs {
  flex-wrap: nowrap;
  min-width: 0;
}

.art-crumbs li {
  flex: none;
}

.art-crumbs .art-crumbs__here {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.art-crumbs a {
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, currentColor 30%, transparent);
  text-underline-offset: 0.22em;
}

/* ── header ────────────────────────────────── */

.art-head,
.art-hero,
.art-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 0 var(--gutter);
}

.art-head {
  padding-top: clamp(28px, 4vw, 56px);
}

.art-head__rail {
  padding-top: 6px;
}

.art-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px 0 10px;
  border-radius: var(--r-pill);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
  box-shadow: 0 0 0 1px var(--line) inset;
  transition: color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}

.art-back:hover {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong) inset;
}

.art-back:hover .icon {
  transform: translateX(-2px);
}

.art-back .icon {
  transition: transform var(--t-med) var(--ease-out);
}

.art-head__main {
  min-width: 0;
}

.art-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 64ch;
  margin-bottom: 26px;
  padding: 12px 16px;
  border-radius: 14px;
  background: color-mix(in oklab, var(--lilac) 16%, var(--surface));
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--lilac) 34%, transparent) inset;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-2);
}

[data-theme="dark"] .art-notice {
  background: color-mix(in oklab, var(--lilac) 12%, var(--surface));
}

.art-notice .icon {
  margin-top: 2px;
  color: color-mix(in oklab, var(--lilac) 60%, var(--ink));
}

.art-notice a {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.art-notice--review {
  background: var(--warn-soft);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--warn) 30%, transparent) inset;
}

.art-notice--review .icon {
  color: var(--warn);
}

.art-head__cat {
  margin-bottom: 18px;
  font-size: 0.875rem;
}

.art-head__title {
  max-width: 21ch;
  font-size: clamp(2.35rem, 4.6vw, 4.25rem);
  font-weight: 670;
  font-stretch: 84%;
  line-height: 1.0;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

.art-head__skel {
  display: block;
  height: 0.86em;
  width: 82%;
  border-radius: 12px;
}

.art-head__skel--short {
  width: 54%;
  margin-top: 0.14em;
}

.art-head__title--long {
  max-width: 26ch;
  font-size: clamp(2.1rem, 3.6vw, 3.4rem);
  line-height: 1.04;
}

:lang(zh) .art-head__title {
  max-width: 18em;
  font-stretch: 100%;
  font-weight: 640;
  line-height: 1.2;
  letter-spacing: 0;
}

:lang(zh) .art-head__title--long {
  font-size: clamp(1.9rem, 3.2vw, 2.9rem);
}

.art-head__dek {
  margin-top: clamp(18px, 2vw, 26px);
  max-width: 44em;
  font-family: var(--font-read);
  font-size: clamp(1.1875rem, 1.6vw, 1.4375rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
}

:lang(zh) .art-head__dek {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.75;
}

.art-head__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  margin-top: clamp(22px, 2.6vw, 32px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.art-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  font-size: 0.875rem;
  color: var(--ink-3);
}

.art-byline__author {
  font-weight: 620;
  color: var(--ink);
}

.art-lang {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding-inline: 12px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 620;
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line) inset;
  transition: box-shadow var(--t-fast);
}

.art-lang:hover {
  box-shadow: 0 0 0 1px var(--line-strong) inset;
}

/* ── hero ──────────────────────────────────── */

.art-hero {
  margin-top: clamp(30px, 3.6vw, 48px);
}

.art-hero__slot {
  grid-column: 2;
  margin: 0;
  min-width: 0;
}

.art-hero .amedia {
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-float);
}

/* ── body + rail ───────────────────────────── */

.art-layout {
  margin-top: clamp(40px, 5vw, 72px);
}

.art-rail {
  min-width: 0;
}

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

.art-toc {
  position: sticky;
  top: calc(var(--header-h) + var(--tank-inset) + 28px);
}

.art-toc__summary {
  display: none;
}

.art-toc__nav {
  max-height: calc(100svh - var(--header-h) - var(--tank-inset) - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.art-toc__title {
  margin-bottom: 12px;
  font-size: 0.8125rem;
  font-weight: 640;
  color: var(--ink-2);
}

.art-toc__list {
  display: grid;
}

.art-toc__item a {
  display: block;
  padding: 7px 0 7px 14px;
  border-left: 1px solid var(--line);
  font-size: 0.84375rem;
  line-height: 1.4;
  color: var(--ink-3);
  transition: color var(--t-fast), border-color var(--t-fast);
}

.art-toc__item--h3 a,
.art-toc__item--h4 a {
  padding-left: 26px;
  font-size: 0.8125rem;
}

.art-toc__item a:hover {
  color: var(--ink);
}

.art-toc__item a.is-active {
  padding-left: 13px;
  border-left: 2px solid var(--accent);
  color: var(--ink);
  font-weight: 560;
}

.art-toc__item--h3 a.is-active,
.art-toc__item--h4 a.is-active {
  padding-left: 25px;
}

/* the reading column */
.art-prose {
  max-width: none;
  overflow-wrap: break-word;
}

.art-prose :where(p, li, blockquote, aside) {
  overflow-wrap: anywhere;
}

.art-prose > :where(p, ul, ol, blockquote, h2, h3, h4, aside) {
  max-width: 37em;
}

:lang(zh) .art-prose > :where(p, ul, ol, blockquote, h2, h3, h4, aside) {
  max-width: 42em;
}

.art-prose h2 {
  font-size: clamp(1.5rem, 2vw, 1.875rem);
  font-weight: 650;
  font-stretch: 90%;
  line-height: 1.18;
  letter-spacing: -0.018em;
}

.art-prose h3 {
  font-size: 1.25rem;
  line-height: 1.3;
}

/* imported display headlines arrive one line per heading: keep them together */
.art-prose h2 + h2,
.art-prose h3 + h3,
.art-prose h4 + h4 {
  margin-top: 0.12em;
}

.art-prose h2 + h3 {
  margin-top: 0.9em;
}

:lang(zh) .art-prose h2,
:lang(zh) .art-prose h3 {
  font-stretch: 100%;
  letter-spacing: 0;
  line-height: 1.42;
}

/* html already pads anchor jumps by the header height; the shared .prose rule adds
   104px more, which parked headings a third of the way down the screen */
.art-prose h2,
.art-prose h3,
.art-prose h4 {
  scroll-margin-top: 28px;
}

.art-prose :where(h2, h3, h4):focus {
  outline: none;
}

.art-prose :where(h2, h3, h4):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 6px;
}

.art-prose p em:only-child {
  color: var(--ink-2);
}

.art-prose code {
  font-size: 0.82em;
}

.art-prose blockquote {
  margin: 1.6em 0;
  padding: 0.1em 0 0.1em 1.1em;
  border-left: 2px solid var(--accent);
  font-size: clamp(1.3rem, 1.9vw, 1.6rem);
  line-height: 1.4;
  font-style: italic;
  color: var(--ink);
}

:lang(zh) .art-prose blockquote {
  font-style: normal;
  font-size: 1.25rem;
  line-height: 1.7;
}

.art-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px;
  border-radius: var(--r-card);
  background: var(--held-soft);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
}

.art-callout .icon {
  margin-top: 3px;
  color: var(--held);
}

.art-code {
  position: relative;
}

.art-code pre.code {
  padding-right: 92px;
  font-size: 0.8125rem;
  /* commands wrap instead of sliding under the copy button */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.art-code__copy {
  position: absolute;
  top: 12px;
  right: 12px;
}

.art-fig {
  position: relative;
  margin-block: 2em;
}

.art-prose > .art-fig {
  margin-top: 1.8em;
}

.art-fig img {
  width: 100%;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-soft);
  cursor: zoom-in;
}

.art-fig__zoom {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  opacity: 0;
  transition: opacity var(--t-fast), transform var(--t-fast);
}

.art-fig:hover .art-fig__zoom,
.art-fig__zoom:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .art-fig__zoom {
    opacity: 1;
  }
}

.art-table {
  margin-block: 1.8em;
  box-shadow: 0 0 0 1px var(--line-soft) inset;
}

.art-prose .art-table table {
  background: transparent;
  border-radius: 0;
}

.art-prose .art-table td {
  padding: 12px 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}

.art-prose .art-table tr:last-child td {
  border-bottom: 0;
}

/* tables scroll sideways on small screens rather than breaking words */
.art-prose .art-table table {
  min-width: 520px;
}

.art-prose .art-table td + td {
  border-left: 1px solid var(--line-soft);
}

.art-rule {
  max-width: 37em;
}

.art-linkcard {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line) inset;
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: box-shadow var(--t-fast);
}

.art-linkcard .icon {
  margin-top: 3px;
  color: var(--link);
}

.art-linkcard--one a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.art-linkcard--one:hover {
  box-shadow: 0 0 0 1px var(--line-strong) inset, var(--shadow-float);
}

/* ── end of article ────────────────────────── */

.art-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  max-width: 980px;
  margin-top: clamp(48px, 6vw, 80px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.art-end__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
}

.art-end__facts dt {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-3);
}

.art-end__facts dd {
  margin: 2px 0 0;
  font-weight: 600;
}

.art-end__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

/* ── related ───────────────────────────────── */

.art-related {
  padding-block: clamp(64px, 8vw, 120px) var(--section-tight);
}

.art-related__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px var(--gutter);
}

.acard--related {
  display: grid;
  gap: 18px;
  align-content: start;
}

.acard--related .acard__desc {
  -webkit-line-clamp: 2;
}

/* ── states ────────────────────────────────── */

.art-state {
  padding-top: calc(var(--header-h) + var(--tank-inset) + clamp(56px, 8vw, 120px));
  padding-bottom: var(--section-tight);
}

.art-state__inner {
  display: grid;
  justify-items: start;
  gap: 18px;
  max-width: 720px;
}

.art-state__label {
  font-size: 0.875rem;
  font-weight: 620;
  color: var(--ink-2);
}

.art-state__title {
  font-size: var(--fs-h1);
  font-weight: 660;
  font-stretch: 86%;
  line-height: 1.02;
  letter-spacing: -0.028em;
}

:lang(zh) .art-state__title {
  font-stretch: 100%;
  letter-spacing: 0;
  line-height: 1.2;
}

.art-state__body {
  max-width: 52ch;
  font-size: var(--fs-body-l);
  line-height: 1.55;
  color: var(--ink-2);
}

.art-state__latest {
  margin-top: clamp(56px, 7vw, 96px);
}

/* ── image zoom ────────────────────────────── */

.art-zoom__panel {
  --dialog-w: min(1480px, 96vw);
  padding: 12px;
  border-radius: 22px;
  background: var(--surface);
}

.art-zoom__img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(100svh - 72px);
  margin-inline: auto;
  border-radius: 14px;
  object-fit: contain;
}

.art-zoom__close {
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-float);
}

/* ── responsive ────────────────────────────── */

@media (max-width: 1023px) {
  .art-head,
  .art-hero,
  .art-layout {
    /* minmax(0, …): a long URL or code token must not widen the track past the screen */
    grid-template-columns: minmax(0, 1fr);
  }

  .art-head__rail {
    padding: 0 0 22px;
  }

  .art-hero__slot {
    grid-column: 1;
  }

  .art-layout {
    margin-top: 28px;
  }

  .art-toc {
    position: static;
    margin-bottom: 32px;
    border-radius: var(--r-card);
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--line-soft) inset;
  }

  .art-toc__summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 18px;
    font-weight: 620;
    cursor: pointer;
    list-style: none;
  }

  .art-toc__summary::-webkit-details-marker {
    display: none;
  }

  .art-toc__count {
    font-size: 0.8125rem;
    font-weight: 540;
    color: var(--ink-3);
  }

  .art-toc__chev {
    margin-left: auto;
    display: grid;
    transition: transform var(--t-med) var(--ease-out);
  }

  .art-toc[open] .art-toc__chev {
    transform: rotate(180deg);
  }

  .art-toc__nav {
    max-height: 60svh;
    padding: 0 18px 16px;
  }

  .art-toc__title {
    display: none;
  }

  .art-related__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .art-related__grid > :nth-child(3) {
    display: none;
  }
}

@media (max-width: 640px) {
  .art-top {
    padding-top: calc(var(--header-h) + var(--tank-inset) + 22px);
  }

  .art-head {
    padding-top: 22px;
  }

  .art-hero .amedia {
    border-radius: var(--r-card);
  }

  .art-prose {
    font-size: 1.125rem;
  }

  .art-related__grid {
    grid-template-columns: 1fr;
  }

  .art-related__grid > :nth-child(3) {
    display: grid;
  }

  .art-end {
    align-items: flex-start;
    flex-direction: column;
  }
}
