/* ============================================================================
   Cor Portal v2 - shared long-read stylesheet.
   Used by the linked long-reads: bridge-paper.html ("The Optimizer Without a
   Target"), and (forthcoming) constitutional.html + programme.html. Component
   classes are namespaced .lr-* per IA-BUILD-CONTRACT sec.3. Loads AFTER
   tokens.css + portal.css, layering on top. Inherits the identity verbatim:
   warm parchment ground, oxblood Spectral display serif, teal+gold accents,
   JetBrains Mono meta, diamond rules, the signature offset hard double-shadow.
   Do NOT invent a new look.
   ============================================================================ */

/* ---- reading column -------------------------------------------------------- */

.lr {
  max-width: var(--reading-maxw);
  margin: 0 auto;
}

/* ---- pitch / hero ---------------------------------------------------------- */

.lr-hero {
  max-width: var(--reading-maxw);
  margin: clamp(20px, 4vw, 48px) auto clamp(18px, 3vw, 34px);
}

.lr-pitch {
  font-family: var(--mono);
  font-size: var(--t-meta);
  letter-spacing: .04em;
  line-height: 1.5;
  color: var(--teal-deep);
  background: var(--bg-warm);
  border-left: 3px solid var(--gold);
  padding: .7rem 1rem;
  margin: 0 0 1.6rem;
}
.lr-pitch b { color: var(--oxblood); font-weight: 500; }

.lr-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--t-eyebrow);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted-warm);
  margin-bottom: .8rem;
}

.lr-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--t-h1);
  line-height: 1.04;
  color: var(--oxblood);
  margin: 0 0 .35rem;
}

.lr-subtitle {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: var(--t-h3);
  line-height: 1.2;
  color: var(--oxblood-warm);
  margin: 0 0 1.1rem;
}

.lr-lede {
  font-family: var(--serif);
  font-size: var(--t-lead);
  line-height: 1.55;
  color: var(--fg);
  margin: 0;
}

/* ---- versioning + live-snapshot strip ------------------------------------- */

.lr-meta {
  max-width: var(--reading-maxw);
  margin: 0 auto 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .9rem;
  align-items: baseline;
}
.lr-stamp {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--muted-warm);
}
.lr-stamp b { color: var(--oxblood-ink); font-weight: 500; }

/* The honest "current snapshot" line: frozen v0 figures in the prose are the
   historical record; this strip shows the live CorData counts so nothing in the
   argument silently contradicts the current spec. */
.lr-live {
  max-width: var(--reading-maxw);
  margin: 0 auto 2rem;
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.6;
  letter-spacing: .03em;
  color: var(--oxblood-ink);
  background: var(--bg-card-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-double-sm);
  padding: .85rem 1.1rem;
}
.lr-live .lr-live-head {
  display: block;
  font-size: var(--t-eyebrow);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted-warm);
  margin-bottom: .35rem;
}
.lr-live b { color: var(--oxblood); font-weight: 500; }

/* ---- body prose ------------------------------------------------------------ */

.lr-body { max-width: var(--reading-maxw); margin: 0 auto; }

.lr-body h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--t-h2);
  line-height: 1.1;
  color: var(--oxblood);
  margin: 3rem 0 1rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border-soft);
}
.lr-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: var(--t-h3);
  line-height: 1.2;
  color: var(--oxblood-warm);
  margin: 2.1rem 0 .7rem;
}
.lr-body p {
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: 1.72;
  color: var(--fg);
  margin: 0 0 1.15rem;
}
.lr-body strong { color: var(--oxblood); font-weight: 600; }
.lr-body em { color: var(--oxblood-ink); }

.lr-body ul {
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--fg);
  margin: 0 0 1.3rem;
  padding-left: 1.4rem;
}
.lr-body li { margin-bottom: .6rem; }
.lr-body li::marker { color: var(--gold); }

.lr-body hr {
  border: none;
  margin: 2.6rem 0;
  height: 7px;
  position: relative;
}
.lr-body hr::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 3px;
  height: 1px; background: var(--border-soft);
}
.lr-body hr::after {
  content: "";
  position: absolute; left: 50%; top: 0;
  width: 7px; height: 7px; margin-left: -3.5px;
  transform: rotate(45deg);
  background: var(--gold);
  box-shadow: 0 0 0 4px var(--parchment);
}

