/* Online appendix: layout, type, and table shading. */

/* ---------------------------------------------------------------- tokens */

:root {
  --page: #fbfbf9;
  --surface: #ffffff;
  --side: #f4f4f1;
  --ink: #1a1a18;
  --ink-2: #4c4b47;
  --ink-3: #7d7b74;
  --rule: #dddcd5;
  --rule-strong: #1a1a18;
  --hover: rgba(0, 0, 0, 0.05);
  --row-hover: #f3f2ee;
  --accent: #1d5fb4;
  --accent-soft: #e4edf9;
  --note-bg: #f0f0ec;
  --shadow: rgba(0, 0, 0, 0.16);
  /* table cell shading */
  --f-head: #e8e8e8;
  --f-group: #f5f5f5;
  --f-dim: #d6e4f0;
  --f-avg: #fff2cc;
  --f-sub: #fbfbfb;
  --f-miss: #fde9d9;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --side-w: 290px;
  --top-h: 0px;
  --bar-h: 0px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

/* pages with the row of buttons at the top */
.with-sitebar { --bar-h: 50px; }

@media (prefers-color-scheme: dark) {
  :root {
    --page: #111110;
    --surface: #181817;
    --side: #151514;
    --ink: #ecebe6;
    --ink-2: #bdbbb3;
    --ink-3: #8c8a82;
    --rule: #30302d;
    --rule-strong: #ecebe6;
    --hover: rgba(255, 255, 255, 0.06);
    --row-hover: #222220;
    --accent: #6ea8ef;
    --accent-soft: #1b2b40;
    --note-bg: #1f1f1d;
    --shadow: rgba(0, 0, 0, 0.6);
    --f-head: #2a2a28;
    --f-group: #222220;
    --f-dim: #1d2c3c;
    --f-avg: #3a3218;
    --f-sub: #1c1c1b;
    --f-miss: #402323;
  }
}

/* ---------------------------------------------------------------- base */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 17px/1.62 var(--serif);
  font-optical-sizing: auto;
}

a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a.xref { text-decoration: none; border-bottom: 1px dotted currentColor; }
a.xref:hover { border-bottom-style: solid; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 60;
  padding: 8px 12px;
  background: var(--surface);
  font: 600 14px/1 var(--sans);
}
.skip:focus { left: 12px; }

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

.layout {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: var(--bar-h);
  height: calc(100vh - var(--bar-h));
  background: var(--side);
  border-right: 1px solid var(--rule);
}

/* ---------------------------------------------------------------- the buttons at the top */

.sitebar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  align-items: stretch;
  gap: 28px;
  height: var(--bar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  font-family: var(--sans);
}
.sitebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.sitebar-brand span {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sitebar-tabs { display: flex; gap: 2px; }
.sitebar-tabs a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 3px solid transparent;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.sitebar-tabs a:hover { color: var(--ink); background: var(--hover); }
.sitebar-tabs a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--accent); }

.sidebar-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 0 48px;
  scrollbar-width: thin;
}

