/* =====================================================================
   Story / article reading page — on the shared Mavion system
   ---------------------------------------------------------------------
   Loads AFTER /mavion.css. Inherits all tokens (--bg, --line, --text,
   --dim, --blue, --red, --serif, --sans, --mono, --wrap, --gutter…) and
   the shared chrome (.mast, .sheet, .foot), .wrap, .media, .prose, .card,
   .reveal. This file only styles the article itself + every story.js
   feature, reskinned to those tokens.

   Accent discipline: RED only on Breaking/live, BLUE only on interactive.
   ===================================================================== */

/* ── Reading-mode variables (set on <body class="story-page"> by story.js
      via data-read-theme / data-read-size). Default = the dark system. ── */
.story-page {
  --read-text:    var(--text);
  --read-heading: var(--white);
  --read-muted:   var(--dim);
  --read-surface: var(--bg-card);
  --read-border:  var(--line);
  --read-size:    1.08rem;
}
.story-page[data-read-theme="sepia"] {
  --read-bg:      #f4ecd8;
  --read-text:    #4a3b24;
  --read-heading: #2a1f10;
  --read-muted:   rgba(80,60,30,.62);
  --read-surface: rgba(0,0,0,.03);
  --read-border:  rgba(80,60,30,.14);
  background: var(--read-bg);
}
.story-page[data-read-theme="light"] {
  --read-bg:      #fafafa;
  --read-text:    #1f2937;
  --read-heading: #0f172a;
  --read-muted:   rgba(15,23,42,.6);
  --read-surface: rgba(0,0,0,.025);
  --read-border:  rgba(0,0,0,.08);
  background: var(--read-bg);
}
.story-page[data-read-size="sm"] { --read-size: .96rem; }
.story-page[data-read-size="md"] { --read-size: 1.08rem; }
.story-page[data-read-size="lg"] { --read-size: 1.22rem; }
.story-page[data-read-size="xl"] { --read-size: 1.38rem; }
.story-page { transition: background .3s var(--ease-soft); }

/* ── Reading progress bar ── */
.story-progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0%;
  background: var(--blue);
  z-index: 9999;
  border-radius: 0 2px 2px 0;
  transition: width 80ms linear;
  pointer-events: none;
}

/* ════════════════════════ Article header ════════════════════════ */
.article { padding-bottom: 0; }

.article__head { padding-top: clamp(28px, 4.5vw, 56px); max-width: 1040px; }

.article__crumbs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .04em;
  color: var(--dimmer); margin-bottom: 18px;
}
.article__crumbs a { color: var(--dim); transition: color .15s; }
.article__crumbs a:hover { color: var(--white); }
.article__crumbs .sep { opacity: .6; }

/* Kicker row: section chip + optional breaking pill (#storyHeroChips) */
.article__kicker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 18px;
}

/* Section chip — neutral, mono. NOT blue/red (it isn't interactive/live). */
.story-tag {
  display: inline-flex; align-items: center;
  font-family: var(--mono);
  font-size: .64rem; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line-2);
  padding: 5px 12px; border-radius: 999px;
}

/* Headline — home hero title scale */
.article__title {
  font-family: var(--serif); font-optical-sizing: auto; font-weight: 480;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1.03; letter-spacing: -.022em;
  color: var(--read-heading);
  max-width: 20ch; text-wrap: balance;
  margin: 0;
}

/* Lede / standfirst */
.article__lede {
  font-size: clamp(1.12rem, 1.5vw, 1.4rem);
  line-height: 1.5;
  color: var(--read-muted);
  max-width: 64ch;
  margin-top: 18px;
}
.article__lede:empty { display: none; }

/* Single clean meta row (.meta from mavion.css gives mono + dim) */
.article__meta { margin-top: 24px; }
.article__byline { display: inline-flex; align-items: center; gap: 9px; }
.article__avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center;
  font-family: var(--sans); font-size: .6rem; font-weight: 700; letter-spacing: .02em;
  color: #cdd9ee;
  background: linear-gradient(135deg, #2a3142, #161a24);
  border: 1px solid var(--line-2);
}
.article__avatar img { width: 100%; height: 100%; object-fit: cover; }
.article__views { display: inline-flex; align-items: center; gap: 6px; }
.article__views svg { width: 14px; height: 14px; }

