/* =========================================================================
   Coherence Review — site styles
   Aesthetic ported from the printed briefing PDF: warm off-white paper,
   deep teal as the only saturated accent, Inter body + DM Sans display,
   JetBrains Mono for technical micro-labels.

   Token namespace lives entirely in :root; no Tailwind, no preprocessor.
   The previous Ocean Machine obsidian theme has been retired.
   ========================================================================= */

:root {
  /* paper + ink */
  --paper:        #f7f6f2;   /* warm off-white background */
  --paper-2:      #ffffff;   /* card surface on paper */
  --paper-tint:   #efeee7;   /* tinted band sections */
  --ink:          #1a1a1a;   /* primary body text */
  --ink-muted:    #56544f;   /* secondary text, captions */
  --ink-faint:    #a09e98;   /* tertiary, separators */
  --rule:         #d4d1ca;   /* hairlines */

  /* accent */
  --teal:         #0c4e54;   /* deep teal — primary accent */
  --teal-soft:    #d8e7e8;   /* tinted fill */
  --teal-deep:    #073b40;   /* hover / dark band */

  /* tier swatches (used sparingly) */
  --tier-E:       #1f6f4a;
  --tier-T:       #5b6cb8;
  --tier-P:       #b78e2a;
  --tier-C:       #aa3a3a;

  /* movement swatches (falsification dashboard) */
  --mv-none:      #9d9b95;
  --mv-tight:     #1f6f4a;
  --mv-loose:     #b78e2a;
  --mv-refute:    #aa3a3a;
  --mv-affirm:    #0c4e54;

  /* type */
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: "DM Sans", "Inter", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* spacing scale */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 24px;  --s-6: 32px;  --s-7: 48px;  --s-8: 64px;
  --s-9: 96px;  --s-10: 128px;

  /* layout */
  --container: 1120px;
  --radius: 6px;
  --radius-lg: 10px;

  /* shadows */
  --shadow-sm: 0 1px 0 rgba(20, 30, 35, 0.04), 0 2px 6px rgba(20, 30, 35, 0.04);
  --shadow-md: 0 1px 0 rgba(20, 30, 35, 0.05), 0 8px 24px rgba(20, 30, 35, 0.06);
}

/* =========================================================================
   Reset
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg, picture, video, canvas { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-decoration: none; transition: color 120ms ease; }
a:hover { color: var(--teal-deep); text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; cursor: pointer; }
ol, ul { padding-left: 1.2em; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* =========================================================================
   Typography
   ========================================================================= */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0 0 var(--s-3);
}
h1 { font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.4rem); letter-spacing: -0.022em; }
h2 { font-size: clamp(1.55rem, 1.15rem + 1.4vw, 2.15rem); letter-spacing: -0.016em; }
h3 { font-size: 1.18rem; }
h4 { font-size: 1.02rem; }

p { margin: 0 0 var(--s-4); }
strong { font-weight: 600; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 var(--s-3);
}
.eyebrow-on-dark { color: rgba(255,255,255,0.85); }
.text-link {
  font-weight: 500;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}
.text-link:hover { text-decoration: none; }
.text-link-on-dark { color: #f4ece0; border-bottom: 1px solid rgba(244,236,224,0.5); }
.text-link-on-dark:hover { color: #fff; }

/* =========================================================================
   Layout primitives
   ========================================================================= */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-5);
}
.section {
  padding: var(--s-9) 0;
  border-top: 1px solid var(--rule);
}
.section-tinted {
  background: var(--paper-tint);
  border-top: 1px solid var(--rule);
}
.section-head {
  max-width: 720px;
  margin-bottom: var(--s-7);
}
.section-head h2 { margin-bottom: var(--s-3); }
.section-lede {
  font-size: 1.05rem;
  color: var(--ink-muted);
  max-width: 60ch;
  margin: 0;
}
.section-head .text-link { display: inline-block; margin-top: var(--s-3); }

/* =========================================================================
   Masthead
   ========================================================================= */
.masthead {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: saturate(140%) blur(6px);
}
.masthead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  padding: var(--s-4) var(--s-5);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--ink);
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  display: inline-flex;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: var(--teal);
  color: #fff;
  border-radius: 50%;
}
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
}
.brand-byline {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}
.primary-nav {
  display: flex;
  gap: var(--s-5);
  font-size: 0.94rem;
}
.primary-nav a {
  color: var(--ink-muted);
  font-weight: 500;
}
.primary-nav a:hover { color: var(--teal); text-decoration: none; }

@media (max-width: 640px) {
  .masthead-row { flex-wrap: wrap; gap: var(--s-3); }
  .primary-nav { gap: var(--s-4); font-size: 0.86rem; flex-wrap: wrap; }
  .brand-byline { display: none; }
}

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.96rem;
  line-height: 1;
  letter-spacing: 0.005em;
  text-align: center;
  border: 1px solid transparent;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