.sidebar-head {
  display: block;
  margin: 0 0 8px;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--sans);
  text-decoration: none;
}
.sidebar-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.sidebar-title {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

main {
  min-width: 0;
  padding: 56px clamp(20px, 4vw, 56px) 96px;
}

.content {
  max-width: 1120px;
  margin: 0 auto;
}

.topbar { display: none; }

/* ---------------------------------------------------------------- contents */

.toc {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.35;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: block;
  padding: 5px 16px 5px 20px;
  border-left: 3px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
}
.toc a:hover { background: var(--hover); color: var(--ink); }
.toc .lvl-2 a { padding-left: 34px; }
.toc .lvl-3 a { padding-left: 48px; font-size: 13px; }
.toc .lvl-4 a { padding-left: 62px; font-size: 13px; }

.toc .part-link {
  margin-top: 18px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.toc .lvl-0 > li:first-child > .part-link { margin-top: 4px; }

/* the reader's position: its section and every section above it */
.toc a.is-trail { color: var(--ink); font-weight: 600; }
.toc .part-link.is-trail { color: var(--accent); }
.toc a[aria-current] {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* deeper entries open only along the reader's position */
.toc .lvl-3, .toc .lvl-4 { display: none; }
.toc li.is-open > .lvl-3, .toc li.is-open > .lvl-4 { display: block; }

/* ---------------------------------------------------------------- document */

.doc-head {
  margin-bottom: 8px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
.eyebrow {
  margin: 0 0 10px;
  font: 700 12px/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.doc-head h1 {
  max-width: 24em;
  margin: 0;
  font: 700 clamp(28px, 3.4vw, 40px)/1.15 var(--serif);
  letter-spacing: -0.01em;
}
.doc-lead {
  max-width: 46rem;
  margin: 16px 0 0;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1.5;
}
.part-title {
  margin: 80px 0 12px;
  padding-top: 18px;
  border-top: 3px solid var(--rule-strong);
  font: 700 30px/1.2 var(--sans);
  letter-spacing: -0.01em;
}
.part-num {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

h3 { margin: 56px 0 14px; font: 700 25px/1.25 var(--serif); }
h4 { margin: 40px 0 10px; font: 700 19px/1.3 var(--sans); }
h5 { margin: 32px 0 8px; font: 700 16.5px/1.35 var(--sans); }
h6 { margin: 26px 0 8px; font: 700 15px/1.35 var(--sans); color: var(--ink-2); }
h2, h3, h4, h5, h6 { scroll-margin-top: calc(var(--bar-h) + 24px); }
.part-title + .ed-note + h3, .part-title + h3 { margin-top: 28px; }

.content p,
.content h3, .content h4, .content h5, .content h6 { max-width: 46rem; }
p { margin: 0 0 14px; }
.hb-note { color: var(--ink-2); }

/* text added for the appendix */
.ed-note {
  max-width: 46rem;
  margin: 12px 0 18px;
  padding: 10px 14px;
  border-left: 3px solid var(--ink-3);
  background: var(--note-bg);
  color: var(--ink-2);
  font: 14.5px/1.5 var(--sans);
}
.table-note {
  margin: -8px 0 18px;
  color: var(--ink-2);
  font: 13.5px/1.5 var(--sans);
}

/* ---------------------------------------------------------------- tables */

.table-wrap {
  margin: 16px 0 22px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
  -webkit-overflow-scrolling: touch;
  /* edge shadows while a wide table has more to scroll */
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255, 255, 255, 0)) left center / 40px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, rgba(255, 255, 255, 0)) right center / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--shadow), transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--shadow), transparent) right center / 12px 100% no-repeat scroll;
  background-color: var(--surface);
}

table.hb {
  width: 100%;
  border-collapse: collapse;
  font: 13.5px/1.45 var(--sans);
  font-variant-numeric: tabular-nums;
}
.hb th, .hb td {
  padding: 7px 10px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.hb th:last-child, .hb td:last-child { border-right: 0; }
.hb tbody tr:last-child td { border-bottom: 0; }
.hb thead th { background: var(--f-head); font-weight: 700; vertical-align: bottom; }
.hb .num { text-align: center; white-space: nowrap; }
.hb .sub { display: block; margin-top: 2px; color: var(--ink-3); font-size: 12px; }
.hb td p { margin: 0 0 6px; max-width: none; }
.hb td p:last-child { margin-bottom: 0; }

.hb .f-head, .hb .f-head > td { background: var(--f-head); }
.hb .f-group, .hb .f-group > td { background: var(--f-group); }
.hb .f-dim, .hb .f-dim > td { background: var(--f-dim); }
.hb .f-avg, .hb .f-avg > td { background: var(--f-avg); }
.hb .f-sub, .hb .f-sub > td { background: var(--f-sub); }
.hb .f-miss { background: var(--f-miss); }

.t-criteria { min-width: 760px; }
.t-forms, .t-indicators { min-width: 620px; }
.t-comparison { min-width: 680px; }
.t-jurisdiction { min-width: 920px; }
.t-market { min-width: 860px; }
.t-defacto { min-width: 820px; }
.t-dims { min-width: 480px; }
.t-effective { min-width: 520px; }
.t-summary.t-comparison { min-width: 640px; }
.t-summary.t-defacto { min-width: 0; }

.df-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
  gap: 14px;
  margin: 16px 0 22px;
}
.df-summary .table-wrap { margin: 0; }