/* ════════════════════════ Contained hero image ════════════════════════ */
.article__hero { margin-top: clamp(28px, 4vw, 48px); max-width: 1040px; }
.article__media { aspect-ratio: 16 / 9; border-radius: var(--radius); }
.article__hero-img { width: 100%; height: 100%; object-fit: cover; }

/* Hero image load states — inherit .media grade, just fade in */
.story-hero__img--pending { opacity: 0; }
.story-hero__img--loaded  { opacity: 1; transition: opacity .7s var(--ease-soft); }

/* No-image fallback — story.js adds .story-hero--no-image to the figure
   when a story has no image. Collapse the frame (and its wrapper) cleanly. */
.article__media.story-hero--no-image { display: none; }
.article__hero:has(.story-hero--no-image) { display: none; }

/* ════════════════════════ Body + rail layout ════════════════════════ */
.article__layout {
  display: grid;
  grid-template-columns: 48px minmax(0, 68ch) auto;
  justify-content: center;
  gap: clamp(24px, 4vw, 56px);
  padding-top: clamp(36px, 5vw, 60px);
  padding-bottom: var(--rhythm);
}
.article__body { min-width: 0; max-width: 68ch; }
/* Optional auto-TOC (story.js appends .story-toc as the 3rd grid child) */
.article__layout .story-toc { width: 220px; }

/* Sticky share rail (#storyTools). Hidden until story.js + scroll reveal. */
.article__rail {
  position: sticky; top: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  align-self: start;
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s var(--ease-soft), transform .25s var(--ease-soft);
  pointer-events: none;
}
.article__rail.visible { opacity: 1; transform: none; pointer-events: auto; }
.article__rail[hidden] { display: none; }
.article__rail-btn {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  transition: color .18s, border-color .18s, background .18s, transform .12s;
}
.article__rail-btn svg { width: 17px; height: 17px; fill: currentColor; }
.article__rail-btn .material-symbols-rounded { font-size: 19px; }
.article__rail-btn:hover {
  color: var(--blue); border-color: rgba(76,141,255,.4); background: var(--blue-soft);
}
.article__rail-btn.active {
  color: var(--blue); border-color: rgba(76,141,255,.4); background: var(--blue-soft);
}
.article__rail-btn.bookmark-btn.active .material-symbols-rounded { font-variation-settings: 'FILL' 1; }
.article__rail-divider { width: 22px; height: 1px; background: var(--line); margin: 2px 0; }

/* ════════════════════════ Article body (.prose injected content) ════════════════════════ */
#storyContent {
  font-size: var(--read-size);
  line-height: 1.75;
  color: var(--read-text);
  transition: color .3s var(--ease-soft), font-size .2s var(--ease-soft);
}
#storyContent { max-width: 68ch; }
#storyContent > * + * { margin-top: 1.15em; }
#storyContent p { color: var(--read-text); }
#storyContent h2 {
  font-family: var(--serif); font-optical-sizing: auto; font-weight: 500;
  font-size: calc(var(--read-size) * 1.6); letter-spacing: -.018em; line-height: 1.14;
  color: var(--read-heading); margin-top: 1.8em; scroll-margin-top: 96px;
}
#storyContent h3 {
  font-family: var(--serif); font-optical-sizing: auto; font-weight: 500;
  font-size: calc(var(--read-size) * 1.2); letter-spacing: -.012em;
  color: var(--read-heading); margin-top: 1.5em; scroll-margin-top: 96px;
}
#storyContent h2:first-child, #storyContent h3:first-child { margin-top: 0; }
#storyContent li { color: var(--read-text); }
#storyContent ul, #storyContent ol { padding-left: 1.3em; }
#storyContent li + li { margin-top: .5em; }
#storyContent strong { color: var(--read-heading); font-weight: 600; }
#storyContent a {
  color: var(--blue);
  border-bottom: 1px solid rgba(76,141,255,.3);
  transition: border-color .15s;
}
#storyContent a:hover { border-bottom-color: var(--blue); }
#storyContent hr { border: 0; border-top: 1px solid var(--read-border); margin: 2.2em 0; }
#storyContent code {
  font-family: var(--mono); font-size: .86em;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 6px; padding: .12em .4em;
}
#storyContent img {
  width: 100%; border-radius: 12px; margin: 1.6em 0;
  background: linear-gradient(135deg, #181b22, #0b0c10);
  cursor: zoom-in;
}

