/* Rainstorm Weather — weather dashboard styles
 * System fonts only, light theme + dark-mode via [data-theme="dark"].
 */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f0f4f9;
  --border: #e2e8f0;
  --text: #1f2937;
  --text-muted: #5b6776;
  --text-faint: #8a96a6;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --accent: #0ea5e9;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 6px 20px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1120px;
  --day-grad: linear-gradient(135deg, #4f93f7 0%, #6fb1ff 55%, #9ccbff 100%);
  --night-grad: linear-gradient(135deg, #1e2a52 0%, #2b3a73 55%, #3d4d8f 100%);
  --ok: #16a34a;
  --warn: #d97706;
}

[data-theme="dark"] {
  --bg: #0e1422;
  --surface: #161e2f;
  --surface-2: #1d2740;
  --border: #2a3550;
  --text: #e6ebf3;
  --text-muted: #9aa7bd;
  --text-faint: #6c7a92;
  --brand: #5b9bff;
  --brand-strong: #82b4ff;
  --accent: #38bdf8;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --day-grad: linear-gradient(135deg, #2c5fb0 0%, #3a72c9 55%, #4a86e0 100%);
  --night-grad: linear-gradient(135deg, #11183a 0%, #1c2752 55%, #2a3a72 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 200;
}
.skip-link:focus {
  left: 0;
}

/* ------------------------------------------------------------------ Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.18rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
}
.brand-logo {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}
.nav-spacer {
  flex: 1;
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-menu a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-menu a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-menu a.active {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--brand);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .moon {
  display: none;
}
[data-theme="dark"] .theme-toggle .sun {
  display: none;
}
[data-theme="dark"] .theme-toggle .moon {
  display: inline;
}
.nav-toggle {
  display: none;
}

/* ------------------------------------------------------------------ Hero */
.hero {
  padding: 30px 0 8px;
}
.hero h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}
.hero p {
  margin: 0;
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ Search */
.search-block {
  margin: 18px 0 8px;
}
.search-form {
  position: relative;
  display: flex;
  gap: 8px;
}
.search-wrap {
  position: relative;
  flex: 1;
}
.search-input {
  width: 100%;
  padding: 13px 14px 13px 42px;
  font-size: 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
.search-ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
}
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn:hover {
  background: var(--brand-strong);
}
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--brand);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 60;
  max-height: 320px;
  overflow-y: auto;
}
.search-item {
  display: flex;
  flex-direction: column;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.search-item:hover,
.search-item.active {
  background: var(--surface-2);
}
.search-city {
  font-weight: 600;
}
.search-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.search-none {
  padding: 12px;
  color: var(--text-muted);
}

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.quick-label {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-right: 2px;
}
.preset-btn,
.geo-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.preset-btn:hover,
.geo-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
}
.geo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.geo-btn svg {
  width: 14px;
  height: 14px;
}
.geo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status-line {
  margin: 10px 0;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ------------------------------------------------------------------ Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge-live {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 14%, transparent);
}
.badge-cached {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 16%, transparent);
}

/* ------------------------------------------------------------------ Layout */
.dashboard {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  margin: 18px 0 40px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
}
.card-body {
  padding: 18px 20px;
}

/* ----------------------------------------------------- Current conditions */
.current-card {
  grid-row: span 2;
  color: #fff;
  border: none;
  overflow: hidden;
  position: relative;
}
.current-card.is-day {
  background: var(--day-grad);
}
.current-card.is-night {
  background: var(--night-grad);
}
.current-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 0;
}
.current-loc {
  font-size: 1.15rem;
  font-weight: 600;
}
.current-updated {
  font-size: 0.8rem;
  opacity: 0.85;
}
.current-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 22px 4px;
}
.current-icon .wx-icon {
  width: 96px;
  height: 96px;
}
.current-temp-wrap {
  display: flex;
  align-items: flex-start;
}
.current-temp {
  font-size: 4.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}
.current-unit {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 6px;
  opacity: 0.9;
}
.current-cond {
  font-size: 1.2rem;
  font-weight: 600;
  padding: 0 22px;
}
.current-feels {
  padding: 2px 22px 16px;
  opacity: 0.9;
  font-size: 0.95rem;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.18);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}
.metric {
  background: transparent;
  padding: 14px 22px;
  backdrop-filter: brightness(1.04);
}
.metric-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}
.metric-value {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2px;
}