.lr-body code {
  font-family: var(--mono);
  font-size: .86em;
  padding: .08rem .32rem;
  background: var(--bg-hover);
  border-radius: 3px;
  color: var(--oxblood-ink);
}

/* ---- pull-quote (voice quotes from the source paper) ----------------------- */

.lr-quote {
  margin: 1.8rem 0;
  padding: 1.1rem 1.3rem;
  background: var(--bg-card-soft);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.lr-quote blockquote {
  margin: 0 0 .6rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.12rem;
  line-height: 1.5;
  color: var(--oxblood);
}
.lr-quote cite {
  font-family: var(--mono);
  font-style: normal;
  font-size: .74rem;
  letter-spacing: .03em;
  color: var(--muted-warm);
}
.lr-quote cite b { color: var(--oxblood-ink); font-weight: 500; }

/* ---- mechanism / evidence table ------------------------------------------- */

.lr-table-wrap { margin: 1.6rem 0; overflow-x: auto; }
.lr-table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--mono);
  font-size: .8rem;
}
.lr-table th {
  text-align: left;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .68rem;
  color: var(--muted-warm);
  padding: .55rem .7rem;
  border-bottom: 2px solid var(--border);
}
.lr-table td {
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--fg);
  vertical-align: top;
}
.lr-table tr:last-child td { border-bottom: none; }
.lr-table .lr-mech-name { font-family: var(--serif); font-size: .94rem; color: var(--oxblood-ink); }
.lr-table .lr-tier-t1 { color: var(--teal-deep); }
.lr-table .lr-tier-t2 { color: var(--gold-dim); }
.lr-table .lr-tier-t3 { color: var(--oxblood-warm); }
.lr-table .xref, .lr-table .xref--plain { font-size: .72rem; }

/* ---- inline xref chips inside running prose -------------------------------- */

.lr-body .xref, .lr-body .xref--plain { white-space: nowrap; }

/* ---- end matter: actions to sibling long-reads ----------------------------- */

.lr-actions {
  max-width: var(--reading-maxw);
  margin: 3rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
}
.lr-action {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .03em;
  text-decoration: none;
  color: var(--oxblood);
  background: var(--bg-card-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.lr-action:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-card-hover);
}

.lr-closing {
  max-width: var(--reading-maxw);
  margin: 2.4rem auto 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body);
  line-height: 1.6;
  color: var(--oxblood-warm);
  text-align: center;
}

/* ============================================================================
   Additions for constitutional.html ("What You Are Talking To"). These layer
   on the shared .lr-* classes above; they do not alter any existing rule.
   - .lr-audience : the required one-line audience frame at the very top, making
     explicit that this states the model FOR THE SYSTEMS (AI) and builders that
     design our environments.
   - .lr-mechrow / .lr-system-mechs : compact CorXref chip rows that hand the
     reader off to the interactive spec (mechanism.html#<CODE>). They are
     plain links only - nothing here animates or imitates the proxy gradient.
   ============================================================================ */

.lr-audience {
  max-width: var(--reading-maxw);
  margin: 0 auto 1.6rem;
  padding: .95rem 1.2rem;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--parchment-soft);
  box-shadow: var(--shadow-double-sm);
}
.lr-audience-k {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-eyebrow);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--cue);
  margin-bottom: .4rem;
}
.lr-audience p {
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.55;
  color: var(--oxblood-ink);
  margin: 0;
}
.lr-audience strong { color: var(--oxblood); font-weight: 600; }

/* per-system mechanism chip row (sits under each evolved-system heading) */
.lr-mechrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: -.5rem 0 1.2rem;
}
.lr-mechrow-label {
  font-family: var(--mono);
  font-size: .58rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted-warm);
}

/* A named evolved-system block: heading + mechanism chip row + prose. Reads as
   a recessed card in the warm ground. The "what it needs to resolve" line is
   italic. Nothing here animates or imitates the proxy gradient; the chip row is
   the handoff to the interactive spec, where that interaction actually lives. */
.lr-system {
  max-width: var(--reading-maxw);
  margin: clamp(22px, 3.5vw, 36px) auto;
  padding: clamp(16px, 2.4vw, 22px) clamp(18px, 2.8vw, 24px);
  background: var(--bg-card-soft);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.lr-system-head { margin: 0 0 .2rem; }
.lr-system-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--t-h3);
  line-height: 1.18;
  color: var(--oxblood);
  margin: 0;
}
.lr-system p {
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: 1.66;
  color: var(--fg);
  margin: 0 0 .85rem;
}
.lr-system p:last-child { margin-bottom: 0; }
.lr-system .lr-mechrow { margin: .35rem 0 1rem; }
.lr-system-needs {
  font-style: italic;
  color: var(--oxblood-ink);
}
.lr-system-needs strong { font-style: normal; }

