/* ============================================================
   Zoniax blog — page-specific styles
   A reskin of the blog onto the main site's "Drafting Paper /
   Control Room" system. No tokens are redefined here: every
   colour, font, radius and space comes from /assets/styles.css
   (--brand, --ink, --rule, --ff-display, --s-*, …). This file
   only arranges the blog-only furniture (article masthead,
   signal-profile instrument card, share row, reference/FAQ/
   licence blocks, the post register and pagination) using that
   vocabulary so the blog reads as native chrome.
   Light + dark are inherited from the data-theme bootstrap.
   ============================================================ */

/* ---------- Reading-progress bar ----------
   A hairline telemetry trace pinned to the very top edge. blog.js
   sets its width as you move through [data-article]. Sits above the
   sticky nav (z 50) but below the mobile menu overlay (z 60). */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--brand);
  z-index: 55;
  transition: width 120ms linear;
  will-change: width;
}
[data-theme="dark"] .reading-progress {
  box-shadow: 0 0 12px color-mix(in srgb, var(--brand) 60%, transparent);
}

/* ============================================================
   POST PAGE
   ============================================================ */

.post-shell { padding-block: var(--s-7) var(--s-9); }

/* Document layout: masthead spans, then a reading column + a
   sticky instrument rail on desktop. Single column on mobile,
   where the profile card flows right under the masthead. */
.post-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
}
@media (min-width: 1000px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr) clamp(15rem, 22vw, 18.5rem);
    grid-template-areas:
      "masthead masthead"
      "main     aside";
    column-gap: var(--s-8);
    row-gap: var(--s-7);
    align-items: start;
  }
  .post-masthead { grid-area: masthead; }
  .post-main     { grid-area: main; min-width: 0; }
  .post-aside    { grid-area: aside; position: sticky; top: 5.5rem; align-self: start; }
}

/* ---------- Masthead ---------- */
.post-masthead { max-width: 60rem; }

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}
.post-tags .chip {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-mono);
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-1);
  padding: 0.25rem 0.55rem;
}
/* Lead tag carries the brand, like the homepage's live pill. */
.post-tags .chip:first-child {
  color: var(--brand);
  background: var(--brand-bg);
  border-color: var(--brand-edge);
}

.post-title {
  font-family: var(--ff-display);
  font-weight: 380;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--ink-strong);
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
  max-width: 22ch;
}
.post-dek {
  margin-top: var(--s-4);
  font-size: var(--fs-xl);
  line-height: var(--lh-relaxed);
  color: var(--ink-dim);
  max-width: 54ch;
}

.post-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-3);
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-mono);
  color: var(--ink-faint);
}
.post-byline a {
  color: var(--ink);
  border-bottom: 1px solid var(--brand-edge);
  transition: background var(--t-fast) var(--ease-out);
}
.post-byline a:hover { background: var(--brand-bg); }
.post-byline__sep { color: var(--ink-ghost); }

/* ---------- Signal-profile instrument card (the signature) ----------
   Re-uses .card + .card--tick from the design system so the corner
   brackets match the homepage telemetry panel. Frames the back-end's
   radar as a spec-sheet figure. */
.profile-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
}
.profile-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--rule);
}
.profile-card__fig {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-mono);
  color: var(--brand);
}
.profile-card__chart {
  display: flex;
  justify-content: center;
  padding-block: 0;
}
.profile-card .radar-chart {
  width: 100%;
  height: auto;
  max-width: 148px;
}
.profile-card__caption {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-mono);
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
}

/* ---------- Instrument rail: radar · listen · contents ----------
   The aside stacks three instruments. On desktop it's the sticky rail
   (radar → listen → contents); on mobile it flows under the masthead
   with the player surfaced first. */
.post-aside {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

/* Listen — AI-narrated player */
.audio-player {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.audio-player__label { display: flex; align-items: center; gap: var(--s-2); }
.audio-player__label::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-bg);
}
.audio-player__el { width: 100%; }

/* Contents — the numbered section index (01 / 02 / 03 …) */
.post-contents { padding-top: var(--s-5); border-top: 1px solid var(--rule); }
.post-contents__label { display: block; margin-bottom: var(--s-3); }
.post-contents__list { display: flex; flex-direction: column; gap: 1px; }
.post-contents__list a {
  display: grid;
  grid-template-columns: 2.1em 1fr;
  gap: var(--s-2);
  align-items: baseline;
  padding: var(--s-2);
  border-radius: var(--r-1);
  color: var(--ink-dim);
  line-height: var(--lh-snug);
  transition: color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.post-contents__n {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-mono);
  color: var(--ink-faint);
}
.post-contents__t { font-size: var(--fs-sm); }
.post-contents__list a:hover { color: var(--ink-strong); background: var(--surface); }
.post-contents__list a:hover .post-contents__n,
.post-contents__list a.is-active .post-contents__n { color: var(--brand); }
.post-contents__list a.is-active { color: var(--ink-strong); background: var(--brand-bg); }

