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

:root {
  --radius:    12px;
  --radius-lg: 18px;
  --font:      'DM Sans', system-ui, sans-serif;
  --mono:      'DM Mono', monospace;
}

[data-theme="dark"] {
  --bg:        #0d0f14;
  --surface:   #141720;
  --surface2:  #1c2030;
  --border:    rgba(255,255,255,0.07);
  --border-md: rgba(255,255,255,0.13);
  --text:      #e8eaf0;
  --muted:     #7a80a0;
  --accent:    #4f8ef7;
  --accent-dim:#1d3a6e;
  --green:     #3ecf8e;
  --amber:     #f7b84f;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --surface2:  #eef0f4;
  --border:    rgba(0,0,0,0.08);
  --border-md: rgba(0,0,0,0.15);
  --text:      #1a1d26;
  --muted:     #6b7280;
  --accent:    #2563eb;
  --accent-dim:#dbeafe;
  --green:     #059669;
  --amber:     #d97706;
  color-scheme: light;
}

html { color-scheme: dark; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Header ───────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 60px;
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toggle-btn {
  background: none;
  border: 1px solid var(--border-md);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 1rem;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}
.toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.tagline {
  font-size: 0.78rem;
  color: var(--muted);
  border-left: 1px solid var(--border-md);
  padding-left: 1.5rem;
}

/* ─── Main layout ──────────────────────────────────── */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ─── Search ───────────────────────────────────────── */
.search-section {
  margin-bottom: 3rem;
}
.search-wrapper {
  position: relative;
  max-width: 480px;
}
.search-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.search-box {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.search-box:focus-within {
  border-color: var(--accent);
  outline: none;
}
.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 0.75rem 1rem;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
}
.search-box input::placeholder { color: var(--muted); }
.search-box button {
  padding: 0 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.search-box button:hover { color: var(--accent); }

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  list-style: none;
  z-index: 100;
  overflow: hidden;
}
.suggestions li {
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  flex-direction: column;
}
.suggestions li:hover, .suggestions li[aria-selected="true"] {
  background: rgba(79,142,247,0.12);
}
.suggestions li span.sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1px;
}

/* ─── Error banner ─────────────────────────────────── */
.error-banner {
  background: rgba(220,60,60,0.12);
  border: 1px solid rgba(220,60,60,0.3);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #e07070;
  margin-bottom: 1.5rem;
}

/* ─── Dashboard grid ───────────────────────────────── */
.dashboard {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  animation: fade-in 0.4s ease;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.current-panel {
  grid-column: 1;
  grid-row: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.chart-panel {
  grid-column: 2;
  grid-row: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}
.forecast-panel {
  grid-column: 1 / -1;
  grid-row: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.panel-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 1.25rem;
}

/* ─── Current panel ────────────────────────────────── */
.current-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.current-location svg { flex-shrink: 0; }
.current-temp-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.weather-icon-lg {
  font-size: 3.5rem;
  line-height: 1;
}
.current-temp-block {
  display: flex;
  align-items: flex-start;
  gap: 2px;
}
.current-temp {
  font-family: var(--mono);
  font-size: 4rem;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.03em;
}
.temp-unit {
  font-family: var(--mono);
  font-size: 1.5rem;
  color: var(--muted);
  margin-top: 0.3rem;
}
.current-description {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  text-transform: capitalize;
}
.current-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}
.stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}
.stat svg { flex-shrink: 0; color: var(--accent); }

/* ─── Chart panel ──────────────────────────────────── */
.chart-container {
  flex: 1;
  min-height: 160px;
  position: relative;
}
#hourly-chart { width: 100% !important; height: 100% !important; }

/* ─── Forecast grid ────────────────────────────────── */
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.75rem;
}
.forecast-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: border-color 0.15s, background 0.15s;
}
.forecast-card:hover {
  border-color: var(--border-md);
  background: rgba(79,142,247,0.06);
}
.forecast-card.today {
  border-color: var(--accent-dim);
  background: rgba(79,142,247,0.08);
}
.fc-day {
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.fc-day.today-label { color: var(--accent); }
.fc-icon { font-size: 1.6rem; }
.fc-precip {
  font-size: 0.72rem;
  color: #4fb8f7;
}
.fc-temps {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 0.82rem;
}
.fc-high { color: var(--text); font-weight: 500; }
.fc-low  { color: var(--muted); }

/* ─── Footer ───────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ─── Loading state ────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Responsive ───────────────────────────────────── */
@media (max-width: 680px) {
  .dashboard { grid-template-columns: 1fr; }
  .chart-panel { grid-column: 1; grid-row: 2; }
  .forecast-panel { grid-row: 3; }
  .forecast-grid { grid-template-columns: repeat(4, 1fr); }
  .forecast-grid .forecast-card:nth-child(n+5) { display: none; }
}
@media (max-width: 420px) {
  .forecast-grid { grid-template-columns: repeat(3, 1fr); }
  .forecast-grid .forecast-card:nth-child(n+4) { display: none; }
}
