/* ================================
   SkyCast - Weather Dashboard
   Friendly design: Fredoka (headings) + Nunito (text)
   ================================ */

/* ---------- Design tokens (change these to restyle the whole site) ---------- */
:root {
  --font-fun: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-text: 'Nunito', system-ui, sans-serif;

  --text: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.85);
  --ink: #1f2d3d;                  /* dark text on light things */

  --glass: rgba(255, 255, 255, 0.16);
  --glass-strong: rgba(255, 255, 255, 0.28);
  --glass-border: rgba(255, 255, 255, 0.45);
  --shadow: 0 12px 30px rgba(20, 40, 80, 0.18);

  /* Happy pastel colours */
  --sun: #ffd23f;
  --sun-dark: #e0a800;
  --pink: #ffb3c7;
  --mint: #9ff0c9;
  --sky: #a5dcff;
  --grape: #d4c4ff;
  --peach: #ffd0a8;

  --radius: 28px;
  --radius-small: 18px;
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --speed: 0.25s;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-text);
  font-size: 16px;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(160deg, #56ccf2, #2f80ed);
  background-attachment: fixed;
  transition: background 1.5s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .big-temp, .value, .best-time, .twin-name, .logo-text {
  font-family: var(--font-fun);
}

/* Soft shadow makes white text readable on any background */
h2, .big-temp, .desc {
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

/* ---------- Background colours for each weather ---------- */

body.clear-day {
  background: linear-gradient(165deg, #6dd5fa 0%, #2f80ed 60%, #ffcf7d 135%);
  background-attachment: fixed;
}

body.clear-night {
  background: linear-gradient(165deg, #141e46 0%, #2b3a7a 55%, #5b4a9e 110%);
  background-attachment: fixed;
}

body.cloudy {
  background: linear-gradient(165deg, #9db8d3 0%, #6481a3 100%);
  background-attachment: fixed;
}

body.rain {
  background: linear-gradient(165deg, #5a7fa0 0%, #263b52 100%);
  background-attachment: fixed;
}

body.storm {
  background: linear-gradient(165deg, #3a345e 0%, #17152b 100%);
  background-attachment: fixed;
}

body.snow {
  background: linear-gradient(165deg, #f2f7ff 0%, #b3c8ea 100%);
  background-attachment: fixed;
}

body.fog {
  background: linear-gradient(165deg, #cfd8e0 0%, #7d8ea1 100%);
  background-attachment: fixed;
}

body.cloudy.night,
body.fog.night {
  background: linear-gradient(165deg, #2c3e60 0%, #1a2440 100%);
  background-attachment: fixed;
}

/* ---------- Animated sky layer ---------- */

#sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#sky-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 400px;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Hide all animations by default, then show the ones we need */
.sun, .moon, .cloud, #rain, #snow, .flash {
  opacity: 0;
  transition: opacity 1.2s ease;
}

/* Sun */
.sun {
  position: absolute;
  top: 70px;
  right: 8%;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fffbe0 0%, #ffd23f 55%, #ffb703 100%);
  animation: sun-glow 4s ease-in-out infinite;
}

/* Sun rays: a spinning ring behind the sun */
.sun::before {
  content: '';
  position: absolute;
  inset: -55px;
  border-radius: 50%;
  background: repeating-conic-gradient(
    rgba(255, 230, 120, 0.45) 0deg 6deg,
    transparent 6deg 30deg
  );
  -webkit-mask: radial-gradient(circle, transparent 55%, black 56%, transparent 100%);
  mask: radial-gradient(circle, transparent 55%, black 56%, transparent 100%);
  z-index: -1;
  animation: spin 30s linear infinite;
}

@keyframes sun-glow {
  0%, 100% { box-shadow: 0 0 60px 20px rgba(255, 210, 63, 0.45); }
  50%      { box-shadow: 0 0 100px 40px rgba(255, 210, 63, 0.75); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Moon (a crescent made with a shadow) */
.moon {
  position: absolute;
  top: 80px;
  right: 10%;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  box-shadow: -25px 10px 0 0 #fff4c2;
  filter: drop-shadow(0 0 24px rgba(255, 244, 194, 0.6));
}

/* Stars at night */
body.clear-night #sky::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(1.5px 1.5px at 70% 20%, white, transparent),
    radial-gradient(1px 1px at 40% 70%, white, transparent),
    radial-gradient(2px 2px at 85% 60%, white, transparent),
    radial-gradient(1px 1px at 10% 85%, white, transparent),
    radial-gradient(1.5px 1.5px at 55% 45%, white, transparent),
    radial-gradient(1px 1px at 30% 10%, white, transparent),
    radial-gradient(1.5px 1.5px at 92% 15%, white, transparent);
  animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.4; }
  to   { opacity: 1; }
}

/* Clouds */
.cloud {
  position: absolute;
  width: 200px;
  height: 60px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 100px;
  animation: float-cloud linear infinite;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud::before {
  width: 100px;
  height: 100px;
  top: -50px;
  left: 25px;
}

.cloud::after {
  width: 80px;
  height: 80px;
  top: -35px;
  right: 25px;
}

.cloud-1 { top: 15%; animation-duration: 60s; }
.cloud-2 { top: 38%; animation-duration: 85s; animation-delay: -30s; transform: scale(0.7); }
.cloud-3 { top: 62%; animation-duration: 70s; animation-delay: -50s; transform: scale(0.5); }

@keyframes float-cloud {
  from { left: -250px; }
  to   { left: 110%; }
}

/* Rain drops (created by JavaScript), slightly slanted */
#rain, #snow {
  position: absolute;
  inset: 0;
}

#rain {
  transform: rotate(10deg) scale(1.2);
}

.drop {
  position: absolute;
  top: -100px;
  width: 2px;
  height: 70px;
  border-radius: 2px;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.75));
  animation: fall linear infinite;
}

@keyframes fall {
  to { transform: translateY(120vh); }
}

/* Snow flakes (created by JavaScript) */
.flake {
  position: absolute;
  top: -20px;
  color: white;
  text-shadow: 0 0 6px rgba(120, 150, 200, 0.8);
  animation: snow-fall linear infinite;
}

@keyframes snow-fall {
  0%   { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(30px, 55vh) rotate(180deg); }
  100% { transform: translate(-10px, 110vh) rotate(360deg); }
}

/* Lightning flash */
.flash {
  position: absolute;
  inset: 0;
  background: white;
}

body.storm .flash {
  animation: lightning 7s infinite;
}

@keyframes lightning {
  0%, 90%, 94%, 100% { opacity: 0; }
  91%, 93%           { opacity: 0.55; }
}

/* Which animations show for which weather */
body.clear-day .sun        { opacity: 1; }
body.clear-day .cloud-1    { opacity: 0.55; }
body.clear-night .moon     { opacity: 1; }
body.cloudy .cloud         { opacity: 0.9; }
body.cloudy .sun           { opacity: 0.35; }
body.rain .cloud,
body.storm .cloud          { opacity: 0.5; background: #7b8ba0; }
body.rain #rain,
body.storm #rain           { opacity: 1; }
body.snow #snow            { opacity: 1; }
body.snow .cloud           { opacity: 0.7; }
body.fog .cloud            { opacity: 0.8; filter: blur(14px); }

/* At night: no sun, dimmer clouds */
body.night .sun            { opacity: 0; }
body.cloudy.night .moon    { opacity: 0.4; }
body.night .cloud          { background: #8795a3; }

/* ---------- Layout ---------- */

.container {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

/* ---------- Header ---------- */

header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: inherit;
  text-decoration: none;
}

.logo-icon {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  transition: transform 0.4s var(--bounce);
}

.logo:hover .logo-icon {
  transform: rotate(-12deg) scale(1.12);
}

.logo-text {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.logo-text span {
  color: var(--sun);
}

#search-form {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 260px;
  max-width: 520px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
}

#city-input {
  width: 100%;
  padding: 14px 18px 14px 44px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 1rem;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color var(--speed), box-shadow var(--speed);
}

#city-input::placeholder {
  color: #94a3b8;
}

#city-input:focus {
  border-color: var(--sun);
  box-shadow: 0 0 0 5px rgba(255, 210, 63, 0.35), var(--shadow);
}

.btn {
  padding: 12px 18px;
  border: 2px solid var(--glass-border);
  border-radius: 999px;
  font-family: var(--font-fun);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.3s var(--bounce), background var(--speed);
}

.btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-3px) scale(1.06);
}

.btn:active {
  transform: translateY(1px) scale(0.95);
}

/* Big yellow "Go!" button with a chunky 3D bottom */
.btn-main {
  background: var(--sun);
  border-color: var(--sun);
  color: var(--ink);
  padding: 12px 24px;
  box-shadow: 0 5px 0 var(--sun-dark);
}

.btn-main:hover {
  background: #ffdc5e;
  box-shadow: 0 7px 0 var(--sun-dark);
}

.btn-main:active {
  box-shadow: 0 2px 0 var(--sun-dark);
}

/* Clear keyboard focus ring for every clickable thing */
.btn:focus-visible,
.chip:focus-visible,
.logo:focus-visible,
footer a:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

.btn-icon {
  width: 50px;
  height: 50px;
  padding: 0;
  font-size: 1.2rem;
}

.unit-btn {
  min-width: 64px;
  height: 50px;
}

.header-buttons {
  display: flex;
  gap: 8px;
}

/* Recent searches */
#recent {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  padding: 6px 16px;
  border-radius: 999px;
  border: 2px solid var(--glass-border);
  background: var(--glass);
  color: inherit;
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.3s var(--bounce), background var(--speed);
}

.chip::before {
  content: '📌 ';
}

.chip:hover {
  background: var(--glass-strong);
  transform: translateY(-2px) rotate(-2deg);
}

#message {
  margin-top: 16px;
  text-align: center;
  font-weight: 700;
}

#message:empty {
  display: none;
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.1));
  border: 2px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 22px;
}

