/* 9M2 Summits on the Air - Redesigned Stylesheet
   Theme: Mountain peaks + amateur radio. Deep sky blues, summit greens,
   warm amber accents reminiscent of vacuum-tube glow. */

:root {
  --bg: #0b1622;
  --bg-soft: #111f30;
  --bg-card: #15273b;
  --bg-elevated: #1b3149;
  --text: #e8eef5;
  --text-muted: #9fb2c7;
  --text-dim: #6f8499;
  --accent: #4ea8ff;
  --accent-2: #38d39f;
  --accent-3: #ffb454;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1180px;
  --header-h: 68px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

/* Subtle topographic background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(78, 168, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at 0% 10%, rgba(56, 211, 159, 0.08), transparent 60%),
    linear-gradient(180deg, #0b1622 0%, #0a1420 100%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #7cc0ff; text-decoration: underline; }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin-top: 0; }
h3 { font-size: 1.25rem; margin: 0 0 0.5rem; }
h4 { font-size: 1.05rem; margin: 0 0 0.4rem; }

p { margin: 0 0 1rem; }

ul, ol { padding-left: 1.25rem; }
li { margin: 0.3rem 0; }

code { font-family: var(--mono); background: rgba(255,255,255,0.06); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }

/* ---------- Layout ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.page-wrap { min-height: calc(100vh - var(--header-h)); }

.section { padding: 64px 0; }
.section.tight { padding: 36px 0; }

.section-head { max-width: 760px; margin: 0 auto 40px; text-align: center; }
.section-head .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--accent-2);
  font-weight: 600;
  margin-bottom: 10px;
}
.section-head p { color: var(--text-muted); font-size: 1.05rem; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(11, 22, 34, 0.85);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand .logo {
  width: 40px; height: 40px;
  display: block;
  object-fit: cover;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(78,168,255,0.35);
  flex-shrink: 0;
}
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand .brand-text .title { font-size: 0.98rem; }
.brand .brand-text .sub { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.04em; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.nav a:hover { color: var(--text); background: rgba(255,255,255,0.05); text-decoration: none; }
.nav a.active { color: var(--text); background: rgba(78,168,255,0.12); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  width: 42px; height: 42px;
  cursor: pointer;
  font-size: 1.2rem;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 96px 0 80px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px; height: 220px;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none;
}
.hero .container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}
.hero .eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid rgba(56,211,159,0.3);
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero-logo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 20px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 0 0 1px var(--border);
}
.hero h1 { margin: 0 0 18px; }
.hero h1 .accent { color: var(--accent); }
.hero .lead { font-size: 1.15rem; color: var(--text-muted); max-width: 560px; margin-bottom: 28px; }
.hero .tagline { font-style: italic; color: var(--accent-3); margin-bottom: 24px; font-size: 1.05rem; }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #061018; }
.btn-primary:hover { background: #6cb8ff; color: #061018; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); }

/* Hero visual: stylized mountain + signal arcs */
.hero-visual {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 460px;
  margin-left: auto;
}
.hero-visual svg { width: 100%; height: 100%; display: block; }

/* ---------- Cards grid ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}
.card .icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(78,168,255,0.12);
  color: var(--accent);
  font-size: 1.3rem;
  margin-bottom: 6px;
}
.card h3 { margin: 0; }
.card p { color: var(--text-muted); margin: 0; font-size: 0.95rem; flex: 1; }
.card .card-link {
  margin-top: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card .card-link:hover { color: #7cc0ff; text-decoration: none; }

/* ---------- Article / page body ---------- */
.page-hero {
  padding: 56px 0 24px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(700px 300px at 90% 0%, rgba(78,168,255,0.10), transparent 60%);
}
.page-hero .eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 600;
  margin-bottom: 10px;
}
.page-hero h1 { margin: 0 0 12px; }
.page-hero .lead { color: var(--text-muted); font-size: 1.1rem; max-width: 760px; margin: 0; }

