/* ═══════════════════════════════════════════════════════════════════════
   articles.css — the reading room. Hub, archive and single article.
   Built on zarnoush.css (the Gold Desk Ledger).
   ═══════════════════════════════════════════════════════════════════════ */

/* ── hub: the featured piece as a full editorial cover ──────────────── */
.hub-cover {
  position: relative; overflow: hidden; border-radius: var(--r-media);
  min-height: clamp(320px, 44vw, 560px);
  background: var(--ink-950); box-shadow: var(--lift-media);
  display: flex; align-items: flex-end;
}
.hub-cover img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.1s var(--ease), filter .4s;
}
.hub-cover:hover img { transform: scale(1.03); filter: saturate(1.05); }
.hub-cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(197deg, rgba(8,13,21,.05) 30%, rgba(8,13,21,.62) 70%, rgba(8,13,21,.92) 100%);
}
.hub-cover .plate { position: relative; z-index: 1; padding: 1.75rem; padding: clamp(1.4rem, 1rem + 2.5vw, 2.6rem); color: #fff; width: 100%; }
.hub-cover h2 {
  font-weight: 800; letter-spacing: -.028em; line-height: 1.18; text-wrap: balance;
  font-size: clamp(1.25rem, 1rem + 1.5vw, 2rem); margin: 0; max-width: 26ch;
}
.hub-cover .meta {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  margin-top: 1.1rem; font-size: 12px; font-weight: 700; color: #fff;
}
.hub-cover .meta > span:first-child span:first-child { width: 2rem; height: 2rem; }
.hub-cover .meta .dot { width: 3px; height: 3px; border-radius: 999px; background: var(--gold-hi); flex: none; }
.hub-cover .meta .nums { font-weight: 600; color: rgba(255,255,255,.82); }

/* ── editorial card: cover over text, directional close on desktop ──── */
.editorial-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; min-width: 0; }
.editorial-card .cover { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--ink-950); }
.editorial-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease), filter .3s; }
.editorial-card:hover .cover img { transform: scale(1.04); filter: saturate(1.05); }
.editorial-card .body { display: flex; flex: 1; flex-direction: column; padding: 18px; }
.editorial-card .cat { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--gold-deep); }
.dark .editorial-card .cat { color: var(--gold-hi); }
.editorial-card h3 { margin: .5rem 0 0; }
.editorial-card .foot {
  margin-top: auto; padding-top: .85rem; display: flex; align-items: center; gap: .6rem;
  font-size: 12px; color: var(--ink-500); font-variant-numeric: tabular-nums;
}
.dark .editorial-card .foot { color: rgba(255,255,255,.55); }
.editorial-card .foot .dot { width: 3px; height: 3px; border-radius: 999px; background: var(--gold); }

/* ── topic index: a ruled ledger of learning paths ─────────────────── */
.topic-index { border-top: 1px solid var(--line); }
.topic-index a {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem; align-items: center;
  padding: 1.15rem .2rem; border-bottom: 1px solid var(--line);
  transition: padding-inline .28s var(--ease), background-color .2s;
}
.topic-index a:hover { padding-inline: .7rem; background: rgba(201,151,63,.05); }
.topic-index .n { font-size: 12px; font-weight: 700; color: var(--gold-deep); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dark .topic-index .n { color: var(--gold-hi); }

/* ── archive toolbar: the ledger header row ────────────────────────── */
.search-field {
  width: 100%; min-height: 56px; padding: 14px 50px 14px 18px;
  border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface);
  color: var(--ink-900); font: inherit; font-size: 15px; font-weight: 600; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.search-field::placeholder { color: var(--ink-500); font-weight: 400; }
.search-field:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,151,63,.14); }
.dark .search-field { background: rgba(255,255,255,.03); color: #fff; }
.filter-chip {
  flex: 0 0 auto; min-height: 42px; padding: 9px 16px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--ink-600); font-size: 12px; font-weight: 600;
  transition: background-color .18s, border-color .18s, color .18s;
}
.dark .filter-chip { color: rgba(255,255,255,.66); }
.filter-chip[aria-pressed="true"] { background: var(--ink-900); border-color: var(--ink-900); color: var(--gold-soft); }
.dark .filter-chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink-900); }

.empty-panel {
  border: 1px dashed var(--line-strong); border-radius: var(--r-card); background: rgba(201,151,63,.04);
  padding: 2.75rem 1.5rem;
}

/* ── single article ───────────────────────────────────────────────── */
#reading-progress {
  position: fixed; inset: 0 0 auto; z-index: 90; height: 3px;
  transform: scaleX(0); transform-origin: right center;
  background: linear-gradient(90deg, var(--gold), var(--gold-hi));
  transition: transform .1s linear;
}
.single-cover {
  overflow: hidden; aspect-ratio: 21 / 9; border-radius: var(--r-media);
  background: var(--ink-950); box-shadow: var(--lift-media);
}
.single-cover img { width: 100%; height: 100%; object-fit: cover; }

