/* Trust in America's Professionals — open review
   One stylesheet. No build step. */

:root {
  color-scheme: light;
  --paper:       #fdfcfa;
  --surface:     #ffffff;
  --surface-2:   #f5f3ee;
  --ink:         #17191e;
  --ink-2:       #4a4a46;
  --muted:       #8a877e;
  --rule:        #e4e1d9;
  --rule-2:      #cbc7bb;
  --accent:      #1b4f8f;
  --accent-ink:  #14406f;
  --accent-soft: #eaf0f8;
  --gold:        #9a6b13;
  --gold-soft:   #fbf4e3;

  --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --r: 5px;
  --rail: 350px;
  --toc: 208px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #131313; --surface: #191919; --surface-2: #222221;
    --ink: #f2f1ec; --ink-2: #c2c1b7; --muted: #8d8b82;
    --rule: #302f2c; --rule-2: #47463f;
    --accent: #7db0ef; --accent-ink: #9cc4f5; --accent-soft: #1a2736;
    --gold: #d9a441; --gold-soft: #2b2313;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #131313; --surface: #191919; --surface-2: #222221;
  --ink: #f2f1ec; --ink-2: #c2c1b7; --muted: #8d8b82;
  --rule: #302f2c; --rule-2: #47463f;
  --accent: #7db0ef; --accent-ink: #9cc4f5; --accent-soft: #1a2736;
  --gold: #d9a441; --gold-soft: #2b2313;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -9999px; z-index: 200; background: var(--ink); color: var(--paper); padding: .6rem 1rem; }
.skip:focus { left: .5rem; top: .5rem; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============================ masthead ============================ */
.top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.top-in {
  max-width: 1560px; margin-inline: auto; padding: 0 1.5rem;
  display: flex; align-items: center; gap: 1rem; min-height: 56px;
}
.wordmark {
  font-family: var(--serif); font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none; margin-right: auto; line-height: 1.25;
}
.wordmark em { font-style: normal; color: var(--muted); font-weight: 400; }
.top-acts { display: flex; align-items: center; gap: .45rem; }
.mini {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
  font-size: .82rem; font-weight: 500; padding: .4rem .75rem; border-radius: var(--r);
  border: 1px solid var(--rule-2); background: transparent; color: var(--ink-2);
  text-decoration: none; cursor: pointer;
}
.mini:hover { background: var(--surface-2); color: var(--ink); }
.mini.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.mini.solid:hover { opacity: .88; background: var(--ink); color: var(--paper); }
.icon { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; }

/* ============================ hero ============================ */
.hero { border-bottom: 1px solid var(--rule); background: var(--surface-2); }
.hero-in { max-width: 1560px; margin-inline: auto; padding: 2.6rem 1.5rem 2.2rem; }
.kicker {
  font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 650; margin-bottom: .9rem;
}
.hero h1 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -.022em; line-height: 1.1;
  font-size: clamp(1.9rem, 4.2vw, 2.9rem); margin: 0 0 .5rem; max-width: 22ch;
}
.hero .by { color: var(--ink-2); font-size: .95rem; margin: 0 0 1.5rem; }
.hero .by b { color: var(--ink); font-weight: 600; }
.hero-acts { display: flex; flex-wrap: wrap; gap: .55rem; }

/* reviewer strip = social proof */
.proof { margin-top: 1.9rem; border-top: 1px solid var(--rule); padding-top: 1.2rem; }
.proof-h {
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 650;
  color: var(--muted); margin-bottom: .85rem;
}
.proof-h b { color: var(--ink); }
.proof-strip { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; scrollbar-width: thin; }
.proof-chip {
  flex: none; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 999px; padding: .35rem .85rem; font-size: .8rem; color: var(--ink-2);
  white-space: nowrap;
}
.proof-chip b { color: var(--ink); font-weight: 600; }

/* ============================ shell ============================ */
.shell {
  max-width: 1560px; margin-inline: auto; padding: 0 1.5rem 4rem;
  display: grid; gap: 2.75rem;
  grid-template-columns: var(--toc) minmax(0, 1fr) var(--rail);
  align-items: start;
}

/* ---------------- table of contents ---------------- */
.toc { position: sticky; top: 74px; max-height: calc(100vh - 96px); overflow-y: auto; padding: 2.2rem 0 1rem; scrollbar-width: thin; }
.toc-h { font-size: .7rem; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); font-weight: 650; margin-bottom: .7rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: flex; gap: .5rem; align-items: baseline; justify-content: space-between;
  padding: .3rem .55rem .3rem .6rem; font-size: .82rem; color: var(--ink-2);
  text-decoration: none; border-left: 2px solid transparent; border-radius: 0 var(--r) var(--r) 0;
  line-height: 1.35;
}
.toc a:hover { background: var(--surface-2); color: var(--ink); }
.toc a.on { border-left-color: var(--accent); color: var(--ink); font-weight: 600; background: var(--accent-soft); }
.toc .cn {
  flex: none; font-size: .68rem; font-weight: 650; color: var(--muted);
  background: var(--surface-2); border-radius: 999px; padding: .05rem .4rem; min-width: 1.3rem; text-align: center;
}
.toc a.on .cn { background: var(--surface); }
.toc .cn[data-zero="1"] { visibility: hidden; }

