*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--ink-0); -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(120% 70% at 50% 120%, rgba(245, 165, 36, 0.045), transparent 60%),
    radial-gradient(80% 50% at 85% -10%, rgba(120, 150, 200, 0.04), transparent 60%),
    var(--ink-0);
  color: var(--text-1);
  font: 400 var(--fs-body)/1.5 var(--f-ui);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
/* film grain: the room is never flat black */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
::selection { background: rgba(245, 165, 36, 0.35); color: #fff; }
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--money); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1.5px solid var(--money-hi); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--ink-2); padding: 8px 12px; border-radius: 6px; }
.skip:focus { top: 10px; }
.noscript { padding: 40px; color: var(--text-2); }

.num, .mono { font-family: var(--f-num); font-variant-numeric: tabular-nums slashed-zero; font-feature-settings: "tnum", "zero"; letter-spacing: -0.01em; }
.serif { font-family: var(--f-display); font-weight: 400; letter-spacing: -0.01em; }
.eyebrow { font: 500 var(--fs-micro)/1.2 var(--f-ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.money { color: var(--money); }

/* masthead */
.masthead {
  position: fixed; top: 0; left: 0; right: 0; height: var(--mast-h); z-index: 50;
  display: flex; align-items: center; gap: 28px; padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(14, 12, 10, 0.92), rgba(14, 12, 10, 0.6) 70%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.wordmark-mark {
  width: 18px; height: 18px; border-radius: 50%; border: 1.4px solid var(--money); position: relative;
  box-shadow: 0 0 14px var(--money-glow);
}
.wordmark-mark::after { content: ""; position: absolute; inset: 1.5px; border-radius: 50%; background: conic-gradient(var(--money) 0 50%, transparent 50% 100%); }
.wordmark-name { font: italic 400 22px/1 var(--f-display); letter-spacing: -0.01em; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  font: 500 var(--fs-ui)/1 var(--f-ui); color: var(--text-2); text-decoration: none; padding: 8px 11px; border-radius: 999px;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav a:hover { color: var(--text-1); background: rgba(255, 236, 214, 0.05); }
.nav a[aria-current="page"] { color: var(--text-1); background: rgba(255, 236, 214, 0.07); }
.search-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 14px; cursor: pointer;
  background: rgba(255, 236, 214, 0.04); border: 1px solid var(--rule); border-radius: 999px; padding: 7px 8px 7px 14px;
  font-size: var(--fs-ui); color: var(--text-3); transition: border-color var(--t-fast), color var(--t-fast);
}
.search-btn:hover { border-color: var(--rule-strong); color: var(--text-2); }
kbd { font: 500 11px/1 var(--f-num); color: var(--text-2); border: 1px solid var(--rule-strong); border-radius: 5px; padding: 3px 6px; background: var(--ink-1); }

/* stage */
#stage { position: relative; min-height: 100vh; min-height: 100dvh; outline: none; }
.view { position: relative; min-height: 100vh; min-height: 100dvh; padding: calc(var(--mast-h) + 8px) var(--gutter) var(--clear); }
.view-enter { animation: view-in var(--t-med) var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* footer line */
.footline {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--foot-h); z-index: 40;
  display: flex; align-items: center; gap: 18px; padding: 0 var(--gutter); overflow: hidden; white-space: nowrap;
  font: 400 11px/1 var(--f-num); color: var(--text-4); letter-spacing: 0;
  background: var(--ink-0);          /* opaque: nothing shows through it */
  border-top: 1px solid var(--rule);
}
.footline a { color: var(--text-3); text-decoration: none; }
.footline a:hover { color: var(--text-1); }
.footline .sep { color: var(--text-4); opacity: 0.6; }
.footline .attr { margin-left: auto; }

/* figures that can show their provenance */
.fig { cursor: help; border-radius: 3px; text-decoration: underline dotted transparent; text-underline-offset: 4px; text-decoration-thickness: 1px; transition: text-decoration-color var(--t-fast), background var(--t-fast); }
.fig:hover, .fig:focus-visible { text-decoration-color: var(--text-3); background: rgba(255, 236, 214, 0.04); }
.fig.is-open { text-decoration-color: var(--money); }
.fig.sfig { font: inherit; color: var(--money-hi); }

.prov {
  position: fixed; z-index: 120; width: min(380px, calc(100vw - 24px)); padding: 16px 18px 14px;
  background: rgba(24, 21, 17, 0.97); border: 1px solid var(--rule-strong); border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: var(--fs-small); color: var(--text-2); line-height: 1.5;
  animation: prov-in var(--t-fast) var(--ease-out) both;
}
@keyframes prov-in { from { opacity: 0; transform: translateY(4px) scale(0.985); } }
.prov h3 { margin: 6px 0 2px; font: 400 21px/1.15 var(--f-display); color: var(--text-1); }
.prov .prov-value { font: 500 15px/1.3 var(--f-num); color: var(--money-hi); margin: 2px 0 10px; }
.prov .prov-row { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding: 7px 0; border-top: 1px solid var(--rule); }
.prov .prov-row > span:first-child { color: var(--text-3); font-size: var(--fs-micro); letter-spacing: 0.1em; text-transform: uppercase; padding-top: 2px; }
.prov .prov-url { font: 400 11px/1.45 var(--f-num); color: var(--text-2); word-break: break-all; }
.prov .prov-url a { color: var(--text-1); }
.prov .caveat { color: var(--text-1); }
.prov .close { position: absolute; right: 8px; top: 8px; background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.prov .close:hover { color: var(--text-1); background: var(--ink-3); }
.level { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-micro)/1 var(--f-ui); letter-spacing: 0.12em; text-transform: uppercase; }
.level::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.level-documented { color: #d9e6c8; } .level-documented::before { background: #b6d08f; }
.level-corroborated { color: #cfe0ea; } .level-corroborated::before { background: transparent; border: 1.5px solid #9cc3da; }
.level-inferred { color: #e9d6c0; } .level-inferred::before { background: repeating-linear-gradient(45deg, #d4b48f 0 1.5px, transparent 1.5px 3px); border: 1px solid #d4b48f; }
.level-hypothesis { color: #d8cbe6; } .level-hypothesis::before { border: 1.5px dashed #bba4d6; }
.level-unknown { color: var(--text-3); } .level-unknown::before { border: 1.5px dotted var(--text-3); }

/* command palette */
.palette-scrim { position: fixed; inset: 0; z-index: 150; background: rgba(6, 5, 4, 0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade-in var(--t-fast) both; }
@keyframes fade-in { from { opacity: 0; } }
.palette {
  position: fixed; z-index: 151; top: 12vh; left: 50%; transform: translateX(-50%); width: min(640px, calc(100vw - 24px));
  background: rgba(22, 19, 16, 0.98); border: 1px solid var(--rule-strong); border-radius: 16px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7); animation: palette-in var(--t-med) var(--ease-out) both;
}
@keyframes palette-in { from { opacity: 0; transform: translate(-50%, -8px) scale(0.985); } }
.palette input {
  width: 100%; border: 0; outline: 0; background: transparent; color: var(--text-1);
  font: 400 24px/1.2 var(--f-display); padding: 22px 22px 16px; letter-spacing: -0.005em;
}
.palette input::placeholder { color: var(--text-4); }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: min(56vh, 460px); overflow-y: auto; border-top: 1px solid var(--rule); }
.palette li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.palette li[aria-selected="true"] { background: var(--ink-3); }
.palette li .p-title { color: var(--text-1); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette li .p-title mark { background: none; color: var(--money-hi); }
.palette li .p-sub { color: var(--text-3); font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette li .p-kind { font: 500 var(--fs-micro)/1 var(--f-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-4); }
.palette .p-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--rule); font-size: 11px; color: var(--text-4); }
.palette .p-empty { padding: 18px; color: var(--text-3); font-size: var(--fs-ui); }

/* tech chip */
.chip { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; vertical-align: -1px; }
.chip.inferred { background: transparent !important; border: 1.6px solid currentColor; }
.chip.none { background: repeating-linear-gradient(45deg, var(--t-unclassified) 0 2px, transparent 2px 4px) !important; border: 1px solid var(--t-unclassified); }
.basis { font: 500 var(--fs-micro)/1 var(--f-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }

/* controls */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(255, 236, 214, 0.04); border: 1px solid var(--rule); }
.seg button { border: 0; background: none; cursor: pointer; padding: 6px 12px; border-radius: 999px; font-size: var(--fs-small); color: var(--text-3); transition: color var(--t-fast), background var(--t-fast); white-space: nowrap; }
.seg button:hover { color: var(--text-1); }
.seg button[aria-pressed="true"] { background: var(--ink-3); color: var(--text-1); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.btn-quiet { white-space: nowrap; background: none; border: 1px solid var(--rule); border-radius: 999px; padding: 6px 12px; font-size: var(--fs-small); color: var(--text-2); cursor: pointer; transition: border-color var(--t-fast), color var(--t-fast); }
.btn-quiet:hover { border-color: var(--rule-strong); color: var(--text-1); }
.field { background: rgba(255, 236, 214, 0.04); border: 1px solid var(--rule); border-radius: 999px; padding: 7px 14px; color: var(--text-1); font: inherit; font-size: var(--fs-small); outline: none; min-width: 0; }
.field:focus { border-color: var(--money-lo); }
.field::placeholder { color: var(--text-4); }

/* readouts that follow the pointer */
.readout {
  position: absolute; z-index: 30; pointer-events: none; min-width: 200px; max-width: 300px; padding: 11px 13px;
  background: rgba(20, 17, 14, 0.94); border: 1px solid var(--rule-strong); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); font-size: var(--fs-small); color: var(--text-2); line-height: 1.45;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: opacity 120ms;
}
.readout[hidden] { display: block; opacity: 0; }
.readout .r-title { color: var(--text-1); font: 400 17px/1.2 var(--f-display); margin-bottom: 4px; }
.readout .r-big { font: 500 18px/1.2 var(--f-num); color: var(--money-hi); }
.readout .r-row { display: flex; justify-content: space-between; gap: 14px; }
.readout .r-row .num { color: var(--text-1); }

/* table alternative */
.table-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: rgba(20, 17, 14, 0.6); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
table.data caption { text-align: left; padding: 12px 14px; color: var(--text-2); caption-side: top; }
table.data th, table.data td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.data th { position: sticky; top: 0; background: var(--ink-2); color: var(--text-3); font-weight: 500; font-size: var(--fs-micro); letter-spacing: 0.1em; text-transform: uppercase; z-index: 1; }
table.data td.n, table.data th.n { text-align: right; font-family: var(--f-num); font-variant-numeric: tabular-nums; }
table.data tr:hover td { background: rgba(255, 236, 214, 0.03); }
table.data td.missing { color: var(--text-4); }

/* sheet: a dossier over the stage */
.sheet-scrim { position: fixed; inset: 0; z-index: 100; background: rgba(6, 5, 4, 0.45); animation: fade-in var(--t-med) both; }
.sheet {
  position: fixed; z-index: 101; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); overflow-y: auto;
  background: linear-gradient(to bottom, rgba(26, 22, 18, 0.985), rgba(18, 15, 12, 0.985)); border-left: 1px solid var(--rule-strong);
  box-shadow: -40px 0 120px rgba(0, 0, 0, 0.6); padding: 28px 30px 60px;
  animation: sheet-in var(--t-med) var(--ease-out) both;
}
@keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } }
.sheet .close-sheet { position: sticky; top: 0; float: right; margin: -10px -12px 0 0; background: var(--ink-2); border: 1px solid var(--rule); color: var(--text-2); border-radius: 999px; width: 34px; height: 34px; cursor: pointer; font-size: 18px; z-index: 2; }
.sheet .close-sheet:hover { color: var(--text-1); border-color: var(--rule-strong); }

/* loading and failure are stated plainly */
.state { display: grid; place-items: center; min-height: 50vh; text-align: center; color: var(--text-3); font-size: var(--fs-ui); }
.state .serif { font-size: 28px; color: var(--text-2); display: block; margin-bottom: 6px; }
.state.error .serif { color: #e8b7a6; }
.pulse { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--money); box-shadow: 0 0 12px var(--money); animation: pulse 1.1s ease-in-out infinite; margin-right: 8px; vertical-align: middle; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.7); } }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-small); color: var(--text-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend .lg .basis { margin-left: 2px; }
.note { font-size: var(--fs-small); color: var(--text-3); line-height: 1.55; max-width: 72ch; }
.note strong { color: var(--text-2); font-weight: 500; }

.keys {
  position: fixed; z-index: 140; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 24px));
  background: rgba(22, 19, 16, 0.98); border: 1px solid var(--rule-strong); border-radius: 16px; padding: 22px 24px; box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7);
}
.keys h2 { font: 400 26px/1.1 var(--f-display); margin: 0 0 14px; }
.keys dl { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; margin: 0; font-size: var(--fs-ui); color: var(--text-2); }
.keys dt { text-align: right; }

