/* ─── Variables ─────────────────────────────────────────── */
:root {
  --bg:          #0d1117;
  --bg-card:     #161b22;
  --bg-card-2:   #1c2230;
  --border:      #30363d;
  --accent:      #4fa3e0;
  --accent-2:    #58c2b8;
  --text:        #e6edf3;
  --text-muted:  #8b949e;
  --radius:      16px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --transition:  .25s ease;
}

/* ─── Reset / Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Header ─────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: .9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  font-size: 1.05rem;
}

.logo-icon { font-size: 1.4rem; }

.last-updated {
  font-size: .8rem;
  color: var(--text-muted);
}

/* ─── Hero ───────────────────────────────────────────────── */
.hero {
  max-width: 1100px;
  margin: 3rem auto 0;
  padding: 0 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .6rem;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ─── City Cards ─────────────────────────────────────────── */
.cities-grid {
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.city-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.city-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(135deg, rgba(79,163,224,.08), rgba(88,194,184,.08));
  transition: opacity var(--transition);
  border-radius: var(--radius);
}

.city-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent);
}

.city-card:hover::before { opacity: 1; }

.city-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* skeleton */
.city-card.skeleton { pointer-events: none; }
.skeleton-line {
  height: 18px;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-card-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
  margin-bottom: .75rem;
}
.skeleton-line.short { width: 55%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* card content */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.city-name {
  font-size: 1.25rem;
  font-weight: 600;
}

.city-region {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

.weather-icon { font-size: 3rem; line-height: 1; }

.temp-main {
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: .35rem;
}

.weather-desc {
  font-size: .9rem;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-bottom: 1.25rem;
}

.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem .75rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.stat-label {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-value {
  font-size: .92rem;
  font-weight: 500;
}

/* ─── Forecast ───────────────────────────────────────────── */
.forecast-section {
  max-width: 1100px;
  margin: 0 auto 4rem;
  padding: 0 1.5rem;
}

.forecast-section h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.forecast-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .5rem 1.1rem;
  border-radius: 8px;
  font-size: .875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover { border-color: var(--accent); color: var(--text); }

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}

.forecast-scroll {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .75rem;
}

@media (max-width: 700px) {
  .forecast-scroll { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 440px) {
  .forecast-scroll { grid-template-columns: repeat(3, 1fr); }
}

.forecast-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem .75rem;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition);
}

.forecast-day:hover { border-color: var(--accent); transform: translateY(-2px); }

.f-day-name { font-size: .78rem; color: var(--text-muted); margin-bottom: .4rem; font-weight: 500; }
.f-icon { font-size: 1.8rem; margin-bottom: .4rem; }
.f-max { font-size: 1rem; font-weight: 600; }
.f-min { font-size: .8rem; color: var(--text-muted); }
.f-precip { font-size: .72rem; color: var(--accent-2); margin-top: .3rem; }

/* ─── Footer ─────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: .82rem;
  border-top: 1px solid var(--border);
}

/* ─── Error state ────────────────────────────────────────── */
.error-msg {
  color: #f87171;
  font-size: .9rem;
  margin-top: .5rem;
}