/* Cards bounce in one after another */
main > * {
  animation: bounce-in 0.7s var(--bounce) both;
}

main > *:nth-child(2) { animation-delay: 0.08s; }
main > *:nth-child(3) { animation-delay: 0.16s; }
main > *:nth-child(4) { animation-delay: 0.24s; }
main > *:nth-child(5) { animation-delay: 0.32s; }
main > *:nth-child(6) { animation-delay: 0.4s; }

@keyframes bounce-in {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.muted {
  color: var(--text-soft);
}

/* ---------- Current weather + Skye ---------- */

.current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.current h2 {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 600;
  line-height: 1.15;
}

.temp-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 10px 0 4px;
}

.big-icon {
  font-size: clamp(3.5rem, 9vw, 4.8rem);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.big-temp {
  font-size: clamp(4.2rem, 12vw, 6.2rem);
  font-weight: 600;
  line-height: 1;
}

.desc {
  font-family: var(--font-fun);
  font-size: 1.4rem;
  font-weight: 500;
  margin-bottom: 10px;
}

.hi-lo {
  display: flex;
  gap: 8px;
}

.pill {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--glass-strong);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Skye the cloud */
.mascot {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}

.speech {
  position: relative;
  max-width: 230px;
  padding: 10px 16px;
  border-radius: 20px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  box-shadow: var(--shadow);
  animation: bounce-in 0.6s var(--bounce) 0.4s both;
}

/* Little tail under the speech bubble */
.speech::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 50%;
  margin-left: -10px;
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: #ffffff transparent transparent;
}

