:root {
  --bg: #fffff8;
  --fg: #111111;
  --muted: #58544c;
  --rule: #d6d0c2;
  --accent: #244c73;
  --link-ul: #9c978a;
  --met: #2f6b4f;
  --half: #b08a2e;
  --no: #b9b2a3;
  --ahead: #a8452f;
  --c0: #244c73;
  --c1: #a8452f;
  --c2: #6b4c9a;
  --fill: 36, 76, 115;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412;
    --fg: #e5e0d5;
    --muted: #9b9589;
    --rule: #2e2b25;
    --accent: #8ab4dc;
    --link-ul: #615c52;
    --met: #7fbf9a;
    --half: #d9b25a;
    --no: #4d4940;
    --ahead: #e28a6f;
    --c0: #8ab4dc;
    --c1: #e28a6f;
    --c2: #b79be0;
    --fill: 138, 180, 220;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #151412;
  --fg: #e5e0d5;
  --muted: #9b9589;
  --rule: #2e2b25;
  --accent: #8ab4dc;
  --link-ul: #615c52;
  --met: #7fbf9a;
  --half: #d9b25a;
  --no: #4d4940;
  --ahead: #e28a6f;
  --c0: #8ab4dc;
  --c1: #e28a6f;
  --c2: #b79be0;
  --fill: 138, 180, 220;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "ETBook", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Liberation Serif", serif;
  font-size: 17px;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 32px 68px;
}

.page.versus-page {
  max-width: 1060px;
}

/* Top nav (matches home.css) */
nav.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 34px;
  font-size: 14.5px;
}

nav.top .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--fg);
  text-decoration: none;
  border: none;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 16.5px;
  font-weight: 600;
}

nav.top .brand svg {
  width: 24px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}

nav.top .nav-right {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 18px;
}

nav.top .links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

nav.top .links a {
  color: var(--muted);
  text-decoration: none;
  border: none;
}

nav.top .links a:hover {
  color: var(--fg);
}

nav.top .links a.on {
  color: var(--fg);
  border-bottom: 1px solid var(--fg);
}

.theme-toggle {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding-left: 14px;
  border-left: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--muted);
}

.theme-toggle button {
  appearance: none;
  background: none;
  border: none;
  padding: 2px 4px;
  margin: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle button:hover {
  color: var(--fg);
}

.theme-toggle button[aria-pressed="true"] {
  color: var(--fg);
  border-bottom: 1px solid var(--fg);
}

/* Base typography */
h1 {
  font-weight: 400;
  font-size: 2.35rem;
  line-height: 1.12;
  margin: 0 0 12px;
}

h2 {
  font-weight: 400;
  font-style: italic;
  font-size: 1.55rem;
  margin: 40px 0 10px;
}

h3 {
  font-weight: 400;
  font-size: 1.25rem;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--link-ul);
}

a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

code {
  font-family: "Liberation Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 0.82em;
}

button {
  font: inherit;
  color: inherit;
}

.lede {
  max-width: 720px;
  color: var(--fg);
  margin: 0 0 24px;
}

.lede em {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

small, .small {
  font-size: 13px;
}

.num {
  font-variant-numeric: lining-nums tabular-nums;
}

.draft {
  display: inline-block;
  font-size: 12.5px;
  color: var(--ahead);
  border: 1px solid var(--ahead);
  border-radius: 3px;
  padding: 0 6px;
  margin-left: 8px;
  vertical-align: middle;
  font-style: normal;
  line-height: 1.5;
}

/* Clause dots */
.cd {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 2px;
  vertical-align: 1px;
  border: 1.3px solid var(--met);
}

.cd.met { background: var(--met); }
.cd.half { background: linear-gradient(90deg, var(--met) 50%, transparent 50%); }
.cd.no { border-color: var(--no); }
.cd.na { border-style: dashed; border-color: var(--no); }

/* ========== VIEW A: MATRIX + RADAR ========== */
.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: 24px;
  align-items: start;
}

.tools {
  display: flex;
  gap: 14px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 13.5px;
}

.tools .hint {
  color: var(--muted);
}

.wrap {
  overflow-x: auto;
  border-top: 1.5px solid var(--fg);
  border-bottom: 1.5px solid var(--fg);
}

table.matrix {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}

table.matrix th,
table.matrix td {
  padding: 6px 5px;
  text-align: center;
  border-bottom: 1px solid var(--rule);
}

table.matrix tbody tr:last-child td {
  border-bottom: none;
}

table.matrix thead th {
  font-weight: 400;
  vertical-align: bottom;
  border-bottom: 1px solid var(--fg);
}

table.matrix thead th button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  line-height: 1.2;
}