/* ----------------------------------------------------------- Hourly strip */
.hourly-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
}
.hourly-strip::-webkit-scrollbar {
  height: 8px;
}
.hourly-strip::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}
.hour {
  flex: 0 0 auto;
  width: 66px;
  text-align: center;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.hour-time {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.hour-icon .wx-icon {
  width: 34px;
  height: 34px;
  margin: 4px 0;
}
.hour-temp {
  font-weight: 600;
  font-size: 0.95rem;
}

/* ----------------------------------------------------------- Daily list */
.daily-list {
  display: flex;
  flex-direction: column;
}
.day-row {
  display: grid;
  grid-template-columns: 62px 36px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.day-row:last-child {
  border-bottom: none;
}
.day-name {
  font-weight: 600;
}
.day-icon .wx-icon {
  width: 30px;
  height: 30px;
}
.day-cond {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-pop {
  font-size: 0.85rem;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 46px;
  justify-content: flex-end;
}
.pop-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}
.day-temps {
  text-align: right;
  min-width: 72px;
}
.day-hi {
  font-weight: 700;
}
.day-lo {
  color: var(--text-faint);
}

/* ------------------------------------------------------------ Unit toggle */
.unit-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.unit-btn {
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.unit-btn.active {
  background: var(--brand);
  color: #fff;
}

/* ------------------------------------------------------- Weather SVG icons */
.wx-sun {
  fill: #fbbf24;
}
.wx-ray {
  stroke: #fbbf24;
  stroke-width: 3;
  stroke-linecap: round;
}
.wx-moon {
  fill: #e8edf6;
}
.wx-cloud {
  fill: #e4ebf3;
  stroke: #cdd7e3;
  stroke-width: 1;
}
[data-theme="dark"] .wx-cloud {
  fill: #c3ccd9;
}
.current-card .wx-cloud {
  fill: #f2f6fb;
  stroke: rgba(255, 255, 255, 0.5);
}
.wx-rain {
  stroke: #4ea3f5;
  stroke-width: 3;
  stroke-linecap: round;
}
.wx-fog {
  stroke: #b6c2d2;
  stroke-width: 3;
  stroke-linecap: round;
}
.wx-flake {
  fill: #bcdcff;
}
.wx-bolt {
  fill: #fbbf24;
}

/* ------------------------------------------------------------ Content pages */
.page {
  padding: 32px 0 48px;
}
.page h1 {
  font-size: 1.9rem;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.page .lead {
  color: var(--text-muted);
  font-size: 1.08rem;
  margin: 0 0 24px;
  max-width: 70ch;
}
.prose {
  max-width: 74ch;
}
.prose h2 {
  font-size: 1.25rem;
  margin: 30px 0 10px;
}
.prose h3 {
  font-size: 1.05rem;
  margin: 22px 0 8px;
}
.prose p,
.prose li {
  color: var(--text);
}
.prose ul {
  padding-left: 20px;
}
.prose li {
  margin: 6px 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.feature .wx-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
}
.feature h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.feature p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  align-items: start;
}
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.97rem;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}
.field textarea {
  min-height: 130px;
  resize: vertical;
}
.contact-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  color: var(--text);
  font-size: 0.92rem;
}
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.info-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}
.info-row {
  margin: 14px 0;
}
.info-row .label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.info-row .val {
  font-weight: 500;
}

/* ------------------------------------------------------------------ Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
  padding: 44px 0 28px;
}
.footer-brand .brand {
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.footer-blurb {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 38ch;
}
.footer-col h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 0 0 12px;
}
.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-col li {
  margin: 8px 0;
}
.footer-col a {
  color: var(--text-muted);
  font-size: 0.92rem;
}
.footer-col a:hover {
  color: var(--brand);
}
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 18px 0 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
  align-items: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.footer-disclaimer {
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ------------------------------------------------------------------ Utility */
.section-title {
  font-size: 1.1rem;
  margin: 28px 0 12px;
}
[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------ Responsive */
@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
  .current-card {
    grid-row: auto;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav-menu {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px;
    box-shadow: var(--shadow);
    display: none;
  }
  .nav-menu.open {
    display: flex;
  }
  .nav-menu a {
    padding: 12px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .current-temp {
    font-size: 3.4rem;
  }
  .current-icon .wx-icon {
    width: 74px;
    height: 74px;
  }
  .hero h1 {
    font-size: 1.45rem;
  }
}