.skye {
  width: 200px;
  height: auto;
  margin-top: 6px;
  overflow: visible;
  filter: drop-shadow(0 12px 16px rgba(20, 40, 80, 0.25));
  animation: float-skye 4s ease-in-out infinite;
}

@keyframes float-skye {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}

/* Skye's moods: hide all extras, then turn on what the weather needs */
.skye .umbrella,
.skye .nightcap,
.skye .eyes-sleep,
.skye .glasses,
.skye .mouth-sad,
.skye .mouth-o,
.skye .scarf,
.skye .zzz {
  display: none;
}

body.clear-day .skye .glasses     { display: inline; }
body.clear-day .skye .eyes-open   { display: none; }

body.night .skye .eyes-sleep,
body.night .skye .nightcap,
body.night .skye .zzz             { display: inline; }
body.night .skye .eyes-open       { display: none; }

body.rain .skye .umbrella,
body.storm .skye .umbrella        { display: inline; }
body.rain .skye .mouth-happy      { display: none; }
body.rain .skye .mouth-sad        { display: inline; }

body.storm .skye .eyes-open       { display: inline; }
body.storm .skye .eyes-sleep,
body.storm .skye .zzz,
body.storm .skye .mouth-happy     { display: none; }
body.storm .skye .mouth-o         { display: inline; }