.article { padding: 40px 0 64px; }
.article .container { max-width: 880px; }
.article h2 { margin: 40px 0 14px; padding-top: 8px; }
.article h3 { margin: 28px 0 10px; color: #d6e4f5; }
.article h4 { margin: 22px 0 8px; color: #cdd9e8; }
.article p, .article li { color: #d2dde9; }
.article ul, .article ol { margin: 0 0 1.2rem; }
.article a { color: var(--accent); }
.article a.btn-primary { color: #061018; }
.article a.btn-ghost { color: var(--text); }
.article blockquote {
  margin: 1.4rem 0;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  background: rgba(78,168,255,0.06);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}
.article hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }

/* Two-column split for content blocks */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin: 24px 0;
}
.split .panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.split .panel h3 { margin-top: 0; }

/* Callout */
.callout {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: rgba(56,211,159,0.07);
  border: 1px solid rgba(56,211,159,0.25);
  margin: 24px 0;
}
.callout.warn { background: rgba(255,180,84,0.07); border-color: rgba(255,180,84,0.25); }
.callout .ico { font-size: 1.4rem; line-height: 1.2; }
.callout p { margin: 0; }

/* Rules list (numbered) */
.rules { counter-reset: rule; display: grid; gap: 14px; margin: 24px 0; }
.rule {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.rule .num {
  counter-increment: rule;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061018;
  font-weight: 700;
  font-size: 0.95rem;
}
.rule .num::before { content: counter(rule); }
.rule h4 { margin: 0 0 4px; }
.rule p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

/* Award tier cards */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; margin: 24px 0; }
.tier {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
}
.tier .pts { font-size: 2rem; font-weight: 800; color: var(--accent-3); }
.tier .name { font-weight: 700; margin: 4px 0 6px; }
.tier .desc { color: var(--text-muted); font-size: 0.9rem; }

/* Stats strip */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  margin: 32px 0;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
}
.stat .num { font-size: 2.2rem; font-weight: 800; color: var(--accent); }
.stat .label { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; }

/* Timeline (stories) */
.timeline { position: relative; margin: 32px 0; padding-left: 28px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border-strong);
}
.timeline .item { position: relative; margin-bottom: 28px; }
.timeline .item::before {
  content: ""; position: absolute; left: -25px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(78,168,255,0.18);
}
.timeline .date { font-size: 0.8rem; color: var(--accent-2); font-weight: 600; letter-spacing: 0.05em; }
.timeline h3 { margin: 4px 0 6px; }
.timeline p { color: var(--text-muted); margin: 0; font-size: 0.95rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 24px 0; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
thead th {
  text-align: left;
  background: var(--bg-elevated);
  color: var(--text);
  padding: 12px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th.center, tbody td.center { text-align: center; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: #d2dde9; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
.mono { font-family: var(--mono); color: var(--accent-3); }

/* Search input (summits) */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 20px 0; }
.toolbar input, .toolbar select {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: var(--font);
}
.toolbar input { flex: 1; min-width: 200px; }
.toolbar select { min-width: 140px; }
.toolbar input:focus, .toolbar select:focus { outline: 2px solid rgba(78,168,255,0.4); border-color: transparent; }
.toolbar .count { color: var(--text-muted); font-size: 0.9rem; margin-left: auto; white-space: nowrap; }

/* Map */
.map-wrap {
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
#summit-map {
  height: 420px;
  width: 100%;
  background: #eef2f7;
}
.location-status {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.location-status.ok { background: rgba(56,211,159,0.1); border: 1px solid rgba(56,211,159,0.3); color: var(--accent-2); }
.location-status.err { background: rgba(255,100,100,0.1); border: 1px solid rgba(255,100,100,0.3); color: #ff6b6b; }
.dist-col { display: none; }
body.has-location .dist-col { display: table-cell; }
/* PWA install button */
.pwa-install-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent);
  color: #061018;
  border: none;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(78,168,255,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.pwa-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(78,168,255,0.5);
}
.pwa-install-btn:active { transform: translateY(0); }
.pwa-install-btn svg { flex-shrink: 0; }

/* Leaflet theme tweaks */
.leaflet-container { background: #eef2f7; font-family: var(--font); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--bg-card); color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.leaflet-popup-content { margin: 12px 14px; font-size: 0.9rem; line-height: 1.5; }
.leaflet-popup-content strong { color: var(--accent); }
.leaflet-popup-content .popup-code { font-family: var(--mono); color: var(--accent-3); font-size: 0.85rem; }
.leaflet-popup-content .popup-meta { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-muted); }
.leaflet-control-attribution { background: rgba(11,22,34,0.8) !important; color: var(--text-dim) !important; }
.leaflet-control-attribution a { color: var(--text-muted) !important; }
.leaflet-bar a { background: var(--bg-card) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--bg-elevated) !important; }

/* Guestbook / contact form */
.form { display: grid; gap: 16px; max-width: 560px; margin: 24px 0; }
.form label { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }
.form input, .form textarea, .form select {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: var(--font);
  width: 100%;
}
.form input:focus, .form textarea:focus { outline: 2px solid rgba(78,168,255,0.4); border-color: transparent; }
.form textarea { min-height: 130px; resize: vertical; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form .note { font-size: 0.85rem; color: var(--text-dim); }
.form .form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.captcha-row { display: flex; flex-direction: column; gap: 6px; }
.captcha-row label { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }
.captcha-field { display: flex; gap: 8px; align-items: center; }
.captcha-field input { flex: 0 0 140px; }
.captcha-refresh {
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  color: var(--text-muted); border-radius: var(--radius-sm);
  width: 40px; height: 40px; font-size: 1.2rem; cursor: pointer;
  display: grid; place-items: center; transition: all 0.15s;
}
.captcha-refresh:hover { color: var(--accent); border-color: var(--accent); }
.captcha-error { color: #ff6b6b; font-size: 0.85rem; min-height: 1em; }

/* Channel cards (contact) */
.channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 18px; margin: 24px 0; }
.channel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.channel .ico { font-size: 1.6rem; }
.channel h3 { margin: 0; }
.channel p { color: var(--text-muted); margin: 0; font-size: 0.95rem; }
.channel a.btn { align-self: flex-start; margin-top: 6px; }

/* Guestbook entries */
.gb-list { display: grid; gap: 14px; margin: 24px 0; }
.gb-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.gb-entry .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gb-entry .name { font-weight: 700; }
.gb-entry .callsign { color: var(--accent-3); font-family: var(--mono); font-size: 0.9rem; }
.gb-entry .when { color: var(--text-dim); font-size: 0.82rem; }
.gb-entry .msg { color: var(--text-muted); margin: 8px 0 0; }
.gb-empty { color: var(--text-dim); text-align: center; padding: 32px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* CTA band */
.cta-band {
  margin: 56px 0 0;
  padding: 48px 24px;
  text-align: center;
  background: linear-gradient(135deg, rgba(78,168,255,0.12), rgba(56,211,159,0.08));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.cta-band h2 { margin: 0 0 10px; }
.cta-band p { color: var(--text-muted); margin: 0 auto 22px; max-width: 560px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 28px;
  margin-top: 40px;
  background: rgba(8, 16, 26, 0.6);
}
.site-footer .container {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
}
.site-footer h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin: 0 0 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 6px 0; }
.site-footer a { color: var(--text-muted); font-size: 0.9rem; }
.site-footer a:hover { color: var(--text); }
.site-footer .brand { margin-bottom: 12px; }
.site-footer .desc { color: var(--text-muted); font-size: 0.9rem; max-width: 320px; }
.footer-bottom {
  max-width: var(--maxw);
  margin: 28px auto 0;
  padding: 18px 24px 0;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-bottom .credit a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.footer-bottom .credit a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero .container { grid-template-columns: 1fr; }
  .hero-visual { max-width: 360px; margin: 8px auto 0; order: 2; }
  .site-footer .container { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .nav {
    position: fixed;
    top: var(--header-h);
    right: 0;
    width: min(320px, 86vw);
    height: calc(100vh - var(--header-h));
    background: var(--bg-soft);
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 4px;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }
  .nav.open { transform: translateX(0); }
  .nav a { padding: 12px 14px; font-size: 0.98rem; }
  .nav-toggle { display: grid; place-items: center; }
  .form .row { grid-template-columns: 1fr; }
  .site-footer .container { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .section { padding: 44px 0; }
  .hero { padding: 64px 0 56px; }
  .container { padding: 0 18px; }
  .brand .brand-text .sub { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
