/* ============================================================================
 *  article-premium.css
 *  CNN / NYT-inspired long-form article design for The Catalyst Magazine.
 *  Scoped under body[data-page="article"] so it cannot leak into other pages.
 * ============================================================================ */

body[data-page="article"] {
  --ink: #0a0a0a;
  --ink-soft: #1d1d1f;
  --ink-muted: #6e6e73;
  --ink-faint: #a1a1a6;
  --line: #e6e6e6;
  --accent: #0f766e;
  --accent-soft: #14b8a6;
  --paper: #ffffff;
  --paper-tint: #fafaf7;

  --serif: "Source Serif Pro", "Georgia", "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body[data-page="article"] .bg-blobs { display: none; }
body[data-page="article"] main { padding: 0; }
body[data-page="article"] .article-page { padding: 0; margin: 0; }
/* Full-bleed only for the article section itself — leave the site footer's
   .container at normal gutters so the footer doesn't touch the edges. */
body[data-page="article"] .article-page > .container { max-width: none; padding: 0; }

/* --- Reading progress bar --------------------------------------------------
   Two elements at the top of the viewport:
     1. A thin gradient track with a glowing fill that tracks progress through
        the article body (not the full page — we don't want to count the
        footer or related articles as "reading").
     2. A pill on the right showing % read + estimated minutes remaining.
        The pill animates into view once the reader is actually inside the
        article and fades out when they finish. */
.reading-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  z-index: 1000;
  pointer-events: none;
  /* Fight the older stray .reading-progress { width:0% } rule in styles.css
     so the outer bar always spans the viewport. */
  width: 100% !important;
  background: transparent !important;
}
.reading-progress__track {
  position: relative;
  height: 4px;
  background: rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.reading-progress__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent, #2563eb), var(--accent-soft, #60a5fa));
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.55), 0 0 18px rgba(37, 99, 235, 0.35);
  transition: width 0.12s ease-out;
  border-radius: 0 4px 4px 0;
}
.reading-progress__pill {
  position: fixed;
  top: 16px;
  right: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  border-radius: 999px;
  font: 600 11px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
}
.reading-progress__pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.75);
}
.reading-progress__pct {
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}
.reading-progress__remaining {
  font-weight: 500;
  color: rgba(255,255,255,0.72);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.reading-progress__remaining:empty { display: none; }
.reading-progress.is-active .reading-progress__pill {
  opacity: 1;
  transform: translateY(0);
}
.reading-progress.is-complete .reading-progress__pill {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}
.reading-progress.is-complete .reading-progress__pill::before {
  background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,0.8);
}
@media (max-width: 640px) {
  .reading-progress__pill { top: 12px; right: 12px; padding: 6px 12px; }
  .reading-progress__remaining { display: none; }
}

/* --- Back link ------------------------------------------------------------- */
body[data-page="article"] .back-link {
  position: fixed;
  top: 22px;
  left: 28px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
body[data-page="article"] .back-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* --- Article detail shell ------------------------------------------------- */
.article-detail {
  max-width: none;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}

/* --- Hero section (full-bleed) -------------------------------------------- */
.article-hero {
  position: relative;
  width: 100%;
  min-height: min(78vh, 760px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 24px 60px;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}
.article-hero__image {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #111;
  z-index: -2;
}
.article-hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.0) 0%,
    rgba(0,0,0,0.08) 35%,
    rgba(0,0,0,0.55) 78%,
    rgba(0,0,0,0.85) 100%
  );
  z-index: -1;
}

/* Light-cover variant: writer flagged this cover as bright/white, so the
   default scrim can't guarantee contrast on title/deck. Darken the whole
   scrim and add a soft blurred container behind the text block itself. */
.article-hero--light-cover::before {
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.25) 0%,
    rgba(0,0,0,0.45) 45%,
    rgba(0,0,0,0.75) 82%,
    rgba(0,0,0,0.92) 100%
  );
}
.article-hero--light-cover .article-hero__inner {
  position: relative;
  padding: 28px 28px 4px;
  border-radius: 6px;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.28) 0%,
    rgba(0,0,0,0.52) 100%
  );
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.article-hero--light-cover .article-hero__title,
.article-hero--light-cover .article-hero__deck {
  text-shadow: 0 2px 18px rgba(0,0,0,0.55), 0 1px 3px rgba(0,0,0,0.4);
}
.article-hero__inner {
  width: 100%;
  max-width: 880px;
  text-align: left;
}
.article-hero__category {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 2px;
  margin-bottom: 22px;
  color: #fff;
}
.article-hero__title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 5.2vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 20px 0;
  color: #fff;
  text-wrap: balance;
  text-shadow: 0 2px 20px rgba(0,0,0,0.25);
}
.article-hero__deck {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  line-height: 1.5;
  max-width: 780px;
  color: rgba(255,255,255,0.92);
  margin: 0 0 28px 0;
  text-wrap: balance;
}
.article-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
}
.article-hero__meta .dot {
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(255,255,255,0.6);
}
.article-hero__meta .reading-time {
  display: inline-flex; align-items: center; gap: 6px;
}
.article-hero__caption {
  position: absolute;
  bottom: 14px; right: 20px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.02em;
  z-index: 1;
}

