.weather {
  --w-bg: #f4f8fb;
  --w-card: #fff;
  --w-text: #17212b;
  --w-muted: #526170;
  --w-accent: #1269a7;
  --w-border: #d8e3eb;
  max-width: 100%;
  min-width: 0;
  color: var(--w-text);
  font: 400 1rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
  background: var(--w-bg);
  border-radius: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
}

.weather *,
.weather *::before,
.weather *::after {
  box-sizing: border-box;
  min-width: 0;
}

.weather__header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.weather h1,
.weather h2,
.weather h3 {
  line-height: 1.2;
  margin: .2em 0;
}

.weather__updated,
.weather__meta {
  color: var(--w-muted);
  font-size: .875rem;
}

.weather__stale {
  padding: .75rem 1rem;
  border: 2px solid #a26000;
  background: #fff4d6;
  border-radius: .5rem;
}

.weather__current {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  background: var(--w-card);
  border: 1px solid var(--w-border);
  border-radius: .75rem;
  padding: 1rem;
}

.weather__icon {
  width: 4.5rem;
  height: 4.5rem;
}

.weather__temp {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 750;
  line-height: 1;
}

.weather__condition {
  font-weight: 650;
}

.weather__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr));
  gap: .5rem 1rem;
  margin: 1rem 0;
}

.weather__metric {
  background: var(--w-card);
  border: 1px solid var(--w-border);
  border-radius: .5rem;
  padding: .65rem;
}

.weather__metric dt {
  color: var(--w-muted);
  font-size: .8rem;
}

.weather__metric dd {
  margin: 0;
  font-weight: 650;
}

.weather__hourly-section {
  margin: 1.25rem 0;
}

.weather__hourly-section > h2 {
  font-size: 1.25rem;
  margin-bottom: .75rem;
}

.weather__hourly {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .625rem;
  width: 100%;
}

.weather__hour-card {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  min-width: 0;
  background: var(--w-card);
  border: 1px solid var(--w-border);
  border-radius: .65rem;
  padding: .7rem;
}

.weather__hour-card h3 {
  font-size: .95rem;
}

.weather__hour-condition {
  display: flex;
  gap: .35rem;
  align-items: center;
  min-height: 2.4rem;
  color: var(--w-muted);
  font-size: .78rem;
  line-height: 1.2;
}

.weather__mini-icon {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
}

.weather__hour-temp {
  font-size: 1.55rem;
  font-weight: 750;
  line-height: 1.1;
}

.weather__hour-details {
  display: grid;
  gap: .3rem;
  margin: 0;
  font-size: .75rem;
  line-height: 1.25;
}

.weather__hour-details > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .25rem;
  align-items: start;
  border-top: 1px solid var(--w-border);
  padding-top: .3rem;
}

.weather__hour-details dt {
  color: var(--w-muted);
}

.weather__hour-details dd {
  margin: 0;
  font-weight: 650;
  text-align: right;
}

.weather__hour-details > .weather__hour-wind {
  grid-template-columns: 1fr;
  margin-top: auto;
}

.weather__hour-wind dd {
  text-align: left;
}

.weather__days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr));
  gap: .75rem;
}

.weather__day {
  background: var(--w-card);
  border: 1px solid var(--w-border);
  border-radius: .75rem;
  padding: 1rem;
}

.weather__day dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .2rem .75rem;
  margin: .5rem 0;
}

.weather__day dt {
  color: var(--w-muted);
}

.weather__day dd {
  margin: 0;
  text-align: right;
}

.weather__attribution {
  margin-top: 1.25rem;
  color: var(--w-muted);
  font-size: .8rem;
}

.weather a {
  color: var(--w-accent);
}

.weather--compact {
  padding: 1rem;
}

.weather--compact .weather__current {
  border: 0;
  padding: 0;
}

.weather--compact .weather__days {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.weather__freshness {
  padding: .75rem 1rem;
  border: 2px solid #9b6a00;
  background: #fff8df;
  border-radius: .5rem;
}

.weather__warnings {
  margin: 1rem 0;
  padding: .75rem 1rem;
  border-left: .3rem solid #b34819;
  background: #fff0e8;
  border-radius: .35rem;
}

.weather__charts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin: 1.25rem 0;
}

.weather__charts h2 {
  grid-column: 1 / -1;
}

.weather__chart {
  margin: 0;
  background: var(--w-card);
  border: 1px solid var(--w-border);
  border-radius: .75rem;
  padding: .75rem;
}

.weather__chart svg {
  display: block;
  width: 100%;
  height: 8rem;
  border-bottom: 1px solid var(--w-border);
}

.weather__chart-line {
  fill: none;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.weather__chart-line--temperature {
  stroke: #d34b32;
}

.weather__chart-line--wind {
  stroke: #1269a7;
}

.weather__chart-bars {
  fill: #398ac0;
}

.weather__chart figcaption {
  margin-top: .35rem;
  color: var(--w-muted);
  font-size: .8rem;
}

.weather__compact-day {
  margin: .75rem 0;
  background: var(--w-card);
  border: 1px solid var(--w-border);
  border-radius: .6rem;
  padding: .7rem;
}

.weather__compact-day h3 {
  font-size: 1rem;
}

.weather__compact-day dl {
  display: grid;
  gap: .35rem;
  margin: .35rem 0 0;
}

.weather__compact-day dl > div {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
}

.weather__compact-day dt {
  color: var(--w-muted);
}

.weather__compact-day dd {
  margin: 0;
  font-weight: 650;
  text-align: right;
}

.weather__more {
  display: inline-block;
  margin-top: .25rem;
  font-weight: 700;
}

@media (min-width: 1280px) {
  .weather__hourly {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .weather__hourly {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .weather {
    border-radius: 0;
  }

  .weather__hourly {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }

  .weather__hour-card {
    padding: .6rem;
  }

  .weather__charts {
    grid-template-columns: 1fr;
  }

  .weather--compact .weather__days {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 340px) {
  .weather {
    padding: .75rem;
  }

  .weather__hour-condition,
  .weather__hour-details {
    font-size: .72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .weather * {
    scroll-behavior: auto !important;
  }
}
