/* ============================================================
   POWDER HOUSE BEND — Mountain Conditions Overlay
   ============================================================ */

:root {
  --ov-bg:           rgba(5, 9, 16, 0.82);
  --ov-panel-bg:     rgba(8, 14, 24, 0.98);
  --ov-border:       rgba(255, 255, 255, 0.07);
  --ov-seam:         #62c1db;
  --ov-seam-glow:    rgba(98, 193, 219, 0.25);
  --ov-accent:       #62c1db;
  --ov-accent-dim:   rgba(98, 193, 219, 0.12);
  --ov-accent-glow:  rgba(98, 193, 219, 0.22);
  --ov-text:         #dce5f0;
  --ov-muted:        rgba(220, 229, 240, 0.42);
  --ov-font:         'Syne', system-ui, -apple-system, sans-serif;
  --ov-mono:         'Courier New', Courier, monospace;
  --ov-r:            12px;
  --ov-ease:         cubic-bezier(0.22, 1, 0.36, 1);
}


/* ────────────────────────────────────────────────────────────
   BACKDROP
──────────────────────────────────────────────────────────── */
#mountain-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2rem);
  background: var(--ov-bg);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

#mountain-overlay.show {
  display: flex;
  animation: ov-backdrop-in 0.22s ease both;
}

#mountain-overlay:not(.hidden) { display: flex; }

@keyframes ov-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ────────────────────────────────────────────────────────────
   PANEL
──────────────────────────────────────────────────────────── */
.mountain-overlay-content {
  margin: 0;
  position: relative;
  background: var(--ov-panel-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--ov-border);
  border-top: 2px solid var(--ov-seam);
  border-radius: var(--ov-r);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.025),
    0 0 40px rgba(98, 193, 219, 0.07),
    0 40px 100px rgba(0, 0, 0, 0.8),
    0 8px 28px rgba(0, 0, 0, 0.55);
  padding: 2rem 2rem 1.75rem;
  width: min(700px, 100%);
  height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  color: var(--ov-text);
  font-family: var(--ov-font);
  animation: ov-panel-in 0.30s var(--ov-ease) both;
}

@keyframes ov-panel-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.mountain-overlay-content::after {
  content: '';
  pointer-events: none;
  position: absolute;
  top: -1px; right: -1px;
  width: 26px; height: 26px;
  border-top: 2px solid var(--ov-seam);
  border-right: 2px solid var(--ov-seam);
  border-radius: 0 var(--ov-r) 0 0;
  box-shadow: 3px -3px 10px var(--ov-seam-glow);
  opacity: 0.55;
}


/* ────────────────────────────────────────────────────────────
   TITLE
──────────────────────────────────────────────────────────── */
.mountain-overlay-content h2 {
  font-family: var(--ov-font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ov-accent);
  margin: 0 0 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  flex-shrink: 0;
}


/* ────────────────────────────────────────────────────────────
   GRID (mountain/park selection)
──────────────────────────────────────────────────────────── */
.mountain-park-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 2rem;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
}

.mountain-column,
.park-column {
  display: flex;
  flex-direction: column;
}

.mountain-column h3,
.park-column h3 {
  font-family: var(--ov-font);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(220, 229, 240, 0.55);
  margin: 0 0 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}


/* ────────────────────────────────────────────────────────────
   MOUNTAIN LIST BUTTONS
──────────────────────────────────────────────────────────── */
.mountain-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mountain-list li { display: block; }

.mountain-list button {
  all: unset;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--ov-font);
  font-size: 0.97rem;
  font-weight: 600;
  color: rgba(220, 229, 240, 0.85);
  line-height: 1.35;
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease;
}

.mountain-list button::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.22;
  flex-shrink: 0;
  transition: opacity 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.mountain-list button:hover {
  color: #fff;
  background: var(--ov-accent-dim);
}

.mountain-list button:hover::before {
  opacity: 1;
  background: var(--ov-accent);
  box-shadow: 0 0 6px var(--ov-accent-glow);
}

.mountain-list button:focus-visible {
  outline: 2px solid var(--ov-accent);
  outline-offset: 2px;
}


/* ────────────────────────────────────────────────────────────
   FORECAST TITLE (pinned above scroll)
──────────────────────────────────────────────────────────── */
.forecast-title {
  font-family: var(--ov-font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ov-accent);
  margin: 0 0 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  flex-shrink: 0;
}


