
:root{
  --paper:#e6d9b8;
  --paper-2:#d9c9a0;
  --ink:#31271d;
  --ink-soft:#52453a;
  --edge:#8f7e5e;
  --shadow:rgba(31,22,13,0.24);
  --accent:#8c6f44;
  --panel-bg:rgba(239,227,196,0.92);
  --panel-line:rgba(96,74,42,0.32);
  --btn:#64523c;
  --btn-hover:#4f4130;
  --btn-text:#f3ead1;
  --max-panel-width:370px;
}
*{box-sizing:border-box;}
html,body,#map{height:100%;margin:0;}
body{
  font-family:"Crimson Text", Georgia, serif;
  color:var(--ink);
  background:#cfc09b;
  overflow:hidden;
}
a{color:#5d4d2d;}
#map{
  position:relative;
  z-index:1;
  background:#cab98d;
}
.leaflet-container{
  background:#cab98d;
  font-family:"Crimson Text", Georgia, serif;
}
.leaflet-control-attribution{
  background:rgba(235,224,193,0.85)!important;
  color:var(--ink-soft);
  border-top-left-radius:10px;
  font-size:11px;
}
.leaflet-tile-pane{
  filter: sepia(.72) saturate(.58) contrast(.84) brightness(.96) hue-rotate(-8deg);
}
#paper-texture, #vignette{
  position:fixed;
  inset:0;
  pointer-events:none;
}
#paper-texture{
  z-index:2;
  opacity:.32;
  mix-blend-mode:multiply;
  background-image:
   radial-gradient(circle at 20% 20%, rgba(255,255,255,.26), rgba(255,255,255,0) 28%),
   radial-gradient(circle at 78% 74%, rgba(125,93,48,.12), rgba(125,93,48,0) 32%),
   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.85'/%3E%3C/svg%3E");
}
#vignette{
  z-index:3;
  background:radial-gradient(circle at center, rgba(0,0,0,0) 52%, rgba(42,30,17,0.18) 100%);
}
.ornate-panel{
  background:var(--panel-bg);
  border:1px solid rgba(104,82,49,.45);
  box-shadow:0 12px 30px var(--shadow), inset 0 0 0 1px rgba(255,246,226,.35);
  backdrop-filter: blur(2px);
}
.floating-panel, #map-title{
  position:fixed;
  z-index:1000;
}
#map-title{
  top:10px;
  left:10px;
  max-width:min(410px, calc(100vw - 20px));
  padding:14px 18px 16px;
}
#map-title .eyebrow{
  font-size:12px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:#6a5a45;
}
#map-title h1{
  margin:2px 0 2px;
  font-family:"Cormorant Garamond", Georgia, serif;
  font-size:clamp(1.65rem, 2.6vw, 2.55rem);
  line-height:.95;
  font-weight:700;
}
#map-title p{
  margin:6px 0 0;
  font-size:0.97rem;
  color:#4b3f35;
}
.floating-panel{
  width:min(var(--max-panel-width), calc(100vw - 20px));
  border-radius:16px;
}
#story-pane{
  right:10px;
  bottom:10px;
  max-height:min(74vh, 760px);
  display:flex;
  flex-direction:column;
}
#filter-pane{
  left:10px;
  bottom:10px;
  width:min(280px, calc(100vw - 20px));
}
.panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
  border-bottom:1px solid var(--panel-line);
  font-family:"Cormorant Garamond", Georgia, serif;
  font-size:1.35rem;
  font-weight:700;
  letter-spacing:.02em;
  user-select:none;
}
#story-header{cursor:grab;}
#story-header:active{cursor:grabbing;}
.panel-body{
  padding:14px;
  overflow:auto;
}
.panel-footer{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px 14px;
  border-top:1px solid var(--panel-line);
}
.icon-button, .nav-btn, .secondary-btn, .collapse-toggle{
  appearance:none;
  border:1px solid rgba(85,64,35,.4);
  background:rgba(248,239,217,.85);
  color:var(--ink);
  border-radius:10px;
  cursor:pointer;
  font-family:inherit;
}
.icon-button{
  width:34px;
  height:34px;
  font-size:17px;
  line-height:1;
}
.nav-btn, .secondary-btn{
  padding:8px 14px;
  min-height:38px;
  font-size:1rem;
}
.nav-btn{
  background:var(--btn);
  color:var(--btn-text);
  font-weight:600;
}
.nav-btn:hover, .secondary-btn:hover, .icon-button:hover, .collapse-toggle:hover{filter:brightness(.97);}
.nav-btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.collapse-toggle{
  width:100%;
  background:none;
  border:none;
  border-radius:16px 16px 0 0;
  text-align:left;
}
#filter-pane.minimized #filter-content{display:none;}
#filter-pane.minimized .collapse-toggle{border-radius:16px;}
#category-list{
  display:grid;
  gap:8px;
  margin-bottom:12px;
}
.category-item{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:1rem;
}
.category-item input{accent-color:#6d5b3c;}
.swatch{
  width:12px;
  height:12px;
  border-radius:50%;
  display:inline-block;
  box-shadow:0 0 0 1px rgba(50,36,20,.25);
}
.sources-launch{margin-top:10px; width:100%;}
#show-all-btn{width:100%;}
.story-image{
  display:block;
  border-radius:10px;
  border:1px solid rgba(78,56,28,.25);
  box-shadow:0 6px 14px rgba(32,24,14,.12);
  margin:0 0 12px;
  object-fit:cover;
  background:#d8c8a3;
}
.story-image.landscape{
  width:100%;
  max-height:150px;
}
.story-image.portrait{
  width:min(66%, 220px);
  max-height:150px;
}
.story-title{
  font-family:"Cormorant Garamond", Georgia, serif;
  font-size:1.9rem;
  line-height:.95;
  margin:0 0 5px;
}
.story-meta{
  font-size:1rem;
  margin:.2rem 0;
  color:#4f4335;
}
.story-category{
  font-weight:700;
  letter-spacing:.02em;
}
.story-description{
  margin:10px 0 12px;
  font-size:1.05rem;
  line-height:1.34;
}
.story-sources{
  font-size:.96rem;
  margin-top:8px;
}
.story-sources a{
  word-break:break-word;
}
.timeline-stamp{
  display:inline-flex;
  align-items:center;
  gap:7px;
  margin-bottom:8px;
  color:#5d4f3d;
  font-size:.95rem;
}
.loading-card{
  padding:18px 22px;
}
#loading-overlay{
  position:fixed;
  inset:0;
  display:none;
  place-items:center;
  background:rgba(74,56,31,0.16);
  z-index:1200;
}
#loading-overlay.visible{display:grid;}
.loading-title{
  font-family:"Cormorant Garamond", Georgia, serif;
  font-size:1.8rem;
  font-weight:700;
}
.loading-note{margin-top:8px; max-width:340px; text-align:center;}
.modal{
  position:fixed;
  inset:0;
  z-index:1300;
}
.modal.hidden{display:none;}
.modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(22,15,8,.4);
}
.modal-dialog{
  position:relative;
  width:min(680px, calc(100vw - 20px));
  max-height:min(82vh, 840px);
  overflow:auto;
  margin:6vh auto;
  padding:18px 20px;
  z-index:2;
}
.modal-dialog h2{
  margin:0 0 12px;
  font-family:"Cormorant Garamond", Georgia, serif;
  font-size:2rem;
}
.modal-close{
  position:absolute;
  top:10px;
  right:10px;
}
.modal-content p{
  margin:.65rem 0;
  font-size:1.03rem;
  line-height:1.35;
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip{
  background:rgba(242,231,203,.97);
  color:var(--ink);
}
.leaflet-popup-content{
  font-family:"Crimson Text", Georgia, serif;
  margin:10px 12px;
}
.popup-title{
  font-family:"Cormorant Garamond", Georgia, serif;
  font-size:1.35rem;
  line-height:.95;
  margin:0 0 2px;
}
.popup-meta{
  color:#584b3a;
  font-size:.95rem;
}
.current-marker-ring{
  stroke:#eadfb4;
  stroke-width:3;
  fill-opacity:1;
}
.route-line{
  stroke-dasharray:8 10;
  line-cap:round;
}
@media (max-width: 760px){
  #map-title{
    right:10px;
    max-width:none;
  }
  #story-pane{
    top:unset;
    left:10px;
    right:10px;
    bottom:10px;
    width:auto;
    max-height:60vh;
  }
  #filter-pane{
    width:min(300px, calc(100vw - 20px));
    bottom:calc(10px + 60vh + 8px);
  }
}
