/* Threshold Data Sciences — institutional research publication register.
   Mass, scale, and density; near-monochrome discipline.
   Palette: Ink #0F2338 · Slate #2E5A88 · Field #F2F4F6 · Rule #C9D1D8 ·
   Signal #C7621B (restricted: step-function risers + chart thresholds only).
   Type: Source Serif 4 (display) · IBM Plex Sans (body) · IBM Plex Mono (utility).
   All fonts self-hosted. No gradients, shadows, radii > 2px, pills, or motion. */

/* ---------- fonts (self-hosted) ---------- */
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-400i.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --ink:    #0F2338;
  --slate:  #2E5A88;
  --field:  #F2F4F6;
  --rule:   #C9D1D8;
  --signal: #C7621B;
  --paper:  #FFFFFF;
  --muted:  #51626F;                     /* secondary text; >=4.5:1 on field and paper */
  --ink-tint: rgba(255, 255, 255, 0.72); /* muted white on Ink; ~8.8:1 */
  --ink-fine: rgba(255, 255, 255, 0.60); /* fine print on Ink; ~6.5:1 */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", "Segoe UI", system-ui, Arial, sans-serif;
  --mono:  "IBM Plex Mono", "Consolas", "Courier New", monospace;
  --measure: 68ch;
}

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: 1.0625rem;            /* 17px */
  line-height: 1.65;
  color: var(--ink);
  background: var(--field);
}

img, svg { max-width: 100%; }

a { color: var(--slate); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.site-header :focus-visible, .site-footer :focus-visible {
  outline-color: var(--paper);
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 1rem; z-index: 10;
}
.skip-link:focus { left: 0; color: var(--paper); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.shell { max-width: 76rem; margin: 0 auto; padding: 0 1.25rem; }
.measure { max-width: calc(var(--measure) + 2.5rem); }

/* ---------- header: full-bleed Ink anchor ---------- */
.site-header {
  background: var(--ink);
  color: var(--paper);
}
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 0.9rem 2rem;
  padding-top: 1.6rem; padding-bottom: 1.6rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.85rem;
  text-decoration: none; color: var(--paper);
}
.brand-mark { width: 38px; height: 38px; display: block; }
.brand-word {
  font-family: var(--serif); font-weight: 700;
  font-size: 1.45rem; letter-spacing: 0.005em; line-height: 1.1;
  color: var(--paper);
}
.site-nav {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.6rem; list-style: none;
}
.site-nav a {
  font-size: 0.92rem; font-weight: 600; text-decoration: none;
  color: var(--ink-tint); padding: 0.2rem 0;
}
.site-nav a:hover { color: var(--paper); text-decoration: underline; }
.site-nav a[aria-current="page"] {
  color: var(--paper);
  border-bottom: 2px solid var(--paper);
}

/* ---------- step-function rule: the signature, with presence ---------- */
.step-rule { height: 22px; margin: 4rem 0; }
.step-rule svg { display: block; width: 100%; height: 22px; }
.step-low, .step-high { stroke: var(--ink); stroke-width: 3; fill: none; }
.step-riser { stroke: var(--signal); stroke-width: 3; fill: none; }
.site-footer .step-low, .site-footer .step-high { stroke: var(--ink-tint); }

/* ---------- page heads & hero ---------- */
.hero { padding: 5rem 0 1rem; }
.hero h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(2.75rem, 6vw, 4.25rem);
  line-height: 1.05; letter-spacing: -0.02em;
  max-width: 18em; margin: 1rem 0 1.75rem;
}
.hero-sub { max-width: 60ch; color: var(--muted); font-size: 1.3rem; line-height: 1.55; }

.eyebrow {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline;
}

.page-head { padding: 4.5rem 0 0.5rem; }
.page-head h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  line-height: 1.05; letter-spacing: -0.02em;
  margin: 1rem 0 1.5rem;
}
.page-lede { max-width: 60ch; color: var(--muted); font-size: 1.25rem; line-height: 1.55; }
.page-note { max-width: 60ch; color: var(--muted); font-size: 0.95rem; margin-top: 1rem; }

.byline { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); margin-top: 1.25rem; }

/* ---------- sections ---------- */
section { padding: 1rem 0; }

h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.15; letter-spacing: -0.01em;
  margin-bottom: 0.9rem;
}
.section-note { color: var(--muted); max-width: var(--measure); margin-bottom: 2.25rem; }

.more-link { font-weight: 600; }

/* ---------- issue lists: bibliography register ---------- */
.issue-list { list-style: none; }
.issue-row {
  display: grid; grid-template-columns: 8ch 1fr; gap: 0.35rem 2.5rem;
  padding: 2rem 0; border-top: 1px solid var(--rule);
}
.issue-row:last-child { border-bottom: 1px solid var(--rule); }
.issue-no {
  font-family: var(--mono); font-weight: 500; font-size: 0.95rem;
  color: var(--ink); letter-spacing: 0.04em; padding-top: 0.35rem;
}
.issue-title {
  font-family: var(--serif); font-weight: 600;
  font-size: 1.45rem; line-height: 1.25; letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
}
.issue-title a { color: var(--ink); text-decoration: none; }
.issue-title a:hover { color: var(--slate); text-decoration: underline; }
.issue-line {
  font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--muted); margin-bottom: 0.6rem;
}
.issue-summary { color: var(--muted); max-width: var(--measure); }

