/* ===== RESET ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== FONTS ===== */
/* Loaded via HTML */

/* ===== SKY THEMES ===== */
:root {
  --sky-hue-a: #0b1426;
  --sky-hue-b: #1a2a4a;
  --glow: #4a9eff;
  --glow2: #7bc5ff;
  --text: #f0f4ff;
  --text2: rgba(240, 244, 255, 0.6);
  --text3: rgba(240, 244, 255, 0.35);
  --glass: rgba(255, 255, 255, 0.08);
  --glass2: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border2: rgba(255, 255, 255, 0.22);
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Sky themes driven by body class */
body.sky-clear {
  --sky-hue-a: #0a1628;
  --sky-hue-b: #1b3b6b;
  --glow: #4a9eff;
  --glow2: #88ccff;
}
body.sky-sunny {
  --sky-hue-a: #1a1200;
  --sky-hue-b: #3d2800;
  --glow: #ffb830;
  --glow2: #ffe080;
}
body.sky-cloudy {
  --sky-hue-a: #1a1e26;
  --sky-hue-b: #2c3340;
  --glow: #9aaabb;
  --glow2: #bfcfdf;
}
body.sky-rainy {
  --sky-hue-a: #0d1520;
  --sky-hue-b: #1a2535;
  --glow: #4a88cc;
  --glow2: #88bbee;
}
body.sky-stormy {
  --sky-hue-a: #080c12;
  --sky-hue-b: #121a28;
  --glow: #8866ee;
  --glow2: #aaccff;
}
body.sky-snowy {
  --sky-hue-a: #0e1828;
  --sky-hue-b: #1a2c48;
  --glow: #aaccee;
  --glow2: #ddeeff;
}
body.sky-foggy {
  --sky-hue-a: #181e28;
  --sky-hue-b: #252d3a;
  --glow: #9aabb8;
  --glow2: #c8d8e0;
}
body.sky-default {
  --sky-hue-a: #0d1528;
  --sky-hue-b: #1a2545;
  --glow: #5a9aee;
  --glow2: #88bbff;
}

/* ===== BODY ===== */
html,
body {
  height: 100%;
}
body {
  font-family: "Outfit", sans-serif;
  font-weight: 300;
  background: var(--sky-hue-a);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 1.5s ease;
}

/* ===== BACKGROUND ===== */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  transition: all 1.5s ease;
}
.bg-base {
  background: radial-gradient(
    ellipse 120% 80% at 50% 100%,
    var(--sky-hue-b) 0%,
    var(--sky-hue-a) 60%
  );
  z-index: 0;
}
.bg-glow {
  background:
    radial-gradient(
      ellipse 70% 50% at 60% 20%,
      rgba(74, 158, 255, 0.12) 0%,
      transparent 65%
    ),
    radial-gradient(
      ellipse 40% 30% at 20% 70%,
      rgba(74, 158, 255, 0.06) 0%,
      transparent 60%
    );
  background-color: transparent;
  z-index: 1;
  /* The glow colours update via JS inline style for theme */
}

/* floating particles */
.particles {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(-100vh) scale(0.5);
    opacity: 0;
  }
}

/* ===== SHELL ===== */
.shell {
  position: relative;
  z-index: 10;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px 80px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== TOPBAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 20px;
}
.logo {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo em {
  font-style: italic;
  font-weight: 300;
  color: var(--text2);
}
.logo-icon {
  font-size: 14px;
  color: var(--glow);
  animation: spin-slow 12s linear infinite;
}
@keyframes spin-slow {
  to {
    transform: rotate(360deg);
  }
}

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

.btn-unit {
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--glass-border2);
  background: var(--glass);
  color: var(--text2);
  font-family: "Outfit", sans-serif;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.05em;
  backdrop-filter: blur(10px);
}
.btn-unit:hover {
  background: var(--glass2);
  color: var(--text);
}
.btn-unit.celsius .celsius-part {
  font-weight: 600;
  color: var(--text);
}
.btn-unit.fahrenheit .fahr-part {
  font-weight: 600;
  color: var(--text);
}

.btn-locate {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--glass-border2);
  background: var(--glass);
  color: var(--text2);
  font-family: "Outfit", sans-serif;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
}
.btn-locate:hover {
  background: var(--glass2);
  color: var(--text);
}