/* Blockquote — restrained, like .prose */
#storyContent blockquote {
  border-left: 2px solid var(--line-2);
  padding: 4px 0 4px 22px;
  margin: 1.6em 0;
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: calc(var(--read-size) * 1.18);
  font-style: italic; line-height: 1.45;
  color: var(--read-muted);
}

/* Pull-quote — centred editorial accent */
#storyContent .pullquote,
#storyContent blockquote[data-pullquote] {
  display: block; border: none;
  margin: 1.8em 0; padding: 0 clamp(0px, 4vw, 28px);
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: calc(var(--read-size) * 1.5); line-height: 1.3;
  color: var(--read-heading);
  text-align: center; font-style: italic;
}
#storyContent .pullquote::before, #storyContent .pullquote::after {
  content: ''; display: block; width: 40px; height: 2px;
  background: var(--blue); margin: 14px auto;
}

/* TTS speaking highlight */
#storyContent .tts-speaking {
  background: var(--blue-soft); border-radius: 6px;
  padding: 2px 6px; margin: -2px -6px; transition: background .3s;
}

/* ── Inline article images injected via .media (galleries etc.) ── */
.story-gallery {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin: 1.8em 0; border-radius: 12px; overflow: hidden;
}
.story-gallery img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 0; margin: 0; cursor: zoom-in; transition: transform .35s var(--ease);
}
.story-gallery img:hover { transform: scale(1.02); }

/* ════════════════════════ Key takeaways (#storyTakeaways) ════════════════════════ */
.story-takeaways {
  margin: 2em 0;
  padding: 24px 26px;
  background: var(--blue-soft);
  border: 1px solid rgba(76,141,255,.22);
  border-radius: 14px;
}
.story-takeaways__label {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono);
  font-size: .64rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 14px;
}
.story-takeaways ul { list-style: none; padding: 0; margin: 0; }
.story-takeaways li {
  position: relative; padding-left: 24px; margin-bottom: 10px;
  font-size: .98rem; line-height: 1.6; color: var(--read-text);
}
.story-takeaways li::before {
  content: ''; position: absolute; left: 0; top: .6em;
  width: 13px; height: 2px; background: var(--blue); border-radius: 2px;
}
.story-takeaways li:last-child { margin-bottom: 0; }

/* ════════════════════════ Official statement / response (#storyResponse) ════════════════════════ */
.story-response {
  margin: 2em 0;
  border-left: 3px solid var(--blue);
  border-radius: 0 12px 12px 0;
  background: var(--blue-soft);
  padding: 22px 26px;
  position: relative;
}
.story-response::before {
  content: '\201C';
  position: absolute; top: 8px; right: 18px;
  font-size: 4.5rem; line-height: 1;
  color: rgba(76,141,255,.16);
  font-family: var(--serif); pointer-events: none;
}
.story-response__header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.story-response__badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em;
  color: var(--blue);
  background: rgba(76,141,255,.16); border: 1px solid rgba(76,141,255,.32);
  padding: 4px 10px; border-radius: 999px;
}
.story-response__from {
  font-family: var(--mono);
  font-size: .72rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
  color: var(--read-muted);
}
.story-response__quote {
  margin: 0; padding: 0; border: none;
  font-size: 1rem; line-height: 1.7;
  color: var(--read-text); font-style: italic;
  white-space: pre-wrap; word-break: break-word;
}
.story-response__footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(76,141,255,.18); }
.story-response__link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .82rem; font-weight: 600; color: var(--blue); text-decoration: none;
  transition: opacity .15s;
}
.story-response__link:hover { opacity: .8; }

