/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --bg:         #f0f4f8;
  --surface:    #ffffff;
  --surface-2:  #f6f8fb;
  --border:     #dde2ea;
  --ink:        #0f1923;
  --ink-muted:  #5a6473;
  --accent:     #1a4b8c;
  --accent-mid: #2560b0;
  --accent-bg:  #eef3fb;
  --shadow:     0 2px 10px rgba(15,25,35,.07);
  --shadow-md:  0 6px 28px rgba(15,25,35,.10);
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  22px;
  --font-body:  'Inter', system-ui, sans-serif;
  --font-head:  'Space Grotesk', 'Inter', system-ui, sans-serif;
  --max-w:      760px;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
}
.topbar-logo svg { color: var(--accent); }
.topbar-day {
  font-size: .75rem;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: .04em;
}

/* ============================================================
   MAIN / APP
   ============================================================ */
.app {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 36px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ============================================================
   SEARCH
   ============================================================ */
.search-form { width: 100%; }
.search-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0 8px 0 16px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap:focus-within {
  border-color: var(--accent-mid);
  box-shadow: 0 0 0 3px rgba(37,96,176,.12);
}
.search-icon { color: var(--ink-muted); flex-shrink: 0; }
.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  padding: 14px 10px;
}
.search-input::placeholder { color: var(--ink-muted); }
.search-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 500;
  padding: 9px 20px;
  cursor: pointer;
  transition: background .15s;
}
.search-btn:hover { background: var(--accent-mid); }

/* ============================================================
   STATE SCREENS
   ============================================================ */
.state-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 60px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}
.state-icon { font-size: 2.8rem; line-height: 1; }
.state-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
}
.state-body { font-size: .925rem; color: var(--ink-muted); max-width: 320px; }
.hidden { display: none !important; }

/* spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   WEATHER RESULT WRAPPER
   ============================================================ */
.weather-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============================================================
   CURRENT WEATHER CARD
   ============================================================ */
.current-card {
  background: var(--accent);
  border-radius: var(--radius-xl);
  padding: 32px 28px 24px;
  color: #fff;
  box-shadow: var(--shadow-md);
}
.current-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.current-location {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.current-date {
  font-size: .82rem;
  opacity: .75;
  margin-bottom: 16px;
}
.current-condition {
  display: flex;
  align-items: center;
  gap: 10px;
}
.condition-icon { font-size: 2rem; line-height: 1; }
.condition-label { font-size: 1rem; font-weight: 500; }
.current-right { text-align: right; }
.current-temp {
  font-family: var(--font-head);
  font-size: clamp(3.2rem, 9vw, 5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
}
.current-feels { font-size: .82rem; opacity: .75; margin-top: 6px; }
.current-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.2);
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  opacity: .9;
}
.meta-item svg { opacity: .75; flex-shrink: 0; }
.meta-item strong { font-weight: 600; }

/* ============================================================
   FORECAST
   ============================================================ */
.forecast-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
}
.forecast-heading {
  font-family: var(--font-head);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-muted);
  margin-bottom: 16px;
}
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.forecast-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 6px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: center;
  transition: background .15s, border-color .15s;
}
.forecast-day:first-child {
  background: var(--accent-bg);
  border-color: rgba(26,75,140,.2);
}
.forecast-day-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-muted);
}
.forecast-day:first-child .forecast-day-label { color: var(--accent); }
.forecast-icon { font-size: 1.5rem; line-height: 1; }
.forecast-max {
  font-family: var(--font-head);
  font-size: .9rem;
  font-weight: 700;
  color: var(--ink);
}
.forecast-min {
  font-size: .78rem;
  color: var(--ink-muted);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .78rem;
  color: var(--ink-muted);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .app { padding: 24px 16px 60px; }
  .current-card { padding: 24px 20px 20px; }
  .current-temp { font-size: 3.2rem; }
  .forecast-grid { grid-template-columns: repeat(4, 1fr); }
  .forecast-grid .forecast-day:nth-child(n+5) { display: none; visibility: hidden; }
  .forecast-grid .forecast-day:nth-child(n+5) * { display: none; }
  .footer { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 380px) {
  .forecast-grid { grid-template-columns: repeat(3, 1fr); }
  .forecast-grid .forecast-day:nth-child(n+4) { display: none; visibility: hidden; }
  .forecast-grid .forecast-day:nth-child(n+4) * { display: none; }
}