body.snow .skye .scarf,
body.snow .skye .mouth-o          { display: inline; }
body.snow .skye .mouth-happy      { display: none; }

body.snow .skye  { animation: shiver 0.25s linear infinite; }
body.storm .skye { animation: scared 7s ease-in-out infinite; }

@keyframes shiver {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-2px); }
  75%      { transform: translateX(2px); }
}

/* Jumps when the lightning flashes */
@keyframes scared {
  0%, 89%, 96%, 100% { transform: translateY(0); }
  91%                { transform: translateY(-18px) scale(1.05); }
  93%                { transform: translateY(0); }
}

.skye .zzz {
  animation: zzz 2.5s ease-in-out infinite;
}

@keyframes zzz {
  0%, 100% { opacity: 0.3; transform: translateY(4px); }
  50%      { opacity: 1;   transform: translateY(-4px); }
}

/* ---------- Detail cards ---------- */

.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.mini {
  padding: 18px 14px;
  text-align: center;
  transition: transform 0.35s var(--bounce), background var(--speed);
}

.mini:hover {
  transform: translateY(-6px) rotate(-1.5deg);
  background: var(--glass-strong);
}

.mini:nth-child(even):hover {
  transform: translateY(-6px) rotate(1.5deg);
}

/* Round colourful badge for each card's emoji */
.badge {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  border-radius: 50%;
  font-size: 1.35rem;
  background: var(--sky);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.08);
}

.mini:nth-child(1) .badge { background: var(--peach); }
.mini:nth-child(2) .badge { background: var(--sky); }
.mini:nth-child(3) .badge { background: var(--mint); }
.mini:nth-child(4) .badge { background: var(--sun); }
.mini:nth-child(5) .badge { background: var(--pink); }
.mini:nth-child(6) .badge { background: var(--grape); }
.mini:nth-child(7) .badge { background: var(--sky); }
.mini:nth-child(8) .badge { background: var(--mint); }

.label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
}

.value {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2px;
}

/* ---------- Air quality ---------- */

.aqi-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-top: 2px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  border: 2px solid #fff;
}

/* ---------- Tips + fun cards (two side by side) ---------- */

.tips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.tip-summary {
  font-family: var(--font-fun);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.outfit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Colourful sticker-style outfit tags */
.outfit-item {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--sun);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
  animation: pop-in 0.5s var(--bounce) both;
}

.outfit-item:nth-child(4n + 2) { background: var(--pink); }
.outfit-item:nth-child(4n + 3) { background: var(--mint); }
.outfit-item:nth-child(4n + 4) { background: var(--sky); }

.outfit-item:nth-child(2) { animation-delay: 0.06s; }
.outfit-item:nth-child(3) { animation-delay: 0.12s; }
.outfit-item:nth-child(4) { animation-delay: 0.18s; }
.outfit-item:nth-child(5) { animation-delay: 0.24s; }
.outfit-item:nth-child(6) { animation-delay: 0.3s; }
.outfit-item:nth-child(7) { animation-delay: 0.36s; }

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

.best-time {
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.2;
}

/* Comfort bar chart */
.comfort-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 70px;
  margin-top: 16px;
}

.bar {
  flex: 1;
  border-radius: 8px 8px 3px 3px;
  background: rgba(255, 255, 255, 0.35);
  transition: height 0.6s var(--bounce);
}

.bar.best {
  background: linear-gradient(180deg, var(--sun), var(--mint));
}

.bars-note {
  font-size: 0.78rem;
  margin-top: 8px;
}

/* Weather twin + time machine */
.twin,
.past {
  margin-top: 12px;
}

.twin-main,
.past-main {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.past-icon {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}

.twin-flag {
  width: 64px;
  height: auto;
  border-radius: 10px;
  border: 3px solid #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  animation: flip-in 0.8s var(--bounce);
}

@keyframes flip-in {
  from { transform: rotateY(180deg) scale(0.5); opacity: 0; }
  to   { transform: rotateY(0) scale(1); opacity: 1; }
}

.twin-name {
  font-size: 1.5rem;
  font-weight: 600;
}

.past strong {
  color: var(--sun);
}

/* ---------- Hourly ---------- */

.hourly {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.5) transparent;
}