.reading-grid {
  display: grid;
  grid-template-columns: minmax(0, 232px) minmax(0, 68ch);
  justify-content: center; gap: 3rem; gap: clamp(2rem, 1rem + 4vw, 4.5rem); align-items: start;
}
.toc { position: sticky; top: 104px; }
.toc-title { font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--ink-500); margin-bottom: .6rem; }
.dark .toc-title { color: rgba(255,255,255,.5); }
.toc nav { border-top: 1px solid var(--line); padding-top: .3rem; }
.toc-link {
  display: block; padding: .55rem 0 .55rem .9rem; color: var(--ink-500); font-size: 12px; line-height: 1.7;
  border-inline-start: 2px solid transparent; margin-inline-start: -1px;
  transition: color .18s, border-color .18s, padding-inline-start .18s;
}
.dark .toc-link { color: rgba(255,255,255,.55); }
.toc-link:hover { color: var(--gold-deep); }
.toc-link[aria-current="true"] { color: var(--gold-deep); border-inline-start-color: var(--gold); padding-inline-start: 1.15rem; }
.dark .toc-link[aria-current="true"], .dark .toc-link:hover { color: var(--gold-hi); }

.article-body { min-width: 0; color: var(--ink-700); font-size: 16.5px; font-weight: 400; line-height: 2.0; }
.dark .article-body { color: rgba(255,255,255,.78); }
.article-body > * { max-width: 68ch; }
.article-body > .full { max-width: none; }
.article-body p { margin: 0 0 1.4em; }
.article-body h2 {
  margin: 2.4em 0 .55em; font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem);
  font-weight: 800; line-height: 1.35; letter-spacing: -.025em; color: var(--ink-900);
  scroll-margin-top: 110px; text-wrap: balance; position: relative; padding-top: 1.1em;
  border-top: 1px solid var(--line);
}
.dark .article-body h2 { color: #fff; }
.article-body h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.article-body h3 { margin: 1.9em 0 .5em; font-size: 1.18rem; font-weight: 700; line-height: 1.5; letter-spacing: -.018em; color: var(--ink-900); scroll-margin-top: 110px; }
.dark .article-body h3 { color: #fff; }
.article-body strong { color: var(--ink-900); font-weight: 700; }
.dark .article-body strong { color: #fff; }
.article-body a { color: var(--gold-ink); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(201,151,63,.45); text-underline-offset: 4px; }
.dark .article-body a { color: var(--gold-hi); }
.article-body ul, .article-body ol { margin: 0 0 1.6em; padding-inline-start: 1.4em; }
.article-body li { margin-bottom: .6em; padding-inline-start: .2em; }
.article-body li::marker { color: var(--gold-deep); font-weight: 700; }

.article-lede { color: var(--ink-800); font-size: 1.15rem; font-size: clamp(1.05rem, 1rem + .5vw, 1.28rem); line-height: 1.85; font-weight: 400; max-width: 40rem; }
.dark .article-lede { color: rgba(255,255,255,.88); }

.pull {
  margin: 2.4rem 0; padding-inline-start: 1.4rem; border-inline-start: 1px solid var(--gold);
  font-size: clamp(1.15rem, 1rem + .7vw, 1.5rem); font-weight: 700; line-height: 1.55;
  letter-spacing: -.02em; color: var(--ink-900); text-wrap: balance;
}
.dark .pull { color: #fff; }

.article-note {
  margin: 2.2rem 0; padding: 1.15rem 1.3rem; border: 1px solid rgba(201,151,63,.32);
  border-radius: var(--r-control); background: rgba(201,151,63,.06); color: var(--ink-700); font-size: 13.5px; line-height: 1.9;
}
.dark .article-note { color: rgba(255,255,255,.8); }
.article-note strong { color: var(--gold-ink); }
.dark .article-note strong { color: var(--gold-hi); }
.article-note p:last-child { margin-bottom: 0; }

.data-table-wrap { max-width: none !important; overflow-x: auto; margin: 2.2rem 0; }
.data-table {
  width: 100%; min-width: 520px; border-collapse: separate; border-spacing: 0; font-size: 14px;
  border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden;
}
.data-table th, .data-table td { padding: 13px 15px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table th { color: var(--gold-ink); font-weight: 700; background: var(--paper-deep); }
.dark .data-table th { color: var(--gold-hi); background: rgba(255,255,255,.03); }
.data-table td.num { font-variant-numeric: tabular-nums; font-weight: 700; }

.author-mark {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-control);
  background: var(--ink-900); color: var(--gold-hi); font-size: 18px; font-weight: 800; flex: 0 0 auto;
}

@media (max-width: 1023px) {
  .reading-grid { grid-template-columns: minmax(0, 68ch); }
  .toc { display: none; }
}
@media (max-width: 639px) {
  .single-cover { aspect-ratio: 16 / 10; border-radius: var(--r-control); }
  .article-body { font-size: 15.5px; line-height: 1.98; }
  .article-body h2 { font-size: 1.28rem; }
}