.btn-primary:hover {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-ghost:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(12, 78, 84, 0.04);
}
.btn-on-dark {
  background: #f4c457;
  color: #1a1a1a;
  border-color: #f4c457;
}
.btn-on-dark:hover { background: #ffd068; border-color: #ffd068; color: #1a1a1a; }

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  padding: var(--s-9) 0 var(--s-8);
  background:
    radial-gradient(1200px 480px at 80% -10%, rgba(12, 78, 84, 0.06), transparent 60%),
    radial-gradient(900px 420px at 5% 110%, rgba(12, 78, 84, 0.04), transparent 60%),
    var(--paper);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--s-8);
  align-items: start;
}
.hero-copy { max-width: 640px; }
.hero-title { font-size: clamp(2.4rem, 1.5rem + 3.4vw, 3.6rem); margin-bottom: var(--s-5); }
.hero-lede { font-size: 1.08rem; color: var(--ink-muted); margin-bottom: var(--s-6); max-width: 56ch; }
.hero-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; }

.latest-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.latest-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--teal);
}
.card-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 var(--s-3);
}
.latest-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.18;
  margin: 0 0 var(--s-3);
  letter-spacing: -0.012em;
}
.latest-subtitle {
  color: var(--ink-muted);
  font-size: 1.0rem;
  margin: 0 0 var(--s-4);
}
.latest-meta {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--ink-muted);
  margin: 0 0 var(--s-5);
}
.latest-meta .dot { margin: 0 6px; color: var(--ink-faint); }
.card-cta { width: 100%; }

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-7); }
  .latest-card { order: -1; }
}

/* =========================================================================
   Recent issues grid
   ========================================================================= */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-5);
}
.recent-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--s-5) var(--s-5) var(--s-6);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.recent-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.recent-card h3 { font-size: 1.12rem; margin: 0 0 var(--s-3); }
.recent-card h3 a { color: var(--ink); }
.recent-card h3 a:hover { color: var(--teal); text-decoration: none; }
.recent-sub { font-size: 0.94rem; color: var(--ink-muted); margin: 0 0 var(--s-3); }
.recent-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 0;
  letter-spacing: 0.04em;
}
.recent-empty { background: transparent; border-style: dashed; }

/* skeleton loaders */
.recent-skeleton .sk {
  background: linear-gradient(90deg, var(--paper-tint) 0%, #e3e1da 50%, var(--paper-tint) 100%);
  background-size: 200% 100%;
  animation: sk 1400ms infinite ease-in-out;
  border-radius: 4px;
  margin-bottom: var(--s-3);
}
.sk-eyebrow { height: 10px; width: 60px; }
.sk-title   { height: 22px; width: 80%; }
.sk-line    { height: 12px; width: 100%; }
.sk-line + .sk-line { width: 75%; }
@keyframes sk {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =========================================================================
   LFSC ladder
   ========================================================================= */
.ladder {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}
.ladder-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--s-4);
  padding: var(--s-5);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  align-items: start;
}
.ladder-num {
  font-family: var(--font-mono);
  font-size: 1.0rem;
  font-weight: 500;
  color: #fff;
  background: var(--teal);
  border-radius: 50%;
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ladder-item h3 { font-size: 1.04rem; margin: 0 0 var(--s-2); }
.ladder-item p { color: var(--ink-muted); margin: 0; font-size: 0.94rem; }

.ladder-tiers {
  margin-top: var(--s-6);
  font-size: 0.94rem;
  color: var(--ink-muted);
}
.ladder-tiers .pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  margin: 4px 6px 4px 0;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--ink);
  letter-spacing: 0.02em;
}
.pill-E { border-color: var(--tier-E); color: var(--tier-E); }
.pill-T { border-color: var(--tier-T); color: var(--tier-T); }
.pill-P { border-color: var(--tier-P); color: var(--tier-P); }
.pill-C { border-color: var(--tier-C); color: var(--tier-C); }

/* =========================================================================
   Falsification dashboard
   ========================================================================= */
.falsif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-4);
}
.falsif-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--mv-none);
  border-radius: var(--radius);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.falsif-tightened { border-left-color: var(--mv-tight); }