table.matrix thead th .id {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

table.matrix thead th.on button {
  text-decoration: underline;
  text-underline-offset: 2px;
}

table.matrix th.name,
table.matrix td.name {
  text-align: left;
  min-width: 168px;
  max-width: 205px;
  padding-left: 8px;
  padding-right: 8px;
}

table.matrix td.name button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  font-size: 15px;
  text-align: left;
}

table.matrix td.name button:hover {
  color: var(--accent);
}

table.matrix td.name .avg {
  float: right;
  color: var(--muted);
  margin-left: 8px;
  font-size: 12.5px;
}

table.matrix td.name .kind {
  display: block;
  line-height: 1.25;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

table.matrix td.name .vs-link {
  font-style: normal;
  color: var(--muted);
  border-bottom-color: transparent;
  margin-left: 3px;
}

table.matrix td.name .vs-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sw {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border: 1.3px solid var(--muted);
  vertical-align: 0;
}

tr.picked .sw {
  background: var(--pc);
  border-color: var(--pc);
}

tr.picked td.name {
  box-shadow: inset 3px 0 var(--pc);
}

table.matrix td.cell {
  background: rgba(var(--fill), calc(var(--f) * 0.0022));
  min-width: 78px;
}

table.matrix td.cell .p {
  font-variant-numeric: lining-nums tabular-nums;
  margin-left: 3px;
}

table.matrix td.cell .how {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.2;
}

table.matrix td.cell.ahead {
  outline: 1.5px solid var(--ahead);
  outline-offset: -3px;
}

table.matrix tr.dither td.name {
  font-weight: 600;
}

table.matrix tr.dither.theory td {
  font-style: italic;
}

table.matrix tr.dither.theory td.cell {
  background: repeating-linear-gradient(
    135deg,
    rgba(var(--fill), calc(var(--f) * 0.0016)) 0 6px,
    transparent 6px 9px
  );
}

table.matrix tr.dither.today td {
  border-bottom: 1.5px solid var(--fg);
}

.key {
  font-size: 12.5px;
  color: var(--muted);
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.key .ak {
  display: inline-block;
  width: 11px;
  height: 11px;
  outline: 1.5px solid var(--ahead);
  vertical-align: -1px;
  margin-right: 4px;
}

aside.radar-box svg {
  width: 100%;
  height: auto;
  display: block;
}

aside.radar-box .legend {
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  justify-content: center;
  margin-top: 4px;
}

aside.radar-box .legend i {
  display: inline-block;
  width: 14px;
  height: 0;
  border-top: 2px solid;
  vertical-align: 4px;
  margin-right: 4px;
}

aside.radar-box p {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  margin: 8px 0 0;
}

/* Quick comparison cards below matrix */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 28px;
  margin-top: 36px;
}

.card {
  border-top: 3px solid var(--pc);
  padding-top: 12px;
}

.card header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.card header h3 a {
  border-bottom-color: transparent;
}

.card header h3 a:hover {
  border-bottom-color: var(--accent);
}

.card header .x {
  margin-left: auto;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}

.card header .x:hover {
  color: var(--fg);
}

.card h4 {
  font-weight: 400;
  font-style: italic;
  margin: 14px 0 4px;
  font-size: 1.05rem;
}

.card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 15px;
}

.card li {
  margin: 4px 0;
}

.card .honest {
  font-size: 15px;
  border-left: 2px solid var(--rule);
  padding-left: 10px;
  margin-top: 14px;
}

.hint-card {
  color: var(--muted);
  font-style: italic;
}

/* Collapsible unscored approach table & rubric links */
.approach-box {
  margin-top: 38px;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
}

.approach-box summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  font-style: italic;
}

.approach-box summary:hover {
  color: var(--fg);
}

.approach-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

