/* Andes Powder — winter theme: bright alpine daylight, frost-glass cards, icy accents */

:root {
  --bg: #f5f9fd;
  --bg-2: #e9f1fa;
  --bg-raised: #ffffff;
  --bg-sunken: #eef4fb;
  --line: #d9e6f2;
  --line-soft: #e6eef7;
  --frost: rgba(15, 45, 90, 0.05);
  --text: #10233d;
  --text-dim: #45607e;
  --text-faint: #7c93ac;
  --accent: #0284c7;
  --accent-2: #7c6fe0;
  --danger: #dc2626;
  --radius: 12px;
  --topbar-h: 68px;
  --footer-h: 34px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(2, 132, 199, 0.07), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(124, 111, 224, 0.06), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.015em;
}

a {
  color: var(--accent);
}

/* ---------------------------------------------------------- snowfall fx --- */

.snowfall {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.flake {
  position: absolute;
  top: -5%;
  color: #7fabd6;
  animation: fall linear infinite;
  will-change: transform;
}

@keyframes fall {
  0% {
    transform: translateY(-5vh) translateX(0);
  }
  50% {
    transform: translateY(52vh) translateX(14px);
  }
  100% {
    transform: translateY(110vh) translateX(-8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .flake {
    animation: none;
    display: none;
  }
}

/* ------------------------------------------------------------- topbar --- */

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(233, 241, 250, 0.92));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 500;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  font-size: 24px;
  line-height: 1;
  letter-spacing: -4px;
}

.brand h1 {
  font-size: 19px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status {
  font-size: 12.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

.status.is-error {
  color: var(--danger);
}

.view-toggle {
  display: flex;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}

.toggle-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toggle-btn:hover {
  color: var(--text);
}

.toggle-btn.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
}

/* --------------------------------------------------------------- views --- */

main {
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 2;
}

.view {
  position: absolute;
  inset: 0;
}

#map {
  position: absolute;
  inset: 0;
  background: var(--bg-sunken);
}

.leaflet-container {
  font-family: var(--font);
  background: var(--bg-sunken);
}

.leaflet-tooltip {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(15, 45, 90, 0.1);
}

.leaflet-tooltip-top::before {
  border-top-color: var(--line);
}

.resort-label {
  background: rgba(16, 35, 61, 0.88);
  border: 1px solid rgba(16, 35, 61, 0.15);
  color: #f2f7fd;
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 5px;
  pointer-events: none;
  white-space: nowrap;
}

.resort-label::before {
  display: none;
}

.backcountry-label {
  background: rgba(154, 88, 6, 0.88);
  color: #fff6e8;
}

.city-label {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  pointer-events: none;
}

.attraction-label {
  color: #92650a;
  border-color: rgba(146, 101, 10, 0.25);
}

/* Custom divIcon pins for cities, attractions, backcountry ops */
.pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(15, 45, 90, 0.18);
}

.pin-city {
  background: #ffffff;
  border: 1.5px solid var(--text-dim);
  color: var(--text-dim);
}

.pin-attraction {
  background: #fff6df;
  border: 1.5px solid #c9930f;
  color: #92650a;
  font-size: 12px;
}

.pin-heli {
  width: 26px;
  height: 26px;
  background: #fff0dc;
  border: 1.5px solid #c9760f;
  color: #8a4d07;
  font-size: 13px;
}

.map-popup {
  min-width: 190px;
  font-family: var(--font);
}

.map-popup-kicker {
  margin: 0 0 3px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.map-popup h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text);
}

.map-popup p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

.popup-code {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
}

.leaflet-popup-content-wrapper {
  background: #ffffff;
  border-radius: 10px;
}

.leaflet-popup-tip {
  background: #ffffff;
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.88) !important;
  color: var(--text-faint) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--text-dim) !important;
}

.leaflet-control-zoom a {
  background: #ffffff !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

/* --------------------------------------------------------- layer toggle --- */

.layers {
  position: absolute;
  left: 14px;
  top: 88px;
  z-index: 450;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(15, 45, 90, 0.08);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.layers-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.layer-toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}

.layer-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  font-size: 11px;
}

.layer-swatch-city {
  color: var(--text-dim);
}

.layer-swatch-heli {
  color: #a5660a;
}

.layer-swatch-attraction {
  color: #92650a;
}

/* -------------------------------------------------------------- legend --- */

.legend {
  position: absolute;
  left: 14px;
  bottom: 26px;
  z-index: 450;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(15, 45, 90, 0.08);
}

.legend-title {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin-bottom: 7px;
}

.legend ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
}

.legend em {
  font-style: normal;
  color: var(--text-faint);
  font-size: 11px;
  margin-left: auto;
  padding-left: 10px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

/* --------------------------------------------------------------- panel --- */

.panel {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: 390px;
  max-width: calc(100% - 28px);
  z-index: 450;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6), 0 20px 60px rgba(15, 45, 90, 0.14);
}

