#weather {
   box-sizing: border-box;
   width: 100%;
   max-width: 1100px;
   margin-top: 2em;
   padding: 24px;
   background: #242424;
   border: 1px solid #444;
   border-top: 3px solid #8cdeff;
   border-radius: 16px;
   color: #f5f5f5;
   opacity: 0;
   transform: translateY(15px);
   transition: opacity 0.5s ease, transform 0.5s ease;
}

#weather.weather-visible {
   opacity: 1;
   transform: translateY(0);
}

#weather h2 {
   font-size: 16px;
   font-weight: 500;
   text-transform: uppercase;
   letter-spacing: 1px;
   color: #aaa;
   margin: 0 0 20px;
}

#weather-output {
   background: #303030;
   border: 1px solid #8cdeff;
   border-radius: 12px;
   border-top: 3px solid #8cdeff;
   padding: 20px;
}

#weather-output h3 {
   font-size: 16px;
   font-weight: 500;
   color: #bbb;
   margin: 0;
}

#weather-output p {
   font-size: 15px;
   margin: 8px 0;
}

#weather-output .weather-temperature {
   font-size: 42px;
   font-weight: 600;
   margin: 12px 0;
}

#forecast-list {
   display: grid;
   grid-template-columns: repeat(3, minmax(0, 1fr));
   gap: 12px;
   margin-top: 12px;
}

.forecast-period {
   background: #303030;
   border: 1px solid #404040;
   border-radius: 12px;
   border-top: 3px solid #8cdeff;
   padding: 20px;
   min-width: 0;
}

.forecast-period h4 {
   font-size: 16px;
   margin: 0 0 14px;
}

.forecast-period p {
   font-size: 15px;
   color: #bbb;
   margin: 8px 0;
}

#forecast-button {
   display: block;
   width: 100%;
   padding: 12px;
   margin-top: 16px;
   background: #363636;
   color: white;
   border: 1px solid #505050;
   border-radius: 8px;
   font: inherit;
   font-size: 14px;
   cursor: pointer;
}

#forecast-button:hover {
   background: #484848;
}

#forecast-button[hidden] {
   display: none;
}

#forecast-list {
   max-height: 0;
   opacity: 0;
   visibility: hidden;
   overflow: hidden;
   margin-top: 0;
   transition: max-height 0.4s ease, opacity 0.4s ease, margin-top 0.4s ease, visibility 0.4s ease;
}

#weather.expanded #forecast-list {
   max-height: 1000px;
   opacity: 1;
   visibility: visible;
   margin-top: 12px;
}

@media (min-width: 800px) {
   #weather.expanded {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      align-items: stretch;
   }

   #weather.expanded h2 {
      grid-column: 1 / -1;
      margin-bottom: 4px;
   }

   #weather.expanded #weather-output {
      grid-column: 1;
   }

   #weather.expanded #forecast-list {
      grid-column: 2 / -1;
      grid-row: 2;
      margin-top: 0;
   }

   #weather.expanded #forecast-button {
      grid-column: 1 / -1;
      grid-row: 3;
      margin-top: 0;
   }
}

@media (max-width: 799px) {
   #forecast-list {
      grid-template-columns: 1fr;
   }
}

@media (prefers-reduced-motion: reduce) {
   #weather,
   #forecast-list {
      transition: none;
   }
}