:root {
  --bg: #0f1215;
  --bg-2: #141922;
  --panel: #171c24;
  --panel-2: #1d232d;
  --line: #2a313c;
  --line-2: #39424f;
  --ink: #dfe4ea;
  --ink-dim: #9aa4b1;
  --ink-faint: #6e7886;
  --amber: #e2873f;
  --amber-dim: #a9632c;
  --ice: #74a9c9;
  --green: #6fbf8b;
  --red: #d9705f;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--ice); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #11161d 0%, var(--bg) 100%);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(8px);
}

.masthead-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 62px;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

.brand { display: flex; align-items: baseline; gap: 9px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { font-family: var(--serif); font-size: 1.22rem; color: var(--ink); letter-spacing: -0.015em; }
.brand-mark b { font-weight: 600; }
.brand-sub {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}

.nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: var(--ink-dim);
  font-size: 0.875rem;
  padding: 7px 11px;
  border-radius: 5px;
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--panel-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--amber); background: rgba(226,135,63,0.09); }

.nav-toggle {
  display: none;
  margin-left: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 6px;
  padding: 7px 11px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ---------- page furniture ---------- */

main { padding-bottom: 72px; }

.page-head { padding: 46px 0 28px; border-bottom: 1px solid var(--line); margin-bottom: 34px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 10px;
}
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.95rem, 4.4vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.35rem, 2.6vw, 1.72rem);
  letter-spacing: -0.015em;
  margin: 40px 0 14px;
}
h3 { font-size: 1.05rem; font-weight: 600; margin: 26px 0 8px; }
.lede { font-size: 1.08rem; color: var(--ink-dim); max-width: 68ch; margin: 0; }

p { margin: 0 0 16px; }
.prose { max-width: 70ch; }
.prose p { color: #cdd4dc; }
.prose ul, .prose ol { color: #cdd4dc; padding-left: 20px; }
.prose li { margin-bottom: 7px; }

hr { border: 0; border-top: 1px solid var(--line); margin: 38px 0; }

/* ---------- hero ---------- */

.hero { position: relative; border-bottom: 1px solid var(--line); }
.hero-img { width: 100%; height: clamp(300px, 52vh, 520px); object-fit: cover; filter: saturate(0.85) brightness(0.62); }
.hero-overlay {
  position: absolute;
  inset: auto 0 0 0;
  background: linear-gradient(180deg, transparent, rgba(15,18,21,0.93) 72%);
  padding: 72px 0 32px;
}
.hero h1 { margin-bottom: 10px; max-width: 18ch; }
.hero .lede { color: #c3ccd6; }

/* ---------- grids & cards ---------- */

.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(286px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-figure { aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-2); }
.card-figure img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.card:hover .card-figure img { transform: scale(1.035); }
.card-body { padding: 15px 17px 17px; flex: 1; display: flex; flex-direction: column; }
.card-title { font-family: var(--serif); font-size: 1.16rem; margin: 0 0 3px; letter-spacing: -0.01em; }
.card-title a { color: var(--ink); }
.card-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 9px;
}
.card-note { font-size: 0.89rem; color: var(--ink-dim); margin: 0; }

/* ---------- stat strip ---------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  margin: 28px 0;
}
.stat { background: var(--panel); padding: 16px 18px; }
.stat-value { font-family: var(--mono); font-size: 1.42rem; color: var(--amber); line-height: 1.15; }
.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-top: 4px;
}

/* ---------- register controls ---------- */

.controls {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.control-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ink-faint);
}
.field input[type="search"], .field input[type="text"], .field select {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.9rem;
  min-width: 158px;
}
.field input:focus, .field select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}
.field input[type="range"] { width: 190px; accent-color: var(--amber); }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.seg button {
  background: var(--bg-2);
  border: 0;
  color: var(--ink-dim);
  padding: 8px 13px;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--amber); color: #15181c; font-weight: 600; }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 13px;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink-faint); }
.btn-ghost { background: transparent; }

.result-count {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 0 0 14px;
}

/* ---------- register table ---------- */

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
table.register { width: 100%; border-collapse: collapse; font-size: 0.89rem; min-width: 780px; }
table.register th, table.register td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--line); }
table.register thead th {
  background: var(--panel-2);
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.register thead th:hover { color: var(--ink); }
table.register thead th[aria-sort="ascending"]::after { content: " ▲"; color: var(--amber); font-size: 0.7em; }
table.register thead th[aria-sort="descending"]::after { content: " ▼"; color: var(--amber); font-size: 0.7em; }
table.register tbody tr:hover { background: var(--panel); }
table.register tbody tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); text-align: right; white-space: nowrap; }
td.peak-name { font-weight: 600; }
td.peak-name small { display: block; font-weight: 400; color: var(--ink-faint); font-size: 0.82em; }

.empty-state { padding: 44px 20px; text-align: center; color: var(--ink-faint); }

/* ---------- peak cards (register) ---------- */

