* {
  box-sizing: border-box;
}

:root {
  --navy-950: #0f2242;
  --navy-900: #16305c;
  --navy-800: #23416f;
  --gold-500: #d4af5a;
  --gold-400: #e3c77b;
  --gold-200: #f5e8c5;
  --paper: #f7f0dc;
  --paper-strong: #fbf6e8;
  --ink: #132033;
  --muted: #4f5c73;
  --border: #c9b37a;
  --focus: #2f6fe4;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, var(--gold-500) 0, var(--gold-500) 20px, var(--paper) 20px, var(--paper) 100%);
  font: 15px/1.5 Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

a {
  color: var(--navy-900);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  z-index: 10;
  padding: 6px 10px;
  background: var(--paper-strong);
  border: 1px solid var(--navy-900);
  color: var(--ink);
  text-decoration: none;
}

.skip-link:focus {
  top: 8px;
}

.page {
  width: 100%;
  max-width: 1280px;
  margin: 0;
  padding: 12px 18px 40px 42px;
  background: transparent;
  min-height: 100vh;
  border-top: 0;
  border-left: 0;
  box-shadow: none;
}

.site-header {
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: 0;
}

.site-copy,
.source-line,
.group-note,
.meta-line,
.note-line {
  margin: 0 0 8px;
}

.location-line {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: inherit;
}

.location-label {
  font-weight: 700;
  color: var(--navy-900);
  margin-right: 6px;
  text-transform: none;
  letter-spacing: normal;
}

.location-citation {
  display: inline-block;
  margin-left: 8px;
  color: var(--navy-900);
  text-decoration: underline;
}

.search-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  margin-right: 12px;
}

.search-field input {
  width: 260px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  background: var(--paper-strong);
  color: var(--ink);
  font: inherit;
}

.index-link {
  display: inline;
}

.index-link:hover,
.index-link.active {
  color: var(--gold-500);
}

.toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 2px 0;
}

.toolbar button {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid rgba(15, 34, 66, 0.22);
  background: linear-gradient(180deg, var(--paper-strong), #f4ecd6);
  color: var(--navy-900);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.toolbar button:hover {
  border-color: rgba(15, 34, 66, 0.36);
  background: linear-gradient(180deg, #fff8e8, #eedcae);
  color: var(--navy-950);
}

.toolbar button:active {
  background: linear-gradient(180deg, #ead9ab, #f6edd6);
  box-shadow: inset 0 1px 2px rgba(15, 34, 66, 0.12);
}

.site-header h1,
.browse-panel h2,
.browse-panel h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: normal;
}

.browse-panel {
  margin: 12px 0 24px;
}

.root-tree,
.tree-list {
  margin: 0;
  padding-left: 18px;
}

.tree-list li {
  margin: 3px 0;
}

.tree-node {
  margin: 0;
}

.tree-node summary {
  list-style: none;
  cursor: pointer;
  line-height: 1.4;
}

.tree-node summary::-webkit-details-marker {
  display: none;
}

.tree-node summary::before {
  content: "+";
  display: inline-flex;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold-500);
  background: var(--paper-strong);
  color: var(--navy-900);
  font-size: 12px;
  line-height: 1;
  vertical-align: text-top;
}

.tree-node[open] > summary::before {
  content: "−";
}

.summary-link {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.summary-link .index-link {
  overflow-wrap: anywhere;
}

.is-active-link {
  color: var(--navy-950);
  background: var(--gold-200);
  text-decoration: none;
}

.is-active-node > summary {
  background: rgba(212, 175, 90, 0.16);
}

.entry-body {
  margin: 4px 0 8px 22px;
  max-width: 1020px;
  overflow-wrap: anywhere;
}

.entry-body p {
  margin: 0 0 8px;
}

.range-note {
  color: var(--muted);
  margin-left: 8px;
}

.meta-line,
.group-note {
  color: var(--muted);
}

.no-results {
  margin-top: 10px;
  color: var(--navy-900);
  font-weight: 700;
}

.site-footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(109, 35, 23, 0.18);
  color: #444;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (max-width: 640px) {
  body {
    background:
      linear-gradient(90deg, var(--gold-500) 0, var(--gold-500) 10px, var(--paper) 10px, var(--paper) 100%);
    font-size: 16px;
    line-height: 1.55;
  }

  .page {
    padding: 12px 12px 30px 16px;
  }

  .site-header h1,
  .browse-panel h2 {
    margin-bottom: 8px;
    line-height: 1.25;
  }

  .site-header h1 {
    font-size: 17px;
    overflow-wrap: anywhere;
  }

  .site-copy,
  .location-line,
  .source-line,
  .group-note,
  .meta-line,
  .note-line,
  .site-footer {
    font-size: 14px;
  }

  .location-citation {
    display: block;
    margin-top: 3px;
    margin-left: 0;
    word-break: break-word;
  }

  .search-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-right: 0;
  }

  .search-field input {
    width: 100%;
    margin-top: 0;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 16px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    margin-top: 10px;
    gap: 8px;
  }

  .toolbar button {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    text-align: center;
    font-size: 15px;
  }

  .root-tree,
  .tree-list {
    padding-left: 10px;
  }

  .tree-list li {
    margin: 6px 0;
  }

  .tree-node summary {
    padding: 1px 0;
  }

  .tree-node summary::before {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    font-size: 13px;
    vertical-align: top;
  }

  .summary-link {
    display: inline-block;
    max-width: calc(100% - 24px);
    vertical-align: top;
  }

  .range-note {
    display: block;
    margin-top: 2px;
    margin-left: 21px;
    font-size: 13px;
  }

  .entry-body {
    margin: 6px 0 10px 21px;
    max-width: none;
  }

  .entry-body p {
    margin-bottom: 10px;
  }

  .source-line a {
    display: inline-block;
    margin-bottom: 4px;
  }

}

@media (max-width: 420px) {
  .page {
    padding-right: 10px;
  }

  .site-header h1 {
    font-size: 16px;
  }

  .location-line {
    margin-bottom: 10px;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .page {
    padding: 0;
  }

  .skip-link,
  .toolbar,
  .search-field,
  .location-line {
    display: none;
  }

  .tree-node {
    display: block;
  }

  .tree-node > summary::before {
    display: none;
  }

  .tree-node .entry-body,
  .tree-node[open] .entry-body {
    display: block;
  }

  .tree-node {
    break-inside: avoid;
  }
}
