@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Instrument+Serif&display=swap');

:root {
  color-scheme: dark;
  --bg: #121619;
  --surface: #1b2226;
  --map: #101619;
  --line: #38464a;
  --text: #f0eadc;
  --muted: #bdc6c2;
  --gold: #efd19a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.6 "DM Sans", system-ui, sans-serif; }
a { color: var(--gold); }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; }
button, select, input[type=search] { background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 7px; min-height: 42px; padding: .4rem .7rem; }
button { cursor: pointer; }
button:hover, .links a:hover, .card:hover { background: #2b3639; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
h1, h2 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; line-height: 1.07; margin: 0 0 .45em; }
h1 { font-size: clamp(3.25rem, 7vw, 5.4rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.65rem); }
p { margin: 0 0 .9rem; }
.frame { width: min(1320px, 100% - 2.5rem); margin: auto; }
.site-header, .site-footer { background: #181e21; }
.site-header { border-bottom: 1px solid var(--line); }
.site-footer { margin-top: 4rem; padding: 2rem 0; border-top: 1px solid var(--line); }
.site-footer p { color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); gap: 1.5rem 2rem; }
.footer-brand p { max-width: 35ch; margin: .6rem 0 0; font-size: .875rem; }
.footer-grid nav { display: block; }
.footer-grid h2 { margin: 0 0 .25rem; font: 700 1rem/1.5 "DM Sans", system-ui, sans-serif; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid nav a { display: inline-flex; align-items: center; min-height: 32px; padding: .125rem 0; color: var(--muted); font-size: .875rem; }
.footer-grid nav a:hover { color: var(--gold); }
.footer-credit { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); text-align: center; font-size: .8125rem; }
.footer-credit p { margin: .2rem 0; }
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-grid nav a { min-height: 44px; }
}
.mast, nav, .links { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.mast { justify-content: space-between; min-height: 63px; padding: .55rem 0; }
.brand { font-weight: 700; font-size: 1.12rem; }
.brand, nav a { text-decoration: none; }
nav a { color: var(--text); padding-block: .25rem; }
nav a:hover { color: var(--gold); }
.hero { padding: 1.8rem 0 .9rem; }
.hero p, .card span, .count, .status, .atlas-footer { color: var(--muted); }
.hero .eyebrow, .eyebrow { color: var(--gold); font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.section { margin-top: 2.55rem; }
.map-page { width: 100%; }
.map-page > .section { width: min(1320px, 100% - 2.5rem); margin-inline: auto; }
.map-reading {
  display: grid;
  grid-template-columns: clamp(13rem, 17vw, 18rem) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.5rem, 4vw, 4.5rem);
  width: min(1400px, 100% - 3rem);
  margin: clamp(1.5rem, 4vw, 3.5rem) auto 0;
}
.map-contents {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: .15rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.map-contents a { color: var(--muted); font-size: .9rem; }
.map-contents a:hover { color: var(--gold); }
.map-reading-sections > .section { scroll-margin-top: 1.25rem; }
.map-reading-sections > .section:first-child { margin-top: 0; }
.map-reading-sections .section + .section { border-top: 1px solid var(--line); padding-top: 1.65rem; }
.map-reading-sections :is(p, ol, details) { max-width: 75ch; }
@media (max-width: 900px) {
  .map-reading { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; width: min(100% - 1.5rem, 48rem); }
  .map-contents { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: .7rem; }
  .map-contents strong { grid-column: 1 / -1; }
  .map-contents a { display: flex; align-items: center; min-height: 36px; }
}
.map-intro { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1rem; padding: .65rem 1rem; }
.map-intro .eyebrow { display: none; }
.map-intro h1 { font-size: clamp(1.65rem, 3vw, 2.4rem); margin: 0; }
.map-intro p { margin: 0; font-size: .9rem; }
.map-page .atlas { border-inline: 0; border-radius: 0; }
.atlas { border: 1px solid var(--line); border-radius: 13px; background: #171f23; overflow: clip; }
.atlas-bar, .atlas-footer { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; padding: .7rem; }
.atlas-bar { border-bottom: 1px solid var(--line); }
.map-route-selection:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; padding: .55rem .7rem; border-bottom: 1px solid var(--line); }
.atlas-footer { justify-content: space-between; border-top: 1px solid var(--line); }
.search { flex: 1; min-width: 11rem; }
.search input { width: 100%; }
.atlas-grid { display: grid; grid-template-columns: clamp(240px, 18vw, 310px) minmax(0, 1fr); }
#map-filters { padding: .75rem; max-height: max(540px, calc(100dvh - 168px)); overflow-y: auto; border-right: 1px solid var(--line); }
.filtered-progress { margin: .65rem 0; color: var(--muted); font-size: .88rem; }
.filtered-progress p { margin: 0; }
.filtered-progress progress { display: block; width: 100%; accent-color: var(--gold); }
#toggle-filters { display: none; }
.filters { display: grid; gap: .5rem; }
.filters select { display: block; width: 100%; max-width: 100%; }
.filters label { font-size: .88rem; }
#layer-filter { grid-column: 1 / -1; }
#layer-filter summary { cursor: pointer; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 7px; }
.layer-options { display: grid; gap: .2rem; padding: .4rem 0; }
.layer-options label { min-height: 42px; padding-inline: .3rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.layer-options img { object-fit: contain; }
.layer-count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: .45rem; min-height: 30px; }
#map-results { list-style: none; padding: 0; margin: 0; }
#map-results button { display: block; width: 100%; text-align: left; margin-bottom: .3rem; }
#map-results [aria-pressed=true], .pin[aria-pressed=true] { border-color: var(--gold); }
.count { margin-top: .65rem; font-size: .85rem; }
.atlas-work { position: relative; min-width: 0; }
#map-viewport { height: max(540px, calc(100dvh - 168px)); position: relative; overflow: hidden; touch-action: none; background: #141210; cursor: grab; }
#map-viewport:active { cursor: grabbing; }
#map-scene { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#map-canvas { display: block; width: 100%; height: 100%; }
#map-pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; display: grid; place-items: center; min-height: 38px; min-width: 38px; padding: 0; border-radius: 50%; border: 2px solid #b8b8aa; background: #1c2428; color: white; pointer-events: auto; transform: translate(-50%, -50%) scale(var(--pin-scale, 1)) translate(var(--pin-offset-x, 0px), var(--pin-offset-y, 0px)); font-size: 1.1rem; }
.pin-icon { background: transparent; border-color: transparent; }
.pin-icon img { display: block; object-fit: contain; pointer-events: none; filter: drop-shadow(0 2px 2px #000); }
.pin-icon:hover, .pin-icon:focus-visible { z-index: 2; background: #211c17; }
.pin-icon.found img { opacity: .58; }
.pin.found { color: #98d7a9; border-color: #98d7a9; }
.map-controls { display: grid; position: absolute; right: .7rem; top: .7rem; gap: .3rem; }
.map-controls button { padding: .3rem; min-width: 44px; }
.map-caption { position: absolute; right: .55rem; bottom: .45rem; margin: 0; font-size: .75rem; background: #121619; padding: .15rem .45rem; border-radius: 4px; pointer-events: none; }
.marker-detail { position: absolute; z-index: 3; bottom: 2rem; left: .75rem; width: min(420px, calc(100% - 1.5rem)); max-height: 50%; overflow-y: auto; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.marker-detail h2 { margin: 0 0 .25rem; padding-right: 6rem; }
.detail-close { position: absolute; top: .55rem; right: .55rem; font-size: .8rem; }
.atlas.expanded { position: fixed; inset: 0; z-index: 10; border-radius: 0; overflow-y: auto; }
.atlas.expanded #map-viewport { height: 75dvh; }
.status { margin: 0; padding: 0 .7rem .55rem; font-size: .88rem; }
.status:empty { display: none; }
.links a, .primary { display: inline-block; padding: .44rem .7rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.primary { background: var(--gold); color: #121619; font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr)); gap: .65rem; margin-bottom: 1rem; }
.card { display: grid; align-content: start; gap: .4rem; padding: 1rem; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.reading { max-width: 740px; }
.reading h2 { margin-top: 1.5rem; }
.faq details, .notes li { padding: .7rem; border-bottom: 1px solid var(--line); }
.checklist-name { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.checklist-control { flex: 0 0 auto; }
#location-checklist:not(.checklist-ready) .checklist-control,
#location-checklist-status:empty { display: none; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: .5rem 0 0; }
.route-planner { margin-bottom: 1.2rem; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.route-planner h3 { margin-top: 0; }
.route-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: .65rem; }
.route-fields fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 6px; }
.route-fields label { display: grid; margin-bottom: .35rem; }
.route-fields select { width: 100%; }
.route-planner .check { margin: .65rem 0; }
.route-mode { display: block; margin: .75rem 0; }
#route-abilities { margin-bottom: .75rem; }
#route-status:not(:empty) { margin: .7rem 0 0; }
#route-steps:empty { display: none; }
#route-steps small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.room-diagram { margin: .9rem 0; padding: .7rem; border: 1px solid var(--line); border-radius: 8px; }
.room-diagram canvas { display: block; width: min(100%, 700px); height: auto; margin: .55rem 0; border-radius: 6px; background: var(--map); }
.room-diagram p { margin: .4rem 0; color: var(--muted); }
.room-preview { margin-left: .65rem; }
.room-exits { padding-inline-start: 1.2rem; }
.notes .room-exits li { padding: .2rem 0; border: 0; }
.room-exits small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.room-exits:empty { display: none; }
.region-connections { margin: 1rem 0; padding: .8rem; border: 1px solid var(--line); border-radius: 8px; }
.region-connections summary { cursor: pointer; font-weight: 700; }
.region-connections p { margin: .5rem 0; color: var(--muted); }
.region-connections-scroll { overflow-x: auto; }
#region-connection-grid { display: grid; position: relative; grid-template-columns: repeat(4, minmax(125px, 1fr)); gap: 2.7rem 1.8rem; min-width: 640px; padding: 1.15rem; }
#region-connection-grid button { position: relative; min-height: 52px; }
#region-connection-lines { position: absolute; inset: 0; pointer-events: none; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
@media (max-width: 740px) {
  .frame { width: calc(100% - 1.25rem); }
  .mast { gap: .1rem .9rem; }
  .mast nav { gap: .25rem .75rem; font-size: .85rem; }
  .hero { padding-top: 1.35rem; }
  .atlas-grid { display: block; }
  #toggle-filters { display: inline-block; }
  #map-filters { display: none; max-height: 46vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .filters-open #map-filters { display: block; }
  .filters-open.search-active #map-filters { display: flex; flex-direction: column; }
  .search-active #map-filters .filters { order: 1; margin-top: .65rem; }
  .filters { grid-template-columns: 1fr 1fr; }
  .map-page { width: 100%; }
  .map-page > .section { width: calc(100% - 1.25rem); }
  .map-intro { padding: .5rem .7rem; }
  .map-intro p { display: none; }
  #map-viewport { height: max(380px, calc(100dvh - 180px)); }
  .marker-detail { position: relative; bottom: auto; left: auto; width: auto; max-height: none; border-radius: 0; }
}