.peak-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.peak-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.peak-card h3 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 1.2rem; letter-spacing: -0.01em; }
.peak-card h3 small { display: block; font-family: var(--sans); font-size: 0.74rem; color: var(--ink-faint); letter-spacing: 0; }
.peak-elev { font-family: var(--mono); font-size: 1.04rem; color: var(--amber); white-space: nowrap; }
.peak-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 0.82rem; }
.peak-facts dt { color: var(--ink-faint); }
.peak-facts dd { margin: 0; color: var(--ink-dim); }
.peak-note { font-size: 0.86rem; color: var(--ink-dim); margin: 0; }

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--line-2);
  color: var(--ink-dim);
}
.badge.trek { border-color: #3c6b4e; color: #7cc496; }
.badge.alpine { border-color: #3c5a78; color: #85b4d8; }
.badge.technical { border-color: #6b5230; color: #d9a05f; }
.badge.bigwall { border-color: #74433a; color: #dd8a76; }
.badge.expedition { border-color: #6a3a63; color: #cb8cc2; }
.badge.unclimbed { border-color: var(--line-2); color: var(--ink-faint); }

/* ---------- compare tray ---------- */

.tray {
  position: sticky;
  bottom: 0;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  padding: 14px 18px;
  margin-top: 26px;
  z-index: 40;
}
.tray[hidden] { display: none; }
.tray-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tray-head h3 { margin: 0; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.11em; color: var(--ink-dim); }
.tray-head .btn { margin-left: auto; }
.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.compare-col { border: 1px solid var(--line); border-radius: 7px; padding: 11px 13px; background: var(--panel); }
.compare-col h4 { margin: 0 0 7px; font-size: 0.95rem; font-family: var(--serif); font-weight: 500; }
.compare-col dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 0.79rem; margin: 0; }
.compare-col dt { color: var(--ink-faint); }
.compare-col dd { margin: 0; font-family: var(--mono); }
.compare-bar { margin-top: 9px; }
.compare-bar svg { width: 100%; height: 46px; display: block; }

.cmp-btn {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink-faint);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  line-height: 1;
  font-size: 1rem;
  cursor: pointer;
  flex: none;
}
.cmp-btn[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: #15181c; }

/* ---------- generic data table ---------- */

table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 18px 0; }
table.data caption { text-align: left; color: var(--ink-faint); font-size: 0.8rem; padding-bottom: 8px; }
table.data th, table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data thead th {
  background: var(--panel-2);
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-dim);
}
table.data tbody tr:hover { background: var(--panel); }
table.data td.mono { font-family: var(--mono); }

/* ---------- callout ---------- */

.callout {
  border-left: 3px solid var(--amber);
  background: var(--panel);
  padding: 14px 18px;
  border-radius: 0 7px 7px 0;
  margin: 24px 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout.ice { border-left-color: var(--ice); }

/* ---------- converter ---------- */

.converter { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 20px; margin: 24px 0; }
.converter-out {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  margin-top: 18px;
}
.converter-out div { background: var(--bg-2); padding: 13px 15px; }
.converter-out .k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }
.converter-out .v { font-family: var(--mono); font-size: 1.22rem; color: var(--amber); margin-top: 3px; }

/* ---------- season matrix ---------- */

.matrix-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
table.matrix { border-collapse: collapse; width: 100%; font-size: 0.82rem; min-width: 760px; }
table.matrix th, table.matrix td { border: 1px solid var(--line); padding: 7px 9px; text-align: center; }
table.matrix th:first-child, table.matrix td:first-child { text-align: left; white-space: nowrap; font-weight: 600; }
table.matrix thead th { background: var(--panel-2); font-family: var(--mono); font-size: 0.72rem; color: var(--ink-dim); font-weight: 500; }
td.s-prime { background: rgba(111,191,139,0.26); color: #cdeed9; }
td.s-ok    { background: rgba(226,135,63,0.20); color: #f0cba6; }
td.s-poor  { background: rgba(217,112,95,0.16); color: #e6b2a8; }
td.s-no    { background: var(--bg-2); color: var(--ink-faint); }
table.matrix tr.dim td:not(:first-child) { opacity: 0.22; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 14px 0 0; font-size: 0.8rem; color: var(--ink-dim); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 13px; height: 13px; border-radius: 3px; border: 1px solid var(--line-2); }

/* ---------- route diagram ---------- */

.diagram { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 20px; margin: 26px 0; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram figcaption { font-size: 0.8rem; color: var(--ink-faint); margin-top: 12px; }

/* ---------- 404 ---------- */

.err { text-align: center; padding: 92px 20px 72px; }
.err-code { font-family: var(--mono); font-size: 4.4rem; color: var(--amber); line-height: 1; letter-spacing: -0.03em; }
.err h1 { margin: 18px 0 10px; }
.err .lede { margin: 0 auto 26px; }
.err-links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- footer ---------- */

.foot { border-top: 1px solid var(--line); background: var(--bg-2); padding: 34px 0 42px; font-size: 0.86rem; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 26px; }
.foot h4 { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-faint); margin: 0 0 9px; font-weight: 600; }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { margin-bottom: 5px; }
.foot a { color: var(--ink-dim); }
.foot a:hover { color: var(--ink); }
.foot-note { color: var(--ink-faint); margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.8rem; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 8px 14px 14px;
    gap: 0;
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 8px; border-radius: 0; border-bottom: 1px solid var(--line); }
  .control-row { flex-direction: column; align-items: stretch; }
  .field input, .field select { min-width: 0; width: 100%; }
  .field input[type="range"] { width: 100%; }
  .hero-overlay { padding-top: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
