:root {
  --ink: #172725;
  --ink-soft: #314340;
  --paper: #f3efe7;
  --paper-deep: #e7e0d3;
  --white: #fffdf8;
  --coral: #e16b55;
  --greek-blue: #0d5eaf;
  --line: rgba(23, 39, 37, 0.17);
  --panel-width: 410px;
  --header-height: 58px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  overflow: hidden;
}
button, input { font: inherit; }
button { color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 9999; padding: 10px 14px; background: var(--white); color: var(--ink); }
.skip-link:focus { top: 12px; }

.site-header {
  height: var(--header-height); display: flex; align-items: center;
  gap: 18px; padding: 0 26px; background: var(--greek-blue); color: var(--paper); border-bottom: 1px solid rgba(255,255,255,.13); position: relative; z-index: 1002;
}
.brand { min-width: 0; display: inline-flex; flex: 1; align-items: center; gap: 11px; color: inherit; }
.brand-mark { display: grid; place-items: center; min-width: 56px; height: 30px; padding: 0 7px; border: 1px solid rgba(255,255,255,.55); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.brand-home-button { background: transparent; color: inherit; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.brand-home-button:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.8); }
.brand-name { margin: 0; font-family: "Gloock", serif; font-size: 25px; font-weight: 400; letter-spacing: -.02em; white-space: nowrap; }
.map-option-control { align-self: stretch; display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 0 14px; border-left: 1px solid rgba(255,255,255,.2); color: rgba(255,253,248,.72); font-size: 8px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.map-option-control select { min-width: 104px; border: 1px solid rgba(255,255,255,.38); border-radius: 0; padding: 6px 24px 6px 8px; background: rgba(23,39,37,.16); color: var(--white); outline: 0; cursor: pointer; font-size: 9px; letter-spacing: 0; text-transform: none; }
.map-option-control select:hover { border-color: rgba(255,255,255,.75); background: rgba(23,39,37,.24); }
.map-option-control select:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.map-option-control option { background: var(--paper); color: var(--ink); }
.language-options { align-self: stretch; display: flex; border-right: 1px solid rgba(255,255,255,.2); border-left: 1px solid rgba(255,255,255,.2); }
.language-button { position: relative; border: 0; border-left: 1px solid rgba(255,255,255,.14); padding: 0 17px; background: transparent; color: rgba(255,253,248,.72); cursor: pointer; font-size: 9px; font-weight: 500; transition: background .18s ease, color .18s ease; }
.language-button:first-child { border-left: 0; }
.language-button:hover { background: rgba(255,255,255,.1); color: var(--white); }
.language-button.is-active { background: rgba(23,39,37,.22); color: var(--white); }
.language-button.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 7px; height: 2px; background: var(--coral); }

