:root {
  --hover-scale: 1.2;        /* how much a line and its dots grow on hover */
  --faded: .2;               /* other routes while one is focused */
  --linked: .68;             /* routes linked to the focused one */
  --page: #131917; --surface: #1c2422; --ink: #e9eeeb; --soft: #a3b0ab; --rule: #35403c; --accent: #5fd0bb; --bar: #3fa593;
  color-scheme: dark;         /* dark on screen, light when printed */
  font: 16px/1.55 "Source Sans 3", "Fira Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
main { max-width: 1440px; margin: 0 auto; padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 4rem; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.02em; }
h2 { font-size: 1.65rem; letter-spacing: -.01em; }
h4 { font-size: .95rem; margin-bottom: .3rem; }
p { margin: .4rem 0; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--soft); font-size: .9rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.loading { padding: 3rem 0; color: var(--soft); }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0; }
.chip { background: var(--bg); color: var(--ink); border-radius: 4px; padding: .1rem .5rem; font-size: .84rem; font-weight: 600; border: 1px solid rgb(128 128 128 / .35); }
.chip-note { font-weight: 400; margin-left: .4rem; }
.grade { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stars { color: #f2c94c; white-space: nowrap; font-size: .95rem; }

.danger { display: inline-flex; gap: .35rem; align-items: baseline; background: var(--bg); color: var(--ink); border: 1px solid transparent; border-radius: 999px; padding: .08rem .6rem; font-size: .82rem; font-weight: 700; white-space: nowrap; }
button.danger { cursor: pointer; }
button.danger:hover { text-decoration: underline; }
.danger small { font-weight: 400; }
.danger.nofall { border-color: #ff9aa2; }
.danger-note { border-left: 4px solid #c81e1e; padding-left: .7rem; font-weight: 600; }
.danger-note.nofall { border: 1px solid #ff9aa2; background: #2a0206; color: #fff; padding: .5rem .7rem; border-radius: 6px; }

.spot-head { border-bottom: 1px solid var(--rule); padding-bottom: 1.5rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.2rem, 1fr)); gap: .6rem 1rem; margin: .8rem 0; }
.facts.wide { display: flex; flex-wrap: wrap; gap: .6rem 2.2rem; }
.facts dt { color: var(--soft); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.facts dd small { display: block; font-weight: 400; color: var(--soft); }
.intro { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem 3rem; align-items: start; }
.prose { max-width: 68ch; }
.prose h3 { font-size: 1.12rem; margin-top: 1rem; }
.charts { display: flex; flex-wrap: wrap; gap: 1rem 2rem; }
.chart { margin: 0; }
.chart figcaption { font-weight: 650; font-size: .9rem; margin-bottom: .4rem; }
.bars { display: flex; gap: 0; padding-bottom: 1.5rem; }
.bar { width: 3.3rem; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; height: 78px; border-bottom: 1px solid var(--rule); }
.bar-fill { width: 24px; background: var(--bar); border-radius: 4px 4px 0 0; }
.bar-n { font-size: .82rem; font-variant-numeric: tabular-nums; }
.bar-l { position: absolute; top: 100%; font-size: .78rem; color: var(--soft); white-space: nowrap; padding-top: .15rem; }
.jump { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.jump a { display: flex; gap: .5rem; align-items: baseline; padding: .4rem .8rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; font-weight: 600; }
.jump small { color: var(--soft); font-weight: 400; }

.sector { padding-top: 2.2rem; }
.sector-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.5rem; margin-top: 1rem; align-items: start; }
.photos { display: grid; gap: 1.2rem; }
.side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.topo { margin: 0; }
.topo figcaption { color: var(--soft); font-size: .9rem; padding-top: .35rem; }
.topo-stage { position: relative; border-radius: 8px; overflow: hidden; touch-action: manipulation; }
.topo-stage img { display: block; width: 100%; height: auto; user-select: none; }
.topo-svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.route-line, .dot, .marker, .route-labels { transition: opacity .15s; }
[data-level=faded] { opacity: var(--faded); }
[data-level=linked] { opacity: var(--linked); }
.route-line path { fill: none; stroke-linejoin: round; stroke-linecap: round; transition: stroke-width .12s; }
.route-line .casing { stroke: rgb(0 0 0 / .6); stroke-width: calc(var(--line) + 2.4px); }
.route-line .stroke { stroke: var(--c); stroke-width: var(--line); }
.route-line.hover .casing { stroke-width: calc(var(--line) * var(--hover-scale) + 2.4px); }
.route-line.hover .stroke { stroke-width: calc(var(--line) * var(--hover-scale)); }
.dot, .marker { transform-box: fill-box; transform-origin: center; transition: opacity .15s, transform .12s; }
.dot.hover, .marker.hover { transform: scale(var(--hover-scale)); }
.dot { stroke: #14110a; stroke-width: 1.5; }
.dot.anchor { fill: #ffd60a; }
.dot.hanger { fill: #2f80ff; stroke: #fff; stroke-width: 1.2; }
.dot.natural { fill: #fff; stroke: #2f80ff; stroke-width: 2.6; }
.dot.belay { fill: none; stroke: #ffd60a; stroke-width: 3.2; filter: drop-shadow(0 0 1px #000); }
.marker circle { fill: var(--c); stroke: #14110a; stroke-width: 1.5; }
.marker text { fill: var(--marker-ink, #111); font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.route-labels { display: none; }
.route-labels[data-level=focused] { display: block; }
.route-labels rect { fill: rgb(15 20 18 / .88); }
.route-labels text { fill: #fff; font-weight: 700; text-anchor: middle; dominant-baseline: central; }

.routes { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; }
.row + .row { border-top: 1px solid var(--rule); }
.row { padding: .5rem .7rem; transition: opacity .15s; }
.row.hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.row.focused { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.row.dim { opacity: .55; }
.row.dim:hover { opacity: 1; }
.row-main { display: flex; gap: .6rem; align-items: center; width: 100%; border: 0; background: none; padding: .1rem 0; text-align: left; cursor: pointer; }
.row-name { flex: 1; font-weight: 600; min-width: 0; }
.row-name small { display: block; font-weight: 400; color: var(--soft); }
.row-extra { display: flex; justify-content: space-between; gap: .6rem; padding-left: 2.2rem; }
.swatch { flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--c); color: var(--ink); border: 1.5px solid #14110a; font-size: .82rem; font-weight: 700; }

.panel { background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--c); border-radius: 8px; padding: .9rem 1rem; margin-bottom: 1rem; }
.panel header { display: flex; gap: .6rem; align-items: center; }
.panel h3 { flex: 1; font-size: 1.25rem; }
.panel section { border-top: 1px solid var(--rule); margin-top: .8rem; padding-top: .7rem; }
.panel-badges { display: flex; gap: .8rem; align-items: center; margin-top: .5rem; }
.close { border: 0; background: none; font-size: 1.5rem; line-height: 1; width: 2.2rem; height: 2.2rem; cursor: pointer; border-radius: 6px; }
.close:hover { background: var(--rule); }
.pitches { border-collapse: collapse; width: 100%; font-size: .92rem; }
.pitches td { padding: .22rem .5rem .22rem 0; }
.pitches td:last-child { text-align: right; padding-right: 0; }
.pitches .num { color: var(--soft); }
.gear, .links { list-style: none; margin: 0; padding: 0; }
.gear li { display: flex; justify-content: space-between; gap: 1rem; }
.rappel strong { color: #ff8d8d; }
.link-route { display: flex; gap: .6rem; align-items: center; width: 100%; text-align: left; background: none; border: 1px solid var(--rule); border-radius: 6px; padding: .35rem .6rem; font-weight: 600; cursor: pointer; }
.link-route span:nth-child(2) { flex: 1; }
.link-route:hover { border-color: var(--accent); }
.links li + li { margin-top: .5rem; }

.danger-info { border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); width: min(26rem, calc(100vw - 2rem)); padding: 1rem 1.1rem; box-shadow: 0 12px 40px rgb(0 0 0 / .35); }
.danger-info::backdrop { background: rgb(0 0 0 / .25); }
.pop-head { display: flex; justify-content: space-between; align-items: center; }
.pop-head .danger { font-size: 1rem; }
.pop-subject { font-weight: 650; }
.pop-note { border-left: 4px solid #c81e1e; padding-left: .7rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; margin-top: .8rem; }
.gallery button { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 6px; overflow: hidden; }
.gallery img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.lightbox { border: 0; padding: 0; background: none; max-width: 96vw; max-height: 96vh; cursor: zoom-out; }
.lightbox img { display: block; max-width: 96vw; max-height: 94vh; }
.lightbox::backdrop { background: rgb(0 0 0 / .8); }

@media (max-width: 1000px) {
  .intro { grid-template-columns: minmax(0, 1fr); }
  .sector-grid { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; }
  .panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; margin: 0; max-height: 46vh; overflow-y: auto; border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgb(0 0 0 / .35); }
  .panel header { position: sticky; top: -.9rem; background: var(--surface); padding: .4rem 0; z-index: 1; }
  .has-panel main { padding-bottom: 50vh; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.more { border-top: 1px solid var(--rule); margin-top: .8rem; padding-top: .6rem; }
.more summary { cursor: pointer; font-weight: 650; }
.more h5 { margin: .6rem 0 .1rem; font-size: .9rem; }
.title-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; }
.print-button { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: .45rem .9rem; font-weight: 600; cursor: pointer; }
.print-button:hover { border-color: var(--accent); }
.print-only { display: none; }

@page { size: A4; margin: 13mm; }
@media print {
  :root { --page: #fff; --surface: #fff; --ink: #000; --soft: #444; --rule: #bbb; --accent: #000; --bar: #2a7f72; color-scheme: light; font-size: 10.5pt; line-height: 1.35; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; transition: none !important; }
  main, .has-panel main { padding: 0; max-width: none; }
  .side, .jump, .print-button, .photos-section, .danger-info, .lightbox, .route-labels { display: none !important; }
  .print-only { display: block; }
  body:not([data-print=route]) [data-level] { opacity: 1 !important; }
  body[data-print=route] .route-labels[data-level=focused] { display: block !important; }
  body[data-print=sector] :is(.charts, [data-print-skip]), body[data-print=route] :is(.charts, [data-print-skip]) { display: none; }
  body[data-print=sector] .sector:not(.print-target), body[data-print=route] .sector:not(.print-target) { display: none; }
  body[data-print=sector] .sector, body[data-print=route] .sector { break-before: auto; padding-top: 4mm; }
  body[data-print=route] .topo:not(.print-target), body[data-print=route] .p-route:not(.print-target) { display: none; }
  body[data-print=sector] #app, body[data-print=route] #app { display: flex; flex-direction: column; }
  body[data-print=sector] .p-legend, body[data-print=route] .p-legend { order: 9; }
  .stars { color: #000; }
  .intro { grid-template-columns: minmax(0, 1fr); }
  .sector-grid { display: block; }
  .sector { break-before: page; padding-top: 0; }
  .topo, .p-route, .p-legend, .chart { break-inside: avoid; }
  .topo { margin-bottom: 1mm; max-width: 142mm; }
  .photos { gap: 2mm; }
  h2, h3, h4 { break-after: avoid; }
  .p-route { border-top: 1px solid var(--rule); padding: 2mm 0; }
  .p-route h4 { display: flex; gap: .6rem; align-items: center; font-size: 11.5pt; margin: 0; }
  .p-route h4 span:nth-child(2) { flex: 1; }
  .p-route p { margin: .6mm 0; }
  .p-danger { font-weight: 700; border-left: 1mm solid #c81e1e; padding-left: 2mm; }
  .p-pitches { margin: .6mm 0; padding-left: 6mm; }
  .p-legend { margin-top: 6mm; }
  .p-legend h2 { font-size: 13pt; margin-top: 3mm; }
  .p-dot { display: flex; align-items: center; gap: .6rem; }
  .dot-icon { flex: none; }
}

/* homepage */
#home { display: grid; grid-template: auto minmax(0, 1fr) / 330px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.home-head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; padding: .7rem 1.2rem; border-bottom: 1px solid var(--rule); }
.home-head h1 { font-size: 1.5rem; }
.views { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.views button { border: 0; background: none; padding: .4rem 1.1rem; font-weight: 600; cursor: pointer; }
.views button[aria-pressed=true] { background: var(--accent); color: #06201b; }
.edit-link { margin-left: auto; }
.home-side { overflow-y: auto; padding: 1rem 1.2rem; border-right: 1px solid var(--rule); scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.filter-box > summary { display: none; }
.home-main { min-height: 0; overflow: hidden; }
#mapview { height: 100%; display: flex; flex-direction: column; }
#mapview[hidden], #list[hidden] { display: none; }
#map { flex: 1; min-height: 0; }
#unplaced { margin: 0; padding: .3rem 1rem; }
#unplaced:empty { display: none; }
#list { height: 100%; overflow-y: auto; padding: 1rem 1.4rem 4rem; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.filters { display: grid; gap: .7rem; }
.filters input:not([type=checkbox]), .filters select, .sortbar select { width: 100%; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: .4rem .6rem; font: inherit; }
.frow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.filters label, .sortbar label { font-size: .88rem; color: var(--soft); }
.filters .muted { margin: 0; }
.filters details { border-top: 1px solid var(--rule); padding-top: .5rem; }
.filters summary, .filter-box > summary { cursor: pointer; font-weight: 600; }
.filters .count { margin-left: .5rem; background: var(--accent); color: #06201b; border-radius: 999px; padding: 0 .5rem; font-size: .8rem; }
.fchips { display: flex; flex-wrap: wrap; gap: .35rem; padding-top: .5rem; }
.fchip { border: 1px solid color-mix(in srgb, var(--bg) 70%, #fff); background: none; border-radius: 4px; padding: .15rem .55rem; font-size: .86rem; cursor: pointer; }
.fchip[aria-pressed=true] { background: var(--bg); color: var(--chip-ink); font-weight: 600; }
.clear { justify-self: start; background: none; border: 1px solid var(--rule); border-radius: 6px; padding: .35rem .8rem; cursor: pointer; }
.clear[hidden], .check[hidden] { display: none; }
.sortbar { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; align-items: center; margin-bottom: 1rem; }
.sortbar select { width: auto; margin-left: .5rem; }
.spot-item { border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); margin-bottom: .7rem; }
.spot-item > summary { padding: .8rem 1rem; cursor: pointer; }
.spot-item > summary strong { font-size: 1.15rem; margin-right: .8rem; }
.spot-body { padding: 0 1rem 1rem; }
.spot-body h3 { font-size: 1.05rem; margin: .9rem 0 .2rem; }
.scroll { overflow-x: auto; }
.rtable { border-collapse: collapse; width: 100%; }
.rtable td { padding: .35rem .8rem .35rem 0; border-top: 1px solid var(--rule); white-space: nowrap; }
.rtable td:first-child { width: 40%; white-space: normal; min-width: 9rem; }

/* maps */
.leaflet-container { font: inherit; background: #20292a; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-control-layers { background: var(--surface); color: var(--ink); }
.leaflet-container a { color: var(--accent); }
.leaflet-control-attribution.leaflet-control-attribution { background: rgb(20 26 24 / .85); color: var(--soft); }
.leaflet-popup-content { margin: .7rem .9rem; }
.pin { display: grid; place-items: center; border-radius: 50%; border: 2px solid #fff; color: #fff; font-weight: 700; box-shadow: 0 1px 5px rgb(0 0 0 / .6); background: #b3261e; }
.pin.parking { background: #1f5fa8; border-radius: 7px; }
.pin.sector { background: #0b6b5d; }
.pin span { line-height: 1; }
.zone-label { background: rgb(15 20 18 / .88); color: #fff; border: 0; font-weight: 600; }
.zone-label::before { display: none; }
.preview img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 6px; margin-bottom: .5rem; }
.preview p { margin: .2rem 0 .4rem; }
.spot-map { height: 380px; border-radius: 8px; margin-top: 1.2rem; position: relative; z-index: 0; }
#map { z-index: 0; }
.crumbs { display: flex; justify-content: space-between; margin-bottom: .6rem; }
.filter-note { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid var(--accent); border-radius: 8px; padding: .6rem 1rem; margin-top: 1.2rem; }
.row[hidden] { display: none; }
a.link-route { color: inherit; text-decoration: none; }
a.link-route span:first-child { flex: 1; }
a.link-route span:nth-child(2) { flex: none; }

@media (max-width: 800px) {
  #home { display: block; height: auto; }
  .home-side { border-right: 0; border-bottom: 1px solid var(--rule); padding: .6rem 1rem; }
  .filter-box > summary { display: block; }
  .filter-box[open] > summary { margin-bottom: .6rem; }
  #mapview { height: 70vh; }
  #list { height: auto; padding: 1rem; }
}
@media print { .spot-map, .crumbs, .filter-note { display: none !important; } .row[hidden] { display: block; } }
.leaflet-marker-icon.pin { padding: 0; break-before: auto; }
.leaflet-tooltip { background: rgb(15 20 18 / .92); color: #fff; border: 0; }
.leaflet-tooltip::before { display: none; }
.leaflet-bar a, .leaflet-bar a.leaflet-disabled { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.leaflet-bar a:hover { background: var(--rule); }
.leaflet-control-scale-line { background: rgb(15 20 18 / .8); color: #fff; border-color: #aaa; text-shadow: none; }

#secret { min-height: 80vh; display: grid; place-items: center; }
.secret-form { display: grid; gap: .8rem; width: min(20rem, 100%); }
.secret-form label { display: grid; gap: .3rem; }
.secret-form input, .secret-form button { font: inherit; padding: .55rem .8rem; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.secret-form button { background: var(--accent); color: #06201b; font-weight: 650; cursor: pointer; }
.secret-form p { min-height: 1.6em; margin: 0; }
.hidden-note { color: #ffb86b; }

.site-footer { max-width: 1440px; margin: 0 auto; padding: 1.2rem clamp(1rem, 3vw, 2.5rem) 2rem; border-top: 1px solid var(--rule); color: var(--soft); font-size: .85rem; }
.site-footer p { margin: .3rem 0; }
.home-side .site-footer { padding: 1rem 0 0; margin-top: 1.2rem; }
@media print { .site-footer { border: 0; padding: 4mm 0 0; font-size: 8pt; } }
