:root {
  --ink: #f5f8fb;
  --muted: rgba(231, 238, 246, .72);
  --hairline: rgba(225, 235, 245, .23);
  --panel: rgba(20, 31, 45, .48);
  --accent: #cdddf2;
  --warm: #f5d58d;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
button, input { font: inherit; }
button { color: inherit; }

body {
  min-height: 100vh;
  color: var(--ink);
  background: #15202e url("../img/storm-background.png") center / cover fixed no-repeat;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 52% 42%, transparent 0 26%, rgba(8, 16, 25, .15) 62%, rgba(6, 12, 20, .58) 100%);
}

.weather-shell {
  position: relative;
  min-height: 100vh;
  padding: clamp(22px, 5vw, 74px);
  display: grid;
  place-items: center;
}

.dashboard {
  width: min(100%, 1360px);
  min-height: min(880px, calc(100vh - 70px));
  padding: 30px 42px 26px;
  border: 1px solid rgba(229, 238, 248, .44);
  border-radius: 18px;
  background: linear-gradient(125deg, rgba(70, 84, 101, .34), rgba(16, 28, 42, .53));
  box-shadow: 0 35px 90px rgba(2, 8, 15, .46), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(6px) saturate(.86);
  -webkit-backdrop-filter: blur(6px) saturate(.86);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.topbar { min-height: 58px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 28px; }
.brand { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 11px; width: max-content; font-size: 19px; font-weight: 300; letter-spacing: -.02em; }
.brand strong { font-weight: 600; }
.brand svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.65; }
.brand svg .bolt { fill: currentColor; stroke: none; }

.location { border: 0; background: none; display: flex; align-items: flex-start; gap: 11px; cursor: pointer; padding: 0; text-align: left; }
.location svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; margin-top: 2px; }
.location span { display: grid; gap: 4px; }
.location b { font-size: 18px; font-weight: 400; white-space: nowrap; }
.location small { color: var(--muted); font-size: 13px; }

.header-actions { justify-self: end; display: flex; align-items: center; gap: 18px; }
.search-wrap { position: relative; display: flex; justify-content: flex-end; }
.search-wrap input { width: 0; opacity: 0; height: 40px; padding: 0; border: 1px solid transparent; border-radius: 11px; color: var(--ink); background: rgba(7, 17, 29, .28); outline: 0; transition: width .35s ease, opacity .25s, padding .35s, border-color .35s; }
.search-wrap.open input { width: 190px; opacity: 1; padding: 0 46px 0 14px; border-color: var(--hairline); }
.icon-button { width: 42px; height: 40px; border: 1px solid var(--hairline); border-radius: 11px; background: rgba(10, 20, 33, .2); display: grid; place-items: center; cursor: pointer; }
.search-wrap .icon-button { position: absolute; right: 0; }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.unit-toggle { height: 36px; padding: 2px; border: 1px solid var(--hairline); border-radius: 10px; display: flex; }
.unit-toggle button { width: 49px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--muted); transition: .25s; }
.unit-toggle button.active { background: rgba(241, 246, 252, .16); color: white; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }

.dashboard-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; padding-top: 44px; }
.current-weather { min-height: 510px; display: flex; flex-direction: column; align-items: flex-start; }
.weather-heading h1 { margin: 0; font-size: clamp(54px, 5vw, 78px); font-weight: 250; line-height: .95; letter-spacing: -.055em; text-shadow: 0 2px 24px rgba(4, 10, 18, .25); }
.weather-heading p { margin: 15px 0 0; font-size: 20px; font-weight: 300; color: rgba(245,248,251,.9); }
.temperature-block { margin-top: 64px; }
.current-temp { font-size: clamp(94px, 9vw, 138px); font-weight: 200; line-height: .75; letter-spacing: -.07em; }
.current-temp sup { font-size: .5em; vertical-align: top; position: relative; top: .02em; font-weight: 250; }
.temperature-block p { margin: 28px 0 0; font-size: 21px; font-weight: 300; }
.conditions { margin-top: 22px; display: flex; align-items: center; gap: 14px; color: rgba(238,244,250,.9); font-size: 14px; text-shadow: 0 1px 10px rgba(3,9,15,.55); }
.conditions span { display: flex; align-items: center; gap: 7px; }
.conditions b { color: var(--ink); font-weight: 500; }
.conditions i { height: 19px; border-left: 1px solid var(--hairline); }
.conditions svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.warning { margin-top: 27px; min-width: 292px; min-height: 60px; padding: 10px 14px; border: 1px solid rgba(245, 213, 141, .72); border-radius: 11px; background: linear-gradient(100deg, rgba(67, 55, 38, .62), rgba(21,32,45,.52)); box-shadow: 0 8px 24px rgba(5,12,20,.12); display: grid; grid-template-columns: 28px 1fr 20px; align-items: center; gap: 9px; text-align: left; cursor: pointer; transition: transform .2s, background .2s; }
.warning:hover { transform: translateX(3px); background: rgba(118, 91, 48, .25); }
.warning-icon { color: var(--warm); font-size: 28px; }
.warning span:nth-child(2) { display: grid; gap: 3px; }
.warning b { color: #fae2ac; font-size: 14px; font-weight: 500; }
.warning small { font-size: 11px; color: var(--muted); }
.warning svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.weather-insights { border-left: 1px solid var(--hairline); padding-left: 28px; align-self: start; }
.insight { padding: 14px 0 27px; }
.insight + .insight { border-top: 1px solid var(--hairline); padding-top: 31px; }
.insight header { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.insight header span { display: flex; gap: 8px; align-items: center; }
.insight header b { font-weight: 400; }
.insight header svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.rain-chart { width: 100%; height: 100px; margin-top: 17px; overflow: visible; }
.grid path { stroke: rgba(228,237,247,.22); stroke-width: 1; stroke-dasharray: 2 6; }
.rain-line { fill: none; stroke: #e2eaf3; stroke-width: 2; }
.points circle { fill: #bdd7fb; filter: drop-shadow(0 0 5px #bcd7f7); }
.chart-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin-top: 2px; }
.pressure { padding-bottom: 0; }
.gauge { position: relative; margin-top: 16px; height: 126px; }
.gauge svg { width: 100%; height: 122px; overflow: visible; }
.gauge-arc, .gauge-ticks { fill: none; stroke: rgba(225,235,245,.55); stroke-width: 2; }
.gauge-ticks { stroke-width: 1.4; }
.needle { stroke: #9cbdec; stroke-width: 2; filter: drop-shadow(0 0 5px #7aa9e3); }
.gauge circle { fill: #29394c; stroke: #dce6f1; stroke-width: 1.5; }
.gauge-number { position: absolute; top: 10px; font-size: 10px; color: var(--muted); }
.gauge-number.left { left: 13%; top: 42px; }.gauge-number.center { left: 47%; }.gauge-number.right { right: 9%; top: 42px; }

.forecast { position: relative; min-height: 202px; padding-top: 5px; }
.forecast-days { height: 100%; position: relative; z-index: 2; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { height: 100%; border: 1px solid transparent; border-radius: 22px; background: transparent; cursor: pointer; color: inherit; display: flex; flex-direction: column; align-items: center; padding: 13px 8px 0; transition: background .25s, border-color .25s, transform .25s; }
.day:hover, .day.active { background: linear-gradient(180deg, rgba(227,237,248,.09), rgba(227,237,248,.025)); border-color: rgba(228,237,247,.28); transform: translateY(-3px); }
.day-name { color: var(--muted); font-size: 17px; }
.day-temp { font-size: 35px; font-weight: 300; margin-top: 8px; }
.weather-icon { width: 38px; height: 38px; margin-top: 8px; }
.weather-icon svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.weather-icon .sun { stroke: var(--warm); }
.day-node { position: absolute; bottom: 23px; width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(223,232,242,.65); background: #9eacbd; box-shadow: 0 0 0 4px rgba(189, 210, 235, .12), 0 0 11px rgba(187,211,241,.45); }
.day.active .day-node { background: #d9e8fb; box-shadow: 0 0 0 5px rgba(189, 210, 235, .19), 0 0 16px #c5dcf8; }
.forecast-curve { position: absolute; left: 3%; width: 94%; height: 88px; bottom: 0; z-index: 1; overflow: visible; }
.forecast-curve path { fill: none; stroke: rgba(231,238,246,.83); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.day:nth-child(1) .day-node { bottom: 22px; }.day:nth-child(2) .day-node { bottom: 40px; }.day:nth-child(3) .day-node { bottom: 12px; }.day:nth-child(4) .day-node { bottom: 33px; }.day:nth-child(5) .day-node { bottom: 6px; }.day:nth-child(6) .day-node { bottom: 22px; }.day:nth-child(7) .day-node { bottom: 39px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 10; padding: 12px 18px; border: 1px solid var(--hairline); border-radius: 10px; background: rgba(16, 27, 40, .9); box-shadow: 0 12px 35px rgba(0,0,0,.3); backdrop-filter: blur(12px); color: var(--ink); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .3s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 960px) {
  .weather-shell { padding: 20px; align-items: start; }
  .dashboard { min-height: auto; padding: 24px; }
  .topbar { grid-template-columns: 1fr auto; }
  .location { grid-column: 1 / -1; grid-row: 2; margin-top: 14px; }
  .dashboard-body { grid-template-columns: 1fr 280px; gap: 24px; padding-top: 34px; }
  .weather-heading h1 { font-size: 56px; }
  .current-temp { font-size: 100px; }
  .forecast { overflow-x: auto; min-height: 205px; margin-right: -24px; padding-right: 24px; }
  .forecast-days { min-width: 800px; }
  .forecast-curve { min-width: 744px; }
}

@media (max-width: 700px) {
  body { background-attachment: scroll; background-position: 58% center; }
  .weather-shell { padding: 8px; }
  .dashboard { width: calc(100vw - 16px); min-width: 0; padding: 18px 16px; border-radius: 15px; background: linear-gradient(145deg, rgba(57,72,89,.64), rgba(13,25,38,.72)); }
  .topbar { gap: 12px; }
  .brand { font-size: 15px; gap: 7px; }.brand svg { width: 28px; }
  .header-actions { gap: 6px; }.unit-toggle button { width: 36px; }.search-wrap.open input { width: 138px; }
  .dashboard-body { grid-template-columns: 1fr; }
  .current-weather { min-height: 470px; }
  .weather-heading h1 { font-size: 53px; }
  .weather-heading p { font-size: 18px; }
  .temperature-block { margin-top: 48px; }
  .conditions { flex-wrap: wrap; }
  .warning { background: linear-gradient(100deg, rgba(65,51,31,.9), rgba(16,28,41,.84)); }
  .weather-insights { min-width: 0; overflow: hidden; border-left: 0; border-top: 1px solid var(--hairline); padding: 18px 0 10px; display: grid; grid-template-columns: 1fr; }
  .forecast { width: calc(100% + 16px); min-width: 0; margin: 18px -16px 0 0; padding-right: 16px; }
}

@media (prefers-reduced-motion: no-preference) {
  .dashboard { animation: enter .9s cubic-bezier(.2,.8,.2,1) both; }
  .current-weather > * { animation: rise .8s .18s both; }
  .current-weather > :nth-child(2) { animation-delay: .28s; }
  .current-weather > :nth-child(3) { animation-delay: .38s; }
  .current-weather > :nth-child(4) { animation-delay: .48s; }
  @keyframes enter { from { opacity: 0; transform: scale(.985) translateY(12px); } }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } }
}
