/* Cubeframe governing documents — system fonts only, no downloads. */
:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", P052, Georgia, Cambria, "Times New Roman", serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --ink: #1c2230;
  --ink-2: #4a5263;
  --ink-3: #6b7282;
  --rule: #ddd8cc;
  --accent: #1f3a5f;
  --accent-2: #2c5282;
  --accent-soft: #e6ecf4;
  --link: #22508a;
  --mark: #fde9a6;
  --focus: #2c6fd1;

  --t1-bg: #eef0f3; --t1-fg: #3d4656;
  --t2-bg: #e3edf9; --t2-fg: #1d4f8c;
  --t3-bg: #fbf0d6; --t3-fg: #7a5200;
  --t4-bg: #fde4d6; --t4-fg: #9a3b0c;
  --t5-bg: #f9dcdc; --t5-fg: #9b1c1c;
  --prot-bg: #e7efe7; --prot-fg: #285c2e;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 28, 45, .06), 0 4px 16px rgba(20, 28, 45, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d; --surface: #181d26; --surface-2: #1f2530;
    --ink: #e7e9ee; --ink-2: #b4bac6; --ink-3: #8e95a3; --rule: #2c3340;
    --accent: #9cc0ec; --accent-2: #b8d2f2; --accent-soft: #1e2a3b; --link: #8fbaf0;
    --mark: #5a4a14; --focus: #7fb0f5;
    --t1-bg: #262c37; --t1-fg: #c3c9d4; --t2-bg: #1c2d45; --t2-fg: #9cc4f3;
    --t3-bg: #3a2f13; --t3-fg: #f0c766; --t4-bg: #3f2416; --t4-fg: #f6a77a;
    --t5-bg: #431e1e; --t5-fg: #f49b9b; --prot-bg: #1d3221; --prot-fg: #9fd3a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  --bg: #12161d; --surface: #181d26; --surface-2: #1f2530;
  --ink: #e7e9ee; --ink-2: #b4bac6; --ink-3: #8e95a3; --rule: #2c3340;
  --accent: #9cc0ec; --accent-2: #b8d2f2; --accent-soft: #1e2a3b; --link: #8fbaf0;
  --mark: #5a4a14; --focus: #7fb0f5;
  --t1-bg: #262c37; --t1-fg: #c3c9d4; --t2-bg: #1c2d45; --t2-fg: #9cc4f3;
  --t3-bg: #3a2f13; --t3-fg: #f0c766; --t4-bg: #3f2416; --t4-fg: #f6a77a;
  --t5-bg: #431e1e; --t5-fg: #f49b9b; --prot-bg: #1d3221; --prot-fg: #9fd3a5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--serif); font-size: 18px; line-height: 1.62;
  text-rendering: optimizeLegibility; overflow-x: hidden;
}
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; font-family: var(--sans); }
.skip:focus { left: 8px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--rule); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; gap: 16px; font-family: var(--sans); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.mark { width: 22px; height: 22px; border-radius: 5px; border: 2px solid var(--accent); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; inset: 4px; border-radius: 2px; background: var(--accent); }
.mainnav { display: flex; gap: 4px; margin-left: auto; }
.mainnav a { color: var(--ink-2); text-decoration: none; font-size: 15px; padding: 7px 12px; border-radius: 8px; white-space: nowrap; }
.mainnav a:hover { background: var(--surface-2); color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.theme { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); cursor: pointer; display: grid; place-items: center; flex: none; }
.theme span { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); border: 1.5px solid var(--ink); }