/* ---------------------------------------------------------------- title blocks, buttons */

.doc-authors {
  margin: 14px 0 0;
  color: var(--ink-2);
  font: 500 15.5px/1.5 var(--sans);
}
.doc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 20px 0 0;
  color: var(--ink-3);
  font: 13.5px/1.4 var(--sans);
}
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: 600 14px/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button.secondary { background: transparent; color: var(--accent); }
.button.secondary:hover { background: var(--accent-soft); filter: none; }
.button:disabled { opacity: 0.5; cursor: default; }
@media (prefers-color-scheme: dark) { .button:not(.secondary) { color: #0b1220; } }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- database page */

.db-meta {
  margin: -4px 0 10px;
  color: var(--ink-3);
  font: 13px/1.4 var(--sans);
}
.db-cols { max-width: 100%; margin: 8px 0 12px; }
.db-cols summary {
  display: inline-block;
  color: var(--ink-2);
  font: 600 13.5px/1.6 var(--sans);
  cursor: pointer;
}
.db-cols .table-wrap { margin-top: 8px; }
.t-cols { min-width: 620px; }
.t-cols code, .db-rows th button { font: 12.5px/1.4 var(--mono); }

/* Start here: questions that open a table with its filters set */
.db-start {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  margin: 14px 0 8px;
  padding: 0;
  list-style: none;
}
.db-start li { display: flex; }
.db-q {
  display: block;
  width: 100%;
  padding: 11px 14px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 600 14.5px/1.4 var(--sans);
  text-decoration: none;
}
.db-q:hover { border-color: var(--accent); background: var(--accent-soft); }
.db-q span { display: block; margin-top: 5px; color: var(--ink-3); font: 400 12.5px/1.4 var(--sans); }

/* a table's heading: its plain name, then its name in the database */
.db-name { margin-left: 6px; color: var(--ink-3); font: 500 0.72em/1 var(--mono); }

.db-browse { margin: 10px 0 34px; }
.db-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  font: 13px/1.3 var(--sans);
}
.db-toolbar input[type="search"], .db-toolbar select {
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: 13.5px/1.3 var(--sans);
}
.db-toolbar input[type="search"] { width: 240px; max-width: 100%; }
.db-toolbar select { max-width: 15rem; }
.db-filter { display: flex; flex-direction: column; gap: 3px; color: var(--ink-3); }
.db-filter span { font: 12px var(--mono); }
.db-clear {
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--accent);
  font: 600 13px/1.3 var(--sans);
  cursor: pointer;
}
.db-status { margin: 10px 0 0; color: var(--ink-2); font: 13px/1.4 var(--sans); }
.db-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 12px;
}
.db-bar .db-status { margin: 0; }
.db-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.db-browse .table-wrap { margin: 8px 0 10px; }
table.db-rows { font: 12.5px/1.45 var(--sans); }
.db-rows td { padding-top: 5px; padding-bottom: 5px; white-space: nowrap; }
.db-c { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
.db-named { color: var(--ink-3); }
.db-rows tbody tr { cursor: pointer; }
.db-rows tbody tr:hover > td, .db-rows tbody tr.is-current > td { background: var(--row-hover); }
.db-rows .db-open-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 1%;
  padding: 3px 5px;
  background: var(--surface);
}
.db-rows thead .db-open-cell { background: var(--f-head); }
.db-open {
  display: grid;
  place-items: center;
  width: 26px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
}
.db-rows tr:hover .db-open { border-color: var(--accent); }
.db-rows th { padding: 0; white-space: nowrap; }
.db-rows th button {
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.db-rows th button.has-note { text-decoration: underline dotted var(--ink-3); text-underline-offset: 4px; }
.db-rows th[aria-sort="ascending"] button::after { content: " ▲"; color: var(--accent); }
.db-rows th[aria-sort="descending"] button::after { content: " ▼"; color: var(--accent); }
.db-rows .nil, .db-fields .nil { color: var(--ink-3); }
.db-pager { display: flex; gap: 8px; }

/* one row, in full */
body:has(.db-dialog[open]) { overflow: hidden; }
.db-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: min(88vh, 960px);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px var(--shadow);
}
.db-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.db-dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}
.db-dialog h2 { flex: 1 1 260px; margin: 0; font: 700 16px/1.35 var(--sans); }
.db-dialog h2 code { margin-left: 6px; color: var(--ink-3); font: 500 12.5px/1 var(--mono); }
.db-dialog h2 span { display: block; margin-top: 2px; color: var(--ink-3); font: 400 12.5px/1.4 var(--sans); }
.db-dialog-nav { display: flex; align-items: center; gap: 8px; }
.db-close {
  width: 34px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: none;
  color: var(--ink-2);
  font: 400 22px/1 var(--sans);
  cursor: pointer;
}
.db-close:hover { background: var(--hover); }
.db-fields { margin: 0; padding: 4px 16px 16px; }
.db-fields > div {
  display: grid;
  grid-template-columns: minmax(140px, 30%) 1fr;
  gap: 4px 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.db-fields > div:last-child { border-bottom: 0; }
.db-fields dt code { color: var(--ink); font: 600 12.5px/1.5 var(--mono); overflow-wrap: anywhere; }
.db-fields dt span { display: block; margin-top: 2px; color: var(--ink-3); font: 12px/1.4 var(--sans); }
.db-fields dd { min-width: 0; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.55 var(--sans); }
.db-more {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: 600 12.5px var(--sans);
  cursor: pointer;
}

.doc-foot {
  margin-top: 72px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font: 13.5px/1.5 var(--sans);
}

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 1079px) {
  :root { --top-h: 52px; }
  .with-sitebar { --bar-h: 0px; }
  .sitebar {
    position: static;
    height: 46px;
    gap: 12px;
    padding: 0 8px;
    overflow-x: auto;
  }
  .sitebar-brand span { display: none; }
  .sitebar-tabs a { padding: 0 10px; font-size: 14px; }
  body { font-size: 16.5px; }
  body.nav-open { overflow: hidden; }
  .layout { display: block; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--top-h);
    padding: 0 16px;
    border-bottom: 1px solid var(--rule);
    background: var(--surface);
    font-family: var(--sans);
  }
  .toc-toggle {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--page);
    color: var(--ink);
    font: 600 14px/1 var(--sans);
    cursor: pointer;
  }
  .burger, .burger::before, .burger::after {
    display: block;
    width: 14px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
  }
  .burger { position: relative; }
  .burger::before, .burger::after { content: ""; position: absolute; left: 0; }
  .burger::before { top: -5px; }
  .burger::after { top: 5px; }
  .topbar-current {
    min-width: 0;
    overflow: hidden;
    color: var(--ink-2);
    font-size: 13.5px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86vw, 330px);
    height: auto;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px var(--shadow); }
  .backdrop {
    position: fixed;
    z-index: 35;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
  }

  main { padding: 28px 16px 72px; }
  h2, h3, h4, h5, h6 { scroll-margin-top: calc(var(--top-h) + 14px); }
  .part-title { margin-top: 56px; font-size: 25px; }
  h3 { margin-top: 44px; font-size: 22px; }
  h4 { font-size: 18px; }
}

@media (max-width: 640px) {
  .sitebar-brand { display: none; }
  .sitebar-tabs { flex: 1; justify-content: space-between; }
  .db-dialog {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .db-fields > div { grid-template-columns: 1fr; }
  .db-dialog-nav .button { padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ---------------------------------------------------------------- print */

@media print {
  .sidebar, .topbar, .backdrop, .skip { display: none !important; }
  .layout { display: block; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  main { padding: 0; }
  .table-wrap { overflow: visible; border: 0; background: none; }
  .hb { min-width: 0 !important; font-size: 8.5pt; }
  .hb tr { break-inside: avoid; }
  a, a.xref { color: inherit; text-decoration: none; border: 0; }
  .part-title { break-before: page; }
}
