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

:root {
  --bg: #f8f9fa;
  --bg2: #ffffff;
  --bg3: #e9ecef;
  --card: rgba(255, 255, 255, 0.95);
  --border: rgba(0, 121, 46, 0.15);
  --accent: #00792e;
  --accent2: #ffc107;
  --warm: #e0a800;
  --cool: #00796b;
  --green: #00792e;
  --red: #e74c3c;
  --text: #343a40;
  --text2: #6c757d;
  --text3: #adb5bd;
  --glow: rgba(0, 121, 46, 0.1);
  --font-display: 'Syne', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --r: 12px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  overflow-x: hidden;
}

/* ── Starfield background ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0, 121, 46, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 193, 7, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

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

#app {
  position: relative; z-index: 1;
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
}
.logo span { color: var(--accent2); }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 8px 16px;
  flex: 1; max-width: 320px;
  transition: border-color .2s;
}
.search-wrap:focus-within { border-color: var(--accent); }
.search-wrap svg { flex-shrink: 0; color: var(--text3); }

#search-input {
  background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-mono); font-size: 13px;
  width: 100%;
}
#search-input::placeholder { color: var(--text3); }

/* ── Search results dropdown ── */
#search-results {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  z-index: 100;
  display: none;
}
.search-result-item {
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--glow); }
.search-result-item .loc-name { color: var(--text); }
.search-result-item .loc-sub { color: var(--text3); font-size: 11px; margin-top: 2px; }

.search-container { position: relative; flex: 1; max-width: 320px; }

/* ── Hero current conditions ── */
#hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 36px;
  margin-bottom: 20px;
  display: flex;
  gap: 32px;
  align-items: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
}
#hero::after {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(58,124,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-main { flex: 1; }
.hero-location {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.hero-location::before {
  content: '◉';
  color: var(--accent2);
  font-size: 8px;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.hero-temp {
  font-size: clamp(64px, 10vw, 96px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.hero-desc {
  font-size: 15px;
  color: var(--text2);
  font-weight: 600;
  text-transform: capitalize;
  margin-bottom: 20px;
}

.hero-stats {
  display: flex; gap: 20px; flex-wrap: wrap;
}
.stat-pill {
  display: flex; flex-direction: column; gap: 2px;
}
.stat-pill .label {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text3); letter-spacing: 0.1em; text-transform: uppercase;
}
.stat-pill .val {
  font-family: var(--font-mono); font-size: 15px;
  color: var(--text); font-weight: 400;
}

.hero-icon {
  font-size: clamp(60px, 8vw, 90px);
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 0 20px rgba(58,124,255,0.3));
  transition: transform .3s;
}
.hero-icon:hover { transform: scale(1.05) rotate(-5deg); }

/* ── Grid layout ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.grid-full { grid-column: 1 / -1; }

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  backdrop-filter: blur(12px);
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: rgba(0, 121, 46, 0.25); }

.card-title {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: '';
  display: block; width: 20px; height: 1px;
  background: var(--accent);
}

/* ── Hourly forecast ── */
.hourly-scroll {
  display: flex; gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.hourly-scroll::-webkit-scrollbar { display: none; }

.hour-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; min-width: 52px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all .2s;
  cursor: default;
}
.hour-item:hover { background: rgba(0, 121, 46, 0.08); border-color: var(--border); }
.hour-item.active { background: rgba(0, 121, 46, 0.15); border-color: rgba(0, 121, 46, 0.4); }

.hour-time { font-family: var(--font-mono); font-size: 11px; color: var(--text3); }
.hour-icon { font-size: 22px; }
.hour-temp { font-family: var(--font-mono); font-size: 14px; color: var(--text); font-weight: 400; }
.hour-precip { font-family: var(--font-mono); font-size: 10px; color: var(--accent2); }

/* ── 7-day forecast ── */
.day-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.day-item:last-child { border-bottom: none; }

.day-name { font-family: var(--font-mono); font-size: 12px; color: var(--text2); width: 36px; flex-shrink: 0; }
.day-icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.day-desc { font-size: 12px; color: var(--text3); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-temps { display: flex; gap: 8px; font-family: var(--font-mono); font-size: 13px; flex-shrink: 0; }
.day-high { color: var(--warm); }
.day-low { color: var(--text3); }

/* ── Temp bar ── */
.temp-bar-wrap { flex: 1; height: 3px; background: var(--bg3); border-radius: 2px; overflow: hidden; margin: 0 8px; }
.temp-bar { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--cool), var(--warm)); }

/* ── Gauge cards ── */
.gauges { display: flex; gap: 12px; flex-wrap: wrap; }
.gauge {
  flex: 1; min-width: 110px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.gauge .g-label { font-family: var(--font-mono); font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; }
.gauge .g-val { font-family: var(--font-mono); font-size: 22px; color: var(--text); font-weight: 300; }
.gauge .g-sub { font-family: var(--font-mono); font-size: 11px; }

.g-good { color: var(--green); }
.g-moderate { color: #f0c040; }
.g-bad { color: var(--warm); }
.g-danger { color: var(--red); }

/* ── Sun/Moon ── */
.astro-row {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 12px;
}
.astro-icon { font-size: 28px; }
.astro-details { display: flex; gap: 20px; flex: 1; }
.astro-item { display: flex; flex-direction: column; gap: 2px; }
.astro-item .al { font-family: var(--font-mono); font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .1em; }
.astro-item .av { font-family: var(--font-mono); font-size: 14px; color: var(--text); }

/* ── Day progress arc ── */
.sun-arc { margin: 8px 0 4px; }

/* ── Alerts ── */
.alert-banner {
  background: rgba(255,95,87,0.08);
  border: 1px solid rgba(255,95,87,0.3);
  border-radius: 10px;
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--red);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}

/* ── Loading / error states ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
  height: 20px;
}
@keyframes shimmer { 0%{background-position:200%} 100%{background-position:-200%} }

.loading-state { opacity: .4; pointer-events: none; }
.error-msg { color: var(--red); font-family: var(--font-mono); font-size: 13px; }

/* ── Update time ── */
.update-time {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text3); text-align: right;
  margin-top: 20px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  #app { padding: 16px 12px 40px; }
  header { flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
  .logo { width: 100%; font-size: 16px; }
  .search-container { max-width: 100%; width: 100%; }
  #hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 16px 24px;
  }
  .hero-main { flex: 1; width: 100%; }
  .hero-location { font-size: 18px; }
  .hero-temp {
    font-size: 48px;
    max-width: calc(100% - 88px);
  }
  .hero-desc {
    font-size: 14px;
    max-width: calc(100% - 88px);
  }
  .hero-icon {
    position: absolute;
    top: 104px;
    right: 18px;
    margin: 0;
    font-size: 68px;
    pointer-events: none;
  }
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 8px;
    width: 100%;
  }
  .stat-pill { padding: 12px; font-size: 12px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .gauges { gap: 8px; }
  .gauge { min-width: 70px; padding: 12px 14px; }
  .astro-details { flex-direction: column; gap: 12px; }
  .hourly-scroll { padding-bottom: 8px; }
  .card { padding: 16px 20px; border-radius: 12px; }
  .card-title { font-size: 9px; margin-bottom: 12px; }
}

/* ── Fade in ── */
.fade-in { animation: fadeIn .5s ease both; }
@keyframes fadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:none} }
.fade-in:nth-child(1){animation-delay:.05s}
.fade-in:nth-child(2){animation-delay:.1s}
.fade-in:nth-child(3){animation-delay:.15s}
.fade-in:nth-child(4){animation-delay:.2s}
.fade-in:nth-child(5){animation-delay:.25s}