/* ────────────────────────────────────────────────────────────
   FORECAST — scrollable card list
──────────────────────────────────────────────────────────── */
#forecast-text {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.forecast-scroll {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(98, 193, 219, 0.22) transparent;
}

.forecast-scroll::-webkit-scrollbar       { width: 4px; }
.forecast-scroll::-webkit-scrollbar-track { background: transparent; }
.forecast-scroll::-webkit-scrollbar-thumb {
  background: rgba(98, 193, 219, 0.28);
  border-radius: 2px;
}

.forecast-day {
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-left: 2px solid rgba(98, 193, 219, 0.28);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  opacity: 0;
  transform: translateY(6px);
  animation: forecast-in 0.24s var(--ov-ease) forwards;
  animation-delay: var(--delay, 0s);
  transition: background 0.14s ease, border-left-color 0.14s ease;
}

.forecast-day:hover {
  background: rgba(98, 193, 219, 0.04);
  border-left-color: var(--ov-accent);
}

@keyframes forecast-in {
  to { opacity: 1; transform: translateY(0); }
}

/* Label row: date + period badge */
.forecast-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.forecast-date {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ov-text);
  line-height: 1.2;
}

.forecast-period {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ov-accent);
  background: var(--ov-accent-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  line-height: 1.4;
}

/* Night period — slightly different badge tint */
.forecast-period.is-night {
  color: rgba(150, 180, 220, 0.85);
  background: rgba(100, 130, 180, 0.12);
}

/* Stats row */
.forecast-stats {
  font-size: 0.86rem;
  font-weight: 500;
  color: rgba(220, 229, 240, 0.6);
  margin-bottom: 0.55rem;
  line-height: 1.4;
}

/* Full forecast text */
.forecast-full {
  font-size: 0.9rem;
  font-weight: 400;
  color: rgba(220, 229, 240, 0.75);
  line-height: 1.72;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Clickable URLs inside forecast text */
.forecast-full a {
  color: var(--ov-accent);
  text-decoration: underline;
  text-decoration-color: rgba(98, 193, 219, 0.35);
  text-underline-offset: 2px;
  word-break: break-all;
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

.forecast-full a:hover {
  color: #a8e0ef;
  text-decoration-color: rgba(98, 193, 219, 0.75);
}

/* Hazard block */
.forecast-hazard {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 170, 40, 0.07);
  border: 1px solid rgba(255, 170, 40, 0.18);
  border-radius: 6px;
  font-size: 0.82rem;
  color: rgba(255, 195, 80, 0.85);
  overflow-wrap: break-word;
  word-break: break-word;
}

.forecast-hazard-icon {
  flex-shrink: 0;
  font-size: 0.82rem;
  line-height: 1.5;
}

.forecast-hazard a {
  color: rgba(255, 195, 80, 0.9);
  text-decoration: underline;
  text-decoration-color: rgba(255, 195, 80, 0.35);
  text-underline-offset: 2px;
  word-break: break-all;
  transition: color 0.12s ease;
}

.forecast-hazard a:hover {
  color: #ffd966;
  text-decoration-color: rgba(255, 195, 80, 0.75);
}


/* ────────────────────────────────────────────────────────────
   ACTION BUTTONS
──────────────────────────────────────────────────────────── */
.overlay-btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-shrink: 0;
}

#back-to-mountains,
#close-overlay {
  font-family: var(--ov-font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-radius: 100px;
  padding: 0 1.1rem;
  height: 34px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.13s ease;
}

.mountain-overlay-content > #back-to-mountains,
.mountain-overlay-content > #close-overlay {
  margin-top: 1.25rem;
  align-self: flex-end;
}

#back-to-mountains {
  background: rgba(255, 255, 255, 0.055);
  color: rgba(220, 229, 240, 0.60);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

#back-to-mountains:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--ov-text);
  transform: translateX(-2px);
}

#close-overlay {
  background: rgba(98, 193, 219, 0.09);
  color: var(--ov-accent);
  border: 1px solid rgba(98, 193, 219, 0.26);
}

#close-overlay:hover {
  background: rgba(98, 193, 219, 0.16);
  border-color: rgba(98, 193, 219, 0.46);
  box-shadow: 0 0 16px var(--ov-accent-glow);
}

#back-to-mountains:focus-visible,
#close-overlay:focus-visible {
  outline: 2px solid var(--ov-accent);
  outline-offset: 3px;
}


