/* ferrata viewer — personal use */
* { box-sizing: border-box; }
:root {
  --bg: #14161a; --panel: #1d2026; --panel2: #23272f; --text: #e8e6e1;
  --muted: #9a978f; --accent: #e0862c; --line: #2e333c;
  --grade: #4a7c59;
}
body { margin: 0; font: 15px/1.55 -apple-system, "Helvetica Neue", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }

.topbar { display: flex; align-items: baseline; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 20; }
.brand { font-size: 20px; font-weight: 700; color: var(--text); }
.tagline { color: var(--muted); font-size: 12px; }
main { max-width: 1200px; margin: 0 auto; padding: 18px 20px 60px; }
.loading { color: var(--muted); }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters input[type="search"] { flex: 1 1 220px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.filters select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.gradechips { display: flex; gap: 4px; }
.gradechips button { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; font-weight: 600; }
.gradechips button.on { background: var(--grade); color: #fff; border-color: var(--grade); }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }

/* card grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: block; color: var(--text); transition: transform .08s; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.cardmain { display: block; color: var(--text); }
.gmapsbtn { position: absolute; right: 8px; bottom: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-size: 15px; line-height: 1.4; }
.gmapsbtn:hover { border-color: var(--accent); }
.card .thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--panel2); display: block; }
.card .body { padding: 10px 12px 12px; }
.card h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.3; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); align-items: center; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 5px; font-weight: 700; font-size: 12px; background: var(--grade); color: #fff; }
.flag { font-size: 13px; }

/* detail */
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); }
.detail h1 { margin: 0 0 4px; font-size: 26px; }
.detail .subtitle { color: var(--muted); margin-bottom: 14px; }
.langtoggle { float: right; display: flex; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.langtoggle button { border: 0; background: var(--panel); color: var(--muted); padding: 6px 14px; cursor: pointer; font-weight: 600; }
.langtoggle button.on { background: var(--accent); color: #14161a; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 14px 0 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat .v { font-size: 17px; font-weight: 700; }
.season { display: flex; gap: 3px; }
.season span { flex: 1; text-align: center; font-size: 10px; padding: 3px 0; border-radius: 4px; background: var(--panel2); color: var(--muted); }
.season span.on { background: var(--grade); color: #fff; }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.section { margin-bottom: 18px; }
.section h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin: 0 0 6px; }
.section p { margin: 0 0 10px; white-space: pre-line; }
.side .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
#map { height: 340px; border-radius: 8px; }
.downloads { display: flex; gap: 10px; flex-wrap: wrap; }
.downloads a { background: var(--panel2); border: 1px solid var(--line); padding: 7px 12px; border-radius: 8px; font-size: 13px; }
#gmapslink, #gmapsroutelink { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.topo img { max-width: 100%; border-radius: 8px; cursor: zoom-in; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; cursor: pointer; }

/* lightbox */
#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 50; display: flex; align-items: center; justify-content: center; }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 92vw; max-height: 84vh; border-radius: 6px; }
#lightbox .lb-caption { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #ddd; font-size: 13px; padding: 0 40px; }
#lightbox button { position: absolute; background: none; border: 0; color: #fff; font-size: 34px; cursor: pointer; padding: 20px; }
.lb-close { top: 6px; right: 10px; }
.lb-prev { left: 6px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 6px; top: 50%; transform: translateY(-50%); }
