/* Beers & Hills: style B, 1930s railway poster. Fixed palette, like a printed sheet. */
:root {
  --ink: #1f3340;
  --ink-2: #2b4555;
  --paper: #f1e4c8;
  --paper-2: #e7d6b0;
  --mustard: #f0b23e;
  --water: #4b86a8;
  --display: "Big Shoulders Display", Impact, "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --tabbar: 0px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ink);
  color: var(--ink);
  font: 500 16px/1.4 var(--body);
  min-height: 100dvh;
  padding-bottom: var(--tabbar);
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }

/* ---------------------------------------------------------- title bar + menu */
.titlebar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--ink); color: var(--paper);
  padding: .55rem clamp(.8rem, 2vw, 1.5rem) .5rem;
  border-bottom: 3px solid var(--mustard);
}
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1; }
.brand-title {
  font: 800 clamp(1.9rem, 5vw, 2.8rem)/0.95 var(--display);
  text-transform: uppercase; letter-spacing: .02em;
}
.brand-sub {
  font: 700 clamp(.7rem, 1.6vw, .9rem)/1.2 var(--display);
  color: var(--mustard); text-transform: uppercase; letter-spacing: .28em; margin-top: .25rem;
}
.menu { display: flex; gap: .25rem; }
.menu a, .menu .soon {
  font: 700 1.15rem/1 var(--display); text-transform: uppercase; letter-spacing: .12em;
  text-decoration: none; padding: .55rem .8rem; border: 2px solid transparent;
}
.menu a:hover { border-color: var(--paper); }
.menu a[aria-current="page"] { background: var(--mustard); color: var(--ink); }
.menu .soon { opacity: .4; cursor: not-allowed; }

@media (max-width: 760px) {
  :root { --tabbar: calc(3.6rem + env(safe-area-inset-bottom)); }
  .menu {
    position: fixed; z-index: 20; inset: auto 0 0 0; height: var(--tabbar);
    background: var(--ink); border-top: 3px solid var(--mustard);
    padding: .3rem .3rem env(safe-area-inset-bottom); justify-content: space-around; gap: 0;
  }
  .menu a, .menu .soon {
    flex: 1; display: grid; place-items: center; font-size: 1rem; letter-spacing: .08em; padding: .4rem .2rem;
  }
  .brand-sub { letter-spacing: .18em; }
}

