/* =============================================================================
   r365 · Research — research.css
   A warm editorial "journal" surface, DELIBERATELY off-brand from the app.
   The app chrome is cool zinc + emerald (#059669) + system-sans + frosted glass.
   This goes the other way on purpose: warm paper, warm ink, a SYSTEM serif
   reading face, an oxblood editorial accent (never the app emerald), a narrow
   reading measure, generous rhythm, first-class citations.

   Constitution of the web surface: zero external assets — no web fonts, no CDN,
   no trackers. The serif comes entirely from the system stack.
   ============================================================================= */

/* --- tokens ---------------------------------------------------------------- */
:root {
  /* Warm paper + ink — the antithesis of the app's cool zinc/white glass. */
  --paper:        #f7f2e8;   /* warm ivory page */
  --paper-raised: #fbf7ef;   /* references / callout panels */
  --paper-edge:   #efe7d6;   /* masthead + footer band */
  --ink:          #221c15;   /* warm near-black body ink (AA on paper: ~13:1) */
  --ink-soft:     #4a4136;   /* secondary prose / captions (AA: ~7:1) */
  --ink-faint:    #6a5f50;   /* small meta labels (AA normal text: ~4.9:1) */

  /* Editorial accent — deep oxblood. NOT the app emerald. */
  --accent:       #7a2e2b;   /* links, rules, drop-cap (AA on paper: ~7.4:1) */
  --accent-deep:  #5c201e;   /* hover / pressed */

  --rule:         #d9ccb4;   /* warm hairline */
  --rule-soft:    #e6dbc6;   /* faint hairline */

  /* System serif reading face — no web fonts, ever. */
  --serif: 'Iowan Old Style', 'Palatino Linotype', 'Palatino', 'Charter',
           'Georgia', 'Times New Roman', 'Book Antiqua', serif;
  /* System sans — used ONLY for tiny kickers / labels, for a crisp contrast. */
  --sans: system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', sans-serif;

  --measure: 68ch;           /* the reading measure (~62–68ch target) */
  --measure-wide: 40rem;     /* index list column */
}

/* --- reset / base ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  /* soft, warm, off-brand page tint — a hairline of paper texture via gradient */
  background-image:
    radial-gradient(120% 60% at 50% -10%, #fdfaf3 0%, transparent 60%);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body { margin: 0; }

/* Links — oxblood, underlined, with a warm underline offset. First-class prose. */
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.14em; }
a:hover { color: var(--accent-deep); text-decoration-thickness: 2px; }

:where(a, button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* skip link (accessibility parity with the app surface) */
.r-skip {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--accent); color: #fff;
  padding: 0.5rem 1rem; border-radius: 4px;
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600;
  text-decoration: none; z-index: 20; transition: top 0.15s;
}
.r-skip:focus { top: 0.75rem; }

/* --- masthead -------------------------------------------------------------- */
.r-masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-edge);
}
.r-masthead__inner {
  max-width: 62rem; margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap;
}
.r-masthead__name {
  font-family: var(--sans);
  font-weight: 700; letter-spacing: 0.02em;
  color: var(--ink); text-decoration: none;
  font-size: 0.95rem;
}
.r-masthead__name b { color: var(--accent); font-weight: 800; }
.r-masthead__sep { color: var(--rule); }
.r-masthead__section {
  font-family: var(--sans);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
}
.r-masthead__spacer { margin-left: auto; }
.r-masthead__tagline {
  font-family: var(--sans);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* --- locale switcher (masthead) — EN · DE · FR · IT ------------------------ */
.r-locales {
  display: flex;
  align-items: baseline;
  font-family: var(--sans);
}
.r-locales__link {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  text-decoration: none; color: var(--ink-faint);
  padding: 0 0.5rem;
}
.r-locales__link:first-child { padding-left: 0; }
.r-locales__link:not(:last-child) { border-right: 1px solid var(--rule); }
.r-locales__link:hover { color: var(--accent); }
.r-locales__link.is-active { color: var(--accent); }  /* current locale, oxblood */

/* =============================================================================
   ARTICLE
   ============================================================================= */
.r-article { padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem 1rem; }
.r-article__wrap { max-width: var(--measure); margin: 0 auto; }

/* kicker / eyebrow above the headline */
.r-kicker {
  font-family: var(--sans);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--accent);
  margin: 0 0 1.1rem;
}