/* Anchored body sections clear the sticky nav when jumped to */
.prose h2 { scroll-margin-top: 5.5rem; }

/* Mobile: surface the player first, then contents, then the radar */
@media (max-width: 999px) {
  .post-aside { gap: var(--s-6); margin-top: var(--s-4); }
  .post-aside .audio-player { order: -2; border-top: 0; padding-top: 0; }
  .post-aside .post-contents { order: -1; }
}

/* ---------- Reading column ---------- */
.post-main > * + * { margin-top: var(--s-7); }

/* Article body uses the shared .prose rules; just left-align it
   inside the column and tidy the first element's top margin. */
.post-main .prose { margin-inline: 0; }
.post-main .prose > :first-child { margin-top: 0; }

/* Audio slot (back-end fills {{audio_player}} later). */
.post-audio { margin-top: var(--s-5); }

/* ---------- Share row ---------- */
.post-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  padding-top: var(--s-6);
  border-top: 1px solid var(--rule);
}
.post-share__label { margin-right: var(--s-1); }
.post-share__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-mono);
  text-transform: uppercase;
  color: var(--ink-dim);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-1);
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  transition:
    color var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    background-color var(--t-fast) var(--ease-out);
}
.share-btn:hover {
  color: var(--brand);
  border-color: var(--brand-edge);
  background: var(--brand-bg);
}

/* ---------- Author box ---------- */
.post-author { /* combines with .card .card--accent */ }
.post-author .label { display: block; margin-bottom: var(--s-3); }
.post-author__name { color: var(--ink); font-size: var(--fs-md); }
.post-author__name strong { color: var(--ink-strong); font-weight: 600; }
.post-author__bio {
  margin-top: var(--s-2);
  color: var(--ink-dim);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

/* ---------- Generated sections: references / FAQ / licence ----------
   These arrive as fixed markup from generate.py. The post FAQ also
   inherits the shared .faq accordion from styles.css; we only add the
   pieces that file doesn't cover (section heads, ordered references,
   the .faq-answer wrapper). */
.references,
.license,
.disclaimer { margin-top: var(--s-7); padding-top: var(--s-6); border-top: 1px solid var(--rule); }
.faq     { margin-top: var(--s-7); padding-top: var(--s-6); border-top: 1px solid var(--rule); }

.references > h2,
.license > h2,
.disclaimer > h2,
.faq > h2 {
  font-family: var(--ff-display);
  font-weight: 450;
  font-size: var(--fs-xl);
  letter-spacing: var(--ls-snug);
  color: var(--ink-strong);
  margin-bottom: var(--s-4);
}

.references ol {
  counter-reset: ref;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.references li {
  position: relative;
  padding-left: var(--s-6);
  color: var(--ink-dim);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}
.references li::before {
  counter-increment: ref;
  content: counter(ref, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.15em;
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-wide);
  color: var(--brand);
}
.references a {
  color: var(--ink);
  border-bottom: 1px solid var(--brand-edge);
  transition: background var(--t-fast) var(--ease-out);
}
.references a:hover { background: var(--brand-bg); }

.faq-answer {
  margin-top: var(--s-3);
  color: var(--ink-dim);
  line-height: var(--lh-relaxed);
  max-width: 64ch;
}
.faq-answer > * + * { margin-top: var(--s-3); }

.license p {
  color: var(--ink-dim);
  line-height: var(--lh-relaxed);
  max-width: 64ch;
}
.license a {
  color: var(--ink);
  border-bottom: 1px solid var(--brand-edge);
  transition: background var(--t-fast) var(--ease-out);
}
.license a:hover { background: var(--brand-bg); }

.disclaimer p {
  color: var(--ink-faint);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  max-width: 64ch;
}

/* ---------- Related (back-end fills {{related_html}}) ---------- */
.related { margin-top: var(--s-8); padding-top: var(--s-7); border-top: 1px solid var(--rule); }
.related__title {
  font-family: var(--ff-display);
  font-weight: 450;
  font-size: var(--fs-xl);
  letter-spacing: var(--ls-snug);
  color: var(--ink-strong);
  margin-bottom: var(--s-5);
}
.related__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
}
@media (min-width: 640px) {
  .related__list { grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
}
.related-card { display: flex; }
.related-card__link {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-1);
  transition:
    border-color var(--t-fast) var(--ease-out),
    background-color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}
.related-card__link:hover {
  border-color: var(--brand-edge);
  background: var(--brand-bg);
  transform: translateY(-2px);
}
.related-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-mono);
  text-transform: uppercase;
  color: var(--ink-faint);
}
.related-card__tag { color: var(--brand); }
.related-card__tag::before { content: "· "; color: var(--ink-ghost); }
.related-card__title {
  font-family: var(--ff-display);
  font-weight: 440;
  font-size: var(--fs-md);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-snug);
  color: var(--ink-strong);
}