.panel-empty {
  padding: 40px 26px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

.panel-empty-mark {
  font-size: 28px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}

.panel-empty-hint {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-bottom: 0;
}

.panel-body {
  padding: 20px 22px 26px;
  position: relative;
}

.panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  color: var(--text-dim);
  border-radius: 7px;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.panel-close:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

.panel-country {
  margin: 0 0 3px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.panel-name {
  font-size: 21px;
  margin-bottom: 10px;
  padding-right: 28px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.flag {
  margin: 0 0 10px;
  font-size: 11.5px;
  color: #92650a;
  background: rgba(217, 158, 10, 0.1);
  border: 1px solid rgba(217, 158, 10, 0.25);
  border-radius: 6px;
  padding: 5px 9px;
}

.flag-info {
  color: var(--accent);
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.25);
}

/* ------------------------------------------------------- expert rating --- */

.expert {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 14px;
}

.expert-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-right: 3px;
}

.pip {
  width: 13px;
  height: 5px;
  border-radius: 2px;
  background: var(--line);
}

.pip.is-on {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---------------------------------------------------------------- stats --- */

.stats {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
}

.stats > div {
  flex: 1;
  background: var(--bg-sunken);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 8px 10px;
}

.stats dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.stats dd {
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.terrain,
.row-terrain {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
  margin: 0 0 16px;
}

.section-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin-bottom: 9px;
}

/* --------------------------------------------------------- snow report --- */

.report {
  background: var(--bg-sunken);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px;
}

.days {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 2px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.6);
}

.day-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.day-date {
  font-size: 9.5px;
  color: var(--text-faint);
}

.day-bar {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  width: 100%;
  padding: 5px 0;
  border-radius: 5px;
  margin: 2px 0;
  background: color-mix(in srgb, var(--band) calc(var(--fill) * 100%), transparent);
}

.day-snow {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.day-unit {
  font-size: 9px;
  color: var(--text-dim);
}

.day-code {
  font-size: 12px;
  line-height: 1;
}

.day-temp {
  font-size: 9.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.report-total {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 2px 2px;
  font-size: 12px;
  color: var(--text-dim);
}

.report-total strong {
  color: var(--text);
  font-size: 13.5px;
}

.band-tag {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--band);
  background: color-mix(in srgb, var(--band) 16%, white);
}

.week-total {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 12px 0 0;
}

.week-total strong {
  color: var(--text);
}

/* ---------------------------------------------------------- profile info --- */

.profile-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 4px;
}

.profile-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.profile-icon {
  flex: none;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-sunken);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  font-size: 13px;
}

.profile-label {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 3px;
}

.profile-row p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

.profile-row p a {
  font-weight: 600;
}

.profile-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-dim);
}

.resort-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 12.5px;
  text-decoration: none;
}

.resort-link:hover {
  text-decoration: underline;
}

.muted {
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ----------------------------------------------------------- list view --- */

#view-list {
  overflow-y: auto;
  position: relative;
  z-index: 2;
}

.list-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 22px 40px;
}

.list-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.list-controls h2 {
  font-size: 17px;
}

.sort-field {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 9px;
}

.sort-field select {
  font-family: var(--font);
  font-size: 12.5px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.country {
  margin-top: 30px;
}

.country:first-child {
  margin-top: 0;
}

.country-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 9px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.country-head h3 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.country-meta {
  font-size: 12px;
  color: var(--text-faint);
}

.row {
  background: linear-gradient(160deg, var(--bg-raised), var(--bg-2));
  border: 1px solid var(--line);
  border-left: 3px solid var(--band);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(15, 45, 90, 0.05);
}

.row + .row {
  margin-top: 10px;
}

.row:hover {
  transform: translateY(-1px);
  border-color: var(--text-faint);
  border-left-color: var(--band);
  box-shadow: 0 8px 20px rgba(15, 45, 90, 0.1);
}

.row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.row.is-selected {
  border-color: var(--accent);
  border-left-color: var(--band);
}

.row-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.row-id h4 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #92650a;
  background: rgba(217, 158, 10, 0.14);
  border-radius: 999px;
  padding: 2px 7px;
}

.tag-backcountry {
  color: #a5660a;
  background: rgba(197, 130, 10, 0.14);
  font-size: 10.5px;
  padding: 2px 9px;
}

.row-region {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.row-stats {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.row .expert {
  margin: 2px 0 0;
  flex: none;
}

.row .report {
  background: var(--bg-sunken);
}

.row-terrain {
  margin: 12px 0 0;
  font-size: 12.5px;
}

.row-quickfact {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  gap: 7px;
  align-items: flex-start;
}

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

.footer {
  height: var(--footer-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.85);
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-faint);
  position: relative;
  z-index: 2;
}

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

@media (max-width: 860px) {
  .topbar {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .panel {
    top: auto;
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-height: 62%;
  }

  .legend,
  .layers {
    display: none;
  }

  .row-main {
    flex-direction: column;
    gap: 10px;
  }

  .days {
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
  }

  .day-temp {
    font-size: 8.5px;
  }

  .footer {
    height: auto;
    padding: 8px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}