/* ── Editor's update / correction banner ── */
.story-update-note {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0 0 1.6em; padding: 14px 18px; border-radius: 10px;
  background: var(--blue-soft); border: 1px solid rgba(76,141,255,.22);
}
.story-update-note__label {
  flex-shrink: 0; font-family: var(--mono);
  font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  color: var(--blue); white-space: nowrap; padding-top: 2px;
}
.story-update-note__text { font-size: .9rem; color: var(--read-muted); line-height: 1.6; }

/* ── Related video ── */
.story-video { margin: 2em 0; }
.story-video__frame {
  position: relative; padding-top: 56.25%;
  border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, #181b22, #0b0c10);
}
.story-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.story-video__player { width: 100%; border-radius: 12px; display: block; }
.story-video__caption {
  margin: 10px 0 0; font-size: .82rem; color: var(--dimmer);
  font-style: italic; text-align: center;
}

/* ════════════════════════ AdSense slots ════════════════════════ */
.story-ad {
  display: block; margin: 2.6em 0; text-align: center;
  padding: 18px 0;
  border-top: 1px solid var(--read-border);
  border-bottom: 1px solid var(--read-border);
}
.story-ad__label {
  font-family: var(--mono);
  font-size: .58rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dimmer); margin-bottom: 8px; display: block;
}
.story-ad ins { display: block; min-height: 90px; }

/* ════════════════════════ Support / tip-jar row ════════════════════════ */
.story-support {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px; margin-top: 2.4em;
  background: var(--read-surface);
  border: 1px solid var(--read-border);
  border-radius: 14px;
}
.story-support__icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--blue); background: var(--blue-soft);
}
.story-support__icon .material-symbols-rounded { font-size: 21px; font-variation-settings: 'FILL' 1; }
.story-support__text { flex: 1; min-width: 0; }
.story-support__text strong { font-size: .94rem; color: var(--read-heading); display: block; margin-bottom: 2px; }
.story-support__text span { font-size: .82rem; color: var(--read-muted); }

/* ════════════════════════ Tags row (#storyTagsRow) ════════════════════════ */
.story-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 2.4em; padding-top: 24px;
  border-top: 1px solid var(--read-border);
}
.story-tag-pill {
  font-family: var(--mono);
  padding: 6px 14px; border: 1px solid var(--read-border); border-radius: 999px;
  font-size: .66rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  color: var(--read-muted); transition: color .18s, border-color .18s;
}
.story-tag-pill:hover { border-color: var(--blue); color: var(--blue); }

/* ════════════════════════ Inline share bar ════════════════════════ */
.story-share-bar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 2em; padding: 20px 0;
  border-top: 1px solid var(--read-border);
  border-bottom: 1px solid var(--read-border);
}
.story-share-bar__label {
  font-family: var(--mono);
  font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  color: var(--dimmer); margin-right: 4px;
}
.story-share-bar__btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: transparent; border: 1px solid var(--line);
  color: var(--dim);
  display: inline-grid; place-items: center;
  transition: color .18s, border-color .18s, background .18s;
}
.story-share-bar__btn svg { width: 16px; height: 16px; fill: currentColor; }
.story-share-bar__btn .material-symbols-rounded { font-size: 18px; }
.story-share-bar__btn:hover { color: var(--blue); border-color: rgba(76,141,255,.4); background: var(--blue-soft); }

/* ════════════════════════ Author bio card (#storyAuthorCard) ════════════════════════ */
.story-author-card {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 24px; margin-top: 2.4em;
  background: var(--read-surface);
  border: 1px solid var(--read-border);
  border-radius: var(--radius);
}
.story-author-card__avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center;
  font-family: var(--sans); font-weight: 700; font-size: 1.3rem; color: #cdd9ee;
  background: linear-gradient(135deg, #2a3142, #161a24);
  border: 1px solid var(--line-2);
}
.story-author-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.story-author-card__label {
  font-family: var(--mono);
  font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  color: var(--dim); margin-bottom: 6px;
}
.story-author-card__name { font-family: var(--serif); font-size: 1.1rem; font-weight: 500; color: var(--read-heading); margin-bottom: 3px; }
.story-author-card__role { font-size: .8rem; color: var(--read-muted); margin-bottom: 12px; }
.story-author-card__bio { font-size: .88rem; color: var(--read-muted); line-height: 1.65; margin: 0; }

