/* Rando · Soleil & Ombre — alpine night-topo aesthetic.
   Deep forest ink, cream text, solar gold. */

:root {
  --ink: #0e120d;
  --panel: rgba(16, 22, 15, 0.92);
  --panel-2: rgba(28, 38, 26, 0.75);
  --line: rgba(242, 234, 216, 0.14);
  --cream: #f2ead8;
  --cream-dim: #b9b19c;
  --gold: #ffc94d;
  --gold-deep: #e8a020;
  --sun: #ffc94d;
  --veg: #4fae62;
  --shade: #6b8fd8;
  --night: #39415e;
  --danger: #e86a5a;
  --r: 14px;
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: "Hanken Grotesk", sans-serif;
  background: var(--ink);
  color: var(--cream);
  overflow: hidden;
}

#map { position: fixed; inset: 0; background: #0a0d09; }
#map .leaflet-control-attribution {
  background: rgba(14, 18, 13, 0.7); color: #8a856f; font-size: 10px;
}
#map .leaflet-control-attribution a { color: #a89f83; }

/* ------------------------------------------------------------- panel */
.panel {
  position: fixed; z-index: 1000;
  top: 14px; left: 14px;
  width: min(390px, calc(100vw - 28px));
  max-height: calc(100dvh - 190px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: calc(var(--r) + 4px);
  padding: 18px 18px 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: panel-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  scrollbar-width: thin;
  scrollbar-color: rgba(242,234,216,.2) transparent;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.brand { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.brand-ico { width: 46px; height: 46px; flex: none; }
.brand-ico svg { width: 100%; height: 100%; }
.b-sun { fill: var(--gold); animation: sunpulse 5s ease-in-out infinite; transform-origin: 66% 32%; }
.b-mtn { fill: #35543a; }
@keyframes sunpulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.12);} }

h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.05;
}
h1 em { font-style: normal; color: var(--gold); font-weight: 500; font-size: 1.1rem; }
.tagline { color: var(--cream-dim); font-size: 0.8rem; line-height: 1.35; margin-top: 5px; }

/* ------------------------------------------------------------- dropzone */
.drop {
  border: 1.5px dashed rgba(255, 201, 77, 0.45);
  border-radius: var(--r);
  padding: 20px 14px;
  text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  background: linear-gradient(160deg, rgba(255,201,77,0.05), transparent 60%);
}
.drop:hover, .drop.over {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(255,201,77,0.12), transparent 70%);
  transform: translateY(-1px);
}
.drop-ico { width: 30px; height: 30px; color: var(--gold); margin-bottom: 8px; }
.drop p { font-size: 0.9rem; line-height: 1.4; color: var(--cream); }
.drop p strong { font-weight: 700; }
.demo-btn {
  margin-top: 12px; border: 0; background: none; cursor: pointer;
  color: var(--gold-deep); font: 600 0.8rem "Hanken Grotesk", sans-serif;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
.demo-btn:hover { color: var(--gold); }

/* ------------------------------------------------------------- track card */
.trackcard {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 12px; margin-bottom: 10px;
}
.tc-name-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tc-name {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 600;
  font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tc-change {
  border: 0; background: none; color: var(--cream-dim); cursor: pointer;
  font: 600 0.72rem "Hanken Grotesk", sans-serif; text-decoration: underline;
  flex: none;
}
.tc-change:hover { color: var(--gold); }
.tc-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 6px; color: var(--cream-dim); font-size: 0.78rem;
}
.tc-stats b { color: var(--cream); font-weight: 700; }

/* ------------------------------------------------------------- controls */
.controls { display: grid; gap: 10px; margin: 12px 0; }
.lbl {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--cream-dim); font-weight: 700;
}
.date-row, .slider-row { display: flex; align-items: center; gap: 10px; }
.date-row .lbl, .slider-row .lbl { width: 52px; flex: none; }
input[type="date"] {
  flex: 1; background: var(--panel-2); color: var(--cream);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 10px; font: 600 0.9rem "Hanken Grotesk", sans-serif;
  color-scheme: dark;
}
.time-val {
  font: 700 0.9rem "Bricolage Grotesque", sans-serif;
  color: var(--gold); width: 62px; text-align: right; flex: none;
  font-variant-numeric: tabular-nums;
}

input[type="range"] { flex: 1; appearance: none; height: 26px; background: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, var(--night), var(--shade) 25%, var(--gold) 55%, var(--gold-deep) 85%, var(--night));
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold); border: 2.5px solid #14180f;
  margin-top: -6.5px; box-shadow: 0 0 0 3px rgba(255,201,77,0.25), 0 2px 8px rgba(0,0,0,0.6);
  transition: transform 0.12s;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }
input[type="range"]::-moz-range-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, var(--night), var(--shade) 25%, var(--gold) 55%, var(--gold-deep) 85%, var(--night));
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--gold); border: 2.5px solid #14180f;
}

.seg {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; gap: 3px;
}
.seg-btn {
  border: 0; border-radius: 8px; padding: 7px 4px; cursor: pointer;
  background: none; color: var(--cream-dim);
  font: 600 0.8rem "Hanken Grotesk", sans-serif;
  transition: background 0.15s, color 0.15s;
}
.seg-btn.active { background: rgba(255, 201, 77, 0.16); color: var(--gold); }
.seg-btn:not(.active):hover { color: var(--cream); }

.check-row {
  display: flex; gap: 8px; align-items: flex-start; cursor: pointer;
  font-size: 0.8rem; color: var(--cream); line-height: 1.3;
}
.check-row em { color: var(--cream-dim); font-style: normal; font-size: 0.72rem; }
.check-row input { accent-color: var(--gold); margin-top: 2px; }

/* ------------------------------------------------------------- stats */
.sunstats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-bottom: 12px;
}
.ss {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 4px 6px; text-align: center;
}
.ss .k { display: block; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cream-dim); font-weight: 700; }
.ss .v {
  font: 700 1.15rem/1.2 "Bricolage Grotesque", sans-serif;
  font-variant-numeric: tabular-nums;
}
.ss .v.sun { color: var(--sun); }
.ss .v.shade { color: var(--shade); }
.ss .v.veg { color: var(--veg); }
.ss .v.night { color: #8a93b8; }

/* ------------------------------------------------------------- dep chart */
.chart-block { margin-bottom: 12px; }
.chart-block h3 {
  font-family: "Bricolage Grotesque", sans-serif; font-size: 0.85rem;
  font-weight: 600; margin-bottom: 6px;
}
.chart-block h3 em { font-style: normal; color: var(--cream-dim); font-weight: 500; }
#depchart {
  width: 100%; height: 110px; display: block;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  cursor: crosshair;
}
.chart-hint { font-size: 0.68rem; color: var(--cream-dim); margin-top: 4px; }

/* ------------------------------------------------------------- legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--cream); }
.chip i { width: 14px; height: 6px; border-radius: 3px; display: inline-block; }
.c-sun { background: var(--sun); box-shadow: 0 0 7px rgba(255,201,77,.8); }
.c-veg { background: var(--veg); }
.c-shade { background: var(--shade); }
.c-night { background: var(--night); outline: 1px solid rgba(242,234,216,.25); }

.day-info { font-size: 0.76rem; color: var(--cream-dim); line-height: 1.45; margin-bottom: 10px; }
.day-info b { color: var(--cream); }

.credits {
  border-top: 1px solid var(--line); padding-top: 8px;
  font-size: 0.62rem; color: #8a856f; line-height: 1.5;
}

/* ------------------------------------------------------------- profile strip */
.profile {
  position: fixed; z-index: 1000; left: 14px; right: 14px; bottom: 12px;
  height: 150px;
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: calc(var(--r) + 4px);
  box-shadow: 0 14px 40px rgba(0,0,0,0.5);
  animation: panel-in 0.8s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#profsvg { width: 100%; height: 100%; display: block; border-radius: inherit; }
.prof-tip {
  position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%);
  background: #1a2216; border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px; font-size: 0.74rem; line-height: 1.45; white-space: nowrap;
  pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.prof-tip b { font-family: "Bricolage Grotesque", sans-serif; }

/* ------------------------------------------------------------- loader / toast */
.loader[hidden], .toast[hidden] { display: none; }
.loader {
  position: fixed; z-index: 2000; inset: 0;
  display: flex; flex-direction: column; gap: 16px;
  align-items: center; justify-content: center;
  background: rgba(10, 13, 9, 0.75); backdrop-filter: blur(4px);
  font: 600 0.95rem "Bricolage Grotesque", sans-serif; color: var(--cream);
}
.loader-sun {
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe9ad, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 0 40px rgba(255, 201, 77, 0.55);
  animation: rise 1.6s ease-in-out infinite;
}
@keyframes rise {
  0%, 100% { transform: translateY(7px); opacity: 0.75; }
  50% { transform: translateY(-7px); opacity: 1; }
}

.toast {
  position: fixed; z-index: 2100; left: 50%; bottom: 180px; transform: translateX(-50%);
  background: #33201c; color: #ffd9d2; border: 1px solid rgba(232,106,90,.5);
  padding: 10px 16px; border-radius: 12px; font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: 90vw;
}

/* ------------------------------------------------------------- mobile */
@media (max-width: 640px) {
  :root { font-size: 14px; }
  .panel { max-height: 52dvh; }
  .profile { height: 110px; }
  .sunstats { grid-template-columns: repeat(4, 1fr); }
}