/* headline */
.r-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.05rem, 1.5rem + 2.7vw, 3.15rem);
  line-height: 1.08;
  letter-spacing: -0.006em;
  margin: 0 0 1.1rem;
  text-wrap: balance;
}

/* standfirst / dek (the description, set as an editorial deck) */
.r-standfirst {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 1.02rem + 0.6vw, 1.4rem);
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
  max-width: 54ch;
}

/* byline / meta row */
.r-meta {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 0.8rem; color: var(--ink-faint);
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.2rem;
}
.r-meta__by { color: var(--ink-soft); font-weight: 600; }
.r-meta__by b { color: var(--accent); }
.r-meta__dot { color: var(--rule); }

/* --- prose ----------------------------------------------------------------- */
.r-prose {
  font-size: 1.1875rem;      /* 19px */
  line-height: 1.75;
  color: var(--ink);
}
.r-prose p { margin: 0 0 1.4rem; }

/* the opening lede — larger, with a drop cap */
.r-prose > p:first-of-type {
  font-size: 1.3rem;
  line-height: 1.65;
  color: var(--ink);
}
.r-prose > p:first-of-type::first-letter {
  float: left;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--accent);
  font-size: 3.55em;
  line-height: 0.74;
  padding: 0.05em 0.09em 0 0;
  margin-right: 0.02em;
}

/* section headings (a leading body <h1> is stripped by the generator; this is
   a defensive style should a mid-article h1 ever appear) */
.r-prose h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.7rem, 1.4rem + 1.3vw, 2.2rem);
  line-height: 1.14;
  margin: 2.9rem 0 0.9rem;
}
.r-prose h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.5rem, 1.28rem + 1vw, 1.95rem);
  line-height: 1.18;
  letter-spacing: -0.004em;
  margin: 2.9rem 0 0.9rem;
  padding-top: 0.4rem;
}
.r-prose h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.28rem;
  margin: 2rem 0 0.6rem;
}

/* emphasis — bold stats bloom in oxblood; italics stay ink */
.r-prose strong { font-weight: 700; color: var(--accent-deep); }
.r-prose em { font-style: italic; }

/* lists */
.r-prose ul, .r-prose ol { margin: 0 0 1.5rem; padding-left: 0; list-style: none; }
.r-prose ul li, .r-prose ol li {
  position: relative;
  padding-left: 1.6rem;
  margin: 0 0 0.85rem;
}
.r-prose ul li::before {
  content: "";
  position: absolute; left: 0.15rem; top: 0.72em;
  width: 0.42rem; height: 0.42rem;
  background: var(--accent);
  transform: rotate(45deg);   /* a small oxblood lozenge, not a dot */
}
.r-prose ol { counter-reset: r-ol; }
.r-prose ol li { counter-increment: r-ol; }
.r-prose ol li::before {
  content: counter(r-ol) ".";
  position: absolute; left: 0; top: 0;
  font-variant-numeric: tabular-nums;
  color: var(--accent); font-weight: 700;
}

/* horizontal rule (the source uses --- before the colophon) */
.r-prose hr {
  border: 0; height: 0;
  margin: 2.6rem auto;
  width: 42%;
  border-top: 1px solid var(--rule);
}

/* --- pull-quote ------------------------------------------------------------ */
/* Rendered from markdown blockquotes AND from the front-matter `pullquotes`
   hint (a display repeat of a body line — the standard print convention). */
.r-pullquote {
  margin: 2.4rem 0;
  padding: 0.2rem 0 0.2rem 1.6rem;
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.4rem, 1.15rem + 1.1vw, 1.85rem);
  line-height: 1.32;
  color: var(--accent-deep);
  letter-spacing: -0.004em;
  text-wrap: balance;
}
.r-prose blockquote {
  margin: 2.4rem 0;
  padding: 0.2rem 0 0.2rem 1.6rem;
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem);
  line-height: 1.34;
  color: var(--accent-deep);
}
.r-prose blockquote p { margin: 0; }