/* ────────────────────────────────────────────────────────────
   MOBILE ≤ 600px
──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #mountain-overlay {
    align-items: flex-start;
    padding: 0;
    padding-top: var(--stack-h, 20px);
  }

  /* Panel: auto height, max to screen, no dead space */
  .mountain-overlay-content {
    width: 100%;
    height: auto;
    max-height: calc(100dvh - var(--stack-h, 60px));
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 1.25rem 1rem 1.1rem;
  }

  .mountain-overlay-content::after { display: none; }

  /* Grid: tighter columns, no overflow */
  .mountain-park-grid {
    gap: 0.25rem 1rem;
    overflow-y: visible;
    flex: 0 0 auto;
  }

  .mountain-column h3,
  .park-column h3 {
    font-size: 0.56rem;
    letter-spacing: 0.16em;
    margin-bottom: 0.35rem;
    padding-bottom: 0.4rem;
  }

  .mountain-list { gap: 0; }

  .mountain-list button {
    font-size: 0.88rem;
    padding: 0.5rem 0.5rem;
    gap: 0.4rem;
    /* Allow wrapping but don't hyphenate mid-word unnecessarily */
    white-space: normal;
    word-break: normal;
    hyphens: none;
  }

  /* Keep dot but make it smaller */
  .mountain-list button::before {
    width: 4px;
    height: 4px;
  }

  /* Forecast adjustments */
  .forecast-date { font-size: 0.88rem; }
  .forecast-full { font-size: 0.84rem; line-height: 1.65; }
  .forecast-stats { font-size: 0.82rem; }
  .forecast-hazard { font-size: 0.78rem; }

  /* Sticky button row — always visible, never buried */
  .overlay-btn-row {
    position: sticky;
    bottom: 0;
    margin: 0;
    padding: 0.85rem 0 1rem;
    background: var(--ov-panel-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.055);
    flex-shrink: 0;
  }
}


/* ════════════════════════════════════════════════════════════
   RETRO MODE
════════════════════════════════════════════════════════════ */
body.retro-mode #mountain-overlay {
  background: rgba(0, 3, 8, 0.92);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.retro-mode #mountain-overlay::before {
  content: '';
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.14) 2px,
    rgba(0, 0, 0, 0.14) 4px
  );
}

body.retro-mode .mountain-overlay-content {
  background: rgba(0, 5, 12, 0.98);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-top: 2px solid #00e5ff;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.05),
    0 0 30px rgba(0, 229, 255, 0.10),
    inset 0 0 80px rgba(0, 229, 255, 0.018),
    0 0 90px rgba(0, 0, 0, 0.95);
}

body.retro-mode .mountain-overlay-content::before {
  content: '';
  pointer-events: none;
  position: absolute;
  top: -1px; left: -1px;
  width: 16px; height: 16px;
  border-top: 2px solid #00e5ff;
  border-left: 2px solid #00e5ff;
  box-shadow: -2px -2px 8px rgba(0, 229, 255, 0.28);
}

body.retro-mode .mountain-overlay-content::after {
  content: '';
  pointer-events: none;
  position: absolute;
  bottom: -1px; right: -1px;
  top: auto; left: auto;
  width: 16px; height: 16px;
  border-top: none;
  border-right: 2px solid #00e5ff;
  border-bottom: 2px solid #00e5ff;
  border-left: none;
  border-radius: 0;
  box-shadow: 2px 2px 8px rgba(0, 229, 255, 0.28);
  opacity: 1;
}

body.retro-mode .mountain-overlay-content h2,
body.retro-mode .forecast-title {
  font-family: var(--ov-mono);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  color: #00e5ff;
  text-shadow: 0 0 14px rgba(0, 229, 255, 0.7);
  border-bottom-color: rgba(0, 229, 255, 0.13);
}

body.retro-mode .mountain-column h3,
body.retro-mode .park-column h3 {
  font-family: var(--ov-mono);
  font-size: 0.55rem;
  letter-spacing: 0.26em;
  color: rgba(0, 229, 255, 0.38);
  border-bottom-color: rgba(0, 229, 255, 0.09);
}

body.retro-mode .mountain-list button {
  font-family: var(--ov-mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(0, 229, 255, 0.55);
  background: transparent;
  border-radius: 1px;
}

body.retro-mode .mountain-list button::before {
  content: '›';
  width: auto; height: auto;
  border-radius: 0;
  background: transparent;
  font-size: 1rem;
  color: #00e5ff;
  opacity: 0;
  box-shadow: none;
  line-height: 1;
}

body.retro-mode .mountain-list button:hover {
  color: #00e5ff;
  background: rgba(0, 229, 255, 0.07);
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.55);
}

