/* =============================================================
   antagonistical.com — refined.css
   Editorial-grade typography refinement layer.
   Drop in AFTER the parent stylesheet so :root variables resolve.
   Tokens consumed: --bg, --bg-card, --border, --text, --text-dim,
                    --red (#ff3b3b), --orange (#ff8c00).
   Fonts: 'Playfair Display' (display), 'Inter' (body).
   ============================================================= */

/* ---------- Fluid type scale -------------------------------- */
:root {
  --fs-xs:    clamp(0.78rem, 0.74rem + 0.18vw, 0.88rem);
  --fs-sm:    clamp(0.88rem, 0.84rem + 0.20vw, 0.98rem);
  --fs-base:  clamp(1.02rem, 0.97rem + 0.28vw, 1.18rem);
  --fs-lead:  clamp(1.14rem, 1.05rem + 0.45vw, 1.34rem);
  --fs-h3:    clamp(1.35rem, 1.22rem + 0.65vw, 1.70rem);
  --fs-h2:    clamp(1.75rem, 1.50rem + 1.20vw, 2.45rem);
  --fs-h1:    clamp(2.25rem, 1.85rem + 2.10vw, 3.85rem);
  --measure:  68ch;
  --rhythm:   1.75;
  --ease:     cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Base body rhythm -------------------------------- */
body {
  font-size: var(--fs-base);
  line-height: var(--rhythm);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* Article container — apply to <article class="prose"> wrapper */
.prose {
  max-width: var(--measure);
  margin: 0 auto;
  font-size: var(--fs-base);
  line-height: var(--rhythm);
  color: var(--text);
}

.prose > * + * { margin-top: 1.25em; }

.prose p {
  color: #cfcfcf;
  letter-spacing: 0.005em;
  hanging-punctuation: first last;
}

.prose .lede {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text);
  letter-spacing: -0.005em;
}

/* ---------- Display headings -------------------------------- */
.prose h1, .prose h2, .prose h3 {
  font-family: 'Playfair Display', serif;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 1.6em;
}

.prose h1 { font-size: var(--fs-h1); letter-spacing: -0.03em; }
.prose h2 { font-size: var(--fs-h2); }
.prose h3 { font-size: var(--fs-h3); letter-spacing: -0.015em; }

/* Small caps section dividers */
.prose .kicker {
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--red);
  font-weight: 600;
}

/* ---------- Drop cap ---------------------------------------- */
/* Usage: <p class="drop-cap">First paragraph...</p> */
.drop-cap::first-letter {
  font-family: 'Playfair Display', serif;
  float: left;
  font-size: 4.6em;
  line-height: 0.85;
  padding: 0.08em 0.12em 0 0;
  margin-right: 0.06em;
  background: linear-gradient(135deg, var(--red), var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* ---------- Pull quote -------------------------------------- */
/* Usage: <aside class="pull-quote">"Words..."</aside> */
.pull-quote {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2.1rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  border-left: 3px solid var(--red);
  padding: 0.4em 0 0.4em 1.2em;
  margin: 2.4em 0;
  position: relative;
}

.pull-quote::before {
  content: "“";
  position: absolute;
  left: 0.25em;
  top: -0.2em;
  font-size: 2.2em;
  color: var(--red);
  opacity: 0.35;
  line-height: 1;
}

/* Standard blockquote */
.prose blockquote {
  border-left: 2px solid var(--orange);
  padding: 0.2em 0 0.2em 1.25em;
  margin: 1.6em 0;
  font-style: italic;
  color: #d8d8d8;
}

.prose blockquote cite {
  display: block;
  margin-top: 0.6em;
  font-size: var(--fs-sm);
  font-style: normal;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.prose blockquote cite::before { content: "— "; }

/* Inline links inside articles */
.prose a {
  color: var(--red);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color .2s var(--ease);
}
.prose a:hover { color: var(--orange); }

/* Lists with rhythm */
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.45em; }
.prose ul li::marker { color: var(--red); }
.prose ol li::marker { color: var(--orange); font-weight: 600; }

/* hr as editorial break */
.prose hr {
  border: 0;
  text-align: center;
  margin: 2.6em 0;
  height: 1em;
}
.prose hr::after {
  content: "❦";
  color: var(--red);
  font-size: 1.2em;
  letter-spacing: 0.5em;
}

/* ---------- Custom selection -------------------------------- */
::selection         { background: var(--red); color: #fff; text-shadow: none; }
::-moz-selection    { background: var(--red); color: #fff; text-shadow: none; }

/* ---------- Read-progress bar ------------------------------- */
/* CSS only — pair with the tiny JS hook in the comment block at the bottom of this file. */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--red), var(--orange));
  z-index: 9999;
  transition: width .08s linear;
  pointer-events: none;
}

/* ---------- Scroll-reveal ----------------------------------- */
/* Usage: add class .reveal to any block. JS toggles .is-visible. */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity   .7s var(--ease),
    transform .7s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Optional stagger helper */
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
.reveal[data-delay="4"] { transition-delay: .32s; }

/* ---------- Editorial signoff ------------------------------- */
.signoff {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--text-dim);
  text-align: right;
  letter-spacing: 0.02em;
}
.signoff strong { color: var(--text); font-style: normal; }