/* --- inline citation superscripts ----------------------------------------- */
.r-cite {
  font-family: var(--sans);
  font-size: 0.62em;
  font-weight: 700;
  line-height: 0;
  vertical-align: super;
  margin-left: 0.12em;
  text-decoration: none;
  color: var(--accent);
}
.r-cite::before { content: "["; }
.r-cite::after  { content: "]"; }
.r-cite:hover { color: var(--accent-deep); }

/* --- references ------------------------------------------------------------ */
.r-references {
  margin: 3rem auto 0;
  padding: 1.8rem 1.6rem 0.6rem;
  border-top: 2px solid var(--accent);
  background: var(--paper-raised);
  border-radius: 2px;
}
.r-references__title {
  font-family: var(--sans);
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
  margin: 0 0 1.1rem;
}
.r-references ol { margin: 0; padding: 0; list-style: none; counter-reset: r-ref; }
.r-references li {
  counter-increment: r-ref;
  position: relative;
  padding-left: 2.2rem;
  margin: 0 0 0.95rem;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.r-references li::before {
  content: counter(r-ref) ".";
  position: absolute; left: 0; top: 0;
  min-width: 1.7rem;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--accent);
}
.r-references a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); }
.r-references a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.r-references__host {
  display: block;
  font-family: var(--sans);
  font-size: 0.76rem;
  color: var(--ink-faint);
  margin-top: 0.15rem;
  word-break: break-word;
}

/* --- colophon (the honesty footer line survives from the source) ---------- */
.r-colophon {
  max-width: var(--measure); margin: 2.4rem auto 0;
  padding: 0 1.5rem;
}
.r-colophon p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  padding-top: 1.4rem;
  margin: 0;
}

/* --- article footer / back nav --------------------------------------------- */
.r-foot {
  max-width: var(--measure); margin: 2.6rem auto 0;
  padding: 0 1.5rem;
}
.r-foot__back {
  font-family: var(--sans);
  font-size: 0.85rem; font-weight: 600;
  color: var(--accent); text-decoration: none;
}
.r-foot__back:hover { text-decoration: underline; }

/* --- end-of-article product card (funnel; section voice, no emerald) ------- */
/* A restrained same-origin bridge to the app/waitlist — "sharing is caring",
   not a hard sell. Bordered editorial panel, oxblood accent (never emerald). */
.r-product {
  max-width: var(--measure); margin: 2.6rem auto 0;
  padding: 0 1.5rem;
}
.r-product__inner {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 0.7rem 1.4rem;
  padding: 1.3rem 1.5rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
}
.r-product__lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.08rem; line-height: 1.5;
  color: var(--ink-soft);
  margin: 0; max-width: 46ch;
}
.r-product__lead b { color: var(--accent); font-style: normal; font-weight: 700; }
.r-product__cta {
  font-family: var(--sans);
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--accent); text-decoration: none; white-space: nowrap;
}
.r-product__cta:hover { text-decoration: underline; }

/* =============================================================================
   INDEX (section landing)
   ============================================================================= */