/* ════════════════════════ Related stories (#relatedStories) ════════════════════════ */
.story-related { padding-bottom: var(--rhythm); }
.story-related .sec__head { margin-bottom: clamp(24px, 3vw, 38px); }
.story-related__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* story.js renders .story-rel-card markup directly — reskin to .card tokens */
.story-rel-card {
  display: flex; flex-direction: column;
  text-decoration: none;
}
.story-rel-card__img,
.story-rel-card__placeholder {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block;
  border-radius: 12px; margin-bottom: 14px;
  background: linear-gradient(135deg, #181b22, #0b0c10);
  filter: saturate(.9) contrast(1.04) brightness(.92);
  transition: transform 1.2s var(--ease), filter .5s var(--ease-soft);
}
.story-rel-card:hover .story-rel-card__img { transform: scale(1.04); filter: saturate(1) contrast(1.04) brightness(1); }
.story-rel-card__placeholder {
  display: grid; place-items: center; color: var(--line-2);
}
.story-rel-card__placeholder .material-symbols-rounded { font-size: 2.2rem; }
.story-rel-card__body { display: flex; flex-direction: column; flex: 1; }
.story-rel-card__tag {
  font-family: var(--mono);
  font-size: .62rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dimmer); margin-bottom: 9px;
}
.story-rel-card__title {
  font-family: var(--serif); font-optical-sizing: auto; font-weight: 500;
  font-size: 1.1rem; line-height: 1.18; letter-spacing: -.012em;
  color: var(--white); margin-bottom: auto;
  transition: color .18s var(--ease-soft);
}
.story-rel-card:hover .story-rel-card__title { color: #fff; }
.story-rel-card__meta {
  font-family: var(--mono);
  font-size: .68rem; letter-spacing: .02em; color: var(--dim); margin-top: 12px;
}

/* ════════════════════════ Reading-settings popover (#storyReadSettings) ════════════════════════ */
.story-read-settings {
  position: fixed; top: 50%; right: clamp(16px, 4vw, 40px);
  transform: translateY(-50%) scale(.96);
  z-index: 80; width: 250px; padding: 18px;
  background: rgba(11,12,16,.92);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease-soft), transform .2s var(--ease-soft);
}
.story-read-settings.open { opacity: 1; pointer-events: auto; transform: translateY(-50%) scale(1); }
.story-read-settings[hidden] { display: none; }
.story-read-settings h4 {
  font-family: var(--mono);
  font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  color: var(--dim); margin: 0 0 10px;
}
.story-rs-row { display: flex; gap: 6px; margin-bottom: 16px; }
.story-rs-row:last-child { margin-bottom: 0; }
.story-rs-btn {
  flex: 1; padding: 10px 6px;
  border: 1px solid var(--line); background: transparent; color: var(--dim);
  border-radius: 10px; font-size: .78rem; font-weight: 600; font-family: inherit;
  transition: color .15s, border-color .15s, background .15s;
}
.story-rs-btn:hover { color: var(--blue); border-color: rgba(76,141,255,.4); background: var(--blue-soft); }
.story-rs-btn.active { color: #06070a; background: var(--white); border-color: var(--white); }
.story-rs-theme { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 4px; }
.story-rs-theme__swatch { width: 15px; height: 15px; border-radius: 50%; display: inline-block; }
.story-rs-theme[data-theme="dark"]  .story-rs-theme__swatch { background: #1a1a1a; border: 1px solid #555; }
.story-rs-theme[data-theme="sepia"] .story-rs-theme__swatch { background: #f4ecd8; border: 1px solid #c4b796; }
.story-rs-theme[data-theme="light"] .story-rs-theme__swatch { background: #fafafa; border: 1px solid #ddd; }

/* ════════════════════════ Listen / TTS bar (#storyListenBar) ════════════════════════ */
.story-listen-bar {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 80; width: min(440px, calc(100vw - 24px));
  padding: 12px 16px; display: flex; align-items: center; gap: 14px;
  background: rgba(11,12,16,.9);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 14px 44px rgba(0,0,0,.55);
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.story-listen-bar.open { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.story-listen-bar[hidden] { display: none; }
.story-listen-bar__btn {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--blue); color: #04060c; border: none;
  transition: transform .15s, filter .18s;
}
.story-listen-bar__btn:hover { transform: scale(1.06); filter: brightness(1.08); }
.story-listen-bar__btn .material-symbols-rounded { font-size: 23px; font-variation-settings: 'FILL' 1; }
.story-listen-bar__info { flex: 1; min-width: 0; }
.story-listen-bar__title { font-size: .85rem; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-listen-bar__sub { font-family: var(--mono); font-size: .68rem; color: var(--dim); margin-top: 2px; }
.story-listen-bar__close {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); color: var(--dim);
  transition: color .15s, border-color .15s, background .15s;
}
.story-listen-bar__close:hover { color: var(--white); border-color: var(--line-2); }
.story-listen-bar__close .material-symbols-rounded { font-size: 17px; }

/* ════════════════════════ Toast (#storyToast) ════════════════════════ */
.story-toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px; z-index: 100;
  background: rgba(11,12,16,.94);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--white); font-size: .84rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease-soft), transform .25s var(--ease-soft);
}
.story-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.story-toast[hidden] { display: none; }
.story-toast .material-symbols-rounded { font-size: 17px; color: var(--blue); }

/* ════════════════════════ Image lightbox (#storyLightbox) ════════════════════════ */
.story-lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4,5,7,.95);
  display: none; align-items: center; justify-content: center;
  padding: 40px; cursor: zoom-out;
}
.story-lightbox.open { display: flex; }
.story-lightbox[hidden] { display: none; }
.story-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.story-lightbox__close {
  position: absolute; top: 20px; right: 20px;
  width: 44px; height: 44px; border-radius: 11px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line-2); color: var(--white);
  transition: background .15s, border-color .15s;
}
.story-lightbox__close:hover { background: rgba(255,255,255,.08); border-color: var(--white); }