/* ---------------------------------------------------------- map page layout */
.page-map { height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.map-layout { display: flex; min-height: 0; }
.map-wrap { position: relative; flex: 1; min-width: 0; border: 5px solid var(--paper); border-width: 5px 5px 0; }
.stage {
  position: absolute; inset: 0; overflow: hidden; background: var(--ink);
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.stage.dragging { cursor: grabbing; }
#map { width: 100%; height: 100%; display: block; }

/* base map: strokes keep a fixed screen width as you zoom */
#rivers { vector-effect: non-scaling-stroke; stroke-width: 1px; stroke-opacity: .85; }
#map .line { vector-effect: non-scaling-stroke; }
#map[data-tier="0"] #road { stroke-width: 1.1px; }
#water path:first-child { vector-effect: non-scaling-stroke; stroke-width: 2px; }
#map .place.village, #map .lake-label { display: none; }
#map[data-tier="1"] .lake-label,
#map[data-tier="2"] .lake-label, #map[data-tier="3"] .lake-label,
#map[data-tier="2"] .place.village, #map[data-tier="3"] .place.village { display: inline; }
#map[data-tier="0"] .place.town text { font-size: 11px; }

/* fells */
.fell { cursor: pointer; }
.fell .hit { fill: transparent; }
.fell .peak { stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
/* still to bag: pale dashed outline, like the poster */
.fell .peak.todo { fill: #fffaf0; fill-opacity: .45; stroke: #fffaf0; stroke-width: 1.5; stroke-dasharray: 2.5 1.8; }
#map[data-tier="2"] .fell .peak.todo, #map[data-tier="3"] .fell .peak.todo { stroke: var(--ink); stroke-opacity: .55; }
.fell .pole { stroke: var(--ink); stroke-width: 1.3; }
.fell .pennant { fill: var(--mustard); stroke: var(--ink); stroke-width: .8; }
.fell .lbl {
  display: none; font: 700 10.5px var(--display); letter-spacing: .07em; text-anchor: middle;
  fill: var(--ink); stroke: var(--paper); stroke-width: 3px; paint-order: stroke; pointer-events: none;
}
#map[data-tier="1"] .fell.t0 .lbl,
#map[data-tier="2"] .fell:is(.t0, .t1) .lbl,
#map[data-tier="3"] .fell .lbl { display: inline; }
.fell:is(:hover, :focus-visible) .lbl, .fell.sel .lbl { display: inline; }
.fell:focus-visible { outline: none; }
.fell:is(:hover, :focus-visible) .peak, .fell.sel .peak { stroke: var(--mustard); stroke-width: 2.6; stroke-dasharray: none; }
.fell.sel .lbl { fill: var(--paper); stroke: var(--ink); }

.map-tools {
  position: absolute; top: .7rem; right: .7rem; display: flex; flex-direction: column; gap: .35rem; z-index: 5;
}
.tool {
  min-width: 2.75rem; height: 2.75rem; padding: 0 .7rem; border: 2px solid var(--paper);
  background: var(--ink); color: var(--paper); cursor: pointer;
  font: 800 1.35rem/1 var(--display); text-transform: uppercase; letter-spacing: .08em;
}
.tool:hover { background: var(--ink-2); }
.tool.wide-only { font-size: 1rem; }
.tool[aria-expanded="true"] { background: var(--mustard); color: var(--ink); }
@media (max-width: 899px) { .wide-only { display: none; } }

/* fell card: bottom sheet on phones, side panel on laptops */
.card {
  position: absolute; z-index: 10; left: .6rem; right: .6rem; bottom: .6rem;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  padding: .9rem 1rem 1rem; max-height: 55%; overflow: auto;
}
@media (min-width: 900px) {
  .card { right: auto; left: .7rem; top: .7rem; bottom: auto; width: 21rem; max-height: calc(100% - 1.4rem); }
}
.card h2 { margin: .1rem 0 .2rem; font: 800 2rem/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.card-book {
  margin: 0; font: 700 .85rem/1 var(--display); letter-spacing: .16em; text-transform: uppercase;
  display: flex; align-items: center; gap: .4rem;
}
.card-book::before { content: ""; width: .8rem; height: .8rem; background: var(--book); border: 1.5px solid var(--ink); }
.card-meta { margin: .2rem 0 .6rem; }
.card-status { margin: 0; padding: .45rem .6rem; font: 700 1.05rem/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.card-status.bagged { background: var(--ink); color: var(--paper); display: flex; gap: .5rem; align-items: center; }
.card-status.todo { border: 2px dashed var(--ink); }
.card details { margin-top: .5rem; }
.card ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.card-close {
  position: absolute; top: .3rem; right: .3rem; width: 2.5rem; height: 2.5rem;
  border: 0; background: transparent; font: 800 1.8rem/1 var(--display); cursor: pointer;
}
.pennant { display: inline-block; width: .8rem; height: .6rem; background: var(--mustard); clip-path: polygon(0 0, 100% 50%, 0 100%); }

.load-error { position: absolute; inset: auto 1rem 1rem; background: var(--paper); padding: 1rem; border: 3px solid #b5452f; }

/* ---------------------------------------------------------- tally band */
.tally {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .3rem 1rem;
  background: var(--ink); color: var(--paper); padding: .55rem clamp(.8rem, 2vw, 1.5rem) .45rem;
  border-top: 3px solid var(--mustard);
}
.legend {
  list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem .5rem;
  font: 700 .72rem/1.1 var(--display); text-transform: uppercase; letter-spacing: .1em;
}
.legend li { display: grid; justify-items: center; text-align: center; width: 4.6rem; gap: .15rem; }
.legend .swatch { width: 2.4rem; height: 1.9rem; border: 2px solid var(--paper); }
.legend b { color: var(--mustard); font-weight: 700; font-size: .85rem; }
.chip { display: inline-block; width: .85rem; height: .85rem; border: 1.5px solid var(--paper); flex: none; }
.tally-count { margin: 0; text-align: right; line-height: .9; }
.tally-big {
  display: block; font: 800 clamp(2rem, 6.4vw, 3.6rem)/.9 var(--display); color: var(--mustard);
  text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
}
.tally-label { display: block; margin-top: .3rem; font: 700 .9rem/1 var(--display); text-transform: uppercase; letter-spacing: .2em; white-space: nowrap; }
.demo-flag { color: var(--mustard); }
.credits { grid-column: 1 / -1; font-size: .78rem; opacity: .8; }
.credits summary { cursor: pointer; font: 700 .8rem var(--display); letter-spacing: .16em; text-transform: uppercase; }
.credits p { margin: .3rem 0 .2rem; }
@media (max-width: 760px) {
  .tally { grid-template-columns: 1fr; gap: .35rem; }
  .tally-count { text-align: left; display: flex; align-items: baseline; gap: .7rem; }
  .tally-label { margin: 0; }
  .legend { gap: .25rem; justify-content: space-between; font-size: .58rem; letter-spacing: .04em; }
  .legend li { width: auto; flex: 1; }
  .legend .lg-name { display: none; }
  .legend .swatch { width: 100%; max-width: 2.4rem; height: 1.1rem; }
}

/* ---------------------------------------------------------- The List (page + panel) */
.list-panel {
  width: 27rem; flex: none; overflow: auto; background: var(--paper);
  border: 5px solid var(--paper); border-right: 0; border-bottom: 0;
}
.panel-title { margin: 0; padding: .6rem .8rem; background: var(--ink); color: var(--mustard);
  font: 800 1.5rem/1 var(--display); text-transform: uppercase; letter-spacing: .1em; }
.list-panel .list-body { padding: .6rem .7rem 1rem; }
@media (max-width: 899px) { .list-panel { display: none; } }

.page-list { background: var(--paper); }
.list-page { max-width: 52rem; margin: 0 auto; padding: 1rem clamp(.7rem, 3vw, 1.5rem) 2rem; }
.page-title { margin: .3rem 0 .8rem; font: 800 clamp(2.2rem, 7vw, 3.4rem)/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.page-title span { display: block; font-size: .38em; letter-spacing: .26em; color: #8a5a12; margin-top: .3rem; }

.list-controls { display: grid; gap: .5rem; margin-bottom: .5rem; }
.list-search {
  width: 100%; padding: .65rem .75rem; border: 3px solid var(--ink); background: #fbf4e4; font-size: 1.05rem;
}
.seg { display: flex; }
.seg button {
  flex: 1; padding: .55rem .6rem; white-space: nowrap; border: 3px solid var(--ink); margin-left: -3px; background: transparent; cursor: pointer;
  font: 700 1.05rem/1 var(--display); text-transform: uppercase; letter-spacing: .1em;
}
.seg button:first-child { margin-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--mustard); }
.list-selects { display: flex; gap: .5rem; flex-wrap: wrap; }
.list-selects label {
  display: flex; align-items: center; gap: .4rem; flex: 1;
  font: 700 .95rem var(--display); text-transform: uppercase; letter-spacing: .1em;
}
.list-selects select { flex: 1; padding: .45rem; border: 2px solid var(--ink); background: #fbf4e4; min-height: 2.6rem; }
.list-count { margin: .2rem 0 .4rem; font: 700 .9rem var(--display); text-transform: uppercase; letter-spacing: .14em; color: #6b5a3a; }

.timetable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.timetable thead th {
  position: sticky; top: 0; background: var(--ink); color: var(--paper); text-align: left;
  padding: .45rem .5rem; font: 700 .9rem var(--display); text-transform: uppercase; letter-spacing: .14em;
}
.timetable td { padding: .45rem .5rem; border-bottom: 1px dotted #a8916a; }
.timetable tbody tr { cursor: pointer; }
.timetable tbody tr:nth-child(even) { background: #ead9b6; }
.timetable tbody tr:hover { background: #f6e9c9; box-shadow: inset 4px 0 0 var(--mustard); }
.timetable .num { text-align: right; white-space: nowrap; }
.timetable .bk { text-align: center; width: 3rem; }
.timetable .fell { font-weight: 600; }
.timetable .fell a { text-decoration: none; }
.timetable .fell .chip { border-color: var(--ink); margin-right: .45rem; vertical-align: -1px; }
.timetable .date { white-space: nowrap; }
.timetable .date .pennant { margin-right: .35rem; outline: 1px solid var(--ink); }
.timetable .todo { color: #8a7a5a; }
.timetable tr.is-bagged .fell a { text-decoration: underline 2px var(--mustard); text-underline-offset: 3px; }
.timetable .empty { text-align: center; padding: 1.5rem; }
.credits-line { font-size: .8rem; color: #6b5a3a; margin-top: 1rem; }
@media (min-width: 640px) {
  .list-controls { grid-template-columns: 1fr auto; }
  .list-selects { grid-column: 1 / -1; }
}