.hour {
  flex: 0 0 auto;
  min-width: 76px;
  text-align: center;
  padding: 14px 8px;
  border-radius: var(--radius-small);
  background: var(--glass);
  border: 2px solid transparent;
  font-weight: 700;
  scroll-snap-align: start;
  transition: transform 0.3s var(--bounce), background var(--speed);
}

.hour:hover {
  background: var(--glass-strong);
  transform: translateY(-4px);
}

.hour.now {
  background: var(--sun);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--sun-dark);
}

.hour .icon {
  font-size: 1.7rem;
  margin: 6px 0;
}

.hourly::-webkit-scrollbar {
  height: 8px;
}

.hourly::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
}

/* ---------- 7-day ---------- */

.day {
  display: grid;
  grid-template-columns: 70px 36px minmax(0, 1fr) 36px 110px 36px;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: var(--radius-small);
  transition: background var(--speed), transform 0.3s var(--bounce);
}

.day:hover {
  background: var(--glass);
  transform: translateX(4px);
}

.day .name {
  font-family: var(--font-fun);
  font-weight: 600;
  font-size: 1.05rem;
}

.day .icon {
  font-size: 1.6rem;
}

.day .rain-chance {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day .low {
  text-align: right;
  font-weight: 700;
  color: var(--text-soft);
}

.day .high {
  font-weight: 800;
}

/* Temperature range bar (filled part is set by JavaScript) */
.range {
  position: relative;
  height: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.25);
}

.range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 10px;
  background: linear-gradient(90deg, #7dd3fc, #fde047, #fb923c);
}

/* ---------- Loader: a bouncing Skye ---------- */

#loader {
  text-align: center;
  margin-top: 70px;
  font-family: var(--font-fun);
  font-size: 1.2rem;
  font-weight: 500;
}

.spinner {
  width: 80px;
  height: 80px;
  margin: 0 auto 14px;
  background: url('favicon.svg') center / contain no-repeat;
  animation: loader-bounce 0.7s ease-in-out infinite alternate;
}

@keyframes loader-bounce {
  from { transform: translateY(0) scale(1, 1); }
  to   { transform: translateY(-24px) scale(1.05, 0.95); }
}

.hidden {
  display: none !important;
}

footer {
  text-align: center;
  margin-top: 34px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-soft);
}

footer a {
  color: inherit;
  font-weight: 800;
}

/* ---------- Snow theme is light, so switch to dark text ---------- */
body.snow {
  --text: #1f2d3d;
  --text-soft: rgba(31, 45, 61, 0.72);
  --glass: rgba(255, 255, 255, 0.4);
  --glass-strong: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.85);
}

body.snow h2, body.snow .big-temp, body.snow .desc, body.snow .logo-text {
  text-shadow: none;
}

body.snow .logo-text span,
body.snow .past strong {
  color: #d97706;
}

/* ---------- Tablet / desktop: current weather + details side by side ---------- */

@media (min-width: 900px) {
  main {
    grid-template-columns: 1.25fr 1fr;
  }

  .details {
    grid-template-columns: repeat(2, 1fr);
  }

  main > .card:not(.current),
  main > .tips {
    grid-column: 1 / -1;
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
  /* Logo and buttons on top, search bar full width below */
  #search-form {
    order: 3;
    min-width: 0;
    max-width: none;
    flex-basis: 100%;
  }

  .logo-icon {
    width: 40px;
    height: 40px;
  }

  .logo-text {
    font-size: 1.6rem;
  }

  .btn-icon,
  .unit-btn {
    height: 44px;
  }

  .btn-icon {
    width: 44px;
  }

  .card {
    padding: 18px;
  }

  .current {
    flex-direction: column;
    align-items: stretch;
  }

  .skye {
    width: 160px;
  }

  .details {
    grid-template-columns: repeat(2, 1fr);
  }

  .day {
    grid-template-columns: 52px 30px 30px minmax(0, 1fr) 30px;
    gap: 8px;
    padding: 10px 4px;
    font-size: 0.92rem;
  }

  /* Hide the text description on small screens to save space */
  .day .rain-chance {
    display: none;
  }

  .sun {
    width: 80px;
    height: 80px;
    top: 40px;
  }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
