:root {
  color-scheme: light;
  --ink: #0f253e;
  --muted: #52687a;
  --blue: #0e5a8a;
  --blue-dark: #0a466c;
  --line: #d6e3e8;
  --paper: #ffffff;
  --wash: #f1f6f9;
  --sky: #d6eef4;
  --shadow: 0 20px 60px rgba(15, 37, 62, .07), 0 4px 16px rgba(15, 37, 62, .04);
  --shadow-elevated: 0 28px 72px rgba(15, 37, 62, .12), 0 6px 20px rgba(15, 37, 62, .06);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(circle at 85% 0%, #e3f2f7 0%, var(--wash) 55%);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease;
}
button, input { font: inherit; }
button { cursor: pointer; transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease; }
button:active { transform: translateY(1px); }
a { color: var(--blue-dark); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid #ed9445; outline-offset: 3px; }
[hidden] { display: none !important; }

.shell { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 20; padding: 10px 14px; background: var(--paper); border-radius: 8px; }
.skip-link:focus { top: 12px; }

.site-header {
  background: linear-gradient(90deg, #0b1e33 0%, #123152 100%);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 74px; gap: 20px; }
.brand { color: white; text-decoration: none; font-weight: 800; letter-spacing: -.04em; font-size: 1.5rem; display: inline-flex; align-items: center; gap: .3em; }
.brand span { color: #f6bc66; }
.header-note { font-size: .88rem; color: #c9dee9; letter-spacing: .01em; }

.intro { display: flex; align-items: center; justify-content: space-between; gap: 35px; padding: 56px 0 38px; }
.eyebrow { color: var(--blue-dark); font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; margin: 0 0 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.3rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -.05em; max-width: 760px; margin-bottom: 16px; }
.intro-copy { max-width: 600px; color: var(--muted); font-size: 1.12rem; margin-bottom: 0; }
.intro-mark {
  width: 144px;
  height: 144px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 5.5rem;
  line-height: 1;
  color: #d07628;
  background: radial-gradient(circle at 35% 35%, #fff9eb 0%, #ffeac2 100%);
  border: 1px solid rgba(208, 118, 40, .18);
  box-shadow: 18px 14px 0 var(--sky), 0 18px 40px rgba(208, 118, 40, .12);
}

.location-panel {
  position: relative;
  display: flex;
  align-items: end;
  gap: 14px;
  padding: 20px 22px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .9);
  outline: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.search-form { flex: 1 1 420px; min-width: 0; }
.search-form label { display: block; font-size: .82rem; font-weight: 750; margin-bottom: 7px; letter-spacing: -.01em; }
.search-row { display: flex; gap: 8px; }
.search-row input {
  min-width: 0;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #b6cad4;
  border-radius: 11px;
  color: var(--ink);
  background: white;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.search-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(14, 90, 138, .12); }

.button {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: var(--ink);
  min-height: 46px;
  padding: 0 18px;
  font-weight: 700;
  white-space: nowrap;
}
.button:hover { background: #eaf4f8; border-color: #b8d0dc; }
.button.primary {
  background: linear-gradient(180deg, #146ca4 0%, var(--blue) 100%);
  border-color: var(--blue-dark);
  color: white;
  box-shadow: 0 4px 12px rgba(14, 90, 138, .22);
}
.button.primary:hover { background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%); }
.location-button { flex: 0 0 auto; }

.unit-control { display: flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; height: 46px; background: var(--wash); padding: 3px; gap: 2px; }
.unit-button { min-width: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 750; font-variant-numeric: tabular-nums; }
.unit-button.active { background: white; color: var(--blue-dark); box-shadow: 0 2px 6px rgba(15, 37, 62, .08); }

.search-results {
  position: absolute;
  left: 20px;
  right: 20px;
  top: calc(100% + 6px);
  z-index: 10;
  padding: 8px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-elevated);
  max-height: 340px;
  overflow-y: auto;
}
.result-button { display: block; width: 100%; border: 0; border-radius: 9px; background: transparent; color: var(--ink); padding: 11px 14px; text-align: left; font-weight: 550; }
.result-button:hover, .result-button:focus-visible { background: #e9f3f7; }
.search-results p { padding: 10px 12px; color: var(--muted); margin: 0; }

.status { min-height: 24px; margin: 16px 4px 20px; color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }

.error-panel { padding: 28px; border-radius: 18px; border: 1px solid #e8c2a9; background: #fff7f0; margin-bottom: 26px; }
.error-panel h2 { margin-bottom: 6px; }
.error-panel p { color: #744b32; }

#weather-content {
  transition: opacity 0.25s ease, filter 0.25s ease;
}
#weather-content[data-loading="true"] {
  opacity: 0.6;
  filter: saturate(0.75);
  pointer-events: none;
}

/* Dynamic Atmospheric Current Card */
.current-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #dff1f6 0%, #f7fbfc 58%, #fff1d6 100%);
  border: 1px solid rgba(15, 37, 62, .1);
  border-radius: 24px;
  padding: clamp(24px, 4vw, 42px);
  box-shadow: var(--shadow-elevated);
  transition: background 0.45s ease, color 0.35s ease, border-color 0.35s ease;
}
.current-card[data-condition="clear-day"] {
  background: linear-gradient(135deg, #d4eef9 0%, #f4fafd 54%, #ffecbe 100%);
}
.current-card[data-condition="partly-cloudy-day"] {
  background: linear-gradient(135deg, #dcebf2 0%, #f5f9fb 60%, #f9ebd2 100%);
}
.current-card[data-condition="overcast"],
.current-card[data-condition="fog"] {
  background: linear-gradient(135deg, #dde5ea 0%, #eff3f6 65%, #e4ecef 100%);
}
.current-card[data-condition="drizzle"],
.current-card[data-condition="rain"] {
  background: linear-gradient(135deg, #cfe2ed 0%, #e7f0f5 62%, #d8e6f0 100%);
}
.current-card[data-condition="snow"] {
  background: linear-gradient(135deg, #e8f3f8 0%, #f8fcfe 60%, #e3eff7 100%);
}
.current-card[data-condition="clear-night"],
.current-card[data-condition="cloudy-night"],
.current-card[data-condition="thunderstorm"] {
  background: linear-gradient(135deg, #0d1f38 0%, #173459 58%, #1e294e 100%);
  color: #f4f8fb;
  border-color: rgba(255, 255, 255, .16);
}
.current-card[data-condition="clear-night"] .eyebrow,
.current-card[data-condition="cloudy-night"] .eyebrow,
.current-card[data-condition="thunderstorm"] .eyebrow {
  color: #7cc4fa;
}
.current-card[data-condition="clear-night"] .muted,
.current-card[data-condition="cloudy-night"] .muted,
.current-card[data-condition="thunderstorm"] .muted,
.current-card[data-condition="clear-night"] .detail-label,
.current-card[data-condition="cloudy-night"] .detail-label,
.current-card[data-condition="thunderstorm"] .detail-label {
  color: #b4cadb;
}
.current-card[data-condition="clear-night"] .detail,
.current-card[data-condition="cloudy-night"] .detail,
.current-card[data-condition="thunderstorm"] .detail {
  background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .15);
}
.current-card[data-condition="clear-night"] .refresh-button,
.current-card[data-condition="cloudy-night"] .refresh-button,
.current-card[data-condition="thunderstorm"] .refresh-button {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .22);
  color: #ffffff;
}
.current-card[data-condition="clear-night"] .refresh-button:hover,
.current-card[data-condition="cloudy-night"] .refresh-button:hover,
.current-card[data-condition="thunderstorm"] .refresh-button:hover {
  background: rgba(255, 255, 255, .2);
}

.current-topline { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.current-topline h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); letter-spacing: -.035em; margin: 0 0 4px; }
.muted { color: var(--muted); font-variant-numeric: tabular-nums; }
.refresh-button {
  border: 1px solid rgba(15, 37, 62, .16);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  color: var(--blue-dark);
  padding: 8px 14px;
  font-weight: 700;
}
.refresh-button:hover { background: white; }

.current-main { display: flex; align-items: center; gap: clamp(18px, 4vw, 40px); margin: 28px 0; }
.weather-icon {
  width: clamp(88px, 14vw, 132px);
  height: clamp(88px, 14vw, 132px);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: clamp(4.2rem, 10vw, 6.8rem);
  line-height: 1;
}
.weather-icon svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 10px 18px rgba(15, 37, 62, .12)); }
.current-temp {
  font-size: clamp(4.8rem, 12vw, 7.8rem);
  line-height: 0.96;
  font-weight: 760;
  letter-spacing: -.065em;
  font-variant-numeric: tabular-nums;
}
.description { font-size: 1.28rem; font-weight: 680; margin: 8px 0 2px; letter-spacing: -.015em; }
.current-main .muted { margin: 2px 0 0; }

.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.detail {
  border: 1px solid rgba(15, 37, 62, .09);
  border-top-color: rgba(255, 255, 255, .85);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.detail-label { display: block; color: var(--muted); font-size: .78rem; font-weight: 600; margin-bottom: 4px; }
.detail-value { display: block; font-size: 1.18rem; font-weight: 760; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.forecast-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(20px, 3vw, 30px);
  margin-top: 24px;
  box-shadow: var(--shadow);
}
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 15px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.035em; }
.section-heading > p { margin: 0; color: var(--muted); font-size: .83rem; }

/* 24-Hour Temperature Trendline Chart */
.hourly-chart {
  margin-bottom: 14px;
  padding: 12px 14px 6px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f5f9fb 0%, #ffffff 100%);
  border: 1px solid #e3eef2;
}
.hourly-chart svg {
  display: block;
  width: 100%;
  height: 86px;
  overflow: visible;
}

.hourly-list { display: flex; overflow-x: auto; gap: 10px; padding: 2px 0 10px; scroll-snap-type: x proximity; }
.hour-card {
  flex: 0 0 96px;
  min-height: 146px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, var(--wash) 100%);
  padding: 13px 10px;
  text-align: center;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.hour-card:first-child {
  background: linear-gradient(180deg, #e7f4f9 0%, #d8eef6 100%);
  border-color: #9ec8dc;
}
.hour-card:hover {
  transform: translateY(-2px);
  border-color: #accAD8;
  box-shadow: 0 8px 20px rgba(15, 37, 62, .06);
}
.hour-card .time { font-size: .81rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.hour-card:first-child .time { color: var(--blue-dark); font-weight: 800; }
.hour-card .icon { display: grid; place-items: center; width: 40px; height: 40px; font-size: 1.9rem; margin: 6px 0; }
.hour-card .icon svg { width: 38px; height: 38px; }
.hour-card .temp { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hour-card .rain { display: block; color: var(--blue-dark); font-size: .76rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* 7-Day Forecast with Proportional Temperature Range Bars */
.daily-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.3fr) 48px minmax(110px, 1.4fr) minmax(170px, 2fr);
  gap: 14px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 13px 4px;
}
.daily-row:first-child { border-top: 0; }
.day-name { font-weight: 750; letter-spacing: -.01em; }
.day-icon { width: 38px; height: 38px; display: grid; place-items: center; font-size: 1.65rem; margin-inline: auto; }
.day-icon svg { width: 36px; height: 36px; }
.day-description { color: var(--muted); font-size: .91rem; }
.day-temps {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  white-space: nowrap;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.day-temps .temp-min {
  color: var(--muted);
  font-weight: 650;
  min-width: 34px;
  text-align: right;
}
.day-temps .temp-max {
  color: var(--ink);
  font-weight: 800;
  min-width: 34px;
  text-align: right;
}
.temp-range-track {
  position: relative;
  flex: 1 1 88px;
  max-width: 120px;
  height: 6px;
  border-radius: 999px;
  background: #e3edf1;
  overflow: hidden;
}
.temp-range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2b93d1 0%, #38b2ac 45%, #ed9445 100%);
}

.source-note {
  color: var(--muted);
  background: linear-gradient(180deg, #ebf4f7 0%, #e4eff3 100%);
  border: 1px solid #d3e3e9;
  border-radius: 18px;
  padding: 22px 25px;
  margin: 24px 0 50px;
  font-size: .9rem;
}
.source-note strong { color: var(--ink); }
.source-note p { margin: 5px 0 0; }

.site-footer { border-top: 1px solid var(--line); background: white; color: var(--muted); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 27px 0; font-size: .9rem; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 14px 21px; }

@media (max-width: 800px) {
  .intro-mark { display: none; }
  .location-panel { flex-wrap: wrap; }
  .search-form { flex-basis: 100%; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 28px, 1120px); }
  .header-inner { min-height: 65px; }
  .header-note { font-size: .76rem; }
  .intro { padding: 42px 0 26px; }
  .intro-copy { font-size: 1rem; }
  .location-panel { gap: 10px; padding: 14px; }
  .search-results { left: 14px; right: 14px; }
  .location-button { flex: 1 1 auto; }
  .current-main { margin: 24px 0; }
  .refresh-button span { display: none; }
  .refresh-button { min-width: 42px; }
  .weather-icon { width: 72px; height: 72px; font-size: 3.8rem; }
  .detail-grid { gap: 8px; }
  .detail { padding: 10px 11px; }
  .daily-row { grid-template-columns: minmax(78px, 1fr) 36px minmax(120px, 1.5fr); gap: 8px; }
  .day-description { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .day-temps { font-size: .85rem; gap: 6px; }
  .footer-inner { display: block; }
  .footer-inner nav { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