/* ============================================================
   INDEX / ARCHIVE / AUTHOR / USAGE  (shared index.html template)
   ============================================================ */

.blog-shell { padding-block: var(--s-7) var(--s-9); }

.blog-masthead { max-width: 60rem; margin-bottom: var(--s-8); }
.blog-masthead .sec-idx { margin-bottom: var(--s-4); }
.blog-masthead__title {
  font-family: var(--ff-display);
  font-weight: 360;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--ink-strong);
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
}
.blog-masthead__dek {
  margin-top: var(--s-4);
  font-size: var(--fs-xl);
  line-height: var(--lh-relaxed);
  color: var(--ink-dim);
  max-width: 52ch;
}

/* ---------- Post register (list of entries) ---------- */
.post-list { display: flex; flex-direction: column; }

.post-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--s-5);
  align-items: start;
  padding-block: var(--s-6);
  border-top: 1px solid var(--rule);
}
.post-list > .post-row:last-of-type { border-bottom: 1px solid var(--rule); }
@media (min-width: 720px) {
  .post-row { grid-template-columns: 104px 1fr; gap: var(--s-6); }
}

/* Mini radar acts as the entry's "signal stamp". */
.post-row__radar { display: block; opacity: 0.85; transition: opacity var(--t-base) var(--ease-out); }
.post-row__radar .radar-chart { width: 100%; height: auto; }
.post-row:hover .post-row__radar { opacity: 1; }

.post-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-mono);
  text-transform: uppercase;
  color: var(--ink-faint);
}
.post-row__sep { color: var(--ink-ghost); }
.post-row__tag { color: var(--brand); }

.post-row__title {
  margin-top: var(--s-2);
  font-family: var(--ff-display);
  font-weight: 420;
  font-size: var(--fs-2xl);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-snug);
  max-width: 40ch;
}
.post-row__title a {
  color: var(--ink-strong);
  transition: color var(--t-fast) var(--ease-out);
}
.post-row:hover .post-row__title a { color: var(--brand); }

.post-row__dek {
  margin-top: var(--s-3);
  color: var(--ink-dim);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  max-width: 68ch;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.pagination__status {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--ink-faint);
}
.pagination a {
  font-family: var(--ff-mono);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-mono);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-1);
  padding: 0.6rem 1rem;
  transition: border-color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.pagination a:hover { border-color: var(--ink); background: var(--surface-2); }
.pagination__prev::before { content: '← '; }
.pagination__next { margin-left: auto; }
.pagination__next::after { content: ' →'; }

.empty {
  padding: var(--s-8) 0;
  text-align: center;
  font-family: var(--ff-mono);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-mono);
  color: var(--ink-faint);
}

/* ---------- Usage / licensing explainer ---------- */
.usage {
  max-width: 68ch;
  color: var(--ink-dim);
  line-height: var(--lh-relaxed);
}
.usage h2 {
  font-family: var(--ff-display);
  font-weight: 450;
  font-size: var(--fs-2xl);
  letter-spacing: var(--ls-tight);
  color: var(--ink-strong);
  margin-top: var(--s-6);
  margin-bottom: var(--s-3);
}
.usage p { margin-bottom: var(--s-4); }
.usage ul {
  margin-bottom: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.usage li { position: relative; padding-left: var(--s-5); }
.usage li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 14px;
  height: 1px;
  background: var(--brand);
}
.usage a {
  color: var(--ink);
  border-bottom: 1px solid var(--brand-edge);
  transition: background var(--t-fast) var(--ease-out);
}
.usage a:hover { background: var(--brand-bg); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .reading-progress { transition: none; }
}
