/* ── Variables (match dashboard) ───────────────────────────────────────── */
:root {
    --bg-dark:       #0e1612;
    --bg-panel:      #1a2420;
    --bg-card:       #222e29;
    --bg-card-hover: #2a3830;
    --bg-header:     #0d1f3c;
    --border:        rgba(140,195,160,0.18);
    --border-bright: rgba(140,195,160,0.38);
    --text-primary:  #f0f5f2;
    --text-secondary:#b8d4c0;
    --text-muted:    #7a9e8a;
    --accent-green:  #5ec47f;
    --accent-blue:   #55afd4;
    --accent-amber:  #e0844a;
    --accent-gold:   #d4a840;
    --font-body:     'DM Sans', sans-serif;
    --font-mono:     'DM Mono', monospace;
    --radius:        7px;
    --shadow:        0 4px 24px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--accent-green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ────────────────────────────────────────────────────────────── */
#site-header {
    background: var(--bg-header);
    border-bottom: 2px solid rgba(100,150,220,0.35);
    padding: 0 32px;
    height: 72px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.kgs-logo {
    height: 36px;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.header-divider {
    width: 1px;
    height: 28px;
    background: var(--border-bright);
}

.header-titles h1 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.header-titles p {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.header-nav {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.kgs-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: opacity 0.2s;
  opacity: 1;
}
.kgs-logo-link:hover { opacity: 0.85; }

.kgs-logo {
  height: 40px;
  width: auto;
  display: block;
  /* Logo is designed for light bg — invert to white for dark header */
  filter: brightness(0) invert(1);
}

/* ─── CLIMBS logo ────────────────────────────────────────────── */
.climbs-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: opacity 0.2s;
}

.climbs-logo-link:hover { opacity: 0.85; }

.climbs-logo {
  height: 52px;
  width: auto;
  display: block;
  background: rgb(238, 238, 238);
  border-radius: 4px;
  padding: 4px 8px;
}

/* Logo stack — side by side on desktop, stacked on mobile */
.logo-stack {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Fix header height bleed — let it grow to fit content */
#site-header {
  background: var(--bg-header);
  border-bottom: 2px solid rgba(100,150,220,0.35);
  padding: 10px 32px;
  min-height: 72px;
  height: auto;        /* was fixed 72px — release it */
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;     /* allow wrapping at mid widths */
}

.header-titles {
  flex: 1;
  min-width: 0;        /* allows text to truncate instead of overflow */
}

.header-titles h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-titles p {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Mid-range: stack logos vertically */
@media (max-width: 960px) {
  .logo-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .kgs-logo  { height: 28px; }
  .climbs-logo { height: 32px; }
}

/* Mobile */
@media (max-width: 640px) {
  #site-header {
    padding: 10px 16px;
    gap: 10px;
  }
  .header-divider { display: none; }
  .header-titles h1 { font-size: 14px; }
  .header-nav { margin-left: 0; }
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.nav-btn:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
    background: rgba(94,196,127,0.08);
    text-decoration: none;
}

.nav-btn svg { width: 13px; height: 13px; }

/* ── Page wrapper ───────────────────────────────────────────────────────── */
.page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 24px 60px;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */
.breadcrumb {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-green); text-decoration: none; }
.breadcrumb-sep { opacity: 0.4; }

/* ── ══════════════════════════════════════════════════════════════════════
    DIRECTORY VIEW
    ══════════════════════════════════════════════════════════════════════ */
.dir-heading {
    margin-bottom: 8px;
}

.dir-heading h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.dir-heading p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

/* Region group label */
.region-group {
    margin-bottom: 32px;
}

.region-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}

.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.station-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.station-card:hover {
    border-color: var(--border-bright);
    transform: translateY(-2px);
    text-decoration: none;
}

.card-thumb {
    width: 100%;
    object-position: center top;
    height: 200px;
    object-fit: cover;
    display: block;
    background: var(--bg-panel);
}