/* ════════════════════════ Auto Table of Contents (story.js builds .story-toc) ════════════════════════ */
.story-toc {
  position: sticky; top: 96px; align-self: start;
  width: 100%; padding: 16px 16px 18px;
  background: var(--read-surface);
  border: 1px solid var(--read-border);
  border-radius: 14px;
  max-height: calc(100vh - 130px); overflow-y: auto;
}
.story-toc__label {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  color: var(--dim); margin-bottom: 12px;
}
.story-toc__label .material-symbols-rounded { font-size: 14px; }
.story-toc ul { list-style: none; padding: 0; margin: 0; }
.story-toc a {
  display: block; padding: 6px 10px;
  font-size: .8rem; line-height: 1.4; color: var(--read-muted);
  text-decoration: none; border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0; transition: color .15s, background .15s, border-color .15s;
}
.story-toc a:hover { color: var(--read-heading); background: rgba(255,255,255,.04); }
.story-toc a.active { color: var(--blue); border-left-color: var(--blue); background: var(--blue-soft); font-weight: 600; }
.story-toc a[data-level="3"] { padding-left: 22px; font-size: .76rem; }

/* ════════════════════════ Comments ════════════════════════ */
.story-comments {
  margin: 3em 0 2em; padding: 28px 0 0;
  border-top: 1px solid var(--read-border);
}
.story-comments__head h3 {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
  font-family: var(--serif); font-optical-sizing: auto; font-weight: 500;
  font-size: 1.5rem; letter-spacing: -.012em; color: var(--read-heading);
}
.story-comments__head h3 .material-symbols-rounded { font-size: 22px; color: var(--blue); }
.story-comments__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 8px;
  background: var(--blue-soft); color: var(--blue);
  border-radius: 999px;
  font-family: var(--mono); font-size: .74rem; font-weight: 600;
}
.story-comments__sub { margin: 0 0 22px; color: var(--read-muted); font-size: .88rem; }
.story-comments__sub code {
  background: var(--blue-soft); color: var(--blue);
  padding: 1px 6px; border-radius: 4px;
  font-family: var(--mono); font-size: .82em;
}