/* Layout */
.layout { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 48px; }
.sidebar { position: relative; }
.sidebar-inner { position: sticky; top: 60px; max-height: calc(100vh - 60px); overflow-y: auto; padding: 28px 4px 40px 0; font-family: var(--sans); scrollbar-width: thin; }
.search input { width: 100%; font: 15px var(--sans); padding: 9px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search-status { min-height: 1.2em; margin: 6px 2px 10px; font-size: 13px; color: var(--ink-3); }
.toc-list, .toc-kids { list-style: none; margin: 0; padding: 0; }
.toc-list > li { margin: 1px 0; }
.toc a { display: flex; gap: 8px; align-items: baseline; padding: 5px 8px; border-radius: 7px; color: var(--ink-2); text-decoration: none; font-size: 14px; line-height: 1.35; }
.toc a:hover { background: var(--surface-2); color: var(--ink); }
.toc a.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tnum { flex: none; min-width: 2.4em; color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.toc a.current .tnum { color: inherit; }
.toc-kids { margin: 0 0 4px 14px; border-left: 1px solid var(--rule); padding-left: 6px; }
.toc-kids a { font-size: 13px; padding: 3px 8px; }
.toc-kids .tnum { min-width: 1.8em; }

/* Document */
.doc { min-width: 0; max-width: 46rem; padding: 40px 0 80px; }
.doc-head { padding-bottom: 28px; margin-bottom: 8px; border-bottom: 2px solid var(--accent); }
.eyebrow { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 8px; }
h1 { font-family: var(--serif); font-size: clamp(34px, 5vw, 48px); line-height: 1.08; margin: 0; color: var(--ink); letter-spacing: -.01em; font-weight: 700; }
.subtitle { font-family: var(--sans); color: var(--ink-3); margin: 12px 0 0; font-size: 15px; }
.toc-toggle { display: none; }
.mobile-toc { display: none; }

.article { padding-top: 12px; }
h2 { font-family: var(--sans); font-size: 24px; line-height: 1.25; margin: 44px 0 18px; color: var(--accent); font-weight: 650; letter-spacing: -.01em; position: relative; }
h2 .num { font-weight: 800; }
h2 .dot, h3 .dot { margin: 0 .45em; color: var(--ink-3); font-weight: 400; }
h3 { font-family: var(--sans); font-size: 18px; margin: 34px 0 12px; color: var(--ink); font-weight: 650; position: relative; }
h3 .num { color: var(--accent); }
.anchor { position: absolute; left: -1.1em; width: 1em; text-align: center; color: var(--ink-3); text-decoration: none; opacity: 0; font-weight: 400; transition: opacity .15s; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }

.sec { margin: 0 0 14px; padding: 2px 0; border-radius: 8px; }
.sec:target { background: var(--accent-soft); box-shadow: 0 0 0 8px var(--accent-soft); }
.sec-head { margin: 0; font-family: var(--sans); font-size: 15.5px; line-height: 1.5; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.sec-head + .sec-body { margin-top: 2px; }
.label { font-weight: 700; color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.label:hover { color: var(--accent); text-decoration: underline; }
.stitle { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--ink-2); }
.sec-body { margin: 0 0 6px; }
.sec-inline { margin: 0 0 6px; }
.sec-inline .label { font-family: var(--sans); font-size: 15.5px; margin-right: .35em; }
.sec-head:only-child, .sec > .sec-head:last-child { margin-bottom: 6px; }
.offense .sec-head { padding-top: 4px; }
.item { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); gap: 0 6px; margin: 6px 0 6px 1.2em; }
.ilabel { font-family: var(--sans); font-weight: 700; font-size: 15px; color: var(--ink-2); padding-top: .12em; }
.note { margin: 10px 0 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; font-size: 17px; }
.ntitle { font-family: var(--sans); font-weight: 650; font-size: 14.5px; color: var(--accent); margin-right: 2px; }
.extra { margin: 6px 0 10px; }
.lede { font-style: italic; color: var(--ink-2); font-size: 19px; margin: 0 0 12px; }
a.ref { color: var(--link); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-underline-offset: 2px; white-space: nowrap; }
a.ref:hover { text-decoration-color: currentColor; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

.tier { display: inline-block; font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .02em; padding: 2px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.6; }
.t1 { background: var(--t1-bg); color: var(--t1-fg); } .t2 { background: var(--t2-bg); color: var(--t2-fg); }
.t3 { background: var(--t3-bg); color: var(--t3-fg); } .t4 { background: var(--t4-bg); color: var(--t4-fg); }
.t5 { background: var(--t5-bg); color: var(--t5-fg); }
.prot { display: inline-block; font-family: var(--sans); font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--prot-bg); color: var(--prot-fg); }

.table-wrap { margin: 14px 0 22px; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 14.5px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: middle; }
thead th { background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
table.ladder td, table.ladder thead th:not(:first-child) { text-align: center; white-space: nowrap; }
td.muted { color: var(--ink-3); }
td.code { font-variant-numeric: tabular-nums; font-weight: 650; }
table.index td:nth-child(3), table.index td:nth-child(4), table.index th:nth-child(3), table.index th:nth-child(4) { text-align: center; }

.no-results { font-family: var(--sans); color: var(--ink-3); padding: 24px 0; }
.doc-foot { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 12px; font-family: var(--sans); font-size: 14px; color: var(--ink-3); }
.doc-foot a { color: var(--ink-2); }
.hidden-by-filter { display: none !important; }

/* Landing */
.landing { max-width: 1040px; margin: 0 auto; padding: 72px 16px 96px; }
.landing-head { max-width: 44rem; }
.landing h1 { font-size: clamp(38px, 6vw, 60px); }
.lede-big { font-size: 21px; color: var(--ink-2); margin: 18px 0 0; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 48px; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 28px; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card-kicker { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }
.card-title { font-size: 30px; font-weight: 700; line-height: 1.15; }
.card-text { color: var(--ink-2); font-size: 17px; }
.card-cta { margin-top: auto; padding-top: 8px; font-family: var(--sans); font-weight: 600; font-size: 15px; color: var(--accent); }

/* Narrow screens */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar { position: sticky; top: 60px; z-index: 10; background: var(--bg); margin: 0 -16px; padding: 10px 16px; border-bottom: 1px solid var(--rule); }
  .sidebar-inner { position: static; max-height: none; overflow: visible; padding: 0; }
  .sidebar .toc { display: none; }
  .search-status { margin: 4px 2px 0; min-height: 0; }
  .search-status:empty { display: none; }
  html { scroll-padding-top: 130px; }
  .doc { padding-top: 24px; }
  .toc-toggle { display: inline-flex; margin-top: 18px; font: 600 14px var(--sans); color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; }
  .mobile-toc:not([hidden]) { display: block; margin-top: 12px; padding: 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); font-family: var(--sans); }
  .anchor { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .topbar-inner { gap: 8px; }
  .brand { font-size: 0; gap: 0; }
  .mainnav a { padding: 7px 9px; font-size: 14px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .landing { padding-top: 44px; }
  .item { margin-left: .2em; }
  h2 { font-size: 21px; }
}

@media print {
  .topbar, .sidebar, .toc-toggle, .mobile-toc, .doc-foot, .skip, .anchor { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .layout { display: block; padding: 0; }
  .doc { max-width: none; padding: 0; }
  a.ref { color: inherit; text-decoration: none; }
  .table-wrap { box-shadow: none; }
  .sec { break-inside: avoid; }
}