/* ---------------- the paper ---------------- */
.doc { padding: 2.2rem 0 0; min-width: 0; }
.sec { scroll-margin-top: 76px; padding-bottom: 2.6rem; }
.sec + .sec { border-top: 1px solid var(--rule); padding-top: 2.4rem; }
.sec > h2 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -.014em; line-height: 1.2;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem); margin: 0 0 1.1rem; max-width: 30ch;
}
.sec p {
  font-family: var(--serif); font-size: 1.075rem; line-height: 1.72;
  margin: 0 0 1.15rem; max-width: 68ch;
}
.sec h3 {
  font-family: var(--sans); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 700; color: var(--muted); margin: 2.4rem 0 .9rem;
}
.doc-lead { color: var(--muted); font-size: .85rem; margin: 0 0 2rem; }

/* exhibit chips */
.exbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0 0 1.5rem; }
.exbar-lbl { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 650; margin-right: .15rem; }
.exchip {
  display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
  font-size: .78rem; font-weight: 550; padding: .25rem .6rem .25rem .5rem;
  border: 1px solid var(--rule-2); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
}
.exchip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.exchip b { font-weight: 700; color: var(--ink); }
.exchip:hover b { color: var(--accent); }
.exchip::after { content: "↗"; font-size: .72em; color: var(--muted); }
.exchip:hover::after { color: var(--accent); }