/* ---------- Reduced motion ---------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .read-progress { transition: none !important; }
}

/* ---------- Print ------------------------------------------- */
@media print {
  :root {
    --bg: #fff; --bg-card: #fff; --border: #ddd;
    --text: #111; --text-dim: #555;
    --red: #b81e1e; --orange: #b35e00;
  }
  body, .prose { background: #fff !important; color: #111 !important; }
  .prose p, .prose li { color: #222 !important; }
  header, footer, nav, .read-progress, .reveal { opacity: 1 !important; transform: none !important; }
  .read-progress, .cta, .disclaimer { display: none !important; }
  .prose a { color: #111 !important; text-decoration: underline; }
  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
    word-break: break-all;
  }
  .pull-quote { break-inside: avoid; border-color: #b81e1e; }
  .drop-cap::first-letter {
    -webkit-text-fill-color: #b81e1e;
    background: none;
    color: #b81e1e;
  }
  h1, h2, h3 { break-after: avoid; }
  p, blockquote, .pull-quote { orphans: 3; widows: 3; }
}

/* =============================================================
   INTEGRATOR NOTES — inline these tiny scripts in the page <body>
   (kept here as comments so the CSS file stays self-contained):

   1) READ-PROGRESS BAR
      Add <div class="read-progress" id="readProgress"></div> at top of <body>.
      Then inline:

      <script>
        (function () {
          var bar = document.getElementById('readProgress');
          if (!bar) return;
          function update() {
            var h = document.documentElement;
            var scrolled = h.scrollTop || document.body.scrollTop;
            var height   = (h.scrollHeight - h.clientHeight) || 1;
            bar.style.width = Math.min(100, (scrolled / height) * 100) + '%';
          }
          document.addEventListener('scroll', update, { passive: true });
          window.addEventListener('resize', update);
          update();
        })();
      </script>

   2) SCROLL REVEAL (IntersectionObserver)
      Add class="reveal" (optionally data-delay="1..4") to elements.
      Inline:

      <script>
        (function () {
          var els = document.querySelectorAll('.reveal');
          if (!els.length) return;
          if (!('IntersectionObserver' in window)) {
            els.forEach(function (el) { el.classList.add('is-visible'); });
            return;
          }
          var io = new IntersectionObserver(function (entries) {
            entries.forEach(function (e) {
              if (e.isIntersecting) {
                e.target.classList.add('is-visible');
                io.unobserve(e.target);
              }
            });
          }, { rootMargin: '0px 0px -10% 0px', threshold: 0.08 });
          els.forEach(function (el) { io.observe(el); });
        })();
      </script>

   Both scripts are ~1KB total, no deps, safe in WKWebView / Android WebView.
   ============================================================= */
