:root {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f4f7f8;
  color: #14283a;
  color-scheme: light;
  --navy: #122a3c;
  --teal: #075e60;
  --muted: #40576a;
  --line: #ccdade;
  --white: #fff;
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #c47e1b; outline-offset: 3px; }
.wrap { width: min(100%, 70.5rem); margin-inline: auto; padding-inline: 1.25rem; }
.skip, .sr-only { position: absolute; }
.sr-only { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.skip { background: var(--white); padding: .75rem; left: .5rem; top: .5rem; transform: translateY(-170%); }
.skip:focus { transform: none; }
.site-header { background: var(--navy); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 4rem; gap: 1rem; }
.site-header a { color: var(--white); padding-block: .5rem; }
.brand { font-weight: 700; text-decoration: none; }
main { min-height: 70vh; padding-block: clamp(2rem, 5vw, 4rem); }
.intro { max-width: 52rem; margin-bottom: 1.65rem; }
h1 { font-size: clamp(2.12rem, 6vw, 3.7rem); letter-spacing: -.045em; line-height: 1.06; margin: 0; }
.intro p { color: var(--muted); font-size: 1.06rem; margin: .8rem 0 0; }
h2, h3 { line-height: 1.25; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: .75rem; padding: clamp(1rem, 3vw, 1.65rem); }
.workspace-columns { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(15rem, 1fr); grid-template-areas: "results search"; align-items: start; gap: 1rem; }
.search-panel { grid-area: search; }
.results-panel { grid-area: results; }
.search-panel, .results-panel { min-width: 0; }
.search-panel h2, .results-panel > h2 { font-size: 1.25rem; margin: 0 0 .85rem; }
.results-scroll { max-height: min(58vh, 31rem); overflow-y: auto; scrollbar-gutter: stable; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--teal) #e5f0ee; }
.query-label { font-weight: 700; margin-bottom: .45rem; padding: 0; }
.search-panel #query, .search-panel select { width: 100%; margin-bottom: .85rem; }
.search-panel select { min-height: 2.75rem; padding: .55rem; border: 1px solid #79939d; border-radius: .35rem; background: var(--white); color: inherit; }
.query-label { display: block; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: .55rem; }
input[type="search"] { min-width: 0; min-height: 2.85rem; padding: .55rem .75rem; border: 1px solid #79939d; border-radius: .35rem; color: inherit; background: var(--white); }
button { border: 1px solid var(--teal); background: var(--teal); color: var(--white); border-radius: .35rem; min-height: 2.75rem; padding: .55rem .9rem; font-weight: 650; }
button:hover { background: #05494a; }
.secondary, .link-button { color: var(--teal); background: var(--white); }
.secondary:hover, .link-button:hover { background: #e5f0ee; }
.link-button { border-color: transparent; text-decoration: underline; text-underline-offset: .2em; }
.search-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 .6rem; margin-top: .15rem; }
.search-meta p, .source-line, .record-meta, .site-footer, .note { font-size: .9rem; color: var(--muted); }
.search-meta p { margin: .4rem 0; }
.source-line p { margin: .8rem 0 .3rem; }
.source-line .note { margin: 0; }
#feedback:not(:empty) { margin: .55rem 0 .85rem; }
#feedback:empty { margin: 0; }
#retry { margin-bottom: .75rem; }
.records { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: .7rem; }
.records li + li { border-top: 1px solid var(--line); }
.record { display: flex; flex-direction: column; gap: .25rem; width: 100%; text-align: start; color: inherit; background: transparent; border: 0; font-weight: 400; padding: .7rem .85rem; }
.record:hover { background: #edf4f4; }
.record:focus-visible { outline-offset: -4px; }
.record-title { font-weight: 650; overflow-wrap: anywhere; }
.record-meta { display: flex; flex-wrap: wrap; gap: .25rem .55rem; align-items: baseline; }
.code { font-family: ui-monospace, Consolas, monospace; color: #06484a; font-weight: 700; background: #e6f0ef; padding: .1rem .38rem; border-radius: .25rem; }
#more, .detail, .child-list { margin-top: 1rem; }
.detail h2 { margin: .45rem 0 .6rem; font-size: clamp(1.35rem, 4vw, 2rem); overflow-wrap: anywhere; }
.detail p { margin: .45rem 0 .7rem; }
.back { margin: -.3rem 0 .35rem; padding-inline: .3rem; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; gap: .25rem; }
.crumbs li { display: flex; align-items: center; }
.crumbs li + li::before { content: '/'; color: var(--muted); margin-inline: .15rem; }
.crumbs button { text-align: start; padding-inline: .35rem; font-size: .875rem; }
.detail dl { margin: .9rem 0; display: grid; grid-template-columns: auto 1fr; gap: .3rem .7rem; }
.detail dt { font-weight: 650; }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.copy-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.child-list h3 { margin: 0 0 .5rem; }
.site-footer { border-top: 1px solid var(--line); padding-block: .8rem 1.1rem; }
.site-footer p { margin: .4rem 0; }

.map-panel { margin-top: 1.4rem; max-width: 54rem; }
.map-panel > summary { color: var(--teal); cursor: pointer; font-weight: 700; }
.map-panel select { margin-bottom: .9rem; max-width: 100%; min-height: 2.75rem; color: inherit; background: var(--white); border: 1px solid #79939d; border-radius: .35rem; padding: .4rem .6rem; }
#map-feedback:empty { display: none; }
#map-results section + section { margin-top: 1.4rem; }
#map-results h3 { margin: .7rem 0 .35rem; }
.mapping-records li { padding: .7rem .85rem; }
.mapping-records p { margin: .25rem 0; overflow-wrap: anywhere; }
.mapping-records summary { color: var(--teal); cursor: pointer; font-size: .85rem; margin-top: .35rem; }

@media (max-width: 42rem) {
  .workspace-columns { grid-template-columns: minmax(0, 1fr); grid-template-areas: "search" "results"; }
  .results-scroll { max-height: min(53vh, 27rem); }
}

@media (max-width: 30rem) {
  .wrap { padding-inline: 1rem; }
  .search-row { grid-template-columns: 1fr; }
  .search-row button { width: 100%; }
  .search-meta .link-button { padding-inline: 0; }
  .detail dl { grid-template-columns: 1fr; }
  .detail dd { margin-bottom: .4rem; }
}
