:root {
  color-scheme: light dark;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --ink: #202122;
  --muted: #54595d;
  --line: #a2a9b1;
  --soft-line: #eaecf0;
  --link: #3366cc;
  --visited: #6b4ba1;
  --header: #f8f9fa;
  --header-bg: rgba(248, 249, 250, 0.96);
  --infobox: #f8f9fa;
  --infobox-title: #dfe8f2;
  --stripe: #fbfbfb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --surface: #171c21;
    --ink: #eaecf0;
    --muted: #a2a9b1;
    --line: #72777d;
    --soft-line: #30363d;
    --link: #8cb4ff;
    --visited: #c8a2ff;
    --header: #171c21;
    --header-bg: rgba(23, 28, 33, 0.96);
    --infobox: #20262d;
    --infobox-title: #273341;
    --stripe: #1d242b;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --ink: #202122;
  --muted: #54595d;
  --line: #a2a9b1;
  --soft-line: #eaecf0;
  --link: #3366cc;
  --visited: #6b4ba1;
  --header: #f8f9fa;
  --header-bg: rgba(248, 249, 250, 0.96);
  --infobox: #f8f9fa;
  --infobox-title: #dfe8f2;
  --stripe: #fbfbfb;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101418;
  --surface: #171c21;
  --ink: #eaecf0;
  --muted: #a2a9b1;
  --line: #72777d;
  --soft-line: #30363d;
  --link: #8cb4ff;
  --visited: #c8a2ff;
  --header: #171c21;
  --header-bg: rgba(23, 28, 33, 0.96);
  --infobox: #20262d;
  --infobox-title: #273341;
  --stripe: #1d242b;
}

* {
  box-sizing: border-box;
}

sein-header,
sein-sidebar {
  display: block;
  min-width: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--link);
  text-decoration: none;
}

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

a:hover {
  text-decoration: underline;
}

a,
dd,
td,
th,
p,
li {
  overflow-wrap: anywhere;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: auto 240px 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 58px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--soft-line);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
}

.sidebar-toggle,
.sidebar-close {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 34px;
  padding: 0;
}

.sidebar-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.sidebar-toggle:hover,
.sidebar-close:hover {
  background: var(--soft-line);
}

.sidebar-toggle:focus-visible,
.sidebar-close:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand:visited {
  color: var(--ink);
}

.brand img {
  width: 34px;
  height: 34px;
}

.sidebar-search {
  display: grid;
  gap: 6px;
}

.sidebar-search label {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-search input {
  width: 100%;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
}

.sidebar-search input:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  font-size: 14px;
}

.language-switch {
  display: inline-flex;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  font-size: 13px;
}

.language-switch a {
  min-width: 38px;
  padding: 5px 9px;
  color: var(--ink);
  text-align: center;
}

.language-switch a + a {
  border-left: 1px solid var(--line);
}

.language-switch a[aria-current="page"] {
  background: var(--soft-line);
  font-weight: 700;
}

.theme-toggle {
  display: inline-flex;
  justify-self: end;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 31px;
  min-width: 86px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.theme-toggle:hover {
  background: var(--soft-line);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

.page {
  display: grid;
  grid-template-columns: 220px minmax(0, 1040px);
  gap: 28px;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.contents {
  position: sticky;
  top: 82px;
  align-self: start;
  max-height: calc(100vh - 104px);
  padding: 14px 0;
  overflow: auto;
  color: var(--muted);
  font-size: 14px;
}

.sidebar-search {
  margin-bottom: 16px;
}

.search-results {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.search-results[hidden] {
  display: none;
}

.search-result {
  display: grid;
  gap: 1px;
  padding: 7px 8px;
  border: 1px solid var(--soft-line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
}

.search-result:visited {
  color: var(--ink);
}

.search-result:hover {
  border-color: var(--line);
  text-decoration: none;
}

.search-result span,
.search-result small,
.search-results p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.contents h2 {
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--soft-line);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 400;
}

.contents ol,
.contents ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 22px;
}

.page-nav {
  display: grid;
  gap: 5px;
}

.page-nav details {
  border-bottom: 1px solid var(--soft-line);
}

.page-nav details:last-child {
  border-bottom: 0;
}

.page-nav summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 2px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  text-transform: uppercase;
}

.page-nav summary::-webkit-details-marker {
  display: none;
}

.page-nav summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 150ms ease;
}

.page-nav details[open] summary::after {
  transform: rotate(225deg);
}

.page-nav summary:hover,
.page-nav summary:focus-visible {
  background: var(--soft-line);
}

.page-nav summary:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

.page-nav ul {
  display: grid;
  gap: 3px;
  padding: 0 0 8px;
  list-style: none;
}

.page-nav li {
  margin: 0;
}

.page-nav a {
  display: block;
  padding: 5px 8px;
  border-radius: 2px;
}

.page-nav .subpage-link {
  padding-left: 18px;
}

.page-nav a[aria-current="page"] {
  background: var(--soft-line);
  color: var(--ink);
  font-weight: 700;
}

.sidebar-note {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 10px;
  border-top: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.sidebar-note strong {
  color: var(--ink);
}

.sidebar-note p {
  margin: 0;
}

.article {
  min-width: 0;
  padding: 0 0 48px;
  background: var(--surface);
}

.article article {
  min-height: calc(100vh - 106px);
  padding: 24px 32px 42px;
  border-left: 1px solid var(--soft-line);
  border-right: 1px solid var(--soft-line);
}

.article-header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.namespace {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 34px;
}

h2 {
  margin: 28px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-size: 24px;
}

h3 {
  margin: 0;
  font-size: 17px;
}

.subtitle {
  max-width: 760px;
  margin-bottom: 8px;
  color: var(--muted);
}

.revision-meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.infobox {
  float: right;
  width: 310px;
  margin: 4px 0 18px 28px;
  border: 1px solid var(--line);
  background: var(--infobox);
  font-size: 13px;
}

.infobox h2 {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--infobox-title);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.infobox dl {
  margin: 0;
}

.infobox div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  border-top: 1px solid var(--soft-line);
}

.infobox div:first-child {
  border-top: 0;
}

.infobox dt,
.infobox dd {
  margin: 0;
  padding: 7px 8px;
}

.infobox dt {
  font-weight: 700;
}

.fact-table,
.directory-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 18px;
  font-size: 14px;
}