/* --- Body column ---------------------------------------------------------- */
.article-body-wrap {
  background: var(--paper);
  padding: 72px 24px 96px;
}
.article-body {
  max-width: 720px;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.7;
  color: var(--ink-soft);
  letter-spacing: -0.003em;
}
.article-body p {
  margin: 0 0 26px 0;
}
.article-body > p:first-of-type::first-letter {
  float: left;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 4.8em;
  line-height: 0.85;
  padding: 6px 14px 0 0;
  color: var(--ink);
}
.article-body h1,
.article-body h2,
.article-body h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 56px 0 18px;
}
.article-body h1 { font-size: 2.1rem; }
.article-body h2 { font-size: 1.65rem; }
.article-body h3 {
  font-size: 1.25rem;
  font-family: var(--sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.article-body a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--accent-soft), var(--accent-soft));
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 1px;
  transition: background-size 0.2s ease;
}
.article-body a:hover {
  background-size: 100% 100%;
  color: #fff;
}

.article-body strong,
.article-body b { font-weight: 700; color: var(--ink); }
.article-body em,
.article-body i { font-style: italic; }
.article-body u { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.article-body s,
.article-body strike,
.article-body del { text-decoration: line-through; color: var(--ink-muted); }
.article-body code {
  background: var(--ink-faint, rgba(0,0,0,.06));
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .92em;
}
.article-body pre {
  background: #0f1115;
  color: #eaeef5;
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 28px 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .95rem;
  line-height: 1.6;
}
.article-body pre code { background: transparent; padding: 0; color: inherit; }

/* Quill alignment classes */
.article-body .ql-align-center { text-align: center; }
.article-body .ql-align-right  { text-align: right; }
.article-body .ql-align-justify { text-align: justify; }

/* Quill indent classes */
.article-body .ql-indent-1 { padding-left: 3em; }
.article-body .ql-indent-2 { padding-left: 6em; }
.article-body .ql-indent-3 { padding-left: 9em; }

/* Pull quote — hairlines top + bottom, centered, big serif. Shared look
   with the compose editor so WYSIWYG holds. */
.article-body figure.rt-pullquote,
.article-body blockquote {
  margin: 56px auto;
  padding: 28px 24px 24px;
  max-width: 640px;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  border-left: none;
  background: transparent;
  text-align: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.015em;
  text-wrap: balance;
  position: relative;
}
.article-body figure.rt-pullquote blockquote {
  margin: 0;
  padding: 0;
  border: none;
  font: inherit;
  color: inherit;
  text-align: inherit;
  max-width: none;
}
.article-body figure.rt-pullquote blockquote::before,
.article-body blockquote::before {
  content: none;
}
.article-body figure.rt-pullquote figcaption,
.article-body blockquote cite,
.article-body blockquote footer {
  display: block;
  margin-top: 14px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border: none;
  padding: 0;
  text-align: center;
}

.article-body ul,
.article-body ol {
  margin: 0 0 26px 0;
  padding-left: 28px;
}
.article-body li { margin-bottom: 10px; }

.article-body img,
.article-body figure {
  display: block;
  max-width: 100%;
  margin: 48px auto;
  border-radius: 4px;
}
.article-body figure { text-align: center; }
/* Editorial figure caption — matches the compose editor so WYSIWYG holds.
   Hairline rule over a serif italic caption, with an optional small-caps
   credit line below (split at the em-dash when the figure was inserted). */
.article-body figcaption,
.article-body img + em {
  display: block;
  margin: 14px auto 0;
  padding-top: 10px;
  max-width: min(100%, 620px);
  border-top: 1px solid rgba(0, 0, 0, 0.14);
  font-family: var(--serif, "Source Serif Pro", Georgia, serif);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink, #1d1d1f);
  font-style: italic;
  font-weight: 400;
  text-align: center;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.article-body figure.rt-size-large figcaption { max-width: 820px; font-size: 15px; }
.article-body figure.rt-size-small figcaption { max-width: 300px; font-size: 13px; }

.article-body figcaption .fig-caption-text {
  display: block;
  color: var(--ink, #1d1d1f);
}
.article-body figcaption .fig-caption-credit {
  display: block;
  margin-top: 6px;
  font-family: var(--sans, "Inter", -apple-system, sans-serif);
  font-style: normal;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted, #6e6e73);
}
.article-body figure.rt-figure-video figcaption {
  border-top: none;
  padding-top: 6px;
  margin-top: 14px;
}
.article-body hr {
  border: none;
  display: block;
  width: 64px;
  height: 18px;
  margin: 32px auto;
  background: transparent;
  position: relative;
  overflow: visible;
  color: var(--ink-faint);
}
.article-body hr::before {
  content: "\2022\00a0\00a0\2022\00a0\00a0\2022";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  letter-spacing: 4px;
  font-size: 14px;
  line-height: 1;
}
.article-body code {
  background: #f1f1f1;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  color: var(--ink);
}
.article-body pre {
  background: #0d1117;
  color: #e6edf3;
  padding: 22px 26px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  margin: 32px 0;
}

/* --- Pull quote (optional <aside class="pull-quote"> support) ------------ */
.article-body .pull-quote {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.8rem;
  line-height: 1.3;
  color: var(--ink);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  padding: 24px 0;
  margin: 56px 0;
  text-align: center;
  letter-spacing: -0.01em;
}

/* --- Byline card (sticky-ish on desktop) --------------------------------- */
.article-byline {
  max-width: 720px;
  margin: 64px auto 0;
  padding: 28px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--sans);
}
.article-byline__avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.article-byline__name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.article-byline__role {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* --- Share row ------------------------------------------------------------ */
.article-share {
  max-width: 720px;
  margin: 28px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.article-share__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}
.article-share__btn:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

/* --- Related articles ---------------------------------------------------- */
.related-wrap {
  background: var(--paper-tint);
  padding: 80px 24px 100px;
  border-top: 1px solid var(--line);
}
.related-inner {
  max-width: 1180px;
  margin: 0 auto;
}
.related-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
  text-align: center;
}
.related-title {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin: 0 0 48px 0;
  letter-spacing: -0.01em;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px;
}

/* Reset the homepage card styles inside related-grid so they render crisp */
.related-grid .article-card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: transform 0.25s ease;
}
.related-grid .article-card:hover { transform: translateY(-4px); }
.related-grid .article-card-image {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  border-radius: 2px;
  margin-bottom: 14px;
  background: #eee;
}
.related-grid .article-card-body { padding: 0; }
.related-grid .article-card-category {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.related-grid .article-card-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 6px 0;
  letter-spacing: -0.005em;
}
.related-grid .article-card-excerpt,
.related-grid .article-card-description {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-muted);
  line-height: 1.5;
}
.related-grid .article-card-meta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  margin-top: 10px;
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 900px) {
  .related-grid { grid-template-columns: 1fr; gap: 32px; }
  .article-body { font-size: 18px; }
  .article-body blockquote { font-size: 1.3rem; margin: 32px 0; padding: 14px 18px; }
  .article-body blockquote::before { font-size: 3.5rem; }
  .article-hero { min-height: 65vh; padding-bottom: 44px; }
  .article-body-wrap { padding: 48px 22px 64px; }
  body[data-page="article"] .back-link { top: 14px; left: 14px; }
  .article-body .pull-quote { font-size: 1.4rem; margin: 40px 0; }
}
@media (max-width: 600px) {
  .article-body > p:first-of-type::first-letter { font-size: 3.6em; padding-right: 10px; }
  .article-hero__category { font-size: 10px; padding: 4px 10px; margin-bottom: 16px; }
}

/* --- Site header + footer tune-up on article pages ----------------------- */
body[data-page="article"] #site-header { display: none; }
body[data-page="article"] #site-footer { background: var(--paper); }

/* Related articles block sits inside the full-bleed container; give it its
   own centered gutter so the grid doesn't touch the viewport edges. */
body[data-page="article"] .related-articles-wrap {
  max-width: 1200px;
  margin: 80px auto 0;
  padding: 0 24px 80px;
}
@media (max-width: 600px) {
  body[data-page="article"] .related-articles-wrap { padding: 0 16px 48px; }
}

/* ==========================================================================
   Article quiz — retro arcade mini-game embedded at the end of a story
   ========================================================================== */

.article-body .article-quiz {
  margin: 64px 0 24px;
  display: flex;
  justify-content: center;
}
.article-quiz-frame {
  width: 100%;
  max-width: 840px;
  height: 720px;
  border: none;
  border-radius: 18px;
  background: #0a0a0f;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}
@media (max-width: 600px) {
  .article-quiz-frame { height: 640px; border-radius: 12px; }
}
