/* =============================================================================
   SkyCast - Weather Information Dashboard
   style.css

   Table of contents
     1.  Design tokens (colours, light + dark theme)
     2.  Base / reset / utilities
     3.  App layout (sidebar, content, top bar)
     4.  Buttons, inputs, segmented controls
     5.  Search + suggestions
     6.  Cards, chips, banners, pills
     7.  Hero (current weather)
     8.  Alerts + tips
     9.  Statistic cards
    10.  Hourly forecast
    11.  Charts
    12.  Daily forecast
    13.  Sun / moon + air quality
    14.  Forecast table, favourites, history, compare
    15.  Settings + about
    16.  Toasts + skeleton loading
    17.  Animations
    18.  Responsive rules
    19.  Accessibility (reduced motion, focus)
   ============================================================================= */

/* ------------------------------ 1. Design tokens ------------------------------ */
:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --navy-900: #061528;
  --navy-800: #0a2540;
  --navy-700: #0f3460;
  --sky-500: #0ea5e9;
  --sky-400: #38bdf8;
  --blue-600: #2563eb;

  --primary: #0ea5e9;
  --primary-strong: #0369a1;
  --grad-primary: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);

  /* light theme (default) */
  --bg-grad:
    radial-gradient(1200px 620px at 8% -10%, #bfe3ff 0%, transparent 60%),
    radial-gradient(900px 520px at 100% 0%, #d4e4ff 0%, transparent 55%),
    linear-gradient(180deg, #eef6ff 0%, #e1edfb 100%);
  --surface: rgba(255, 255, 255, 0.68);
  --surface-2: rgba(255, 255, 255, 0.55);
  --surface-solid: #ffffff;
  --border: rgba(255, 255, 255, 0.9);
  --border-soft: rgba(15, 52, 96, 0.09);
  --text: #0b2545;
  --muted: #5a6b85;
  --shadow: 0 10px 30px rgba(15, 52, 96, 0.1), 0 2px 6px rgba(15, 52, 96, 0.05);
  --shadow-hover: 0 18px 40px rgba(15, 52, 96, 0.16), 0 4px 10px rgba(15, 52, 96, 0.07);
  --chart-grid: rgba(15, 52, 96, 0.08);
  --tooltip-bg: rgba(10, 37, 64, 0.95);
  --sk-a: rgba(15, 52, 96, 0.08);
  --sk-b: rgba(15, 52, 96, 0.18);
  --blob-1: rgba(56, 189, 248, 0.35);
  --blob-2: rgba(99, 102, 241, 0.22);
  --blob-3: rgba(14, 165, 233, 0.22);

  /* weather icon tints (tuned for light surfaces) */
  --ic-sun: #f59e0b;
  --ic-moon: #6366f1;
  --ic-cloud: #64748b;
  --ic-rain: #0ea5e9;
  --ic-storm: #d97706;
  --ic-snow: #38bdf8;
  --ic-fog: #94a3b8;

  --ok: #16a34a;
  --info: #0284c7;
  --warning: #d97706;
  --danger: #dc2626;

  --radius: 22px;
  --radius-sm: 14px;
  --sidebar-w: 264px;
  --bg-base: #eaf4ff;
}

:root[data-theme='dark'] {
  --bg-base: #050f22;
  --bg-grad:
    radial-gradient(1100px 620px at 8% -10%, rgba(37, 99, 235, 0.38) 0%, transparent 60%),
    radial-gradient(900px 520px at 100% 0%, rgba(14, 165, 233, 0.2) 0%, transparent 55%),
    linear-gradient(180deg, #050f22 0%, #071a33 100%);
  --surface: rgba(16, 34, 66, 0.58);
  --surface-2: rgba(30, 55, 100, 0.38);
  --surface-solid: #0d2142;
  --border: rgba(140, 190, 255, 0.15);
  --border-soft: rgba(140, 190, 255, 0.12);
  --text: #e7f0ff;
  --muted: #9bb2d3;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.38), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 20px 44px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3);
  --chart-grid: rgba(140, 190, 255, 0.1);
  --tooltip-bg: rgba(3, 12, 28, 0.96);
  --sk-a: rgba(140, 190, 255, 0.08);
  --sk-b: rgba(140, 190, 255, 0.2);
  --blob-1: rgba(37, 99, 235, 0.35);
  --blob-2: rgba(124, 58, 237, 0.22);
  --blob-3: rgba(14, 165, 233, 0.18);

  --ic-sun: #fde047;
  --ic-moon: #c7d2fe;
  --ic-cloud: #cbd5e1;
  --ic-rain: #7dd3fc;
  --ic-storm: #fcd34d;
  --ic-snow: #e0f2fe;
  --ic-fog: #cbd5e1;
}

/* Hero card gradients, chosen from the weather code. Also used by favourite cards. */
[data-cond='clear-day']   { --hero-grad: linear-gradient(135deg, #0ea5e9 0%, #2563eb 58%, #1e3a8a 100%); --hero-glow: rgba(253, 224, 71, 0.55); }
[data-cond='clear-night'] { --hero-grad: linear-gradient(135deg, #0b1d4a 0%, #1e1b4b 62%, #0f172a 100%);  --hero-glow: rgba(199, 210, 254, 0.35); }
[data-cond='cloudy-day']  { --hero-grad: linear-gradient(135deg, #5b8db8 0%, #4a6fa5 52%, #334e7a 100%);  --hero-glow: rgba(255, 255, 255, 0.22); }
[data-cond='cloudy-night']{ --hero-grad: linear-gradient(135deg, #22345a 0%, #16233f 60%, #0d1629 100%);  --hero-glow: rgba(148, 163, 184, 0.22); }
[data-cond='rain']        { --hero-grad: linear-gradient(135deg, #3d5c80 0%, #2b4263 55%, #1b2b47 100%);  --hero-glow: rgba(125, 211, 252, 0.2); }
[data-cond='storm']       { --hero-grad: linear-gradient(135deg, #34306a 0%, #1d2145 55%, #0f1228 100%);  --hero-glow: rgba(252, 211, 77, 0.25); }
[data-cond='snow']        { --hero-grad: linear-gradient(135deg, #8fb8de 0%, #6b95c4 55%, #4a6fa5 100%);  --hero-glow: rgba(255, 255, 255, 0.4); }
[data-cond='fog']         { --hero-grad: linear-gradient(135deg, #7c8da3 0%, #5f7088 55%, #465669 100%);  --hero-glow: rgba(255, 255, 255, 0.25); }

/* ------------------------------ 2. Base / utilities ----------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-grad) fixed;
  background-color: var(--bg-base, #eaf4ff);
  transition: background-color 0.4s ease, color 0.3s ease;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; }
a { color: var(--primary-strong); text-underline-offset: 3px; }
:root[data-theme='dark'] a { color: var(--sky-400); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.mt { margin-top: 18px; }
.tiny { font-size: 0.7em; opacity: 0.8; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 1000;
  background: var(--navy-800); color: #fff; padding: 10px 16px; border-radius: 10px;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.noscript { margin: 0; padding: 14px; text-align: center; background: #fee2e2; color: #7f1d1d; font-weight: 600; }

/* Animated blurred shapes behind the UI */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(80px); animation: blobFloat 22s ease-in-out infinite alternate; }
.bg-blobs span:nth-child(1) { width: 480px; height: 480px; background: var(--blob-1); top: -120px; left: 12%; }
.bg-blobs span:nth-child(2) { width: 420px; height: 420px; background: var(--blob-2); bottom: -140px; right: 6%; animation-delay: -7s; }
.bg-blobs span:nth-child(3) { width: 340px; height: 340px; background: var(--blob-3); top: 42%; left: -100px; animation-delay: -13s; }

/* ------------------------------ 3. Layout ------------------------------ */
.app { display: flex; min-height: 100vh; }
.bottom-nav { display: none; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  display: flex; flex-direction: column; gap: 22px; padding: 22px 16px;
  color: #dbeafe;
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(56, 189, 248, 0.22), transparent 70%),
    linear-gradient(180deg, #0a2540 0%, #071a33 100%);
  border-right: 1px solid rgba(148, 197, 255, 0.12);
  box-shadow: 8px 0 30px rgba(6, 21, 40, 0.18);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; }
.brand-logo {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; flex: none;
  font-size: 22px; color: #fff; background: var(--grad-primary);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1.2rem; color: #fff; letter-spacing: -0.02em; }
.brand-text small { font-size: 0.7rem; color: #93b4dc; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 12px 14px; border: 0; border-radius: 14px; background: transparent;
  color: #b6cbe8; font-weight: 550; font-size: 0.95rem; text-align: left;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.nav-item i { width: 20px; text-align: center; font-size: 1rem; }
.nav-item:hover { background: rgba(148, 197, 255, 0.1); color: #fff; transform: translateX(2px); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.32), rgba(37, 99, 235, 0.3));
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.28);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 20%; bottom: 20%; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--sky-400);
}
.nav-badge {
  margin-left: auto; font-style: normal; font-size: 0.72rem; font-weight: 700;
  min-width: 22px; padding: 2px 7px; border-radius: 999px; text-align: center;
  background: var(--sky-500); color: #fff;
}

.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: rgba(148, 197, 255, 0.07); }
.api-status { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; color: #cfe3ff; }
.api-status .dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); animation: pulseDot 2s infinite; }
.api-status.offline .dot { background: #ef4444; animation: none; }
.credit { font-size: 0.72rem; color: #8aa8d1; }
.credit a { color: #bcd8ff; }

.content { margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w)); min-width: 0; padding: 0 28px 24px; }

.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px;
  padding: 16px 0 14px; margin-bottom: 6px;
}
.topbar::before {
  content: ''; position: absolute; inset: 0 -28px; z-index: -1;
  background: linear-gradient(180deg, var(--surface-solid) 0%, transparent 100%);
  opacity: 0.55; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  mask-image: linear-gradient(180deg, #000 60%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent);
}
.mobile-brand { display: none; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #fff; background: var(--grad-primary); flex: none; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.only-mobile { display: none; }

main { outline: none; }
.view { display: none; }
.view.active { display: block; animation: viewIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 10px 0 18px; }
.view-head p { margin-top: 2px; }
.view-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.site-footer { margin-top: 34px; text-align: center; font-size: 0.8rem; color: var(--muted); }

/* ------------------------------ 4. Buttons & inputs ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border: 1px solid transparent; border-radius: 12px;
  font-weight: 600; font-size: 0.9rem; white-space: nowrap;
  transition: transform 0.18s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.6; cursor: progress; transform: none; }
.btn-primary { color: #fff; background: var(--grad-primary); box-shadow: 0 8px 20px rgba(37, 99, 235, 0.32); }
.btn-primary:hover { box-shadow: 0 12px 26px rgba(37, 99, 235, 0.42); }
.btn-ghost { background: var(--surface); border-color: var(--border-soft); box-shadow: var(--shadow); }
.btn-ghost:hover { background: var(--surface-solid); }
.btn-danger { color: var(--danger); background: rgba(220, 38, 38, 0.1); border-color: rgba(220, 38, 38, 0.25); }
.btn-danger:hover { background: rgba(220, 38, 38, 0.18); }
:root[data-theme='dark'] .btn-danger { color: #fca5a5; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border-radius: 12px; border: 1px solid var(--border-soft); background: var(--surface);
  box-shadow: var(--shadow); transition: transform 0.18s, background 0.2s;
}
.icon-btn:hover { transform: translateY(-2px); background: var(--surface-solid); }
.icon-btn.small { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
.icon-btn.spinning i { animation: spin 0.9s linear infinite; }
.glass-btn { color: #fff; background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.3); box-shadow: none; backdrop-filter: blur(8px); }
.glass-btn:hover { background: rgba(255, 255, 255, 0.3); }
#favBtn[aria-pressed='true'] { color: #fde047; }

/* Segmented radio-style buttons */
.segmented {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
}
.segmented button {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 0.86rem;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked='true'] { color: #fff; background: var(--grad-primary); box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3); }
.segmented.mini { padding: 3px; flex: none; flex-wrap: nowrap; }
.segmented.mini button { white-space: nowrap; }
.segmented.mini button { padding: 7px 11px; font-size: 0.82rem; }
.top-actions .segmented.mini { height: 42px; align-items: center; box-shadow: var(--shadow); }

/* ------------------------------ 5. Search ------------------------------ */
.search-wrap { position: relative; flex: 1 1 auto; max-width: 640px; min-width: 0; }
.search-wrap input {
  width: 100%; height: 46px; padding: 0 76px 0 46px; border-radius: 14px;
  border: 1px solid var(--border-soft); background: var(--surface); box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-size: 0.95rem; transition: box-shadow 0.2s, border-color 0.2s;
  -webkit-appearance: none; appearance: none;
}
.search-wrap input::placeholder { color: var(--muted); opacity: 0.85; }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-wrap input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.22), var(--shadow); }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted);
}
.search-clear:hover { color: var(--text); }
.search-kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  min-width: 24px; padding: 1px 7px; text-align: center; border-radius: 7px; font-family: var(--font); font-size: 0.78rem;
  color: var(--muted); border: 1px solid var(--border-soft); background: var(--surface-2); pointer-events: none;
}
.search-wrap input:focus ~ .search-kbd, .search-clear:not([hidden]) ~ .search-kbd { display: none; }

.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 70;
  max-height: min(420px, 62vh); overflow-y: auto; padding: 6px; border-radius: 16px;
  background: var(--surface-solid); border: 1px solid var(--border-soft);
  box-shadow: 0 24px 50px rgba(6, 21, 40, 0.25);
  animation: dropIn 0.18s ease-out;
}
.suggestions[hidden] { display: none; }
.sug-head { padding: 8px 12px 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sug-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; cursor: pointer; }
.sug-item:hover, .sug-item.active { background: rgba(14, 165, 233, 0.14); }
.sug-flag { width: 26px; height: 19px; flex: none; display: grid; place-items: center; border-radius: 4px; overflow: hidden; background: var(--surface-2); color: var(--muted); font-size: 0.8rem; }
.sug-flag img { width: 26px; height: 19px; object-fit: cover; display: block; }
.sug-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sug-main { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-sub { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-tag { margin-left: auto; font-size: 0.72rem; font-weight: 700; color: var(--muted); padding: 2px 8px; border-radius: 999px; background: var(--surface-2); flex: none; }
.sug-state { display: flex; align-items: center; gap: 10px; padding: 14px 12px; color: var(--muted); font-size: 0.9rem; }

/* ------------------------------ 6. Cards, chips, banners ------------------------------ */
.card {
  position: relative; padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { display: flex; align-items: center; gap: 9px; }
.card-head h3 i { color: var(--primary); font-size: 0.95em; }
.fine-print { margin-top: 12px; font-size: 0.74rem; color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; white-space: nowrap;
  color: var(--primary-strong); background: rgba(14, 165, 233, 0.14);
}
:root[data-theme='dark'] .pill { color: var(--sky-400); }
.pill.warn { color: #b45309; background: rgba(245, 158, 11, 0.18); }
.pill.danger { color: #b91c1c; background: rgba(220, 38, 38, 0.15); }
.pill.ok { color: #15803d; background: rgba(34, 197, 94, 0.16); }
:root[data-theme='dark'] .pill.warn { color: #fbbf24; }
:root[data-theme='dark'] .pill.danger { color: #fca5a5; }
:root[data-theme='dark'] .pill.ok { color: #86efac; }

.chips-block { display: grid; gap: 10px; margin: 6px 0 18px; }
.chips-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.chips-row[hidden] { display: none; }
.chips-title { flex: none; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-soft); background: var(--surface); color: var(--text);
  font-size: 0.86rem; font-weight: 600; box-shadow: var(--shadow); transition: transform 0.18s, background 0.2s, border-color 0.2s;
}
.chip:hover { transform: translateY(-2px); background: var(--surface-solid); border-color: var(--primary); }
.chip.active { color: #fff; background: var(--grad-primary); border-color: transparent; }
.chip.fav i { color: #f59e0b; }
.chip .chip-x { margin-left: 2px; width: 20px; height: 20px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: rgba(120, 140, 170, 0.22); font-size: 0.7rem; color: inherit; }
.chip .chip-x:hover { background: rgba(220, 38, 38, 0.3); }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 4px 0 16px;
  border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 550;
  color: #92400e; background: rgba(245, 158, 11, 0.16); border: 1px solid rgba(245, 158, 11, 0.38);
}
.banner[hidden] { display: none; }
.banner.info { color: #075985; background: rgba(14, 165, 233, 0.14); border-color: rgba(14, 165, 233, 0.35); }
:root[data-theme='dark'] .banner { color: #fcd34d; }
:root[data-theme='dark'] .banner.info { color: #7dd3fc; }
.banner button { margin-left: auto; }

.error-panel { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 44px 24px; max-width: 560px; margin: 24px auto; }
.error-panel[hidden] { display: none; }
.error-icon { font-size: 54px; color: var(--ic-storm); }
.error-panel p { color: var(--muted); max-width: 44ch; }
.error-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }

.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 44px 24px; }
.empty[hidden] { display: none; }
.empty > i { font-size: 44px; color: var(--primary); opacity: 0.8; }
.empty p { color: var(--muted); max-width: 46ch; }
.empty .btn { margin-top: 8px; }

/* ------------------------------ 7. Hero ------------------------------ */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.dash-grid > * { animation: cardIn 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.dash-grid > *:nth-child(2) { animation-delay: 0.06s; }
.dash-grid > *:nth-child(3) { animation-delay: 0.12s; }
.dash-grid > *:nth-child(4) { animation-delay: 0.18s; }
.dash-grid > *:nth-child(5) { animation-delay: 0.24s; }
.dash-grid > *:nth-child(6) { animation-delay: 0.3s; }
.dash-grid > *:nth-child(7) { animation-delay: 0.36s; }

.hero { grid-column: span 8; color: #fff; border: 0; overflow: hidden; isolation: isolate; background: var(--hero-grad); box-shadow: 0 22px 50px rgba(15, 52, 96, 0.32); display: flex; flex-direction: column; gap: 14px; min-height: 380px; }
.hero::before {
  content: ''; position: absolute; z-index: -1; right: -60px; top: -80px; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, var(--hero-glow) 0%, transparent 68%);
}
.hero::after {
  content: ''; position: absolute; z-index: -1; left: -120px; bottom: -160px; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
}
.hero .hero-fx { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.6s; }
.hero[data-cond='rain'] .hero-fx, .hero[data-cond='storm'] .hero-fx {
  opacity: 1;
  background-image: repeating-linear-gradient(105deg, transparent 0 22px, rgba(255, 255, 255, 0.16) 22px 23px, transparent 23px 46px);
  background-size: 60px 120px; animation: rain 0.7s linear infinite;
}
.hero[data-cond='storm'] .hero-fx { animation: rain 0.7s linear infinite, flash 6s infinite; }
.hero[data-cond='snow'] .hero-fx {
  opacity: 1;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0 2px, transparent 3px), radial-gradient(circle, rgba(255, 255, 255, 0.6) 0 1.5px, transparent 2.5px);
  background-size: 70px 70px, 110px 110px; background-position: 0 0, 30px 40px; animation: snow 9s linear infinite;
}

.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero-loc h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); line-height: 1.1; letter-spacing: -0.03em; font-weight: 750; }
.hero-loc p { margin-top: 4px; opacity: 0.88; font-weight: 500; }
.hero-actions { display: flex; gap: 8px; flex: none; }
.hero-datetime { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 550; opacity: 0.95; font-variant-numeric: tabular-nums; }
.hero-datetime .sep { opacity: 0.6; }

.hero-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: 1; }
.hero-temp-block { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.temp-big { display: flex; align-items: flex-start; font-size: clamp(4.4rem, 9vw, 7.4rem); font-weight: 250; line-height: 0.95; letter-spacing: -0.05em; }
.temp-big .temp-unit { font-size: 0.32em; font-weight: 400; letter-spacing: 0; margin-top: 0.38em; opacity: 0.85; }
.hero-text { display: grid; gap: 3px; }
.hero-condition { font-size: 1.35rem; font-weight: 650; }
.hero-text p:not(.hero-condition) { opacity: 0.9; font-weight: 500; }
.hero-icon { font-size: clamp(5rem, 11vw, 8.6rem); line-height: 1; padding-right: 6px; animation: floaty 6s ease-in-out infinite; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.3)); }
.hero .ic-sun { color: #fde047; }
.hero .ic-moon { color: #e0e7ff; }
.hero .ic-cloud { color: #e2e8f0; }
.hero .ic-rain { color: #7dd3fc; }
.hero .ic-storm { color: #fcd34d; }
.hero .ic-snow { color: #f0f9ff; }
.hero .ic-fog { color: #e2e8f0; }

.hero-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hero-metrics li {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'i l' 'i v'; column-gap: 11px; align-items: center;
  padding: 11px 13px; border-radius: 15px; background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2); backdrop-filter: blur(10px); transition: background 0.2s, transform 0.2s;
}
.hero-metrics li:hover { background: rgba(255, 255, 255, 0.24); transform: translateY(-2px); }
.hero-metrics i { grid-area: i; font-size: 1.15rem; width: 24px; text-align: center; opacity: 0.95; }
.hero-metrics span { grid-area: l; font-size: 0.74rem; opacity: 0.8; }
.hero-metrics strong { grid-area: v; font-size: 0.98rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.hero-foot { font-size: 0.8rem; opacity: 0.8; display: flex; align-items: center; gap: 7px; }

/* ------------------------------ 8. Alerts + tips ------------------------------ */
.side-stack { grid-column: span 4; display: grid; gap: 18px; align-content: start; grid-template-rows: auto 1fr; }
.alerts { display: grid; gap: 10px; }
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid; animation: dropIn 0.35s ease-out; }
.alert-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; color: #fff; }
.alert strong { display: block; font-size: 0.92rem; line-height: 1.3; }
.alert p { margin-top: 2px; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
.alert-danger { background: rgba(220, 38, 38, 0.1); border-color: rgba(220, 38, 38, 0.35); }
.alert-danger .alert-icon { background: #dc2626; }
.alert-warning { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); }
.alert-warning .alert-icon { background: #f59e0b; }
.alert-info { background: rgba(14, 165, 233, 0.1); border-color: rgba(14, 165, 233, 0.32); }
.alert-info .alert-icon { background: #0ea5e9; }
.alert-ok { background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.32); }
.alert-ok .alert-icon { background: #22c55e; }

.tips { display: grid; gap: 10px; }
.tips li { display: flex; align-items: flex-start; gap: 12px; font-size: 0.88rem; line-height: 1.45; }
.tips li span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex: none; color: var(--primary); background: rgba(14, 165, 233, 0.13); }

/* ------------------------------ 9. Statistic cards ------------------------------ */
.stats-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 8px; padding: 18px; }
.stat:hover { transform: translateY(-4px); }
.stat-head { display: flex; align-items: center; gap: 10px; }
.stat-head h3 { font-size: 0.86rem; font-weight: 600; color: var(--muted); }
.stat-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; font-size: 0.95rem; }
.bg-blue { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.bg-teal { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.bg-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }
.bg-indigo { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.bg-sky { background: linear-gradient(135deg, #7dd3fc, #0284c7); }
.bg-green { background: linear-gradient(135deg, #4ade80, #16a34a); }
.bg-amber { background: linear-gradient(135deg, #fcd34d, #f59e0b); }
.bg-rose { background: linear-gradient(135deg, #fb7185, #7c3aed); }
.stat-value { font-size: 1.75rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 0.82rem; color: var(--muted); }
.wind-arrow { display: inline-block; font-size: 0.55em; color: var(--primary); transition: transform 0.8s cubic-bezier(0.3, 1.4, 0.5, 1); vertical-align: middle; }
.meter { position: relative; height: 8px; border-radius: 999px; background: var(--sk-a); }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #38bdf8, #2563eb); transition: width 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); }
.meter.uv { background: linear-gradient(90deg, #22c55e 0%, #eab308 30%, #f97316 55%, #ef4444 78%, #a855f7 100%); }
.meter.uv span {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  border: 3px solid var(--navy-800); transform: translate(-50%, -50%); transition: left 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.aqi-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); vertical-align: middle; }
.aqi-good { background: #22c55e; } .aqi-moderate { background: #eab308; } .aqi-sensitive { background: #f97316; }
.aqi-unhealthy { background: #ef4444; } .aqi-very-unhealthy { background: #a855f7; } .aqi-hazardous { background: #7f1d1d; } .aqi-na { background: #94a3b8; }

/* ------------------------------ 10. Hourly forecast ------------------------------ */
.hourly-card { grid-column: 1 / -1; min-width: 0; }
.scroll-btns { display: flex; gap: 8px; }
.hourly-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity;
  scrollbar-width: thin; scrollbar-color: rgba(14, 165, 233, 0.5) transparent; outline-offset: 4px;
}
.hourly-scroll::-webkit-scrollbar { height: 8px; }
.hourly-scroll::-webkit-scrollbar-thumb { background: rgba(14, 165, 233, 0.45); border-radius: 8px; }
.hour-card {
  flex: 0 0 96px; scroll-snap-align: start; display: grid; justify-items: center; gap: 7px; padding: 14px 8px;
  border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border-soft);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.hour-card:hover { transform: translateY(-5px); background: var(--surface-solid); box-shadow: var(--shadow); }
.hour-card.now { color: #fff; border-color: transparent; background: var(--grad-primary); box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35); }
.hour-card.now .ic-sun, .hour-card.now .ic-moon, .hour-card.now .ic-cloud, .hour-card.now .ic-rain,
.hour-card.now .ic-storm, .hour-card.now .ic-snow, .hour-card.now .ic-fog { color: #fff; }
.h-time { font-size: 0.82rem; font-weight: 650; opacity: 0.9; }
.h-icon { font-size: 1.7rem; height: 34px; display: grid; place-items: center; }
.h-temp { font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.h-rain, .h-wind { display: flex; align-items: center; gap: 5px; font-size: 0.76rem; opacity: 0.88; font-variant-numeric: tabular-nums; white-space: nowrap; }
.h-rain i { color: #38bdf8; }
.hour-card.now .h-rain i { color: #fff; }

/* ------------------------------ 11. Charts ------------------------------ */
.chart-card { grid-column: span 7; min-width: 0; }
.chart-box { position: relative; height: 290px; width: 100%; }
.chart-msg { padding: 14px; text-align: center; font-size: 0.86rem; color: var(--warning); }
.chart-msg[hidden] { display: none; }

/* ------------------------------ 12. Daily forecast ------------------------------ */
.daily-card { grid-column: span 5; min-width: 0; }
.daily-list { display: grid; gap: 4px; }
.daily-item {
  display: grid; grid-template-columns: 86px 38px minmax(0, 1fr); gap: 2px 12px; align-items: center;
  padding: 10px 10px; border-radius: 14px; transition: background 0.2s, transform 0.2s;
}
.daily-item:hover { background: var(--surface-2); transform: translateX(3px); }
.d-day { display: grid; line-height: 1.2; }
.d-day strong { font-size: 0.95rem; }
.d-date { font-size: 0.74rem; color: var(--muted); }
.d-icon { font-size: 1.5rem; text-align: center; }
.d-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.d-desc { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-rain { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; font-weight: 650; color: var(--info); flex: none; font-variant-numeric: tabular-nums; }
.d-range { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 8px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.d-min { color: var(--muted); font-size: 0.86rem; text-align: right; }
.d-max { font-weight: 700; font-size: 0.9rem; }
.range-bar { position: relative; height: 7px; border-radius: 999px; background: var(--sk-a); }
.range-fill { position: absolute; top: 0; bottom: 0; border-radius: inherit; background: linear-gradient(90deg, #38bdf8, #fbbf24, #f97316); }

/* Weather icon tints (used outside the hero) */
.ic-sun { color: var(--ic-sun); } .ic-moon { color: var(--ic-moon); } .ic-cloud { color: var(--ic-cloud); }
.ic-rain { color: var(--ic-rain); } .ic-storm { color: var(--ic-storm); } .ic-snow { color: var(--ic-snow); } .ic-fog { color: var(--ic-fog); }

/* ------------------------------ 13. Sun / moon + air quality ------------------------------ */
.sun-card { grid-column: span 7; min-width: 0; }
.aq-card { grid-column: span 5; min-width: 0; }
.sun-wrap { display: grid; gap: 4px; }
.sun-svg { width: 100%; max-width: 460px; margin: 0 auto; display: block; overflow: visible; }
.sun-horizon { stroke: var(--muted); stroke-opacity: 0.45; stroke-width: 2; stroke-linecap: round; }
.sun-arc { fill: none; stroke: var(--muted); stroke-opacity: 0.4; stroke-width: 3; stroke-dasharray: 3 7; stroke-linecap: round; }
.sun-arc-progress { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray 1s ease; }
.sun-glow { fill: rgba(251, 191, 36, 0.28); }
.sun-core { fill: #fbbf24; stroke: #fff; stroke-width: 2.5; }
#sunDot { transition: transform 1s ease; }
#sunDot.night .sun-core { fill: #a5b4fc; }
#sunDot.night .sun-glow { fill: rgba(165, 180, 252, 0.22); }
.sun-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; margin-top: -8px; }
.sun-times span { display: block; font-size: 0.76rem; color: var(--muted); }
.sun-times strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.sun-extra { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border-soft); font-size: 0.9rem; }
.sun-extra i { color: var(--primary); margin-right: 4px; }
.moon { font-size: 1.3rem; vertical-align: middle; }

.aq-body { display: grid; gap: 14px; }
.aq-main { display: flex; align-items: center; gap: 16px; }
.aq-ring { display: grid; place-items: center; width: 86px; height: 86px; border-radius: 50%; flex: none; font-size: 1.8rem; font-weight: 800; color: #fff; box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.28); }
.aq-main strong { display: block; font-size: 1.05rem; }
.aq-main p { font-size: 0.84rem; color: var(--muted); }
.aq-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.aq-tile { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.aq-tile span { display: block; font-size: 0.74rem; color: var(--muted); }
.aq-tile strong { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.aq-unavailable { display: grid; justify-items: center; gap: 8px; padding: 26px 10px; text-align: center; color: var(--muted); }
.aq-unavailable i { font-size: 34px; opacity: 0.6; }

/* ------------------------------ 14. Forecast, favourites, history, compare ------------------------------ */
.forecast-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 12px; text-align: left; white-space: nowrap; }
thead th { font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border-soft); }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: var(--surface-2); }
tbody td { border-bottom: 1px solid var(--border-soft); font-size: 0.92rem; }
tbody tr:last-child td { border-bottom: 0; }
.cell-cond { display: flex; align-items: center; gap: 10px; }
.cell-cond i { font-size: 1.2rem; width: 26px; text-align: center; }
.hi { font-weight: 700; }
.lo { color: var(--muted); }

.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.fav-card {
  position: relative; display: grid; gap: 14px; padding: 18px; border-radius: var(--radius); color: #fff;
  background: var(--hero-grad); box-shadow: var(--shadow); overflow: hidden; isolation: isolate; cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s; border: 0; text-align: left; width: 100%;
}
.fav-card::before { content: ''; position: absolute; z-index: -1; right: -40px; top: -50px; width: 190px; height: 190px; border-radius: 50%; background: radial-gradient(circle, var(--hero-glow), transparent 70%); }
.fav-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.fav-card[data-cond=''] , .fav-card:not([data-cond]) { --hero-grad: linear-gradient(135deg, #3b6ea5 0%, #1e3a8a 100%); --hero-glow: rgba(255, 255, 255, 0.2); }
.fav-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fav-name { font-size: 1.15rem; font-weight: 750; line-height: 1.2; }
.fav-meta { font-size: 0.8rem; opacity: 0.85; }
.fav-body { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fav-temp { font-size: 2.8rem; font-weight: 300; letter-spacing: -0.04em; line-height: 1; }
.fav-icon { font-size: 2.6rem; }
.fav-icon .ic-sun { color: #fde047; } .fav-icon .ic-moon { color: #e0e7ff; } .fav-icon .ic-cloud { color: #e2e8f0; }
.fav-icon .ic-rain { color: #7dd3fc; } .fav-icon .ic-storm { color: #fcd34d; } .fav-icon .ic-snow { color: #f0f9ff; } .fav-icon .ic-fog { color: #e2e8f0; }
.fav-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.84rem; }
.fav-remove { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 10px; color: #fff; background: rgba(255, 255, 255, 0.18); }
.fav-remove:hover { background: rgba(239, 68, 68, 0.75); }

.history-list { display: grid; gap: 10px; }
.history-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); animation: cardIn 0.4s backwards; }
.history-open { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; padding: 4px; border: 0; background: transparent; text-align: left; border-radius: 10px; }
.history-open:hover .sug-main { color: var(--primary); }
.history-time { font-size: 0.8rem; color: var(--muted); flex: none; }
.history-item .icon-btn { box-shadow: none; }

.compare-tools { display: grid; gap: 14px; margin-bottom: 18px; }
.compare-search { max-width: none; }
.compare-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
#compareResults { display: grid; gap: 18px; }
#compareResults[hidden] { display: none; }
.compare-table th, .compare-table td { padding: 12px 14px; }
.compare-table tbody th { font-size: 0.84rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border-soft); position: sticky; left: 0; background: var(--surface-solid); }
.compare-table thead th { text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--text); }
.compare-table .best { color: var(--ok); font-weight: 750; }

/* ------------------------------ 15. Settings + about ------------------------------ */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.setting h3 { margin-bottom: 2px; }
.setting .muted { font-size: 0.84rem; max-width: 34ch; }

.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.about-grid h3 { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.about-grid h3 i { color: var(--primary); }
.about-grid p { color: var(--muted); line-height: 1.65; }
.details { display: grid; gap: 10px; }
.details div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--border-soft); }
.details dt { color: var(--muted); font-size: 0.88rem; }
.details dd { font-weight: 600; text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { padding: 5px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: rgba(14, 165, 233, 0.13); color: var(--primary-strong); }
:root[data-theme='dark'] .tags li { color: var(--sky-400); }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; }
.feature-list li { position: relative; padding-left: 26px; font-size: 0.9rem; color: var(--text); }
.feature-list li::before { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; left: 0; color: var(--ok); font-size: 0.8rem; top: 2px; }

/* ------------------------------ 16. Toasts + skeleton ------------------------------ */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 500; display: grid; gap: 10px; width: min(380px, calc(100vw - 28px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px;
  border-radius: 14px; background: var(--surface-solid); color: var(--text);
  border: 1px solid var(--border-soft); border-left: 5px solid var(--info); box-shadow: 0 18px 40px rgba(6, 21, 40, 0.28);
  animation: toastIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.out { animation: toastOut 0.3s ease forwards; }
.toast-success { border-left-color: var(--ok); } .toast-error { border-left-color: var(--danger); } .toast-warning { border-left-color: var(--warning); }
.toast-icon { margin-top: 2px; }
.toast-success .toast-icon { color: var(--ok); } .toast-error .toast-icon { color: var(--danger); } .toast-warning .toast-icon { color: var(--warning); } .toast-info .toast-icon { color: var(--info); }
.toast-msg { flex: 1; font-size: 0.9rem; line-height: 1.4; }
.toast-action { border: 0; background: transparent; color: var(--primary-strong); font-weight: 750; padding: 2px 6px; border-radius: 8px; }
:root[data-theme='dark'] .toast-action { color: var(--sky-400); }
.toast-action:hover { background: rgba(14, 165, 233, 0.15); }
.toast-close { border: 0; background: transparent; color: var(--muted); padding: 2px 4px; }

/* Skeleton shimmer while loading */
.is-loading .sk {
  color: transparent !important; width: fit-content; min-width: 6ch; border-radius: 8px;
  background: linear-gradient(100deg, var(--sk-a) 30%, var(--sk-b) 50%, var(--sk-a) 70%);
  background-size: 300% 100%; animation: shimmer 1.4s linear infinite; user-select: none; pointer-events: none;
}
.is-loading .sk * { visibility: hidden; }
.is-loading .hero .sk { background-image: linear-gradient(100deg, rgba(255, 255, 255, 0.14) 30%, rgba(255, 255, 255, 0.32) 50%, rgba(255, 255, 255, 0.14) 70%); }
.is-loading .hero .hero-icon { opacity: 0.25; }
.is-loading .temp-big .sk { min-width: 2.4ch; }
.is-loading .meter span { width: 0 !important; }
.sk-block { border-radius: 14px; background: linear-gradient(100deg, var(--sk-a) 30%, var(--sk-b) 50%, var(--sk-a) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.hour-card.sk-block { height: 156px; border: 0; }
.daily-item.sk-block { height: 62px; margin: 4px 0; }

/* ------------------------------ 17. Animations ------------------------------ */
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(22px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(1.5deg); } }
@keyframes blobFloat { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.15); } }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); } 70% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@keyframes rain { from { background-position: 0 0; } to { background-position: -22px 120px; } }
@keyframes snow { from { background-position: 0 0, 30px 40px; } to { background-position: 20px 140px, 60px 200px; } }
@keyframes flash { 0%, 92%, 100% { filter: none; } 94% { filter: brightness(2.2); } 96% { filter: brightness(1); } 98% { filter: brightness(1.8); } }

/* ------------------------------ 18. Responsive ------------------------------ */
@media (max-width: 1180px) {
  .hero, .side-stack, .chart-card, .daily-card, .sun-card, .aq-card { grid-column: 1 / -1; }
  .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; align-items: start; }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 84px; }
  .sidebar { padding: 20px 12px; align-items: center; }
  .brand { padding: 0; }
  .brand-text, .nav-item span, .sidebar-foot .credit, #apiStatusText { display: none; }
  .nav-item { justify-content: center; padding: 14px 0; }
  .nav-item i { font-size: 1.15rem; }
  .nav-item.active::before { left: -12px; }
  .nav-badge { position: absolute; top: 4px; right: 6px; margin: 0; min-width: 18px; padding: 1px 5px; font-size: 0.62rem; }
  .sidebar-foot { padding: 10px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 0 20px 24px; }
  .topbar::before { inset: 0 -20px; }
}

@media (max-width: 860px) {
  .forecast-grid, .settings-grid, .about-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: 1fr; }
  .feature-list { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* The sidebar is replaced by a bottom navigation bar */
  .sidebar { display: none; }
  .content { margin-left: 0; width: 100%; padding: 0 14px 96px; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 0 10px; }
  .topbar::before { inset: 0 -14px; }
  .mobile-brand { display: grid; }
  .search-wrap { flex: 1 1 calc(100% - 54px); max-width: none; }
  .search-kbd { display: none; }
  .top-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .only-mobile { display: inline-grid; }
  .bottom-nav { display: grid; }
  .toasts { top: auto; bottom: 86px; right: 50%; transform: translateX(50%); }
  .chart-box { height: 240px; }
  .hero { min-height: 0; }
  .hero-main { flex-direction: column; align-items: flex-start; }
  .hero-icon { position: absolute; right: 14px; top: 78px; font-size: 5.2rem; opacity: 0.9; }
  .hero-text { padding-right: 90px; }
  .stat-value { font-size: 1.5rem; }
  .history-item { flex-wrap: wrap; }
  .view-head { align-items: flex-start; }
}

@media (max-width: 520px) {
  .btn-label { font-size: 0.84rem; }
  .lbl-extra { display: none; }
  .btn-primary { padding: 10px 12px; }
  .top-actions { gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
  .hero-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { gap: 12px; }
  .stat { padding: 14px; }
  .card { padding: 16px; border-radius: 20px; }
  .daily-item { grid-template-columns: 70px 32px minmax(0, 1fr); gap: 2px 8px; padding: 10px 4px; }
  .aq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sun-times strong { font-size: 0.98rem; }
  .setting .segmented { width: 100%; }
  .setting .segmented button { flex: 1 1 auto; justify-content: center; }
}

/* Bottom navigation (hidden on larger screens; shown by the 768px rule above) */
.bottom-nav {
  position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 80;
  grid-template-columns: repeat(6, 1fr); gap: 2px; padding: 6px; border-radius: 22px;
  background: var(--surface-solid); border: 1px solid var(--border-soft);
  box-shadow: 0 18px 40px rgba(6, 21, 40, 0.28);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.bottom-nav .nav-item { flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 0.64rem; justify-content: center; color: var(--muted); border-radius: 16px; text-align: center; }
.bottom-nav .nav-item:hover { transform: none; background: transparent; color: var(--text); }
.bottom-nav .nav-item.active { color: #fff; background: var(--grad-primary); box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35); }
.bottom-nav .nav-item.active::before { display: none; }
.bottom-nav .nav-item i { font-size: 1.05rem; width: auto; }
.bottom-nav .nav-item span { display: block; }

/* ------------------------------ 19. Accessibility ------------------------------ */
:focus-visible { outline: 3px solid var(--sky-400); outline-offset: 2px; }
.search-wrap input:focus-visible { outline: none; }
.hero :focus-visible { outline-color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .bg-blobs span { animation: none; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .toasts, .bg-blobs { display: none !important; }
  .content { margin: 0; width: 100%; }
  body { background: #fff; }
}