.card-thumb-placeholder {
    width: 100%;
    height: 200px;
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 10px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    gap: 6px;
}

.card-thumb-placeholder svg { width: 16px; height: 16px; opacity: 0.4; }

.card-body {
    padding: 13px 15px 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.card-region {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.card-pill {
    font-size: 10px;
    font-family: var(--font-mono);
    padding: 2px 7px;
    border-radius: 3px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* ── ══════════════════════════════════════════════════════════════════════
    STATION DETAIL VIEW
    ══════════════════════════════════════════════════════════════════════ */
.station-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 720px) {
    .station-detail { grid-template-columns: 1fr; }
}

/* Left column — photo + map link */
.detail-photo {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
    border: 1px solid var(--border);
}

.detail-photo-placeholder {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-photo-placeholder svg { width: 28px; height: 28px; opacity: 0.3; }

.map-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.map-link-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(85,175,212,0.08);
    text-decoration: none;
}

.map-link-btn svg { width: 14px; height: 14px; }

/* Right column — info */

.detail-station-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.detail-region {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Info table */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.info-table tr {
    border-bottom: 1px solid var(--border);
}

.info-table tr:last-child { border-bottom: none; }

.info-table td {
    padding: 10px 0;
    vertical-align: top;
    line-height: 1.45;
}

.info-table td:first-child {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    width: 42%;
    padding-right: 12px;
    padding-top: 12px;
}

.info-table td:last-child {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Susceptibility badges */
.susc-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.susc-very-low  { background: rgba(93,186,125,0.15); color: #5dba7d; border: 1px solid rgba(93,186,125,0.25); }
.susc-low       { background: rgba(93,186,125,0.10); color: #7dcf9a; border: 1px solid rgba(93,186,125,0.2); }
.susc-moderate  { background: rgba(201,168,76,0.15);  color: #c9a84c; border: 1px solid rgba(201,168,76,0.25); }
.susc-high      { background: rgba(224,132,74,0.15);  color: #e0844a; border: 1px solid rgba(224,132,74,0.25); }
.susc-very-high { background: rgba(224,112,112,0.15); color: #e07070; border: 1px solid rgba(224,112,112,0.25); }
.susc-unknown   { background: rgba(140,195,160,0.07); color: var(--text-muted); border: 1px solid var(--border); }

/* Coords */
.coords-mono {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
}

/* Sensor depth chips */
.depth-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.depth-chip {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-bright);
    border-radius: 3px;
    color: var(--text-secondary);
}

/* Section heading */
.section-heading {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}

/* Live data CTA */
.live-cta {
    background: linear-gradient(135deg, rgba(13,31,60,0.8), rgba(26,36,32,0.8));
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(94,196,127,0.2);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(94,196,127,0.2); }
    50%       { box-shadow: 0 0 0 6px rgba(94,196,127,0.05); }
}

.live-cta-text p:first-child {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.live-cta-text p:last-child {
    font-size: 11px;
    color: var(--text-muted);
}

.live-cta-btn {
    margin-left: auto;
    padding: 8px 16px;
    background: var(--accent-green);
    color: #0a1a10;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}

.live-cta-btn:hover {
    background: #6ed48f;
    text-decoration: none;
}

/* ── Back nav ───────────────────────────────────────────────────────────── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 24px;
    transition: color 0.15s;
}

.back-link:hover { color: var(--accent-green); text-decoration: none; }
.back-link svg { width: 12px; height: 12px; }

/* ── Sort toggle ────────────────────────────────────────────────────────── */
.sort-active {
    border-color: var(--accent-green);
    color: var(--accent-green);
    background: rgba(94,196,127,0.08);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
#site-footer {
    border-top: 1px solid var(--border);
    padding: 20px 32px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    #site-header { padding: 0 16px; }
    .page-wrap   { padding: 20px 16px 40px; }
    .detail-station-name { font-size: 22px; }
}