/* The numbered "Rules for gradient thinking" paragraphs: tint the lead-in. */
.lr-body .lr-rule strong:first-child { color: var(--teal-deep); }

/* ============================================================================
   Additions for programme.html (the Lakatosian research-programme long-read).
   Ported from the live programme.html (lakatos-block / hard-core-grid /
   falsification-grid) and re-skinned to v2 tokens. These layer on the shared
   .lr-* classes above; they do not alter any existing rule. The grids widen
   past the reading column, so they live OUTSIDE .lr-body in their own blocks.
   ============================================================================ */

/* A titled programme block, wider than the reading column for its grids. */
.lr-block {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.8rem, 4vw, 3rem) 0;
}
.lr-block + .lr-block { border-top: 1px solid var(--border-soft); }

/* Recessed (soft) variant - the live section-soft. */
.lr-block.is-soft {
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  padding-left: clamp(1.1rem, 3vw, 2.4rem);
  padding-right: clamp(1.1rem, 3vw, 2.4rem);
  margin-top: clamp(1.6rem, 4vw, 2.8rem);
  margin-bottom: clamp(1.6rem, 4vw, 2.8rem);
  border: 1px solid var(--border-soft);
}
.lr-block.is-soft + .lr-block { border-top: none; }

.lr-block-head {
  max-width: var(--reading-maxw);
  margin: 0 auto clamp(1.3rem, 3vw, 2rem);
}
.lr-block-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--t-h2);
  line-height: 1.1;
  color: var(--oxblood);
  margin: .4rem 0 .8rem;
}
.lr-block-head .lr-lede {
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--fg-dim);
}

/* ---- hard core: the four irrevocable claims -------------------------------- */

.lr-core-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1rem, 2.4vw, 1.8rem);
}
.lr-core-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 2.6vw, 1.7rem);
  padding-top: clamp(2rem, 4vw, 2.6rem);
  box-shadow: var(--shadow-double-sm);
}
.lr-core-num {
  position: absolute;
  top: -0.75rem;
  left: 1.1rem;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: .92rem;
  font-weight: 500;
  color: var(--parchment);
  background: var(--teal);
  border: 1px solid var(--teal-deep);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--gold);
}
.lr-core-card h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--t-h3);
  line-height: 1.18;
  color: var(--oxblood);
  margin: 0 0 .7rem;
}
.lr-core-card p {
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: 1.62;
  color: var(--fg);
  margin: 0;
}

/* ---- protective belt: the methodology prose -------------------------------- */

.lr-surface {
  max-width: var(--reading-maxw);
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 2.6vw, 1.8rem);
  box-shadow: var(--shadow-card);
}
.lr-surface + .lr-surface { margin-top: 1.4rem; }
.lr-surface h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--t-h3);
  color: var(--oxblood);
  margin: 0 0 .7rem;
}
.lr-surface p {
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--fg);
  margin: 0 0 1rem;
}
.lr-surface p:last-child { margin-bottom: 0; }

/* ---- falsification: what would refute Cor ---------------------------------- */

.lr-fals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(.9rem, 2.2vw, 1.4rem);
}
.lr-fals-item {
  background: var(--bg-card-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--state-zero);
  border-radius: var(--radius-sm);
  padding: clamp(1rem, 2.4vw, 1.4rem);
}
.lr-fals-item h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.06rem;
  line-height: 1.28;
  color: var(--oxblood);
  margin: 0 0 .6rem;
  display: flex;
  gap: .55rem;
  align-items: baseline;
}
.lr-fals-num {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 500;
  color: var(--state-zero);
}
.lr-fals-item p {
  font-family: var(--serif);
  font-size: .98rem;
  line-height: 1.58;
  color: var(--fg);
  margin: 0;
}
.lr-fals-closing {
  max-width: var(--reading-maxw);
  margin: clamp(1.4rem, 3vw, 2rem) auto 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-lead);
  line-height: 1.5;
  color: var(--oxblood-warm);
}

@media (max-width: 560px) {
  .lr-core-grid,
  .lr-fals-grid { grid-template-columns: 1fr; }
}
