:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #edf2f5;
  --surface-blue: #e7eff6;
  --ink: #1d344a;
  --text: #2b4054;
  --muted: #5f7386;
  --line: #cfd9e2;
  --navy: #1e4f78;
  --blue: #236a98;
  --teal: #176e78;
  --teal-soft: #e8f1f1;
  --link: #1d6592;
  --focus: #d9a126;
  --max: 1120px;
  --read: 810px;
  --body-size: 1.08rem;
  --shadow: 0 14px 34px rgba(28, 49, 72, 0.07);
}

html[data-reading-width="narrow"] { --read: 690px; }
html[data-reading-width="standard"] { --read: 810px; }
html[data-reading-width="wide"] { --read: 980px; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", Inter, Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.74;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.15em; }
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.wrap { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; }
.read { width: min(var(--read), calc(100% - 40px)); margin: 0 auto; }

/* Home */
.hero {
  background: #1d496f;
  color: #fff;
  border-bottom: 1px solid #163b5a;
}
.hero-top {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 0;
}
.hero-top a { color: rgba(255,255,255,.95); font-size: .92rem; }
.hero-copy { text-align: center; padding: 24px 20px 34px; }
.hero h1 {
  margin: 0;
  font-size: clamp(2.05rem, 5vw, 2.75rem);
  letter-spacing: -.035em;
  line-height: 1.08;
  font-weight: 740;
}
.hero p { margin: 6px 0 0; color: rgba(255,255,255,.82); }

.archive { padding: 42px 0 78px; }
.archive-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 20px;
}
.archive-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.34rem;
  letter-spacing: -.015em;
}
.archive-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.notes { display: grid; gap: 10px; }
.note {
  display: grid;
  grid-template-columns: 72px minmax(0,1fr) 198px;
  gap: 24px;
  padding: 23px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  box-shadow: 0 5px 18px rgba(28,49,72,.035);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.note:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: #b9c9d7;
  box-shadow: 0 12px 28px rgba(28,49,72,.07);
}
.note-number {
  color: var(--teal);
  font-weight: 760;
  font-size: .76rem;
  letter-spacing: .09em;
  padding-top: 4px;
}
.note h3 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.29;
  letter-spacing: -.018em;
}
.note .summary {
  margin: 0 0 8px;
  color: #40566a;
  font-size: .95rem;
  line-height: 1.66;
}
.note .result {
  margin: 0;
  color: #536a7e;
  font-size: .84rem;
  line-height: 1.58;
}
.note .result strong { color: var(--teal); }
.meta { font-size: .77rem; line-height: 1.68; color: var(--muted); }
.meta strong { color: #394f64; }

/* Article header / controls */
.topbar {
  background: #f7f8fa;
  border-bottom: 1px solid #dce3e9;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}
.topbar .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.brand {
  font-weight: 720;
  color: var(--navy);
  white-space: nowrap;
}
.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
}
.all-notes {
  font-size: .88rem;
  color: var(--navy);
  white-space: nowrap;
}
.reading-width {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}
.reading-width-label {
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.width-options {
  display: inline-grid;
  grid-template-columns: repeat(3, 34px);
  gap: 2px;
  padding: 2px;
  border: 1px solid #ccd7e0;
  border-radius: 6px;
  background: #edf1f4;
}
.width-button {
  width: 34px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #607487;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.width-button:hover { background: rgba(255,255,255,.75); }
.width-button[aria-pressed="true"] {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(28,49,72,.12);
}
.width-mark {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.width-mark.narrow { width: 11px; }
.width-mark.standard { width: 17px; }
.width-mark.wide { width: 23px; }

.article-hero {
  background: var(--surface-blue);
  color: var(--ink);
  padding: 42px 0 36px;
  border-bottom: 1px solid #cbd9e5;
}
.kicker {
  color: var(--teal);
  font-size: .73rem;
  font-weight: 760;
  letter-spacing: .11em;
  text-transform: uppercase;
  margin-bottom: 11px;
}
.article-hero h1 {
  margin: 0;
  max-width: 100%;
  color: #18344f;
  font-size: clamp(2.35rem, 4.6vw, 3.12rem);
  line-height: 1.08;
  letter-spacing: -.037em;
  font-weight: 740;
}
.deck {
  margin: 17px 0 0;
  max-width: 780px;
  color: #465e73;
  font-size: 1.08rem;
  line-height: 1.7;
}

.article-shell { padding: 44px 0 90px; }
.paper {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.brief {
  background: #eaf0f3;
  border: 1px solid #cfdae1;
  border-radius: 8px;
  padding: 22px 24px;
  margin-bottom: 38px;
}
.brief h2 {
  margin: 0 0 14px !important;
  color: var(--navy) !important;
  font-size: 1.02rem !important;
}
.brief-grid { display: block; }
.brief-item { padding: 8px 0; }
.brief-item + .brief-item { border-top: 1px solid #d5e0e6; }
.brief-item strong {
  display: inline-block;
  width: 108px;
  vertical-align: top;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: .69rem;
  margin-top: 2px;
}
.brief-item span {
  display: inline-block;
  width: calc(100% - 116px);
  color: #2d465b;
  font-size: .97rem;
  line-height: 1.64;
}

.paper-meta {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  margin: 0 0 48px;
  color: #51687c;
  font-size: .81rem;
  line-height: 1.68;
}
.paper-meta .paper-title {
  color: var(--ink);
  font-weight: 670;
  font-size: .88rem;
  margin-bottom: 2px;
}

.article-body h2 {
  color: var(--teal);
  font-size: 1.43rem;
  line-height: 1.28;
  letter-spacing: -.022em;
  margin: 2.7em 0 .82em;
  font-weight: 760;
}
.article-body h2:first-of-type { margin-top: 0; }
.article-body p {
  margin: 0 0 1.3em;
  color: var(--text);
  font-size: var(--body-size);
  line-height: 1.88;
}
.article-body h2 + p { color: #233c52; }
.article-body strong { color: #173f5c; font-weight: 720; }

.source {
  margin-top: 64px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.source h2 { color: var(--navy); }
.source p {
  color: #4e667a;
  font-size: .91rem;
  line-height: 1.74;
}
.source .note-source { color: var(--muted); font-size: .8rem; }
.footer {
  text-align: center;
  color: var(--muted);
  font-size: .84rem;
  padding: 0 0 44px;
}

@media (max-width: 820px) {
  .note { grid-template-columns: 58px minmax(0,1fr); }
  .note .meta { grid-column: 2; }
  .archive-head { align-items: start; flex-direction: column; gap: 5px; }
  .reading-width { display: none; }
  .article-hero { padding-top: 34px; }
}

@media (max-width: 600px) {
  :root { --body-size: 1.02rem; }
  .wrap, .read, .hero-top { width: calc(100% - 28px); }
  .hero-copy { padding: 18px 14px 28px; }
  .hero h1 { font-size: 2.05rem; }
  .archive { padding: 32px 0 54px; }
  .note {
    grid-template-columns: 44px minmax(0,1fr);
    gap: 12px;
    padding: 20px 18px;
    border-radius: 7px;
  }
  .note h3 { font-size: 1.16rem; }
  .topbar { position: static; padding: 11px 0; }
  .topbar .wrap { gap: 10px; }
  .brand { font-size: .91rem; overflow: hidden; text-overflow: ellipsis; }
  .all-notes { font-size: .82rem; }
  .article-hero { padding: 30px 0 28px; }
  .article-hero h1 { font-size: 2rem; }
  .deck { font-size: 1rem; }
  .article-shell { padding: 34px 0 64px; }
  .brief { padding: 18px 18px; margin-bottom: 32px; }
  .brief-item strong,
  .brief-item span { display: block; width: 100%; }
  .brief-item strong { margin-bottom: 3px; }
  .paper-meta { margin-bottom: 38px; }
  .article-body h2 { font-size: 1.3rem; margin-top: 2.4em; }
  .article-body p { line-height: 1.82; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .note { transition: none; }
}