table.approach {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.approach th,
table.approach td {
  text-align: left;
  padding: 7px 12px 7px 0;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

table.approach thead th {
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  border-top: 1px solid var(--fg);
  border-bottom: 1px solid var(--fg);
}

.rubric-note {
  margin-top: 22px;
  font-size: 14px;
  color: var(--muted);
  max-width: 760px;
}

/* ========== VIEW D: VERSUS PAGE ========== */
.crumb {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

.crumb a {
  color: var(--muted);
  border-bottom-color: transparent;
}

.crumb a:hover {
  color: var(--fg);
  border-bottom-color: var(--link-ul);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  border-bottom: 1px solid var(--rule);
  margin: 4px 0 26px;
}

.tabs a {
  display: inline-block;
  padding: 6px 0;
  font-size: 17px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover {
  color: var(--fg);
  border-bottom-color: var(--rule);
}

.tabs a.on {
  color: var(--fg);
  border-bottom-color: var(--c1);
}

.tabs a small {
  font-size: 12px;
  margin-left: 4px;
  color: var(--muted);
}

.vs-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.vs-head h1 {
  margin: 0;
  font-style: normal;
  font-size: 2rem;
}

.vs-head h1 span.them { color: var(--c1); }
.vs-head h1 em { color: var(--muted); font-size: 1.25rem; margin: 0 6px; }
.vs-head h1 b { font-weight: 400; color: var(--c0); }

.bells {
  margin: 18px 0 10px;
  border-top: 1.5px solid var(--fg);
}

.bell {
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr) 235px;
  gap: 16px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}

.bell .ax {
  font-size: 16px;
}

.bell .ax small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.bt {
  position: relative;
  height: 22px;
  margin: 0 10px;
}

.bt .base {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  border-top: 1px dotted var(--rule);
}

.bt .gap {
  position: absolute;
  top: 9px;
  height: 3px;
  background: rgba(var(--fill), 0.25);
}

.bt i {
  position: absolute;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translateX(-50%);
}

.bt i.them { background: var(--c1); z-index: 3; }
.bt i.today { background: var(--c0); width: 9px; height: 9px; top: 6.5px; z-index: 2; }
.bt i.theory { border: 1.5px dashed var(--c0); background: none; width: 18px; height: 18px; top: 2px; z-index: 1; }

.bell .how {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

.bell .how b {
  font-weight: 400;
  color: var(--c1);
}

.bell .how .v {
  color: var(--fg);
}

.bell .how .ahead-note {
  color: var(--ahead);
}

.legend {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.legend i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  vertical-align: -1px;
  margin-right: 4px;
}

.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  margin-top: 30px;
}

.cols h2 {
  margin: 0;
  font-style: italic;
  font-size: 1.2rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 5px;
}

.cols h2.them { color: var(--c1); }
.cols h2.us { color: var(--c0); }

.cols ol {
  padding-left: 20px;
  margin: 12px 0;
}

.cols li {
  margin: 8px 0;
  font-size: 15.5px;
}

.borrow {
  margin-top: 26px;
  max-width: 780px;
}

.borrow h2 {
  margin: 0 0 8px;
  font-style: italic;
  font-size: 1.2rem;
}

.borrow ul {
  margin: 0;
  padding-left: 20px;
}

.borrow li {
  margin: 6px 0;
  font-size: 15.5px;
}

.honest {
  margin-top: 26px;
  font-size: 16px;
  border-left: 3px solid var(--rule);
  padding: 2px 0 2px 14px;
  max-width: 780px;
}

.honest strong.label {
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  margin-right: 6px;
}

/* Full write-up & clause scorecard rendered below View D */
.writeup {
  margin-top: 44px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  max-width: 780px;
}

.writeup h2 {
  font-size: 15.5px;
  font-weight: 600;
  font-style: normal;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  margin: 34px 0 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.writeup h2:first-child {
  margin-top: 18px;
  border-top: none;
  padding-top: 0;
}

.writeup h3 {
  font-size: 19px;
  font-style: italic;
  margin: 24px 0 8px;
}

.writeup h2 a.anchor,
.writeup h3 a.anchor {
  opacity: 0;
  border: none;
  text-decoration: none;
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
  margin-left: 6px;
}

.writeup h2:hover a.anchor,
.writeup h3:hover a.anchor,
.writeup h2 a.anchor:focus,
.writeup h3 a.anchor:focus {
  opacity: 1;
}

.writeup p {
  margin: 0 0 14px;
}

.writeup ul {
  margin: 8px 0 16px;
  padding-left: 20px;
}

.writeup li {
  margin: 6px 0;
}

.writeup table {
  width: 100%;
  max-width: 980px;
  border-collapse: collapse;
  margin: 14px 0 24px;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}

.writeup th,
.writeup td {
  text-align: left;
  padding: 7px 12px 7px 0;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.writeup thead th {
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  border-top: 1px solid var(--fg);
  border-bottom: 1px solid var(--fg);
}

.writeup td:nth-child(2) {
  white-space: nowrap;
}

.writeup td:nth-child(3) {
  min-width: 140px;
  max-width: 230px;
}

/* Footer (matches home.css) */
footer {
  clear: both;
  margin-top: 52px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  max-width: 640px;
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 920px) {
  .top-grid {
    grid-template-columns: 1fr;
  }
  aside.radar-box {
    max-width: 340px;
    margin: 0 auto;
  }
}

@media (max-width: 800px) {
  .page {
    padding: 20px 18px 52px;
  }
  .theme-toggle {
    padding-left: 0;
    border-left: none;
  }
  h1 {
    font-size: 1.9rem;
  }
  .cols {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .bell {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .bt {
    margin: 4px 10px;
  }
}
