:root {
  --bg: #0e1215; --panel: #151b20; --line: #263039; --text: #e3e8ea; --dim: #8a979f;
  --done: #46c27a; --done-ring: #0f3d24; --todo: #9aa5ad; --accent: #46c27a; --link: #7cc7ff;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
.dim { color: var(--dim); }

header, main, footer { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
header { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: end; justify-content: space-between; padding-top: 20px; padding-bottom: 16px; }
h1 { margin: 0; font-size: 1.9rem; font-weight: 700; letter-spacing: 0.01em; display: flex; align-items: center; gap: 10px; }
.mark { width: 40px; height: 40px; background: url(/favicon.svg?v=5) center / contain no-repeat; }
.sub { margin: 2px 0 0; color: var(--dim); }
.progress { min-width: min(100%, 320px); }
.progress p { margin: 0 0 6px; font-size: 1.05rem; }
.progress strong { color: var(--accent); font-size: 1.4rem; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width 0.6s ease; }

.map-wrap { position: relative; }
#map { height: min(72vh, 760px); min-height: 380px; border-radius: 8px; border: 1px solid var(--line); background: #a9ddef; }
/* where there are no tiles, show the sea colour of the current layer (OS sea; satellite's dark ocean) */
#map.sat { background: #0c1b2c; }
.legend {
  position: absolute; left: 56px; top: 10px; z-index: 500; display: flex; gap: 14px;
  background: rgba(14, 18, 21, 0.85); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 0.85rem;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.done { background: var(--done); border: 1.6px solid var(--done-ring); }
.dot.todo { background: #fbe98a; border: 1.6px solid #8a7420; }

section h2 { font-size: 1rem; margin: 22px 0 8px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; cursor: pointer;
}
.chips button b { color: var(--accent); margin-left: 4px; }
.chips button.on { border-color: var(--accent); background: #173022; }
.chips button:disabled { opacity: 0.35; cursor: default; }
.chips button:focus-visible, .seg button:focus-visible, th button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 22px 0 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; color: var(--text); background: var(--panel); border: 0; padding: 6px 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: #173022; color: var(--accent); font-weight: 600; }
#area {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px;
}
#search {
  flex: 1 1 220px; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px;
}

/* fixed column widths, so switching All / Climbed / Not Climbed (or area) doesn't make the columns jump */
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th.num { width: 6.5rem; }
th.area-col { width: 9.5rem; }
th.when-col { width: 9rem; }
td { overflow-wrap: anywhere; }
th { text-align: left; border-bottom: 1px solid var(--line); }
th button { font: inherit; font-weight: 600; color: var(--dim); background: none; border: 0; padding: 8px 6px; cursor: pointer; }
th button[aria-sort]::after { content: " ▲"; font-size: 0.7em; }
th button[aria-sort="descending"]::after { content: " ▼"; }
td { padding: 7px 6px; border-bottom: 1px solid #1c242b; vertical-align: top; }
tr.row { cursor: pointer; }
tr.row:hover td { background: #161e24; }
td.num, th.num { text-align: right; }
td.when { white-space: nowrap; }
td.when.done { color: var(--accent); }
td .tick { color: var(--accent); margin-right: 4px; }
.gaelic { display: block; color: var(--dim); font-size: 0.85em; }
.hill-name { font: inherit; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.hill-name:hover, .hill-name:focus-visible { text-decoration: underline; }
.wh {
  display: inline-block; margin-left: 8px; padding: 0 7px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.75em; line-height: 1.6; vertical-align: 1px; white-space: nowrap; background: var(--panel);
}
.wh:hover, .wh:focus-visible { text-decoration: none; border-color: var(--link); }

footer { text-align: center; color: var(--dim); font-size: 0.85rem; padding-top: 24px; padding-bottom: 32px; }
footer p { margin: 4px 0; }

/* map popups and controls in the page's colours */
.leaflet-container { font: 14px/1.4 var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 10px 14px; }
.leaflet-popup-content h3 { margin: 0 0 2px; font-size: 1.05rem; }
.leaflet-popup-content p { margin: 2px 0; }
.leaflet-popup-content .when { color: var(--accent); font-weight: 600; }
.leaflet-popup-content .when.todo { color: var(--dim); font-weight: 400; }
.leaflet-container a.leaflet-popup-close-button { color: var(--dim); }
.leaflet-control-layers, .leaflet-bar a { background: var(--panel); color: var(--text); border-color: var(--line); }
.leaflet-control-layers { border: 1px solid var(--line) !important; }
.leaflet-bar a:hover, .leaflet-bar a:focus { background: #1d262d; color: var(--text); }
.leaflet-bar a:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.leaflet-control-attribution { background: rgba(14, 18, 21, 0.8) !important; color: var(--dim); }
.leaflet-control-attribution a { color: var(--link); }

@media (max-width: 600px) {
  .area-col, td.area { display: none; }
  h1 { font-size: 1.6rem; }
  #map { height: 62vh; }
}

/* layer-switcher icon drawn inline (Leaflet's own PNG isn't shipped) */
.leaflet-control-layers-toggle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e3e8ea' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12 4 3 9l9 5 9-5z'/%3E%3Cpath d='m3 14 9 5 9-5'/%3E%3C/svg%3E") !important;
  background-size: 24px 24px !important;
}
.leaflet-control-layers-expanded { padding: 8px 12px; }
.leaflet-control-layers-separator { border-top-color: var(--line); }

/* hill dots on the map (Leaflet divIcon markers; same look as the legend) */
.leaflet-marker-icon.hill { border-radius: 50%; box-sizing: border-box; }
.leaflet-marker-icon.hill.done { background: var(--done); border: 1.6px solid var(--done-ring); }
.leaflet-marker-icon.hill.todo { background: #fbe98a; border: 1.6px solid #8a7420; }
.leaflet-marker-icon.hill.faded { opacity: 0.25; }

.seg button .n { color: var(--dim); font-weight: 400; }
.seg button.on .n { color: inherit; opacity: 0.8; }

/* OS API branding: the logo at OS's size (90 x 24), only while the OS layer shows */
.leaflet-control.os-logo { width: 90px; height: 24px; background: url(/os/os-logo-maps.svg) center / contain no-repeat; pointer-events: none; }
#map.sat .os-logo { display: none; }
/* keep the OS logo and scale bar clear of the copyright strip, however many lines it wraps to */
.leaflet-bottom.leaflet-left { bottom: var(--attr-h, 0px); }

/* full-screen map: browser full screen, or the fallback that fills the window */
.map-wrap:fullscreen, .map-wrap.full { background: var(--bg); }
.map-wrap:fullscreen #map, .map-wrap.full #map { height: 100%; min-height: 0; border-radius: 0; border: 0; }
.map-wrap:fullscreen { width: 100vw; height: 100vh; }
.map-wrap.full { position: fixed; inset: 0; z-index: 2000; height: 100dvh; }
body.map-full { overflow: hidden; }
.leaflet-bar a.fs-btn { display: flex; align-items: center; justify-content: center; }