/* [hidden] must win over the flex layout below */
.story-comments__signin[hidden],
.story-comments__form[hidden] { display: none !important; }

/* Signed-out gate */
.story-comments__signin {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px; margin-bottom: 22px;
  background: var(--blue-soft);
  border: 1px solid rgba(76,141,255,.25);
  border-radius: 14px;
}
.story-comments__signin strong { display: block; color: var(--read-heading); font-size: .98rem; margin-bottom: 2px; }
.story-comments__signin p { margin: 0; color: var(--read-muted); font-size: .85rem; }
.story-comments__signin-logo {
  flex-shrink: 0; height: 26px; width: auto; max-width: 140px; object-fit: contain;
}
.story-comments__signin-copy { flex: 1; min-width: 180px; }
.story-comments__signin-btn {
  flex-shrink: 0; padding: 9px 18px;
  background: var(--blue); color: #04060c; border-radius: 999px;
  font-weight: 600; font-size: .85rem; text-decoration: none; white-space: nowrap;
  transition: filter .15s, transform .12s;
}
.story-comments__signin-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* Posting form */
.story-comments__form {
  padding: 18px 20px 14px; margin-bottom: 22px;
  background: var(--read-surface);
  border: 1px solid var(--read-border);
  border-radius: 14px;
}
.story-comments__form-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.story-comments__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-card); object-fit: cover; border: 1px solid var(--line);
}
.story-comments__form-as { font-size: .9rem; font-weight: 600; color: var(--read-heading); }
.story-comments__textarea-wrap { position: relative; }
.story-comments__textarea {
  width: 100%; padding: 12px 14px; resize: vertical; min-height: 80px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 11px;
  color: var(--read-heading); font-family: inherit;
  font-size: .92rem; line-height: 1.55;
  transition: border-color .15s, box-shadow .15s;
}
.story-comments__textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.story-comments__textarea::placeholder { color: var(--dimmer); }