.atlas { height: calc(100vh - var(--header-height)); height: calc(100dvh - var(--header-height)); min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-width); overflow: hidden; }
.atlas.is-archive-collapsed { grid-template-columns: minmax(0, 1fr) 0; }
.map-stage { position: relative; min-width: 0; background: #d6e7cf; overflow: hidden; }
#map { position: absolute; inset: 0; z-index: 1; background: #d6e7cf; }
.map-wash { position: absolute; inset: 0; z-index: 2; pointer-events: none; box-shadow: inset 0 0 100px rgba(14, 35, 31, .17); mix-blend-mode: multiply; }
.maplibregl-map { font-family: "DM Sans", sans-serif; }
.maplibregl-ctrl-attrib { margin-bottom: 0 !important; background: rgba(243,239,231,.82) !important; color: #53635f !important; font-size: 9px !important; }
.maplibregl-ctrl-attrib a { color: #314d47 !important; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { border: 0 !important; box-shadow: 0 4px 18px rgba(23,39,37,.14) !important; margin: 0 22px 25px 0 !important; }
.maplibregl-ctrl-group button { width: 38px !important; height: 38px !important; border: 0 !important; background-color: var(--paper) !important; color: var(--ink) !important; }
.village-info-popup { position: absolute; z-index: 15; inset: 18px 40px 18px 18px; display: flex; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid rgba(23,39,37,.28); background: var(--paper); box-shadow: 0 18px 55px rgba(23,39,37,.3); }
.village-info-popup[hidden] { display: none; }
.village-info-close { position: absolute; z-index: 1; top: 18px; right: 18px; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); padding: 0 0 2px; background: var(--paper); color: var(--ink); font-size: 25px; font-weight: 400; line-height: 1; cursor: pointer; transition: background .16s ease, color .16s ease, border-color .16s ease; }
.village-info-close:hover { border-color: var(--ink); background: var(--ink); color: var(--white); }
.village-info-scroll { width: 100%; overflow-y: auto; padding: clamp(42px, 7vw, 88px) clamp(40px, 9vw, 120px) 72px; scrollbar-color: #a9b0ab transparent; scrollbar-width: thin; }
.village-info-popup h2 { max-width: 760px; margin: 0; padding-right: 38px; font: 400 clamp(34px, 5vw, 66px)/1.02 "Gloock", serif; letter-spacing: -.025em; }
.village-info-location { margin: 14px 0 42px; color: #74817c; font-size: 10px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
.village-info-copy { max-width: 760px; color: var(--ink-soft); font-size: 16px; line-height: 1.8; }

button:focus-visible, input:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.village-icon { width: 18px; height: 18px; overflow: visible !important; border: 0; padding: 0; background: transparent; cursor: pointer; }
.village-marker-shell { position: relative; display: block; width: 18px; height: 18px; }
.village-marker-scale { position: absolute; inset: 0; transform: scale(var(--marker-scale, .5)); transform-origin: center; transition: transform .18s ease; }
.village-marker { --marker-display-color: #000; position: relative; display: block; flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; background: var(--marker-display-color); border: 1px solid rgba(255,253,248,.95); box-shadow: 0 1px 4px rgba(21,39,37,.3); transform: scale(.68); transition: transform .22s cubic-bezier(.2,.8,.2,1), background .18s ease, box-shadow .18s ease; }
.village-marker::after { content: ""; position: absolute; inset: -3px; border: .5px solid var(--marker-display-color); border-radius: 50%; opacity: 0; transform: scale(.5); transition: .2s ease; }
.village-marker.is-region-highlighted { --marker-display-color: var(--marker-color); transform: scale(1.35); }
.village-marker:hover:not(.is-hover-suppressed), .village-marker.is-active { --marker-display-color: var(--marker-color); transform: scale(1.55); box-shadow: 0 1.5px 6px rgba(21,39,37,.4); }
.village-marker:hover:not(.is-hover-suppressed)::after, .village-marker.is-active::after { opacity: .65; transform: scale(1); }
.village-map-label { position: absolute; z-index: 1; left: 50%; top: 22px; width: max-content; transform: translateX(-50%); color: #75847f; font: 500 16px/1 "DM Sans", sans-serif; text-align: center; white-space: nowrap; opacity: 0; pointer-events: none; paint-order: stroke fill; -webkit-text-stroke: 2.6px #edf2ec; text-shadow: 0 0 1px #edf2ec; transition: opacity .12s ease; }
.village-map-label.is-collision-free,
.village-icon:hover .village-map-label,
.village-icon:focus .village-map-label,
.village-icon:focus-visible .village-map-label { opacity: 1; }
.archive-panel { height: 100%; min-width: 0; min-height: 0; overflow: hidden; background: var(--paper); border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20; }
.panel-header { display: none; align-items: start; justify-content: space-between; padding: 28px 28px 20px; }
.archive-panel.has-panel-title .panel-header { display: flex; }
.panel-header h2 { margin: 0; font: 400 28px/1.1 "Gloock", serif; }
.panel-close { display: none; border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; }
.search-wrap { margin: 0 28px 10px; position: relative; }
.archive-panel:not(.has-panel-title) .search-wrap { margin-top: 28px; }
.search-wrap svg { position: absolute; left: 13px; top: 50%; width: 15px; transform: translateY(-50%); fill: none; stroke: #687671; stroke-width: 1.5; }
.search-wrap input { width: 100%; border: 1px solid var(--line); border-radius: 0; padding: 12px 14px 12px 38px; color: var(--ink); background: rgba(255,255,255,.3); outline: 0; font-size: 12px; }
.search-wrap input::placeholder { color: #8a938f; }
.panel-actions { display: flex; margin: 0 28px 18px; }
.deselect-all { width: 100%; border: 1px solid var(--line); padding: 8px 10px 7px; background: rgba(255,255,255,.22); color: #65736e; font-size: 9px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.deselect-all:hover { border-color: var(--ink); background: var(--ink); color: var(--white); }
.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 28px 32px; scrollbar-color: #a9b0ab transparent; scrollbar-width: thin; }
.archive-tree { border-top: 1px solid var(--line); }
.tree-region { border-bottom: 1px solid var(--line); }
.tree-summary { display: grid; align-items: center; width: 100%; list-style: none; cursor: pointer; user-select: none; }
.tree-summary::-webkit-details-marker { display: none; }
.tree-region-summary { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 7px; min-height: 52px; padding: 12px 3px 12px 0; font: 500 18px/1 "DM Sans", sans-serif; }
.tree-subregion-summary { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 7px; min-height: 43px; padding: 9px 3px 9px 18px; border-top: 1px solid rgba(23,39,37,.1); color: #44534f; font: 500 18px/1 "DM Sans", sans-serif; }
.tree-summary:hover { background: rgba(255,255,255,.32); }
.tree-summary:focus-visible { outline: 2px solid var(--coral); outline-offset: -2px; }
.tree-chevron { color: #71807a; font-size: 33px; font-weight: 600; line-height: 1; transform-origin: center; transition: transform .16s ease; }
details[open] > .tree-summary .tree-chevron { transform: rotate(90deg); }
.tree-label { min-width: 0; overflow-wrap: anywhere; }
.tree-label, .village-name { margin-inline: -6px; padding-inline: 6px; cursor: text; -webkit-user-select: text; user-select: text; }
.tree-region-children { padding-bottom: 5px; }
.tree-region-villages { margin-left: 16px; border-left: 1px solid rgba(23,39,37,.12); }
.tree-region-villages .tree-village { width: calc(100% - 12px); margin-left: 12px; }
.tree-villages { margin-left: 34px; border-left: 1px solid rgba(23,39,37,.12); }
.tree-village { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; width: calc(100% - 18px); margin-left: 18px; border-top: 1px solid rgba(23,39,37,.1); }
.tree-villages .tree-village { width: calc(100% - 12px); margin-left: 12px; }
.tree-village::before { content: ""; position: absolute; left: -19px; top: 7px; bottom: 7px; width: 2px; background: var(--region-color); opacity: 0; transition: opacity .16s ease; }
.tree-village:hover::before, .tree-village.is-selected::before { opacity: 1; }
.tree-village-open { min-width: 0; min-height: 44px; display: grid; grid-template-columns: 11px minmax(0, 1fr); align-items: center; gap: 7px; border: 0; padding: 7px; background: transparent; text-align: left; cursor: pointer; }
.tree-village-open:hover, .tree-village.is-selected .tree-village-open { background: rgba(255,255,255,.32); }
.tree-village-dot { width: 10.5px; height: 10.5px; border: 1px solid rgba(255,253,248,.95); border-radius: 50%; background: var(--region-color); box-shadow: 0 1px 4px rgba(21,39,37,.3); }
.village-name { min-width: 0; font: 500 18px/1 "DM Sans", sans-serif; overflow-wrap: anywhere; }
.tree-actions { align-self: center; justify-self: end; display: flex; gap: 4px; margin-right: 3px; }
.tree-zoom, .tree-copy { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid rgba(23,39,37,.28); padding: 1px; background: transparent; color: #63716c; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.tree-zoom { cursor: zoom-in; }
.tree-copy { position: relative; cursor: copy; font: 18px/1 "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif; }
.tree-copy::after { content: attr(data-copied-label); position: absolute; z-index: 5; top: 50%; right: calc(100% + 7px); visibility: hidden; padding: 5px 7px; background: var(--ink); color: var(--white); font: 600 9px/1 "DM Sans", sans-serif; letter-spacing: .03em; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(4px, -50%); transition: opacity .14s ease, transform .14s ease, visibility 0s linear .14s; }
.tree-copy.is-copied::after { visibility: visible; opacity: 1; transform: translate(0, -50%); transition-delay: 0s; }
.tree-zoom:hover, .tree-copy:hover, .tree-copy.is-copied { border-color: var(--ink); background: var(--ink); color: var(--white); }
.tree-zoom-icon { display: block; width: 21px; height: 21px; background: currentColor; -webkit-mask: url("./assets/map-pin.svg") center / contain no-repeat; mask: url("./assets/map-pin.svg") center / contain no-repeat; }
.tree-empty { margin: 0; padding: 12px 0 14px 34px; color: #7a8782; font-size: 10px; }
.empty-state { padding: 40px 0; color: #74807b; text-align: center; font-size: 12px; }
.loading-state { padding: 40px 0; color: #74807b; text-align: center; font-size: 12px; }
.content-error { margin-top: 18px; padding: 18px; border: 1px solid rgba(165,51,39,.34); background: rgba(225,107,85,.09); color: #49312c; font-size: 12px; line-height: 1.55; }
.content-error p { margin: 0 0 12px; }
.content-error p:last-child { margin-bottom: 0; }
.content-error-label { color: #9e392c; font-size: 9px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.content-error pre { margin: 12px 0; padding: 10px; overflow-x: auto; background: rgba(255,255,255,.48); white-space: pre-wrap; overflow-wrap: anywhere; }

.detail-copy { color: #53635e; font-size: 13px; line-height: 1.75; }
.detail-copy > :first-child { margin-top: 0; }
.detail-copy > :last-child { margin-bottom: 0; }
.detail-copy p, .detail-copy ul, .detail-copy ol, .detail-copy blockquote { margin: 0 0 1em; }
.detail-copy ul, .detail-copy ol { padding-left: 20px; }
.detail-copy h1, .detail-copy h2, .detail-copy h3, .detail-copy h4 { margin: 1.4em 0 .45em; font: 400 18px/1.25 "Gloock", serif; }
.detail-copy a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.detail-copy blockquote { padding-left: 13px; border-left: 2px solid var(--line); }
.mobile-archive-button { display: none; }
.desktop-archive-toggle { position: absolute; z-index: 12; top: 20px; right: 0; display: grid; place-items: center; width: 32px; height: 52px; border: 1px solid var(--line); border-right: 0; background: rgba(243,239,231,.94); color: var(--ink); box-shadow: -5px 5px 18px rgba(23,39,37,.13); cursor: pointer; }
.desktop-archive-toggle span { font-size: 26px; line-height: 1; transition: transform .18s ease; }
.desktop-archive-toggle:hover { background: var(--white); }
.atlas.is-archive-collapsed .desktop-archive-toggle span { transform: rotate(180deg); }
.atlas.is-archive-collapsed .archive-panel { border-left: 0; }

@media (max-width: 980px) {
  :root { --panel-width: 350px; }
  .brand-name { font-size: 18px; }
}

@media (max-width: 720px) {
  :root { --header-height: 56px; }
  .site-header { gap: 10px; padding: 0 12px 0 17px; }
  .brand-mark { min-width: 52px; height: 28px; }
  .brand-name { min-width: 0; font-size: 14px; line-height: .95; white-space: normal; }
  .map-option-control { gap: 0; padding: 0 7px; }
  .map-option-control > span { display: none; }
  .map-option-control select { min-width: 82px; width: 82px; padding: 6px 18px 6px 6px; font-size: 8px; }
  .language-options { flex: none; }
  .language-button { padding: 0 10px; font-size: 8px; }
  .language-button.is-active::after { left: 7px; right: 7px; bottom: 6px; }
  .atlas { display: block; }
  .map-stage { height: calc(100vh - var(--header-height)); height: calc(100dvh - var(--header-height)); }
  .maplibregl-ctrl-attrib { max-width: calc(100vw - 10px); white-space: normal; font-size: 7px !important; line-height: 1.2; }
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { margin: 0 15px 76px 0 !important; }
  .village-info-popup { inset: 12px; }
  .village-info-close { top: 12px; right: 12px; }
  .village-info-scroll { padding: 52px 25px 44px; }
  .village-info-popup h2 { padding-right: 28px; font-size: clamp(34px, 12vw, 52px); }
  .village-info-location { margin-bottom: 30px; }
  .village-info-copy { font-size: 15px; line-height: 1.7; }
  .mobile-archive-button { display: flex; position: absolute; z-index: 12; right: 15px; bottom: 12px; align-items: center; gap: 17px; border: 0; padding: 13px 15px; background: var(--ink); color: var(--white); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; box-shadow: 0 8px 24px rgba(23,39,37,.24); cursor: pointer; }
  .mobile-archive-button span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--coral); }
  .desktop-archive-toggle { display: none; }
  .archive-panel { position: fixed; z-index: 1500; left: 0; right: 0; bottom: 0; height: min(78vh, 720px); height: min(78dvh, 720px); border-left: 0; border-top: 1px solid var(--line); transform: translateY(102%); visibility: hidden; pointer-events: none; transition: transform .35s cubic-bezier(.76,0,.24,1), visibility 0s linear .35s; box-shadow: 0 -20px 50px rgba(23,39,37,.2); }
  .archive-panel.is-open { transform: translateY(0); visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .archive-panel::before { content: ""; position: absolute; top: 7px; left: 50%; width: 35px; height: 3px; border-radius: 3px; background: #a9aea8; transform: translateX(-50%); }
  .panel-header, .archive-panel.has-panel-title .panel-header { display: flex; padding: 27px 20px 15px; }
  .panel-close { display: block; }
  .search-wrap { margin: 0 20px 10px; }
  .panel-actions { margin: 0 20px 14px; }
  .panel-scroll { padding: 0 20px 25px; }
  .tree-region-summary { min-height: 50px; }
}

@media (max-width: 480px) {
  .brand-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
