:root {
  --paper: #f3eee4;
  --ink: #1b1612;
  --ink-soft: #4a433a;
  --rule: #d4c8b4;
  --rule-strong: #b9a88c;
  --gold: #9a7438;
  --moss: #2f5a42;
  --rose: #8b3a3a;
  --plum: #6a3d58;
  --navy: #2a3d52;
  --teal: #2a5a58;
  --ink-hue: #3a332c;
  --panel: #f7f3eb;
  --serif: "Fraunces", "Iowan Old Style", Palatino, serif;
  --sans: "Figtree", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(154, 116, 56, 0.08), transparent 28%),
    linear-gradient(180deg, #f7f2e8 0%, var(--paper) 45%, #efe6d6 100%);
}

.app {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 5rem;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.kicker {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  letter-spacing: -0.03em;
}

.lede {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
}

.search { position: relative; }

.search input {
  width: min(18rem, 90vw);
  border: 1px solid var(--rule-strong);
  background: #fffaf2;
  border-radius: 999px;
  padding: 0.55rem 0.9rem 0.55rem 2.1rem;
  font: 500 0.9rem/1 var(--sans);
}

.search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  stroke: var(--ink-soft);
  fill: none;
  stroke-width: 1.8;
}

.core {
  display: flex;
  justify-content: center;
  margin: 1.6rem 0 1.2rem;
}

.hub {
  border: 0;
  background: var(--ink);
  color: #f6efe3;
  font-family: var(--serif);
  font-size: 1.35rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  cursor: pointer;
}

.map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}

.branch {
  background: #fffaf2;
  border: 1px solid var(--rule);
  border-radius: 1rem;
  padding: 0.95rem 1rem 1rem;
  border-top: 4px solid var(--ink-hue);
}

.branch.hue-moss { border-top-color: var(--moss); }
.branch.hue-gold { border-top-color: var(--gold); }
.branch.hue-rose { border-top-color: var(--rose); }
.branch.hue-plum { border-top-color: var(--plum); }
.branch.hue-navy { border-top-color: var(--navy); }
.branch.hue-teal { border-top-color: var(--teal); }
.branch.hue-ink { border-top-color: var(--ink-hue); }

.branch h2 {
  margin: 0 0 0.35rem;
}

.branch h2 button,
.leaf,
.twig {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  padding: 0;
}

.branch h2 button {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 520;
}

.branch > p {
  margin: 0 0 0.7rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.4;
}

.group { margin: 0.55rem 0 0; }

.twig {
  display: block;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.35rem;
}

.leaves {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.leaf {
  background: #efe6d6;
  border-radius: 999px;
  padding: 0.32rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.leaf:hover, .twig:hover, .branch h2 button:hover, .hub:hover {
  filter: brightness(1.05);
}

.is-dim { opacity: 0.28; }
.is-hit { outline: 2px solid var(--gold); outline-offset: 2px; }

.panel {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: min(24rem, calc(100vw - 1.6rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--rule);
  box-shadow: 0 24px 60px rgba(40, 28, 16, 0.14);
  border-radius: 1.15rem;
  padding: 1.15rem 1.2rem 1.25rem;
  transform: translateX(120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 8;
}

.panel.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.panel-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 650;
}

.panel h2 {
  margin: 0.25rem 0 0.55rem;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 520;
}

.panel p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.85rem 0 0;
  align-items: center;
}

.crumbs button {
  border: 0;
  background: #efe6d6;
  border-radius: 999px;
  padding: 0.32rem 0.65rem;
  font: 600 0.75rem/1 var(--sans);
  cursor: pointer;
}

.close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: #efe6d6;
  cursor: pointer;
  font-size: 1.1rem;
}

@media (max-width: 720px) {
  .panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 48vh;
    border-radius: 1.1rem 1.1rem 0 0;
    transform: translateY(110%);
  }
  .panel.open { transform: none; }
}