body.retro-mode .mountain-list button:hover::before {
  opacity: 1;
  background: transparent;
  box-shadow: none;
}

body.retro-mode .mountain-list button:focus-visible {
  outline: 1px solid rgba(0, 229, 255, 0.55);
  outline-offset: 2px;
}

body.retro-mode .forecast-day {
  background: rgba(0, 229, 255, 0.022);
  border: 1px solid rgba(0, 229, 255, 0.09);
  border-left: 2px solid rgba(0, 229, 255, 0.42);
  border-radius: 1px;
}

body.retro-mode .forecast-day:hover {
  background: rgba(0, 229, 255, 0.05);
  border-left-color: #00e5ff;
}

body.retro-mode .forecast-date {
  font-family: var(--ov-mono);
  color: #00e5ff;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

body.retro-mode .forecast-period {
  font-family: var(--ov-mono);
  color: rgba(0, 229, 255, 0.7);
  background: rgba(0, 229, 255, 0.07);
}

body.retro-mode .forecast-period.is-night {
  color: rgba(0, 180, 220, 0.65);
  background: rgba(0, 180, 220, 0.06);
}

body.retro-mode .forecast-stats {
  font-family: var(--ov-mono);
  color: rgba(0, 229, 255, 0.48);
}

body.retro-mode .forecast-full {
  font-family: var(--ov-mono);
  font-size: 0.84rem;
  color: rgba(0, 229, 255, 0.46);
  line-height: 1.75;
}

body.retro-mode .forecast-full a {
  color: rgba(0, 229, 255, 0.7);
  text-decoration-color: rgba(0, 229, 255, 0.3);
}

body.retro-mode .forecast-full a:hover {
  color: #00e5ff;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

body.retro-mode .forecast-hazard {
  background: rgba(0, 229, 255, 0.04);
  border-color: rgba(0, 229, 255, 0.15);
  color: rgba(0, 229, 255, 0.5);
  font-family: var(--ov-mono);
}

body.retro-mode .forecast-hazard a {
  color: rgba(0, 229, 255, 0.7);
}

body.retro-mode .forecast-hazard a:hover {
  color: #00e5ff;
}

body.retro-mode .forecast-scroll {
  scrollbar-color: rgba(0, 229, 255, 0.28) transparent;
}

body.retro-mode .forecast-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.28);
}

body.retro-mode #back-to-mountains {
  font-family: var(--ov-mono);
  font-size: 0.65rem;
  letter-spacing: 0.10em;
  background: transparent;
  color: rgba(0, 229, 255, 0.52);
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 2px;
  box-shadow: none;
}

body.retro-mode #back-to-mountains:hover {
  color: #00e5ff;
  border-color: rgba(0, 229, 255, 0.60);
  background: rgba(0, 229, 255, 0.06);
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.55);
  transform: translateX(-2px);
  box-shadow: none;
}

body.retro-mode #close-overlay {
  font-family: var(--ov-mono);
  font-size: 0.65rem;
  letter-spacing: 0.10em;
  background: rgba(255, 0, 200, 0.06);
  color: rgba(255, 0, 200, 0.62);
  border: 1px solid rgba(255, 0, 200, 0.30);
  border-radius: 2px;
  box-shadow: none;
}

body.retro-mode #close-overlay:hover {
  background: rgba(255, 0, 200, 0.10);
  color: #ff00c8;
  border-color: rgba(255, 0, 200, 0.60);
  box-shadow: 0 0 14px rgba(255, 0, 200, 0.20);
}

@media (max-width: 600px) {
  body.retro-mode .mountain-overlay-content {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top: 2px solid #00e5ff;
  }

  body.retro-mode .mountain-overlay-content::before,
  body.retro-mode .mountain-overlay-content::after {
    display: none;
  }
}


/* ────────────────────────────────────────────────────────────
   REDUCED MOTION
──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #mountain-overlay,
  .mountain-overlay-content,
  .forecast-day,
  .mountain-list button,
  #back-to-mountains,
  #close-overlay {
    transition: none !important;
    animation: none !important;
  }
  .forecast-day { opacity: 1; transform: none; }
}