/* figures & tables */
figure.fig, .tbl { margin: 2rem 0; }
figure.fig img {
  width: 100%; height: auto; display: block; border: 1px solid var(--rule);
  border-radius: var(--r); background: #fff;
}
.fig-h, .tbl-h {
  font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  color: var(--gold); margin-bottom: .3rem;
}
.fig-t, .tbl-t {
  font-family: var(--serif); font-style: italic; font-size: 1rem;
  color: var(--ink-2); margin: 0 0 .85rem; max-width: 62ch;
}
.fig-n, .tbl-n {
  font-size: .82rem; line-height: 1.55; color: var(--muted); margin: .8rem 0 0; max-width: 70ch;
}
.fig-n b, .tbl-n b { font-style: italic; font-weight: 400; color: var(--ink-2); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th, td { padding: .6rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
th { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td { font-variant-numeric: tabular-nums; }
td:first-child { font-weight: 600; }
/* keep short numeric cells on one line; let long prose cells wrap */
td.tight { white-space: nowrap; }

.fnote {
  font-size: .84rem; line-height: 1.6; color: var(--muted);
  border-top: 1px solid var(--rule); padding-top: .8rem; margin-top: 1.6rem; max-width: 70ch;
}
.fnote sup { color: var(--ink-2); font-weight: 700; margin-right: .35rem; }
.ref { font-family: var(--serif); font-size: .98rem; padding-left: 2rem; text-indent: -2rem; margin: 0 0 .85rem; max-width: 68ch; }

/* per-section comment prompt */
.sec-cta {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin-top: 1.8rem; padding: .8rem 1rem; border: 1px dashed var(--rule-2);
  border-radius: var(--r); background: var(--surface);
}
.sec-cta span { font-size: .84rem; color: var(--muted); }
.sec-cta button {
  margin-left: auto; font-size: .8rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--rule-2); background: transparent; color: var(--ink);
  padding: .35rem .8rem; border-radius: var(--r);
}
.sec-cta button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------------- comment rail ---------------- */
.rail { position: sticky; top: 74px; height: calc(100vh - 90px); display: flex; flex-direction: column; padding-top: 2.2rem; min-width: 0; }
.rail-top { border-bottom: 1px solid var(--rule); padding-bottom: .85rem; margin-bottom: .3rem; }
.rail-top h2 { font-family: var(--sans); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 .2rem; }
.rail-count { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.rail-count small { font-family: var(--sans); font-size: .8rem; font-weight: 400; color: var(--muted); margin-left: .3rem; }
.rail-add {
  width: 100%; margin-top: .8rem; cursor: pointer; font-size: .875rem; font-weight: 600;
  padding: .6rem 1rem; border-radius: var(--r); border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper);
}
.rail-add:hover { opacity: .88; }
.rail-scroll { overflow-y: auto; padding: 1rem .25rem 1rem 0; scrollbar-width: thin; flex: 1; }
.rail-filter { font-size: .78rem; color: var(--muted); padding: .5rem 0; display: none; align-items: center; gap: .5rem; }
.rail-filter.on { display: flex; }
.rail-filter button { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: .78rem; text-decoration: underline; padding: 0; }

.cmt { padding: .95rem 0; border-bottom: 1px solid var(--rule); }
.cmt:first-child { padding-top: .25rem; }
.cmt-who { font-size: .9rem; font-weight: 650; line-height: 1.3; }
.cmt-org { font-size: .8rem; color: var(--accent-ink); margin-top: .1rem; }
.cmt-body { font-family: var(--serif); font-size: .97rem; line-height: 1.6; margin: .55rem 0 0; white-space: pre-wrap; }
.cmt-meta { font-size: .72rem; color: var(--muted); margin-top: .5rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.cmt-sec {
  cursor: pointer; border: 1px solid var(--rule); background: var(--surface-2); color: var(--muted);
  border-radius: 999px; padding: .05rem .5rem; font-size: .7rem;
}
.cmt-sec:hover { color: var(--accent); border-color: var(--accent); }

.rail-empty { padding: 1.75rem 0; color: var(--muted); font-size: .9rem; font-family: var(--serif); line-height: 1.6; }
.rail-note { font-size: .74rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: .7rem; }

/* ============================ modal form ============================ */
dialog.sheet {
  width: min(94vw, 33rem); padding: 0; border: 1px solid var(--rule-2); border-radius: 8px;
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgb(0 0 0 / .28);
}
dialog::backdrop { background: rgb(10 10 10 / .55); backdrop-filter: blur(2px); }
.sheet-h { padding: 1.25rem 1.4rem .9rem; border-bottom: 1px solid var(--rule); }
.sheet-h h2 { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 .3rem; font-weight: 600; }
.sheet-h p { margin: 0; font-size: .84rem; color: var(--muted); }
.sheet-b { padding: 1.25rem 1.4rem; }
.sheet-f { padding: 0 1.4rem 1.3rem; display: flex; gap: .6rem; align-items: center; }
.sheet-f .spacer { margin-left: auto; }

.f { margin-bottom: 1rem; }
.f label { display: block; font-size: .78rem; font-weight: 650; margin-bottom: .3rem; }
.f label span { font-weight: 400; color: var(--muted); }
.f input, .f select, .f textarea {
  font: inherit; font-size: .95rem; width: 100%; padding: .55rem .7rem;
  border: 1px solid var(--rule-2); border-radius: var(--r);
  background: var(--paper); color: var(--ink);
}
.f textarea { min-height: 7.5rem; resize: vertical; font-family: var(--serif); line-height: 1.6; }
.hp { position: absolute; left: -9999px; }
.msg { border-radius: var(--r); padding: .7rem .85rem; font-size: .84rem; margin-bottom: 1rem; border: 1px solid; }
.msg.ok  { background: var(--accent-soft); border-color: var(--accent); }
.msg.bad { background: var(--gold-soft); border-color: var(--gold); }
.msg.dim { background: var(--surface-2); border-color: var(--rule); color: var(--ink-2); }

/* ============================ exhibit drawer ============================ */
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(96vw, 46rem); z-index: 120;
  background: var(--surface); border-left: 1px solid var(--rule-2);
  box-shadow: -20px 0 60px rgb(0 0 0 / .22);
  display: flex; flex-direction: column; transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1); visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }
.scrim {
  position: fixed; inset: 0; z-index: 110; background: rgb(10 10 10 / .4);
  opacity: 0; visibility: hidden; transition: opacity .22s;
}
.scrim.open { opacity: 1; visibility: visible; }
.dr-h { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--rule); }
.dr-h .t { font-weight: 650; font-size: .95rem; line-height: 1.3; }
.dr-h .t small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }
.dr-h .sp { margin-left: auto; }
.dr-b { flex: 1; overflow: auto; }
.dr-b iframe { width: 100%; height: 100%; border: 0; background: var(--surface-2); }
.dr-cap { padding: .85rem 1rem; border-bottom: 1px solid var(--rule); font-size: .85rem; color: var(--ink-2); line-height: 1.55; background: var(--surface-2); }
.dr-miss { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); font-size: .9rem; line-height: 1.6; }