.fact-table th,
.fact-table td,
.directory-table th,
.directory-table td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.fact-table th,
.directory-table th {
  background: var(--header);
  font-weight: 700;
  text-align: left;
}

.directory-table tbody tr:nth-child(even) {
  background: var(--stripe);
}

.org-address {
  color: var(--muted);
  display: block;
  font-size: 0.86rem;
  line-height: 1.35;
  margin-top: 0.25rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.section-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.section-title-row h2 {
  margin-bottom: 0;
  border-bottom: 0;
}

#resultCount {
  padding-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.audience-badge,
.official-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--header);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.empty-row td {
  color: var(--muted);
  font-style: italic;
}

.references {
  padding-left: 24px;
  font-size: 14px;
}

.references li {
  margin-bottom: 7px;
}

.article-list {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding-left: 22px;
}

.article-list li {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--soft-line);
}

.article-list a {
  display: block;
  font-weight: 700;
}

.article-list span {
  display: block;
  color: var(--muted);
}

.legal-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}

.legal-list div {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--soft-line);
}

.legal-list dt {
  font-weight: 700;
}

.legal-list dd {
  margin: 0;
}

.map-shell {
  position: relative;
  min-height: 430px;
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  background: var(--infobox);
  overflow: hidden;
}

.map-shell iframe,
.leaflet-map {
  width: 100%;
  min-height: 430px;
  border: 0;
}

.leaflet-map {
  background: var(--surface);
  z-index: 0;
}

.map-fallback {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 8px 10px 10px;
}

.organization-map-marker {
  align-items: center;
  background: #3366cc;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  color: #fff;
  display: flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
}

.organization-map-popup {
  display: grid;
  gap: 4px;
}

.organization-map-popup span,
.organization-map-popup small {
  color: #4b5563;
}

.density-placeholder {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  border-left: 4px solid var(--line);
  background: var(--infobox);
}

.density-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.density-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.density-swatch {
  width: 16px;
  height: 16px;
  border-radius: 999px;
}

.density-swatch.low {
  background: rgba(51, 102, 204, 0.25);
}

.density-swatch.medium {
  background: rgba(255, 193, 7, 0.45);
}

.density-swatch.high {
  background: rgba(204, 51, 51, 0.55);
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .page {
    display: block;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .language-switch,
  .theme-toggle {
    justify-self: end;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .contents {
    position: fixed;
    z-index: 30;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(340px, calc(100vw - 44px));
    max-height: none;
    padding: 54px 14px 18px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-open .contents {
    transform: translateX(0);
  }

  .sidebar-open body {
    overflow: hidden;
  }

  .sidebar-open::before {
    content: "";
    position: fixed;
    z-index: 20;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
  }

  .article article {
    border: 1px solid var(--soft-line);
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .site-header {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 8px;
    min-height: 54px;
    padding: 8px 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand img {
    width: 30px;
    height: 30px;
  }

  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .language-switch,
  .theme-toggle {
    justify-self: end;
  }

  .theme-toggle {
    min-height: 34px;
    padding: 4px 7px;
  }

  .language-switch a {
    min-width: 34px;
    padding: 4px 7px;
  }

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

  .contents {
    padding: 54px 12px 18px;
  }

  .sidebar-search input {
    min-height: 40px;
  }

  .page-nav summary {
    min-height: 40px;
  }

  .page-nav a {
    padding: 8px;
  }

  .article article {
    min-height: auto;
    padding: 18px 16px 28px;
  }

  .infobox {
    float: none;
    width: 100%;
    margin: 16px 0;
  }

  .infobox div {
    grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
  }

  .fact-table,
  .directory-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fact-table th,
  .fact-table td,
  .directory-table th,
  .directory-table td {
    min-width: 140px;
  }

  .section-title-row {
    display: grid;
    align-items: start;
    gap: 4px;
  }

  #resultCount {
    padding-bottom: 0;
  }

  .legal-list div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .map-shell,
  .map-shell iframe {
    min-height: 360px;
  }

  h1 {
    font-size: 30px;
  }
}

@media (max-width: 460px) {
  .site-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .theme-toggle {
    grid-column: 2 / 3;
    grid-row: 2;
    justify-self: start;
  }

  .language-switch {
    grid-column: 3 / 4;
    grid-row: 2;
  }

  .article article {
    padding: 16px 12px 24px;
  }

  .infobox div {
    grid-template-columns: 1fr;
  }

  .infobox dt {
    padding-bottom: 2px;
  }

  .infobox dd {
    padding-top: 2px;
  }

  h1 {
    font-size: 26px;
  }
}
