:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --surface: #fffefa;
  --ink: #202225;
  --muted: #5f6267;
  --line: #d9d2c5;
  --blue: #315f7b;
  --blue-soft: #e2edf2;
  --gold: #875a10;
  --green: #2b7a57;
  --red: #a93434;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: var(--blue);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(49, 95, 123, 0.32);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 8px;
  left: 8px;
  padding: 9px 12px;
  color: #ffffff;
  background: var(--blue);
  border-radius: 6px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.guide-shell {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto;
  padding: clamp(22px, 5vw, 54px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(32, 34, 37, 0.1);
}

.guide-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 800;
}

.eyeline {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.15;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 6vw, 3.4rem);
}

h2 {
  margin-top: 34px;
  padding-top: 12px;
  border-top: 2px solid var(--blue-soft);
}

h3 {
  margin-top: 24px;
}

p,
li,
td,
th {
  font-size: 0.96rem;
}

.lede {
  color: var(--muted);
  font-size: 1.08rem;
}

.callout {
  margin: 20px 0;
  padding: 14px 16px;
  background: var(--blue-soft);
  border-left: 5px solid var(--blue);
}

.warning {
  background: #f6dddd;
  border-left-color: var(--red);
}

.checklist,
.steps {
  display: grid;
  gap: 8px;
}

table {
  width: 100%;
  margin: 18px 0;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  color: #ffffff;
  background: var(--blue);
}

.compact th,
.compact td {
  padding: 7px;
  font-size: 0.86rem;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card h3 {
  margin-top: 0;
}

.print-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.library-shell {
  width: min(1120px, calc(100% - 32px));
}

.library-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.35fr);
  gap: 8px 14px;
  align-items: end;
  margin: 30px 0;
  padding: 18px;
  background: var(--blue-soft);
  border-radius: 8px;
}

.library-controls h2,
.library-controls .result-count {
  grid-column: 1 / -1;
}

.library-controls h2 {
  margin: 0;
  padding: 0;
  border: 0;
}

.library-controls label {
  font-size: 0.82rem;
  font-weight: 800;
}

.library-controls input,
.library-controls select {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}

.result-count {
  margin: 7px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.guide-results {
  display: grid;
  gap: 18px;
}

.guide-card {
  scroll-margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.guide-card:target {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(49, 95, 123, 0.12);
}

.guide-card h2 {
  margin: 4px 0 9px;
  padding: 0;
  border: 0;
}

.guide-card details {
  margin: 15px 0;
}

.guide-card summary {
  color: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

.permalink {
  font-size: 0.82rem;
  font-weight: 800;
}

.authority-list {
  display: grid;
  gap: 12px;
  padding-left: 20px;
}

.authority-list strong,
.authority-list span,
.authority-list a {
  display: block;
}

.authority-list strong {
  margin-top: 3px;
  font-size: 0.86rem;
}

.authority-list span {
  color: var(--muted);
}

.source-policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.library-footer {
  margin-top: 40px;
  padding-top: 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (max-width: 680px) {
  .two-column {
    grid-template-columns: 1fr;
  }

  .guide-shell {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  table {
    display: block;
    overflow-x: auto;
  }

  .library-controls,
  .source-policy-grid {
    grid-template-columns: 1fr;
  }

  .library-controls h2,
  .library-controls .result-count {
    grid-column: auto;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .guide-shell {
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .guide-nav,
  .print-note {
    display: none;
  }

  h2,
  h3,
  table,
  .callout,
  .card {
    break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
