/* ─────────────────────────────────────────────────────────────
   Austlie Weather
   ───────────────────────────────────────────────────────────── */

:root {
  --bg:          #0a0e14;
  --bg-2:        #0f141c;
  --surface:     rgba(16, 22, 31, 0.92);
  --surface-sol: #10161f;
  --border:      rgba(120, 160, 190, 0.16);
  --border-2:    rgba(120, 160, 190, 0.28);
  --text:        #e6edf3;
  --text-dim:    #7d8da0;
  --accent:      #22d3ee;
  --accent-2:    #0891b2;
  --accent-soft: rgba(34, 211, 238, 0.14);
  --warn:        #f59e0b;
  --danger:      #ef4444;
  --radius:      10px;
  --radius-sm:   7px;
  --shadow:      0 8px 30px rgba(0, 0, 0, 0.55);
  --mono:        "JetBrains Mono", "SFMono-Regular", ui-monospace, "Cascadia Mono",
                 Menlo, Consolas, monospace;
  --sans:        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
  --panel-w:     340px;
  --top-h:       52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--sans);
  font-size: 14px; line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim  { color: var(--text-dim); }

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

/* Leaflet chrome, restyled */
.leaflet-container { background: var(--bg); font-family: var(--sans); outline: none; }
.leaflet-control-attribution {
  background: rgba(10, 14, 20, 0.78) !important;
  color: var(--text-dim) !important;
  font-size: 10px !important;
  padding: 2px 7px !important;
  border-radius: 6px 0 0 0;
  backdrop-filter: blur(6px);
}
.leaflet-control-attribution a { color: var(--text-dim) !important; }
.leaflet-control-zoom { border: none !important; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  backdrop-filter: blur(10px);
  width: 32px !important; height: 32px !important; line-height: 30px !important;
  font-size: 17px !important;
}
.leaflet-control-zoom a:hover { background: #182230 !important; color: var(--accent) !important; }
.leaflet-bar a:first-child { border-radius: 8px 8px 0 0 !important; }
.leaflet-bar a:last-child  { border-radius: 0 0 8px 8px !important; }
.leaflet-top.leaflet-left { margin-top: calc(var(--top-h) + 8px); }
.leaflet-popup-content-wrapper {
  background: var(--surface-sol); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--surface-sol); border: 1px solid var(--border-2); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; max-height: 42vh; overflow-y: auto; }
.leaflet-popup-close-button { color: var(--text-dim) !important; }

/* ── top bar ─────────────────────────────────────────────── */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--top-h);
  z-index: 900;
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px;
  background: linear-gradient(180deg, rgba(10,14,20,.95) 0%, rgba(10,14,20,.78) 70%, rgba(10,14,20,0) 100%);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.brand-mark .sweep { transform-origin: 16px 16px; animation: sweep 4s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .brand-mark .sweep { animation: none; } }
.brand-text {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  letter-spacing: .14em; white-space: nowrap;
}
.brand-accent { color: var(--accent); margin-left: .35em; }

.search-wrap { position: relative; flex: 1; max-width: 380px; }
#search {
  width: 100%; height: 34px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 12px; font-size: 13px; font-family: var(--sans);
  backdrop-filter: blur(10px); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#search::placeholder { color: var(--text-dim); }
#search:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
#search::-webkit-search-cancel-button { filter: invert(.6); }