/* @mention autocomplete dropdown */
.story-comments__mentions {
  position: absolute; z-index: 30;
  min-width: 220px; max-width: 320px;
  background: var(--bg-card);
  border: 1px solid rgba(76,141,255,.35); border-radius: 11px;
  padding: 4px; box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
.story-comments__mention-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  color: var(--white); font-size: .88rem; transition: background .12s;
}
.story-comments__mention-item:hover,
.story-comments__mention-item[aria-selected="true"] { background: var(--blue-soft); }
.story-comments__mention-item img,
.story-comments__mention-fallback {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  background: var(--blue-soft);
  display: grid; place-items: center;
  color: var(--blue); font-weight: 700; font-size: .72rem; text-transform: uppercase;
}
.story-comments__mention-meta { flex: 1; min-width: 0; line-height: 1.25; }
.story-comments__mention-item .name { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--white); }
.story-comments__mention-item .handle { color: var(--dim); font-size: .78rem; font-family: var(--mono); }
.story-comments__mention-badge {
  display: inline-flex; align-items: center; padding: 1px 6px;
  background: var(--blue-soft); color: var(--blue);
  border: 1px solid rgba(76,141,255,.35); border-radius: 5px;
  font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.story-comments__mention-empty {
  padding: 10px 12px; color: var(--dim); font-size: .82rem; font-style: italic; text-align: center;
}

.story-comments__form-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.story-comments__charcount { font-family: var(--mono); font-size: .72rem; color: var(--dimmer); }
.story-comments__charcount.over { color: var(--red); }
.story-comments__post {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
  background: var(--blue); color: #04060c; border: 0; border-radius: 999px;
  font-weight: 600; font-size: .85rem;
  transition: filter .15s, transform .12s, opacity .15s;
}
.story-comments__post:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.story-comments__post:disabled { opacity: .5; cursor: not-allowed; }
.story-comments__post .material-symbols-rounded { font-size: 16px; }
.story-comments__error {
  margin: 10px 0 0; padding: 8px 12px;
  background: var(--red-soft); border: 1px solid rgba(255,59,51,.32); border-radius: 8px;
  color: #ff9f9a; font-size: .82rem;
}

/* List + items */
.story-comments__list { display: flex; flex-direction: column; gap: 14px; }
.story-comments__empty { margin: 0; padding: 22px 0; text-align: center; color: var(--dim); font-size: .9rem; }
.story-comment {
  display: flex; gap: 12px; padding: 14px 16px;
  background: var(--read-surface);
  border: 1px solid var(--read-border); border-radius: 12px;
  transition: border-color .12s, background .12s; scroll-margin-top: 96px;
}
.story-comment:target,
.story-comment.story-comment--highlight { background: var(--blue-soft); border-color: rgba(76,141,255,.4); }
.story-comment--reply { margin-left: 36px; padding: 12px 14px; background: rgba(0,0,0,.18); }
.story-comment__avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  background: var(--blue-soft);
  display: grid; place-items: center;
  color: var(--blue); font-weight: 700; font-size: .82rem; text-transform: uppercase;
}
.story-comment__body { flex: 1; min-width: 0; }
.story-comment__head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.story-comment__name { font-size: .88rem; font-weight: 700; color: var(--read-heading); }
.story-comment__handle { font-family: var(--mono); font-size: .78rem; color: var(--dim); }
.story-comment__handle:hover { color: var(--blue); }
.story-comment__time { font-family: var(--mono); font-size: .72rem; color: var(--dimmer); margin-left: auto; }
.story-comment__text { margin: 0; color: var(--read-text); font-size: .92rem; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.story-comment__text .mention { color: var(--blue); font-weight: 600; text-decoration: none; }
.story-comment__text .mention:hover { text-decoration: underline; }
.story-comment__actions { display: flex; gap: 14px; margin-top: 8px; }
.story-comment__action { background: 0; border: 0; padding: 0; color: var(--dim); font-size: .78rem; font-family: inherit; }
.story-comment__action:hover { color: var(--blue); }
.story-comment__action--danger { color: #ff9f9a; }
.story-comment__action--danger:hover { color: var(--red); }

/* ════════════════════════ Light / sepia reading-mode tweaks ════════════════════════ */
.story-page[data-read-theme="sepia"] .story-toc a:hover,
.story-page[data-read-theme="light"] .story-toc a:hover { background: rgba(0,0,0,.04); }

/* ════════════════════════ Responsive ════════════════════════ */
@media (max-width: 1280px) {
  /* No room for the side TOC — drop it (in-body headings remain) */
  .article__layout { grid-template-columns: 48px minmax(0, 68ch); }
  .article__layout .story-toc { display: none; }
}
@media (max-width: 1080px) {
  /* Drop the sticky rail; the inline share bar covers sharing on smaller screens */
  .article__layout { grid-template-columns: minmax(0, 68ch); justify-content: center; }
  .article__rail { display: none; }
}
@media (max-width: 900px) {
  .story-related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-read-settings { display: none; }
}
@media (max-width: 600px) {
  .article__media { aspect-ratio: 3 / 2; }
  .story-comments__signin { flex-direction: column; align-items: flex-start; }
  .story-comment--reply { margin-left: 18px; }
}
@media (max-width: 520px) {
  .story-related__grid { grid-template-columns: 1fr; }
  .article__meta .article__views { display: none; }
}

/* Honour reduced motion (mavion.css already neutralises .reveal/.media) */
@media (prefers-reduced-motion: reduce) {
  .story-rel-card__img,
  .story-listen-bar,
  .story-read-settings,
  .story-toast { transition: none !important; }
  .story-rel-card:hover .story-rel-card__img { transform: none; }
}