/* ---------- home section cards ---------- */
.section-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
}
.section-card {
  background: var(--paper); border: 1px solid var(--rule);
  padding: 1.9rem 1.75rem 2rem;
}
.section-card h2 { font-size: 1.35rem; margin-bottom: 0.6rem; }
.section-card h2 a { color: var(--ink); text-decoration: none; }
.section-card h2 a:hover { color: var(--slate); text-decoration: underline; }
.section-card p { color: var(--muted); font-size: 0.95rem; }

.home-practice p { max-width: var(--measure); }
.home-practice p + p { margin-top: 0.75rem; }

.press-list { list-style: none; }
.press-list li { padding: 0.75rem 0; border-top: 1px solid var(--rule); }

/* ---------- prose (issue/analysis/page bodies) ---------- */
.prose > * + * { margin-top: 1.15rem; }
.prose h2 { margin-top: 2.75rem; font-size: 1.35rem; }
.prose h2 + * { margin-top: 0.6rem; }
.prose h3 { font-family: var(--sans); font-weight: 600; font-size: 1.05rem; margin-top: 1.8rem; }
.prose blockquote {
  border-left: 3px solid var(--ink);
  padding: 0.2rem 0 0.2rem 1.2rem;
  color: var(--muted);
}
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.4rem; }
.prose hr { border: none; border-top: 1px solid var(--rule); margin: 2rem 0; }
.prose code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--paper); border: 1px solid var(--rule); padding: 0.05rem 0.3rem;
}
.prose pre {
  background: var(--ink); color: var(--field);
  padding: 1rem 1.2rem; overflow-x: auto; font-size: 0.88rem;
}
.prose pre code { background: none; border: none; color: inherit; padding: 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.95rem; background: var(--paper); }
.prose th, .prose td {
  border: 1px solid var(--rule); padding: 0.45rem 0.7rem; text-align: left;
  vertical-align: top;
}
.prose th { font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.prose .footnote { font-size: 0.9rem; color: var(--muted); }
.prose img { display: block; }
.table-scroll { overflow-x: auto; }

/* ---------- figures (build-time SVG charts) ---------- */
.chart { margin: 2.5rem 0; }
.chart-svg { display: block; width: 100%; height: auto; }
.chart figcaption {
  display: flex; flex-direction: column; gap: 0.25rem;
  margin-top: 0.9rem;
}
.fig-title { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.fig-caption { color: var(--muted); font-size: 0.92rem; }
.fig-source {
  font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
}
.fig-data { margin-top: 0.9rem; border-top: 1px solid var(--rule); }
.fig-data summary {
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted);
  padding: 0.6rem 0; cursor: pointer;
}
.fig-data summary:hover { color: var(--ink); }
.fig-data table { border-collapse: collapse; width: 100%; font-size: 0.85rem; background: var(--paper); }
.fig-data th, .fig-data td { border: 1px solid var(--rule); padding: 0.35rem 0.6rem; text-align: left; }
.fig-data th { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.fig-download { margin-top: 0.6rem; font-family: var(--mono); font-size: 0.8rem; }

/* ---------- corrections ---------- */
.corrections {
  margin-top: 3rem;
  border-left: 3px solid var(--ink);
  padding-left: 1.25rem;
}
.corrections h2 {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted);
  margin-bottom: 0.6rem;
}
.correction { font-size: 0.95rem; margin-bottom: 0.5rem; }
.correction-date { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); margin-right: 0.5rem; }

/* ---------- sources block ---------- */
.sources-block { margin-top: 3rem; }
.sources-block h2 {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted);
  border-top: 1px solid var(--rule); padding-top: 1.3rem; margin-bottom: 0.7rem;
}
.sources-list { list-style: none; }
.sources-list li {
  font-family: var(--mono); font-size: 0.85rem; line-height: 1.6;
  padding: 0.3rem 0; color: var(--muted);
}
.sources-list a { color: var(--slate); }

/* ---------- related issues ---------- */
.related { margin-top: 2.5rem; }
.related h2 {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted);
  margin-bottom: 0.25rem;
}
.related .issue-row { padding: 1.1rem 0; }
.related-title { font-size: 1.1rem; margin-bottom: 0.15rem; }

/* ---------- citation block ---------- */
.cite-block {
  margin-top: 3.5rem;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding-top: 1.4rem; padding-bottom: 1.6rem;
}
.cite-block h2 {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted);
  margin-bottom: 0.6rem;
}
.cite-text {
  font-family: var(--mono); font-size: 0.88rem; line-height: 1.6;
  overflow-wrap: break-word;
}

/* ---------- issue footer / prev-next ---------- */
.issue-foot { padding-top: 3rem; padding-bottom: 2rem; }
.prevnext {
  display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  border-top: 1px solid var(--rule); padding-top: 1.5rem;
}
.prevnext a { font-size: 0.92rem; font-weight: 600; text-decoration: none; }
.prevnext a:hover { text-decoration: underline; }