.exlist { padding: .5rem 0 2rem; }
.exrow {
  display: grid; grid-template-columns: 2.5rem 1fr; gap: .85rem; align-items: baseline;
  padding: .8rem 1rem; border-bottom: 1px solid var(--rule); cursor: pointer; width: 100%;
  background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: inherit;
}
.exrow:hover { background: var(--surface-2); }
.exrow .n { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; color: var(--muted); }
.exrow .ti { font-weight: 600; font-size: .92rem; }
.exrow .ca { font-size: .82rem; color: var(--muted); margin-top: .15rem; line-height: 1.5; }
.exrow .kd { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--muted); }

/* ============================ mobile ============================ */
.mobile-bar { display: none; }

@media (max-width: 1240px) {
  .shell { grid-template-columns: minmax(0, 1fr) var(--rail); }
  .toc { display: none; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; padding-bottom: 6rem; }
  .rail {
    position: static; height: auto; border-top: 1px solid var(--rule);
    margin-top: 2rem; padding-top: 1.75rem;
  }
  .rail-scroll { overflow: visible; max-height: none; }
  .sec p { font-size: 1.05rem; }
  .mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    gap: .5rem; padding: .6rem .9rem calc(.6rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(10px); border-top: 1px solid var(--rule);
  }
  .mobile-bar button { flex: 1; }
  .mobile-bar .solid { flex: 2; }
  .hero h1 { max-width: none; }
  /* the sticky bottom bar already carries these — keep the header to one line */
  .top-acts .mini:not(.icon) { display: none; }
  .wordmark { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 560px) {
  .top-in { padding: 0 1rem; }
  .hero-in, .shell { padding-left: 1rem; padding-right: 1rem; }
  .wordmark em { display: none; }
}

.foot {
  border-top: 1px solid var(--rule); padding: 2rem 1.5rem 3rem; color: var(--muted); font-size: .82rem;
}
.foot-in { max-width: 1560px; margin-inline: auto; display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: space-between; }
.foot a { color: var(--ink-2); }