/* ===== SEARCH ===== */
.search-wrap {
  margin-bottom: 32px;
}
.search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border2);
  border-radius: 14px;
  padding: 6px 6px 6px 16px;
  backdrop-filter: blur(20px);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.search-inner:focus-within {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}
.search-icon {
  color: var(--text3);
  flex-shrink: 0;
}
.search-inner input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: "Outfit", sans-serif;
  font-size: 15px;
  font-weight: 300;
  padding: 6px 0;
}
.search-inner input::placeholder {
  color: var(--text3);
}

.btn-search {
  height: 40px;
  padding: 0 20px;
  border-radius: 10px;
  border: none;
  background: var(--glow);
  color: #0a1020;
  font-family: "Outfit", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    opacity 0.18s,
    transform 0.12s,
    background 1.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-search:hover {
  opacity: 0.88;
}
.btn-search:active {
  transform: scale(0.97);
}

/* ===== PLACEHOLDER ===== */
.hero-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
}
.placeholder-text {
  font-family: "Cormorant Garamond", serif;
  font-size: 18px;
  font-style: italic;
  color: var(--text3);
  text-align: center;
  line-height: 1.6;
}

/* ===== LOADING ===== */
.loading-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 80px 20px;
}
.loader {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--glass-border2);
  border-top-color: var(--glow);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-label {
  font-size: 13px;
  color: var(--text3);
  letter-spacing: 0.05em;
}

/* ===== ERROR ===== */
.error-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 80px 20px;
  text-align: center;
}
.error-icon {
  font-size: 36px;
  opacity: 0.5;
}
.error-msg {
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  font-weight: 300;
  color: var(--text2);
}

/* ===== WEATHER HERO ===== */
.weather-wrap {
  animation: wFadeIn 0.5s ease forwards;
}
@keyframes wFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* HERO SECTION */
.weather-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.hero-left {
}
.city-name {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 4px;
}
.city-country {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 16px;
}
.temp-main {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(72px, 14vw, 110px);
  font-weight: 300;
  line-height: 0.9;
  letter-spacing: -4px;
  color: var(--text);
  display: flex;
  align-items: flex-start;
}
.temp-unit-sup {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: -1px;
  margin-top: 14px;
  color: var(--text2);
}
.weather-desc {
  font-size: 14px;
  font-weight: 400;
  color: var(--text2);
  text-transform: capitalize;
  margin-top: 10px;
  letter-spacing: 0.04em;
}

.hero-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding-top: 8px;
}
.weather-emoji {
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.4));
}
.feels-like {
  font-size: 12px;
  color: var(--text3);
  letter-spacing: 0.04em;
}
.feels-like strong {
  color: var(--text2);
  font-weight: 400;
}
.weather-condition-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--glass);
  border: 1px solid var(--glass-border2);
  font-size: 11px;
  font-weight: 400;
  color: var(--text2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* STAT CARDS ROW */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  backdrop-filter: blur(16px);
  transition:
    background 0.2s,
    border-color 0.2s;
}
.stat-card:hover {
  background: var(--glass2);
  border-color: var(--glass-border2);
}
.stat-card-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}
.stat-card-value {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.stat-card-unit {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

/* FORECAST SECTION */
.forecast-section {
  margin-top: 4px;
}
.section-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
@media (max-width: 480px) {
  .forecast-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
}

.forecast-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  backdrop-filter: blur(16px);
  transition:
    background 0.2s,
    transform 0.2s;
  cursor: default;
}
.forecast-card:hover {
  background: var(--glass2);
  transform: translateY(-2px);
}
.forecast-day {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}
.forecast-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 6px;
}
.forecast-temp-hi {
  font-family: "Cormorant Garamond", serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.forecast-temp-lo {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
.forecast-desc {
  font-size: 9px;
  color: var(--text3);
  text-transform: capitalize;
  margin-top: 4px;
  letter-spacing: 0.03em;
}

/* DIVIDER */
.section-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 20px 0;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(240, 244, 255, 0.95);
  color: #0a1020;
  padding: 10px 22px;
  border-radius: 99px;
  font-family: "Outfit", sans-serif;
  font-size: 13px;
  font-weight: 400;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 999;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error {
  background: rgba(200, 60, 60, 0.9);
  color: #fff;
}