.results {
  position: absolute; top: 40px; left: 0; right: 0;
  background: var(--surface-sol); border: 1px solid var(--border-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; max-height: 320px; overflow-y: auto;
}
.results button {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--border);
  color: var(--text); padding: 9px 12px; cursor: pointer; font: inherit; font-size: 13px;
}
.results button:last-child { border-bottom: 0; }
.results button:hover, .results button.active { background: var(--accent-soft); }
.results .r-sub { display: block; font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.results .r-empty { padding: 10px 12px; color: var(--text-dim); font-size: 12px; }

.topbar-actions { display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; }
.icon-btn, .text-btn {
  height: 34px; min-width: 34px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; backdrop-filter: blur(10px);
  transition: background .15s, color .15s, border-color .15s;
}
.text-btn { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.icon-btn:hover, .text-btn:hover { color: var(--accent); border-color: var(--border-2); background: #182230; }
.icon-btn.on { color: var(--accent); border-color: var(--accent-2); background: var(--accent-soft); }
.icon-btn.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── settings popover ────────────────────────────────────── */
.popover {
  position: absolute; top: calc(var(--top-h) + 4px); right: 12px; z-index: 950;
  width: 268px; padding: 14px;
  background: var(--surface-sol); border: 1px solid var(--border-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.pop-row { margin-bottom: 12px; }
.pop-row label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 5px; letter-spacing: .04em; text-transform: uppercase; }
.pop-row label span { text-transform: none; letter-spacing: 0; float: right; color: var(--accent); }
.pop-row select {
  width: 100%; height: 30px; padding: 0 8px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font: inherit; font-size: 12.5px; cursor: pointer; outline: none;
}
.pop-row select:focus { border-color: var(--accent-2); }
.pop-row input[type=range] { width: 100%; }
.pop-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pop-check label { font-size: 12.5px; cursor: pointer; }
.pop-check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.pop-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 10.5px; }

input[type=range] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px;
  background: var(--border-2); outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); cursor: pointer;
}

/* ── side panel ──────────────────────────────────────────── */
.panel {
  position: absolute; top: var(--top-h); left: 0; bottom: 0; width: var(--panel-w);
  z-index: 880; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 14px 22px;
  background: linear-gradient(180deg, rgba(10,14,20,.93), rgba(10,14,20,.97));
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  transition: transform .22s ease;
  scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.panel::-webkit-scrollbar { width: 7px; }
.panel::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
.panel.hidden { transform: translateX(-100%); }
.panel section { margin-bottom: 18px; }

.place h1 { font-size: 19px; margin: 0 0 2px; font-weight: 600; letter-spacing: -.01em; }
.place p { margin: 0; font-size: 11px; }

.section-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); margin: 0 0 8px; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
}
.pill {
  background: var(--danger); color: #fff; border-radius: 20px;
  padding: 1px 7px; font-size: 10px; letter-spacing: 0; font-family: var(--mono);
}

