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

:root {
  --primary: #1e3a5f;
  --primary-light: #2d5a8e;
  --accent: #4fc3f7;
  --accent-glow: rgba(79, 195, 247, 0.3);
  --bg: #0a1628;
  --bg-card: rgba(15, 30, 55, 0.85);
  --bg-card-hover: rgba(20, 40, 70, 0.95);
  --text: #e8edf3;
  --text-muted: #8ba3c4;
  --border: rgba(79, 195, 247, 0.15);
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

html {
  scroll-behavior: smooth;
}

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

/* === Hero === */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #0d1f3c;
  transition: background-image 1s ease;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 22, 40, 0.3) 0%,
    rgba(10, 22, 40, 0.6) 40%,
    rgba(10, 22, 40, 0.92) 80%,
    rgba(10, 22, 40, 1) 100%
  );
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  width: 100%;
  max-width: 700px;
}

.city-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79, 195, 247, 0.15);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 8px 20px;
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 1rem;
  backdrop-filter: blur(10px);
}

.city-icon {
  font-size: 1rem;
}

.city-title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.city-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-weight: 300;
}

/* === Weather Main Card === */
.weather-main {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.weather-main.loaded {
  display: block;
  text-align: center;
}

.weather-icon {
  font-size: 5rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
  animation: float 3s ease-in-out infinite;
}

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

.weather-temp {
  font-size: 5.5rem;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  margin-bottom: 0.3rem;
  background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.weather-meta {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.weather-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.weather-meta-item .icon {
  font-size: 1.2rem;
}

/* === Loading Spinner === */
.weather-loading, .forecast-loading {
  text-align: center;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* === Forecast Section === */
.forecast-section {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.section-desc {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.forecast-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1rem;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  cursor: default;
}

.forecast-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.3), 0 0 20px var(--accent-glow);
}

.forecast-day {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.8rem;
}

.forecast-icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
  display: block;
}

.forecast-temp {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.forecast-temp-min {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.2rem;
}

.forecast-precip {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 0.5rem;
}

/* === Details Section === */
.details-section {
  padding: 2rem 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

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

.detail-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.detail-info {
  flex: 1;
}

.detail-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.detail-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

/* === Gallery === */
.gallery-section {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.gallery-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/10;
  cursor: pointer;
  transition: all 0.4s ease;
  border: 1px solid var(--border);
}

.gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  border-color: var(--accent);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-card:hover img {
  transform: scale(1.08);
}

.gallery-card .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1.2rem 1rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

/* === Facts === */
.facts-section {
  padding: 2rem 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.fact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: all 0.3s ease;
}

.fact-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}

.fact-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 1rem;
}

.fact-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.fact-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

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

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* === Responsive === */
@media (max-width: 768px) {
  .hero-content {
    padding: 1rem;
  }

  .weather-main {
    padding: 2rem 1.5rem;
  }

  .weather-temp {
    font-size: 4rem;
  }

  .weather-icon {
    font-size: 3.5rem;
  }

  .weather-meta {
    gap: 1rem;
  }

  .forecast-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* === Scroll animations === */
.forecast-section,
.details-section,
.gallery-section,
.facts-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.forecast-section.visible,
.details-section.visible,
.gallery-section.visible,
.facts-section.visible {
  opacity: 1;
  transform: translateY(0);
}