/* ---------------------------------------------------------------------------
   The Inference Primer — a printed-monograph reading surface.
   Bootstrap supplies the reset and utilities only; everything below is the
   site's own typographic system. Deliberately flat: hairline rules, no
   rounded corners, no drop shadows.
   ------------------------------------------------------------------------ */

:root {
  --paper:      #fbf9f4;
  --paper-2:    #f4f0e6;
  --ink:        #16181d;
  --ink-soft:   #4c5059;
  --ink-faint:  #7a7e88;
  --accent:     #2c3e73;
  --accent-2:   #3f5aa6;
  --rule:       #ddd6c7;
  --rule-soft:  #ebe5d9;
  --measure:    38rem;

  --serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Safeguard: content is never hidden waiting on JS. Any reveal animation is
   progressive enhancement only. */
[data-aos] { opacity: 1 !important; transform: none !important; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.075rem;
  line-height: 1.68;
  font-feature-settings: "liga" 1, "onum" 1;
}

img { max-width: 100%; height: auto; }

.wrap {
  width: 100%;
  max-width: 76rem;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: .6rem 1rem;
  font-family: var(--sans);
  z-index: 60;
}
.skip:focus { left: 0; }

/* ------------------------------- masthead ------------------------------- */

.topbar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 2rem;
  min-width: 0;
  padding-top: .85rem;
  padding-bottom: .85rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}

.brand__mark {
  font-family: var(--serif);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--accent);
  border: 1px solid var(--rule);
  padding: .3rem .55rem;
}

.brand__text { display: flex; flex-direction: column; min-width: 0; }

.brand__name {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: .01em;
}

.brand__sub {
  font-family: var(--sans);
  font-size: .74rem;
  color: var(--ink-faint);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.topnav { min-width: 0; }

.topnav__list {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.topnav__link {
  font-family: var(--sans);
  font-size: .87rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding: .2rem 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.topnav__link:hover { color: var(--accent); }

.topnav__link--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* reading progress — decorative only */
.progress { height: 2px; background: transparent; position: sticky; top: 0; z-index: 39; }
.progress span { display: block; height: 2px; width: 0; background: var(--accent-2); }

/* -------------------------------- layout -------------------------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
  padding-top: 2.75rem;
  padding-bottom: 4rem;
  align-items: start;
}

.col-article { min-width: 0; }

@media (min-width: 62rem) {
  .layout {
    grid-template-columns: minmax(0, var(--measure)) 15.5rem;
    justify-content: center;
    gap: 4.5rem;
  }
  .rail { position: sticky; top: 5.5rem; }
}

@media (min-width: 62rem) and (max-width: 74.99rem) {
  .layout { justify-content: start; }
}

.eyebrow {
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 .9rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--rule);
  max-width: var(--measure);
}

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

.prose { max-width: var(--measure); }

.prose h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.95rem, 1.35rem + 2.1vw, 2.85rem);
  line-height: 1.16;
  letter-spacing: -0.012em;
  margin: 0 0 1.1rem;
  text-wrap: balance;
}

.prose h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.42rem;
  line-height: 1.3;
  margin: 2.6rem 0 .85rem;
  padding-top: .9rem;
  border-top: 1px solid var(--rule-soft);
  position: relative;
}

.prose h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .01em;
  margin: 1.9rem 0 .6rem;
  color: var(--accent);
}

.prose p { margin: 0 0 1.15rem; }

.prose .lede {
  font-size: 1.24rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 1.7rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.prose a:hover { color: var(--accent-2); background: var(--paper-2); }

.prose ul, .prose ol { margin: 0 0 1.3rem; padding-left: 1.35rem; }
.prose li { margin-bottom: .55rem; }

.prose strong { font-weight: 600; }
.prose em { font-style: italic; }

.prose .equation {
  font-size: 1.18rem;
  text-align: center;
  margin: 1.7rem 0;
  padding: 1.1rem 1rem;
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  letter-spacing: .02em;
}

.prose .notice {
  border-left: 3px solid var(--accent);
  background: var(--paper-2);
  padding: 1rem 1.15rem .1rem;
  margin: 1.8rem 0;
  font-family: var(--sans);
  font-size: .92rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.prose .notice p { margin-bottom: 1rem; }

.prose ul.bib { list-style: none; padding-left: 0; }
.prose ul.bib li {
  padding-left: 1.15rem;
  border-left: 1px solid var(--rule);
  margin-bottom: 1rem;
  font-size: 1rem;
}

figure.hero {
  margin: 0 0 2rem;
  max-width: none;
}
figure.hero img {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}

/* --------------------------------- rail --------------------------------- */

.rail {
  font-family: var(--sans);
  border-top: 2px solid var(--ink);
  padding-top: .9rem;
}

.rail__title {
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 1rem;
}

.rail__group {
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 1.2rem 0 .4rem;
}

.rail__list { list-style: none; margin: 0; padding: 0; }
.rail__list li { margin: 0; }

.rail__link {
  display: block;
  font-size: .89rem;
  line-height: 1.35;
  padding: .3rem 0 .3rem .7rem;
  border-left: 2px solid var(--rule-soft);
  color: var(--ink-soft);
  text-decoration: none;
}
.rail__link:hover { color: var(--accent); border-left-color: var(--accent-2); }

.rail__link--active {
  color: var(--accent);
  font-weight: 500;
  border-left-color: var(--accent);
}

/* -------------------------------- footer -------------------------------- */

.foot {
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 2.6rem 0 3rem;
  font-family: var(--sans);
}

.foot__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

@media (min-width: 48rem) {
  .foot__inner { grid-template-columns: 1.6fr 1fr 1.3fr; gap: 2.5rem; }
}

.foot__head {
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 .8rem;
}

.foot__note {
  font-size: .84rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 .9rem;
}

.foot__list { list-style: none; margin: 0; padding: 0; }
.foot__list li { margin-bottom: .4rem; }
.foot__list a { font-size: .86rem; color: var(--ink-soft); text-decoration: none; }
.foot__list a:hover { color: var(--accent); text-decoration: underline; }

.foot__copy { font-size: .78rem; color: var(--ink-faint); margin: 0; }

/* ------------------------------ small screens ---------------------------- */

@media (max-width: 47.99rem) {
  body { font-size: 1.03rem; }
  .brand__sub { display: none; }
  .topnav__list { gap: .2rem .9rem; }
  .prose .lede { font-size: 1.12rem; }
}