/* alerts */
.alert-card {
  border-left: 3px solid var(--warn);
  background: rgba(255,255,255,.035);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 8px 10px; margin-bottom: 7px; cursor: pointer;
  transition: background .15s;
}
.alert-card:hover { background: rgba(255,255,255,.07); }
.alert-card .a-title { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.alert-card .a-meta { font-size: 10.5px; color: var(--text-dim); margin-top: 3px; font-family: var(--mono); }
.alert-card .a-body { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; line-height: 1.5; white-space: pre-wrap; }

/* current conditions */
.now-main { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.now-icon { width: 46px; height: 46px; flex-shrink: 0; color: var(--accent); }
.now-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.now-temp { font-size: 40px; font-weight: 300; line-height: 1; font-family: var(--mono); letter-spacing: -.03em; }
.now-desc { font-size: 12.5px; margin-top: 3px; }
.now-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.now-grid > div { background: var(--bg-2); padding: 7px 10px; display: flex; flex-direction: column; gap: 1px; }
.now-grid .k { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.now-grid .v { font-size: 13px; font-family: var(--mono); }

/* hourly */
.hourly-strip {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px;
  scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.hourly-strip::-webkit-scrollbar { height: 6px; }
.hourly-strip::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
.hour {
  flex: 0 0 auto; width: 54px; text-align: center;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 4px;
}
.hour .h-t { font-size: 10px; color: var(--text-dim); font-family: var(--mono); }
.hour .h-i { width: 22px; height: 22px; margin: 4px auto 3px; color: var(--accent); }
.hour .h-i svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hour .h-d { font-size: 13px; font-family: var(--mono); }
.hour .h-p { font-size: 9.5px; color: var(--accent); font-family: var(--mono); min-height: 13px; }

/* daily */
.daily-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.day { display: grid; grid-template-columns: 40px 26px 1fr 76px; align-items: center; gap: 8px; padding: 7px 10px; background: var(--bg-2); }
.day .d-n { font-size: 11.5px; font-family: var(--mono); color: var(--text-dim); }
.day .d-i { width: 20px; height: 20px; color: var(--accent); }
.day .d-i svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.day .d-p { font-size: 10px; color: var(--accent); font-family: var(--mono); }
.day .d-t { font-size: 12px; font-family: var(--mono); text-align: right; }
.day .d-t .lo { color: var(--text-dim); }

.panel-foot { font-size: 10px; line-height: 1.7; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── legend ──────────────────────────────────────────────── */
.legend {
  position: absolute; right: 12px; bottom: 92px; z-index: 870;
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 9px;
  backdrop-filter: blur(10px);
}
.legend-label { font-size: 9.5px; color: var(--text-dim); font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.legend-bar { width: 108px; height: 8px; border-radius: 4px; border: 1px solid var(--border); }

/* ── timeline ────────────────────────────────────────────── */
.timeline {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px;
  z-index: 890;
  width: min(680px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 10px 14px;
  box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
body.panel-open .timeline { left: calc(50% + var(--panel-w) / 2); }

.play-btn {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%;
  background: var(--accent); color: #04222a; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s, background .15s;
}
.play-btn:hover { background: #67e8f9; transform: scale(1.05); }
.play-btn svg { width: 20px; height: 20px; fill: currentColor; }
/* SVGElement has no .hidden IDL property, so state rides on a class */
.play-btn .ico-pause { display: none; }
.play-btn.playing .ico-play  { display: none; }
.play-btn.playing .ico-pause { display: block; }

.track-wrap { flex: 1; min-width: 0; }
.track-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.spacer { flex: 1; }
.frame-time { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.frame-tag {
  font-size: 9px; text-transform: uppercase; letter-spacing: .1em;
  padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-weight: 600;
  background: var(--border-2); color: var(--text-dim);
}
.frame-tag.forecast { background: rgba(245, 158, 11, .18); color: var(--warn); }
.track-head .dim { font-size: 10.5px; }

.track { position: relative; height: 24px; cursor: pointer; touch-action: none; }
.track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 4px;
  background: var(--border-2); border-radius: 2px;
}
.track:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.track-fill {
  position: absolute; left: 0; top: 10px; height: 4px; width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 2px; pointer-events: none;
}
.track-now {
  position: absolute; top: 4px; width: 2px; height: 16px;
  background: var(--text); opacity: .55; pointer-events: none; border-radius: 1px;
}
.track-ticks { position: absolute; inset: 0; pointer-events: none; }
.track-ticks i {
  position: absolute; top: 9px; width: 2px; height: 6px;
  background: var(--text-dim); opacity: .5; border-radius: 1px; transform: translateX(-1px);
}
.track-ticks i.fc { background: var(--warn); opacity: .75; }
.track-thumb {
  position: absolute; top: 5px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface-sol);
  box-shadow: 0 0 0 1px var(--accent-2), 0 2px 6px rgba(0,0,0,.5);
  pointer-events: none; transform: translateX(-7px);
  transition: left .09s linear;
}

/* ── toast + boot ────────────────────────────────────────── */
.toast {
  position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%);
  z-index: 960; background: var(--surface-sol); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 8px;
  padding: 9px 15px; font-size: 12.5px; box-shadow: var(--shadow);
  max-width: 86vw; text-align: center;
}
body.panel-open .toast { left: calc(50% + var(--panel-w) / 2); }

.boot {
  position: absolute; inset: 0; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--bg); color: var(--text-dim); font-size: 12px; letter-spacing: .1em;
  transition: opacity .4s; text-transform: uppercase;
}
.boot.gone { opacity: 0; pointer-events: none; }
.boot-ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--border-2); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}

/* ── responsive ──────────────────────────────────────────── */
@media (max-width: 860px) {
  :root { --panel-w: 300px; }
  .panel { width: 88vw; max-width: 340px; box-shadow: var(--shadow); padding-bottom: 96px; }
  .panel.hidden { transform: translateX(-101%); }
  body.panel-open .timeline, body.panel-open .toast { left: 50%; }
  .brand-text { display: none; }
  .legend { display: none; }
}
@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 0 8px; }
  .search-wrap { max-width: none; }
  .timeline { bottom: 10px; padding: 8px 11px; gap: 9px; }
  .play-btn { width: 34px; height: 34px; }
}
