@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  color-scheme: light;
  --paper: #f5f2eb;
  --ink: #381e14;
  --clay: #8c4a32;
  --muted: #c9b39a;
  --serif: 'Libre Baskerville', Georgia, serif;
  --sans: 'DM Sans', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.archive {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse at 50% 47%, #f8f6f0 0, var(--paper) 78%);
}

.archive-header {
  position: absolute;
  z-index: 5;
  inset: 3.7% 3.35% auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.archive-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #381e14;
  text-decoration: none;
}

.brand-mark-window { position: relative; display: block; width: 52px; height: 39px; overflow: hidden; flex: 0 0 52px; }
.brand-mark-image { position: absolute; inset: 0 auto auto 0; width: auto; max-width: none; height: 39px; }
.brand-name { color: #381e14; font: italic 400 25px/1.25 var(--serif); }

.menu-toggle {
  display: grid;
  width: 44px;
  height: 42px;
  align-content: center;
  gap: 8px;
  padding: 7px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-toggle span {
  width: 30px;
  height: 2px;
  background: var(--clay);
  transition: transform 200ms ease;
}

.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-5px) rotate(-45deg); }

.visualization {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.graph {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  cursor: grab;
  user-select: none;
}

.graph:active { cursor: grabbing; }
.connection { fill: none; stroke-linecap: round; pointer-events: none; }

.province-node {
  cursor: pointer;
  transition: opacity 220ms ease;
  -webkit-tap-highlight-color: transparent;
}

.province-node:focus { outline: none; }
.province-circle { stroke: rgb(248 246 240 / 85%); stroke-width: 1.5; transition: filter 180ms ease, r 180ms ease; }
.province-node:hover .province-circle, .province-node:focus .province-circle, .province-node[aria-pressed="true"] .province-circle { filter: brightness(1.12); }
.province-focus-ring { fill: none; stroke: var(--clay); stroke-width: 1.4; opacity: 0; }
.province-node:focus .province-focus-ring, .province-node[aria-pressed="true"] .province-focus-ring { opacity: .75; }

.province-label {
  fill: #5f5147;
  font-family: var(--sans);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.province-node:hover .province-label, .province-node:focus .province-label, .province-node[aria-pressed="true"] .province-label { opacity: 1; }
.province-label.is-mobile { font-size: 11px; }
.graph-empty { position: absolute; inset: 50% 20px auto; margin: 0; color: #806f63; font-size: 14px; text-align: center; transform: translateY(-50%); }
.graph-empty[hidden], .results[hidden], .about-menu[hidden] { display: none; }

.search-area {
  position: absolute;
  z-index: 4;
  bottom: 9.4%;
  left: 50%;
  width: min(50.5vw, 1010px);
  transform: translateX(-50%);
}

.search {
  display: flex;
  width: 100%;
  height: clamp(54px, 6.3vh, 72px);
  min-height: 54px;
  overflow: hidden;
  border: 1.5px solid var(--clay);
  border-radius: 999px;
  background: var(--paper);
  transition: box-shadow 200ms ease;
}

.search:focus-within { box-shadow: 0 7px 24px rgb(75 40 28 / 10%); }

.search input {
  width: 100%;
  min-width: 0;
  padding: 0 30px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: clamp(15px, 1.2vw, 23px);
}

.search input::placeholder { color: #c8b097; opacity: 1; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.search-submit {
  display: grid;
  flex: 0 0 clamp(62px, 4.4vw, 88px);
  place-items: center;
  border: 0;
  background: var(--clay);
  cursor: pointer;
  transition: background 180ms ease;
}

.search-submit:hover { background: #743b29; }
.search-submit svg { width: 33px; fill: none; stroke: #e8d9c9; stroke-width: 2.8; }

.results {
  max-height: min(55vh, 460px);
  margin-bottom: 12px;
  padding: 20px 24px;
  overflow: auto;
  border: 1px solid rgb(147 77 53 / 24%);
  border-radius: 18px;
  background: rgb(248 246 240 / 97%);
  box-shadow: 0 18px 50px rgb(75 40 28 / 12%);
}

.results-heading { margin: 0 0 12px; color: #937a6b; font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.result-item { padding: 13px 0; border-top: 1px solid rgb(75 40 28 / 12%); }
.result-item[role="button"] { cursor: pointer; }
.result-item[role="button"]:hover .result-name { color: var(--clay); }
.result-name { margin: 0 0 3px; font: 500 19px var(--serif); }
.result-scientific { margin: 0 0 6px; color: #8b7b6f; font-size: 11px; font-style: italic; }
.result-description { margin: 0; color: #806d60; font-size: 12px; line-height: 1.6; }
.result-tag { display: inline-block; margin-top: 8px; padding: 3px 7px; border-radius: 999px; background: rgb(147 77 53 / 9%); color: #805440; font-size: 9px; }
.results-empty { margin: 0; color: #806d60; font-size: 13px; line-height: 1.6; }

.about-menu {
  position: absolute;
  z-index: 6;
  top: calc(3.7% + 55px);
  right: 3.35%;
  display: flex;
  width: min(350px, calc(100vw - 40px));
  flex-direction: column;
  padding: 10px 22px;
  border: 1px solid rgb(147 77 53 / 20%);
  border-radius: 12px;
  background: rgb(248 246 240 / 97%);
  box-shadow: 0 18px 50px rgb(75 40 28 / 12%);
}

.about-menu a { display: flex; justify-content: space-between; gap: 14px; padding: 16px 0; border-bottom: 1px solid rgb(75 40 28 / 12%); color: var(--ink); font: 400 14px var(--serif); text-decoration: none; }
.about-menu a:last-child { border-bottom: 0; }
.about-menu a:hover, .about-menu a[aria-current="page"] { color: var(--clay); }
.about-menu a span { color: #a58a77; font-family: var(--sans); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
}

@media (max-width: 700px) {
  .archive-header { inset: 23px 6% auto; }
  .archive-brand { gap: 10px; }
  .brand-mark-window { width: 43px; height: 33px; flex-basis: 43px; }
  .brand-mark-image { height: 33px; }
  .brand-name { font-size: 21px; }
  .search-area { bottom: 8%; width: calc(100% - 40px); }
  .search { height: 58px; }
  .search input { padding: 0 18px; font-size: 15px; }
  .search-submit { flex-basis: 62px; }
  .search-submit svg { width: 29px; }
  .results { max-height: 48svh; padding: 16px 18px; }
  .about-menu { top: 78px; right: 20px; }
}

@media (max-height: 520px) {
  .archive-header { inset-block-start: 18px; }
  .search-area { bottom: 5%; }
}

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