/* ---------- analysis methods block ---------- */
.methods {
  border-top: 1px solid var(--rule);
  margin-top: 3rem; padding-top: 1.75rem; padding-bottom: 2.5rem;
}
.methods h2 {
  font-family: var(--mono); font-size: 0.8rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted);
  margin: 1.5rem 0 0.5rem;
}
.mono-note { font-family: var(--mono); font-size: 0.88rem; line-height: 1.6; }
.source-list { list-style: none; }
.source-list li { padding: 0.2rem 0; }

/* ---------- research: bibliography ---------- */
.research-list { list-style: none; }
.research-item {
  display: grid; grid-template-columns: 6ch 1fr; gap: 0.35rem 2.5rem;
  padding: 2rem 0; border-top: 1px solid var(--rule);
}
.research-item:last-child { border-bottom: 1px solid var(--rule); }
.research-year {
  font-family: var(--mono); font-weight: 500; font-size: 0.95rem;
  letter-spacing: 0.04em; padding-top: 0.25rem;
}
.research-title {
  font-family: var(--serif); font-weight: 600;
  font-size: 1.3rem; line-height: 1.3; letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.research-title a { color: var(--ink); text-decoration: none; }
.research-title a:hover { color: var(--slate); text-decoration: underline; }
.research-venue {
  font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--muted); margin-bottom: 0.6rem;
}
.research-desc { color: var(--muted); max-width: var(--measure); }
.mono { font-family: var(--mono); }

/* ---------- contact ---------- */
.contact-email {
  margin: 2rem 0 0; padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem; color: var(--muted);
}
.contact-form { margin-top: 2.5rem; max-width: 36rem; }
.form-field { margin-bottom: 1.2rem; }
.form-field label {
  display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.35rem;
}
.form-field input, .form-field textarea {
  width: 100%; padding: 0.65rem 0.8rem;
  font-family: var(--sans); font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 0;
}
.form-field input:focus, .form-field textarea:focus {
  outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink);
}
.contact-form button {
  font-family: var(--sans); font-weight: 600; font-size: 1rem;
  color: var(--paper); background: var(--ink);
  border: 1px solid var(--ink); border-radius: 0;
  padding: 0.7rem 2rem; cursor: pointer;
}
.contact-form button:hover { background: var(--slate); border-color: var(--slate); }
.form-note { font-size: 0.88rem; color: var(--muted); margin-top: 1rem; }

/* ---------- category filter (JS-injected) ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem;
}
.filter-bar button {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 0;
  padding: 0.4rem 1rem; cursor: pointer;
}
.filter-bar button[aria-pressed="true"] {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.filter-bar button:hover { border-color: var(--ink); }
.issue-row[hidden] { display: none; }

/* ---------- footer: the heaviest block on the page ---------- */
.site-footer {
  background: var(--ink); color: var(--ink-tint);
  padding: 4.5rem 0; margin-top: 5rem;
}
.site-footer .step-rule { margin: 0 0 3.5rem; }
.footer-cols {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: flex-start; gap: 2rem 3rem; margin-bottom: 3rem;
}
.footer-name {
  font-family: var(--serif); font-weight: 700; color: var(--paper);
  font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.2; letter-spacing: -0.01em;
}
.footer-sub {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 400;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-tint);
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
.footer-links a { font-size: 0.95rem; color: var(--ink-tint); }
.footer-links a:hover { color: var(--paper); }
.footer-fine { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-fine); }

/* ---------- responsive ---------- */
@media (max-width: 44rem) {
  .issue-row, .research-item { grid-template-columns: 1fr; gap: 0.3rem; }
  .issue-no, .research-year { padding-top: 0; }
  .hero { padding-top: 3.5rem; }
  .page-head { padding-top: 3rem; }
  .step-rule { margin: 2.75rem 0; }
  .site-footer { padding: 3.5rem 0; margin-top: 3.5rem; }
  .site-footer .step-rule { margin: 0 0 2.5rem; }
}

/* No animations are used anywhere; honor the preference regardless. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- print: issues get printed and saved as PDFs ---------- */
@media print {
  .site-nav, .footer-links, .step-rule, .skip-link, .filter-bar,
  .prevnext, .brand-mark { display: none !important; }
  body { background: #fff !important; color: #000 !important;
         font-family: var(--serif); font-size: 11pt; }
  .site-header, .site-footer {
    background: #fff !important; color: #000 !important;
    padding: 0.5rem 0; margin: 0;
  }
  .brand, .brand-word, .footer-name, .footer-sub, .footer-fine,
  .hero h1, .page-head h1, h2, h3, .page-lede, .hero-sub, .byline,
  .issue-line, .issue-summary, .cite-block h2, .eyebrow {
    color: #000 !important;
  }
  a { color: #000 !important; }
  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em; word-break: break-all;
  }
  h1, h2, h3 { break-after: avoid; page-break-after: avoid; }
  .cite-block { border-color: #000; }
  .prose pre { background: #fff !important; color: #000 !important;
               border: 1pt solid #000; }
}