@media (max-width: 760px) {
  :root { --mast-h: 52px; --foot-h: 26px; --nav-h: 48px; }
  .nav { display: none; }
  .search-btn span { display: none; }
  .search-btn { padding: 7px 10px; }
  .search-btn::before { content: "Search"; font-size: var(--fs-small); }
  .footline { font-size: 10px; gap: 10px; }
  .footline .attr, .footline .gen { display: none; }
  .sheet { padding: 22px 18px 60px; top: auto; height: 88vh; height: 88dvh; border-left: 0; border-top: 1px solid var(--rule-strong); border-radius: 18px 18px 0 0; animation-name: sheet-up; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
  .mobile-nav { display: flex !important; }
}
.mobile-nav { display: none; position: fixed; z-index: 45; left: 0; right: 0; bottom: var(--foot-h); height: var(--nav-h); align-items: center; justify-content: space-around; padding: 0 8px; background: var(--ink-0); border-top: 1px solid var(--rule); }
.mobile-nav a { font-size: 12.5px; color: var(--text-2); text-decoration: none; padding: 8px 12px; border-radius: 999px; }
.mobile-nav a[aria-current="page"] { background: var(--ink-3); color: var(--text-1); }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: 380ms; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: 120ms !important; }
  .pulse { animation: none; }
}