.falsif-loosened  { border-left-color: var(--mv-loose); }
.falsif-refuted   { border-left-color: var(--mv-refute); }
.falsif-affirmed  { border-left-color: var(--mv-affirm); }
.falsif-key {
  font-family: var(--font-mono);
  font-size: 0.96rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--teal);
  margin: 0;
}
.falsif-status {
  font-size: 0.96rem;
  color: var(--ink);
  margin: 0;
  line-height: 1.45;
}
.falsif-meta {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-muted);
  margin: 0;
  letter-spacing: 0.03em;
}
.movement {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(157,155,149,0.15);
  color: var(--mv-none);
}
.movement-tightened { background: rgba(31,111,74,0.10);   color: var(--mv-tight); }
.movement-loosened  { background: rgba(183,142,42,0.12);  color: var(--mv-loose); }
.movement-refuted   { background: rgba(170,58,58,0.10);   color: var(--mv-refute); }
.movement-affirmed  { background: rgba(12,78,84,0.10);    color: var(--mv-affirm); }

/* =========================================================================
   Catalog stats
   ========================================================================= */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-7);
}
.stat-tile {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.stat-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--teal);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.histogram-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 var(--s-4);
}
.histogram {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--s-5);
}
.hist-row {
  display: grid;
  grid-template-columns: 36px 1fr 48px;
  gap: var(--s-3);
  align-items: center;
}
.hist-key {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--teal);
  font-weight: 500;
}
.hist-track {
  background: var(--paper-tint);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
}
.hist-fill {
  background: linear-gradient(90deg, var(--teal) 0%, #1a7a82 100%);
  height: 100%;
  border-radius: 999px;
  transition: width 320ms cubic-bezier(.2,.8,.2,1);
}
.hist-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-muted);
  text-align: right;
}

/* =========================================================================
   How issues are made — loop
   ========================================================================= */
.loop {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-4);
  counter-reset: step;
}
.loop-step {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--teal);
  border-radius: var(--radius);
  padding: var(--s-5);
}
.loop-num {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--teal);
  letter-spacing: 0.08em;
  font-weight: 500;
  display: block;
  margin-bottom: var(--s-3);
}
.loop-step h3 { font-size: 1.08rem; margin: 0 0 var(--s-2); }
.loop-step p { color: var(--ink-muted); margin: 0; font-size: 0.94rem; }

/* =========================================================================
   Follow block — only inverted band
   ========================================================================= */
.section-cta {
  background:
    radial-gradient(800px 320px at 90% 10%, rgba(244,196,87,0.10), transparent 70%),
    radial-gradient(900px 380px at -10% 110%, rgba(12,78,84,0.7), transparent 60%),
    var(--teal);
  color: #f7f6f2;
  border-top: 1px solid var(--teal-deep);
}
.section-cta h2 { color: #fff; }
.follow-wrap { max-width: 720px; margin: 0 auto; text-align: center; }
.follow-h {
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.4rem);
  margin-bottom: var(--s-3);
}
.follow-lede {
  color: rgba(247,246,242,0.85);
  font-size: 1.04rem;
  margin: 0 auto var(--s-6);
  max-width: 56ch;
}
.follow-alt {
  margin-top: var(--s-5);
  font-size: 0.94rem;
  color: rgba(247,246,242,0.75);
}
.follow-alt a { margin: 0 4px; }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding: var(--s-7) 0;
  font-size: 0.92rem;
  color: var(--ink-muted);
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-4);
}
.footer-brand strong {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  margin-right: 8px;
}
.footer-nav { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.footer-nav a { color: var(--ink-muted); }
.footer-nav a:hover { color: var(--teal); }
.footer-copy { margin: 0; font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-faint); letter-spacing: 0.03em; }

/* =========================================================================
   Issue and standalone pages — preserve readable typography
   for content rendered via pandoc
   ========================================================================= */
article.issue, article.note, article.lfsc, article.about {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-9) var(--s-5);
}
article.issue h1, article.note h1, article.lfsc h1, article.about h1 {
  margin-bottom: var(--s-6);
}
article.issue h2, article.note h2, article.lfsc h2, article.about h2 {
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
article.issue blockquote, article.note blockquote {
  margin: var(--s-5) 0;
  padding: var(--s-4) var(--s-5);
  border-left: 3px solid var(--teal);
  background: var(--paper-tint);
  color: var(--ink);
}
article.issue code, article.note code, article.lfsc code, article.about code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--paper-tint);
  padding: 1px 6px;
  border-radius: 4px;
}
article.issue pre, article.note pre, article.lfsc pre {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  background: var(--ink);
  color: #f4ece0;
  padding: var(--s-5);
  border-radius: var(--radius);
  overflow-x: auto;
}

/* legacy support — buttons used in other pages */
.button { display: inline-block; padding: 12px 22px; border-radius: var(--radius); font-weight: 600; }
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: var(--teal-deep); color: #fff; text-decoration: none; }
.button-secondary { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.button-secondary:hover { border-color: var(--teal); color: var(--teal); }

/* =========================================================================
   Reduced motion
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* =========================================================================
   Print
   ========================================================================= */
@media print {
  .masthead, .site-footer, .section-cta { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
}