.r-index { padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem 1rem; }
.r-index__wrap { max-width: var(--measure-wide); margin: 0 auto; }
.r-index__title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.3rem, 1.7rem + 3vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0.4rem 0 1rem;
}
.r-index__intro {
  font-family: var(--serif);
  font-size: clamp(1.12rem, 1.02rem + 0.5vw, 1.32rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 52ch;
  margin: 0 0 2.6rem;
  padding-bottom: 2.2rem;
  border-bottom: 1px solid var(--rule);
}
.r-index__intro em { color: var(--accent-deep); font-style: italic; }

/* --- the "second brain": a full-height pinned scroll-reveal between intro and articles ----- */
.r-brain__intro { margin: 1.9rem 0 0.5rem; }
.r-brain__kicker {
  display: block; font-size: 0.72rem; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 0.35rem;
}
.r-brain__title { font-size: 1.4rem; line-height: 1.2; margin: 0 0 0.35rem; color: var(--ink); }
.r-brain__dek { color: var(--ink-soft); max-width: 42rem; margin: 0; }

/* the tall wrapper gives the scroll distance; the stage pins to the viewport within it.
   It breaks OUT of the centered article column to full viewport width, so the pinned graph
   is edge-to-edge fullscreen — not trapped in the reading measure. */
.r-brain__scroll {
  position: relative; height: 280vh; view-timeline: --r-brain block;
  width: 100vw; max-width: 100vw;
  margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
}
.r-brain__stage {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: var(--paper-raised);
}
.r-brain__frame { display: block; width: 100%; height: 100%; border: 0; }
.r-brain__open {
  position: absolute; right: 1rem; bottom: 1rem; z-index: 3;
  background: var(--accent); color: #fff; padding: 0.4rem 0.85rem; border-radius: 3px;
  font-size: 0.82rem; font-weight: 600; text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.r-brain__open:hover { background: var(--accent-deep); color: #fff; }
.r-brain__note {
  margin: 0.5rem 0 0; font-size: 0.8rem; font-style: italic; color: var(--ink-faint, #a8a29e);
}

/* reveal-in → hold fullscreen → disappear-inverse: a rounded "cutout" that grows then shrinks.
   Progressive enhancement (scroll-driven CSS, no JS); degrades to a clean sticky pin elsewhere. */
@supports (animation-timeline: view()) {
  .r-brain__stage {
    animation: r-brain-reveal linear both;
    animation-timeline: --r-brain;
    animation-range: entry 0% exit 100%;
    will-change: clip-path, opacity;
  }
  @keyframes r-brain-reveal {
    0%   { clip-path: inset(20% 10% round 18px); opacity: 0.35; }
    24%  { clip-path: inset(0 0 0 0 round 0);    opacity: 1; }
    76%  { clip-path: inset(0 0 0 0 round 0);    opacity: 1; }
    100% { clip-path: inset(20% 10% round 18px); opacity: 0.35; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .r-brain__scroll { height: auto; }
  .r-brain__stage { position: static; height: clamp(460px, 72vh, 760px); }
}

.r-list { list-style: none; margin: 0; padding: 0; }
.r-item {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: 0.4rem 1.2rem;
  padding: 1.8rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.r-item:first-child { padding-top: 0; }
.r-item__num {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.r-item__body { min-width: 0; }
.r-item__title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.8rem);
  line-height: 1.2;
  margin: 0 0 0.55rem;
  letter-spacing: -0.004em;
}
.r-item__title a { color: var(--ink); text-decoration: none; }
.r-item__title a:hover { color: var(--accent); }
.r-item__dek {
  font-size: 1.02rem; line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
}
.r-item__tags {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 0 0 0.9rem; padding: 0; list-style: none;
}
.r-item__tag {
  font-family: var(--sans);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em;
  color: var(--ink-faint);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
}
.r-item__read {
  font-family: var(--sans);
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--accent); text-decoration: none;
}
.r-item__read:hover { text-decoration: underline; }

/* =============================================================================
   PAGE FOOTER (shared)
   ============================================================================= */
.r-pagefoot {
  margin-top: clamp(3rem, 8vw, 5rem);
  border-top: 1px solid var(--rule);
  background: var(--paper-edge);
}
.r-pagefoot__inner {
  max-width: 62rem; margin: 0 auto;
  padding: 1.8rem 1.5rem;
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 0.8rem; color: var(--ink-faint);
}
.r-pagefoot__inner a { color: var(--ink-soft); text-decoration: none; }
.r-pagefoot__inner a:hover { color: var(--accent); }
.r-pagefoot__spacer { margin-left: auto; }

/* --- responsive ------------------------------------------------------------ */
@media (max-width: 640px) {
  .r-prose { font-size: 1.125rem; }
  .r-prose > p:first-of-type { font-size: 1.22rem; }
  .r-prose > p:first-of-type::first-letter { font-size: 3.1em; }
  .r-item { grid-template-columns: 2.4rem 1fr; gap: 0.3rem 0.8rem; }
  .r-item__num { font-size: 1.9rem; }
  .r-references { padding-left: 1.1rem; padding-right: 1.1rem; }
  .r-masthead__tagline { display: none; }
}

/* --- reduced motion (this surface is intentionally near-static) ------------ */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
