:root {
  --ink: #14110d;
  --paper: #e9e2d3;
  --paper-soft: #f4efe5;
  --gold: #d9a72e;
  --gold-light: #efcb72;
  --rust: #8a3d24;
  --line: rgba(239, 203, 114, .27);
  --sans: "DM Sans", sans-serif;
  --serif: "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ink); }
body { margin: 0; color: var(--paper); background: var(--ink); font-family: var(--sans); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 1000; opacity: .13; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E"); }

.masthead { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(22px, 5vw, 78px); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.wordmark { color: var(--paper); text-decoration: none; font-family: var(--serif); font-size: clamp(18px, 2vw, 25px); }
.wordmark span { color: var(--gold-light); font-style: italic; }
nav { display: flex; gap: 8px; }
.nav-button, .filter { color: var(--paper); background: transparent; border: 1px solid transparent; padding: 10px 14px; cursor: pointer; }
.nav-button:hover, .nav-button.is-active, .filter:hover, .filter.is-active { color: var(--gold-light); border-color: var(--line); }

.intro { min-height: min(76vh, 760px); display: grid; align-content: center; padding: clamp(44px, 6vh, 70px) clamp(22px, 9vw, 150px); position: relative; overflow: hidden; }
.intro-lens { position: absolute; z-index: 2; top: -52%; right: -16%; width: min(1120px, 84vw); aspect-ratio: 1; border: 9px solid rgba(8,13,19,.84); border-radius: 50%; opacity: .38; pointer-events: none; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.46) 0 2%, transparent 15%), radial-gradient(circle at 55% 58%, rgba(79,116,157,.14) 0 31%, rgba(6,17,30,.72) 58%, rgba(2,7,13,.86) 72%); box-shadow: inset 0 0 0 3px rgba(255,255,255,.25), inset 0 0 0 17px rgba(10,16,27,.84), inset 0 0 0 21px rgba(214,147,31,.44), 0 22px 60px rgba(0,0,0,.53); }
.intro-lens::before, .intro-lens::after { content: ""; position: absolute; border-radius: 50%; }
.intro-lens::before { inset: 13.7%; border: 2px solid rgba(255,255,255,.36); box-shadow: 0 0 24px rgba(130,180,227,.34); }
.intro-lens::after { inset: 28.4%; border: 1px solid rgba(233,170,22,.48); background: radial-gradient(circle at 38% 32%, rgba(255,255,255,.27), transparent 20%); }
.intro-image { position: absolute; inset: 0; background: url("../images/treasure-hoard/hero-treasure-hoard.jpg") 70% 42% / cover no-repeat; filter: saturate(.72) contrast(1.04) brightness(.73); transform: scale(1.005); }
.intro-shade { position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(20,17,13,.99) 0%, rgba(20,17,13,.96) 23%, rgba(20,17,13,.72) 48%, rgba(20,17,13,.09) 82%), linear-gradient(0deg, var(--ink) 0%, transparent 18%, transparent 82%, rgba(20,17,13,.36) 100%); }
.intro-copy { position: relative; z-index: 3; max-width: 900px; }
.eyebrow { text-transform: uppercase; letter-spacing: .24em; font-size: 11px; font-weight: 600; color: var(--gold-light); margin: 0 0 22px; }
h1 { max-width: 940px; font-family: var(--serif); font-weight: 400; font-size: clamp(62px, 8vw, 122px); line-height: .78; letter-spacing: -.045em; margin: 0; position: relative; }
h1 small { display: block; margin-bottom: .24em; color: var(--paper); font: 500 clamp(16px, 1.5vw, 23px)/1 var(--sans); letter-spacing: .04em; }
h1 em { color: var(--gold-light); font-weight: 400; }
.lede { max-width: 590px; font-family: var(--serif); font-size: clamp(21px, 2.2vw, 31px); line-height: 1.08; margin: 30px 0 26px; color: #d8d0c1; }
.intro-meta { display: flex; gap: 28px; text-transform: uppercase; letter-spacing: .15em; font-size: 10px; color: #a69e8f; }
.intro-meta strong { color: var(--gold-light); font-weight: 500; }
.visit-note { max-width: 510px; margin: 12px 0 0; color: #afa697; font-family: var(--serif); font-size: 13px; line-height: 1.3; }
.enter-button { justify-self: start; margin-top: 28px; border: 0; background: var(--gold); color: var(--ink); padding: 13px 19px; font-weight: 600; cursor: pointer; }
.enter-button span { padding-left: 24px; }

.explorer { border-top: 1px solid var(--line); min-height: 100vh; }
.explorer-tools { padding: 13px clamp(18px, 4vw, 58px) 11px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 500; background: rgba(20,17,13,.96); backdrop-filter: blur(14px); }
.search { flex: 1; display: flex; align-items: center; border-bottom: 1px solid #6d6559; }
.search input { width: 100%; border: 0; outline: 0; padding: 12px 4px; color: var(--paper); background: transparent; font-family: var(--serif); font-size: 20px; }
.search input::placeholder { color: #8c8478; }
.search span { color: var(--gold-light); font-size: 22px; }
.section-menu { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); }
.section-menu-button { min-height: 39px; padding: 9px 12px; border: 0; border-right: 1px solid var(--line); color: #aaa194; background: transparent; text-transform: uppercase; letter-spacing: .1em; font-size: 9px; cursor: pointer; }
.section-menu-button:last-child { border-right: 0; }
.section-menu-button:hover, .section-menu-button:focus-visible, .section-menu-button.is-active { color: var(--ink); background: var(--gold); outline: none; }
.section-menu-summary { min-height: 24px; margin: 10px 2px 0; color: #c5bcad; font-family: var(--serif); font-size: 18px; line-height: 1.25; transition: opacity .15s; }
.view { display: block; }
.map-view { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(330px, .72fr); height: max(520px, calc(100svh - 230px)); min-height: 520px; margin: 18px clamp(18px, 3vw, 46px); border: 1px solid var(--gold); }
.map-stage { position: relative; height: 100%; min-width: 0; }
#map { height: 100%; background: #24231e; pointer-events: none; }
.map-stage.is-active #map { pointer-events: auto; }
.map-activate { position: absolute; inset: 0; z-index: 450; border: 0; color: var(--paper); background: rgba(20,17,13,.2); display: grid; place-content: center; gap: 8px; text-align: center; cursor: pointer; backdrop-filter: blur(1px); }
.map-activate span { color: var(--gold-light); font-size: 27px; }
.map-activate strong { padding: 12px 16px; color: var(--ink); background: var(--gold); font-size: 13px; }
.map-activate small { color: #ddd3c3; font-size: 10px; text-shadow: 0 1px 5px #000; }
.map-stage.is-active .map-activate { display: none; }
.leaflet-tile-pane { filter: grayscale(1) sepia(.24) brightness(.63) contrast(1.15); }
.leaflet-control-attribution { background: rgba(20,17,13,.82) !important; color: #aaa !important; }
.leaflet-control-attribution a { color: var(--gold-light) !important; }
.leaflet-control-zoom a { background: var(--ink) !important; color: var(--paper) !important; border-color: var(--line) !important; }
.treasure-marker { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--gold); border: 2px solid var(--paper-soft); box-shadow: 0 3px 14px rgba(0,0,0,.6); transition: transform .2s; }
.treasure-marker:hover { transform: rotate(-45deg) scale(1.3); }
.detail { min-height: 0; height: 100%; background: #1d1914; border-left: 1px solid var(--line); overflow-y: auto; }
.detail-empty { min-height: 100%; display: grid; place-content: center; text-align: center; padding: 50px; color: #999083; }
.detail-empty .sigil { color: var(--gold-light); font-size: 36px; }
.detail-empty p { max-width: 250px; font-family: var(--serif); font-size: 24px; }
.detail-image { width: 100%; height: 43%; min-height: 230px; object-fit: cover; display: block; background: #29231c; }
.detail-image.is-portrait { height: 52%; object-fit: contain; background: radial-gradient(circle at center, #393127 0%, #211c16 72%); }
.detail-body { padding: clamp(26px, 4vw, 54px); }
.detail-index { color: var(--gold-light); letter-spacing: .18em; font-size: 10px; text-transform: uppercase; }
.detail h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(39px, 4vw, 64px); line-height: .94; margin: 19px 0 23px; }
.detail-description { font-family: var(--serif); font-size: 21px; line-height: 1.35; color: #cbc2b4; }
.story-link { display: inline-block; margin-top: 20px; padding: 13px 17px; background: var(--gold); color: var(--ink); text-decoration: none; font-weight: 600; }
.map-only { margin-top: 22px; color: #978f82; font-size: 12px; text-transform: uppercase; letter-spacing: .11em; }
.another-chance { width: 100%; margin-top: 24px; padding: 14px 17px; border: 1px solid var(--gold); color: var(--gold-light); background: rgba(217,167,46,.06); text-transform: uppercase; letter-spacing: .11em; font-size: 10px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.another-chance span { margin-right: 10px; }
.another-chance:hover, .another-chance:focus-visible { color: var(--ink); background: var(--gold); outline: none; }
.cabinet-threshold { width: 100%; min-height: 180px; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 30px clamp(22px, 6vw, 90px); color: var(--paper); background: #18140f; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto auto; text-align: left; cursor: pointer; }
.cabinet-threshold span { color: var(--gold-light); text-transform: uppercase; letter-spacing: .19em; font-size: 10px; }
.cabinet-threshold strong { grid-column: 1; font-family: var(--serif); font-size: clamp(34px, 5vw, 70px); line-height: 1; font-weight: 400; }
.cabinet-threshold strong span { font: inherit; color: inherit; text-transform: none; letter-spacing: inherit; }
.cabinet-threshold small { grid-column: 1; margin-top: 11px; color: var(--paper); font-family: var(--serif); font-size: clamp(18px, 1.7vw, 25px); font-weight: 500; }
.cabinet-threshold i { grid-column: 2; grid-row: 1 / 4; align-self: center; width: 58px; height: 58px; border: 1px solid var(--gold); border-radius: 50%; display: grid; place-content: center; color: var(--gold-light); font-style: normal; font-size: 25px; transition: transform .25s, background .25s; }
.cabinet-threshold:hover i { transform: translateY(6px); background: var(--gold); color: var(--ink); }

.cabinet-view { padding: clamp(50px, 8vw, 120px) clamp(18px, 4vw, 58px); }
.cabinet-heading h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(50px, 7vw, 102px); margin: 0 0 50px; }
.cabinet-grid { columns: 4 260px; column-gap: 16px; }
.card { break-inside: avoid; margin: 0 0 16px; background: #211c16; border: 1px solid var(--line); cursor: pointer; position: relative; overflow: hidden; }
.card img { width: 100%; height: auto; min-height: 180px; display: block; object-fit: cover; filter: saturate(.78); transition: transform .5s, filter .5s; }
.card:hover img { transform: scale(1.025); filter: saturate(1); }
.card-copy { padding: 21px; }
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1; margin: 0 0 12px; }
.card p { color: #aaa194; line-height: 1.45; font-size: 13px; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.no-results { column-span: all; font-family: var(--serif); font-size: 32px; color: #aaa194; }

.planner-view { padding: clamp(55px, 8vw, 120px) clamp(18px, 4vw, 58px); border-top: 1px solid var(--line); background: #17130f; }
.planner-heading { display: flex; align-items: end; justify-content: space-between; gap: 35px; margin-bottom: 45px; }
.planner-heading > div { max-width: 860px; }
.planner-heading h2 { font-family: var(--serif); font-size: clamp(48px, 7vw, 96px); line-height: .92; font-weight: 400; margin: 0 0 22px; }
.planner-heading > div > p:last-child { max-width: 650px; color: #b8afa1; font-family: var(--serif); font-size: 22px; }
.planner-print { border: 0; padding: 14px 18px; background: var(--gold); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; }
.planner-print:disabled { opacity: .32; cursor: not-allowed; }
.print-control { display: grid; justify-items: end; gap: 8px; max-width: 240px; }
.print-control small { color: #9f9688; font-size: 10px; line-height: 1.35; text-align: right; }
.planner-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, .7fr); min-height: 690px; border: 1px solid var(--line); }
#planner-map { min-height: 690px; background: #24231e; }
.journey-panel { padding: clamp(25px, 3vw, 45px); border-left: 1px solid var(--line); background: #211b15; display: flex; flex-direction: column; }
.journey-empty { margin: auto; text-align: center; max-width: 280px; }
.journey-empty > span { font-size: 34px; color: var(--gold-light); }
.journey-empty h3, .journey-title-row h3 { font-family: var(--serif); font-size: 36px; line-height: 1; font-weight: 400; margin: 13px 0; }
.journey-empty p { color: #a49b8e; line-height: 1.5; }
.journey-title-row { display: flex; justify-content: space-between; gap: 20px; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.journey-kicker { color: var(--gold-light); text-transform: uppercase; letter-spacing: .15em; font-size: 9px; }
#clear-route { border: 1px solid var(--line); color: var(--paper); background: transparent; padding: 8px 10px; cursor: pointer; }
#journey-list { margin: 25px 0; padding: 0; list-style: none; counter-reset: journey; max-height: 375px; overflow-y: auto; }
#journey-list li { counter-increment: journey; display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid rgba(239,203,114,.12); font-family: var(--serif); font-size: 19px; }
#journey-list li::before { content: counter(journey, decimal-leading-zero); color: var(--gold-light); font: 10px/2.2 var(--sans); letter-spacing: .08em; }
.maps-route { display: block; text-align: center; color: var(--ink); background: var(--gold); padding: 13px; text-decoration: none; font-weight: 600; }
.planner-disclaimer { margin-top: auto; padding-top: 25px; color: #8f877b; font-size: 10px; line-height: 1.5; }
.planner-disclaimer strong { color: #b7ad9e; }
.planner-marker { width: 19px; height: 19px; border-radius: 50%; background: var(--gold); border: 2px solid var(--paper); box-shadow: 0 2px 10px #000; }
.planner-marker.is-selected { background: var(--rust); transform: scale(1.35); }
footer { display: flex; justify-content: space-between; padding: 30px clamp(22px, 5vw, 78px); border-top: 1px solid var(--line); color: #8f877b; font-size: 12px; }
footer a { color: var(--gold-light); }
.gazetteer-editor-section { position: relative; z-index: 2; overflow: hidden; border-top: 1px solid var(--line); background: var(--ink); }
.gazetteer-editor-content { width: min(100% - 36px, 1120px); max-width: 1120px; margin: clamp(35px, 6vw, 80px) auto; color: var(--paper); }
.gazetteer-editor-content > .kg-card:first-child { margin-top: 0; }
.gazetteer-editor-content > .kg-card:last-child { margin-bottom: 0; }

@media (max-width: 1050px) {
  .map-view { display: block; height: auto; min-height: 0; }
  .map-stage { height: min(62svh, 650px); min-height: 430px; }
  .detail { position: static; width: 100%; height: auto; max-height: none; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .detail-empty { min-height: 165px; }
  .detail-image { height: min(48vw, 410px); min-height: 250px; }
  .detail-body { padding: clamp(28px, 5vw, 52px); }
}

@media (max-width: 800px) {
  .masthead { display: block; min-height: 0; padding: 15px 18px 14px; }
  .wordmark { display: block; font-size: 21px; line-height: 1.08; }
  .wordmark span { display: block; }
  .masthead nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: 13px; border: 1px solid var(--line); }
  .nav-button { min-height: 39px; padding: 8px 6px; border: 0; border-right: 1px solid var(--line); font-size: 10px; }
  .nav-button:nth-child(2n) { border-right: 0; }
  .nav-button:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .intro { min-height: min(550px, 76svh); padding: 34px 22px 32px; }
  .intro-image { inset: 0; background-position: 61% center; opacity: .5; }
  .intro-shade { background: linear-gradient(90deg, rgba(20,17,13,.98) 0%, rgba(20,17,13,.72) 68%, rgba(20,17,13,.35)), linear-gradient(0deg, var(--ink), transparent 25%, transparent 70%, rgba(20,17,13,.65)); }
  .intro-lens { top: -18%; right: -63%; width: 135vw; opacity: .33; }
  h1 { font-size: clamp(45px, 13vw, 64px); line-height: .82; }
  h1 small { margin-bottom: .18em; }
  .lede { font-size: 20px; margin: 20px 0 18px; max-width: 330px; }
  .visit-note { margin-top: 9px; }
  .enter-button { margin-top: 20px; }
  .intro-meta { flex-wrap: wrap; gap: 10px 20px; }
  .section-menu { grid-template-columns: repeat(2, 1fr); }
  .section-menu-button:nth-child(2) { border-right: 0; }
  .section-menu-button:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .section-menu-summary { min-height: 50px; font-size: 16px; }
  .map-view { display: block; position: relative; height: auto; min-height: 0; margin: 10px; }
  .map-stage { width: 100%; height: auto; min-height: 0; aspect-ratio: 16 / 10; }
  #map { height: 100%; min-height: 0; }
  .detail { position: static; height: auto; max-height: none; border: 0; border-top: 1px solid var(--line); box-shadow: none; }
  .detail-empty { min-height: 145px; padding: 20px 25px; background: rgba(29,25,20,.98); }
  .detail-empty .sigil { font-size: 22px; }
  .detail-empty p { font-size: 18px; margin: 7px 0; }
  .detail-image { height: 52vw; min-height: 190px; }
  .detail-image.is-portrait { height: min(112vw, 70svh); min-height: 320px; }
  .detail-body { padding: 22px; }
  .detail h2 { font-size: 45px; }
  .cabinet-threshold { min-height: 175px; grid-template-columns: 1fr auto; gap: 10px; }
  .cabinet-threshold strong { font-size: 34px; }
  .cabinet-threshold small { font-size: 18px; }
  .cabinet-threshold i { width: 45px; height: 45px; }
  .cabinet-grid { columns: 2 155px; }
  .card h3 { font-size: 23px; }
  .card-copy { padding: 16px; }
  .planner-heading { align-items: stretch; flex-direction: column; }
  .planner-heading h2 { font-size: 51px; }
  .planner-print { align-self: start; }
  .print-control { justify-items: start; }
  .print-control small { text-align: left; }
  .planner-layout { display: block; }
  #planner-map { width: 100%; min-height: 0; aspect-ratio: 16 / 10; }
  .journey-panel { min-height: 440px; border-left: 0; border-top: 1px solid var(--line); }
  footer { gap: 20px; flex-direction: column; }
  .gazetteer-editor-content { width: min(100% - 20px, 1120px); margin: 26px auto; }
}

@media print {
  body { color: #111; background: #fff; }
  .masthead, .intro, .explorer-tools, .map-view, .cabinet-threshold, .cabinet-view, .planner-heading, #planner-map, footer, .maps-route, #clear-route, .grain { display: none !important; }
  .planner-view { padding: 0; border: 0; background: #fff; }
  .planner-layout { display: block; border: 0; min-height: 0; }
  .journey-panel { color: #111; background: #fff; border: 0; padding: 0; }
  .journey-title-row { border-color: #999; }
  #journey-list { max-height: none; }
  #journey-list li { color: #111; border-color: #ccc; }
  .planner-disclaimer { color: #444; }
}

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