.product-preview .preview-weather-source {
  align-items: center;
  min-height: 44px;
  margin-block: -10px;
  text-underline-offset: .18em;
}

.product-preview :is(.preview-sample-caption, .preview-weather-source, .preview-weather-sky),
.product-preview [data-weather-hours] [hidden],
.product-preview :is([data-weather-hours], .preview-weather-card .preview-feature-icon)[hidden] {
  display: none;
}

.product-preview:is([data-preview-app="today"], [data-preview-app="weather"]) .preview-weather-source {
  display: inline-flex;
}

.product-preview:is([data-preview-app="fitness"], [data-preview-app="mail"]) .preview-sample-caption {
  display: inline;
}

.weather-credits {
  --credits-paper: var(--panel);
  --credits-enter: ifl-sheet-pop;
  --credits-duration: var(--ifl-motion-sheet, .46s);
  width: min(calc(100% - 2rem), 35rem);
  max-width: none;
  max-height: 88dvh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 1.8rem;
  background: var(--credits-paper);
  color: var(--ink);
  box-shadow: 0 1.25rem 4.5rem #0a061a38;
  overflow: hidden;
}

@media (prefers-color-scheme: light) {
  .weather-credits { --credits-paper: #fff; }
}

.weather-credits[open] { display: flex; flex-direction: column; }
.weather-credits::backdrop { background: #18122052; }
html:has(.weather-credits[open]) { overflow: hidden; }

.weather-credits-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.125rem;
  border-bottom: 1px solid var(--line);
}

.weather-credits-head h2 {
  font-size: 1.35rem;
  font-weight: 720;
}

.weather-credits-head h2:focus { outline: none; }
.weather-credits-head button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink);
  background: var(--credits-paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  font: 1.6rem/1 var(--font);
  cursor: pointer;
}

.weather-credits-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.15rem 1.125rem max(1.125rem, env(safe-area-inset-bottom));
}

.weather-credits .brand {
  display: flex;
  width: fit-content;
  max-width: 100%;
  min-height: 3.25rem;
  margin: 0 auto 1.25rem;
  justify-self: auto;
  font-size: clamp(.875rem, 4.2vw, 1.2rem);
}

.weather-credits .brand-company { font-size: inherit; }
.weather-credits .brand > img { width: clamp(2rem, 9vw, 2.5rem); height: auto; }

.weather-credits-sources {
  list-style: none;
  padding-inline: .875rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
}

.weather-credits-sources li + li { border-top: 1px solid var(--line); }
.weather-credits-sources a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  gap: .1rem .75rem;
  min-height: 3.65rem;
  padding-block: .55rem;
  text-decoration: none;
}

.weather-credits-sources a:focus-visible { outline-offset: -2px; border-radius: .4rem; }
.weather-credits-sources strong { font-size: 1rem; font-weight: 600; }
.weather-credits-sources small { color: var(--muted); font-size: .8rem; grid-column: 1; }
.weather-credits-sources a::after {
  content: "";
  grid-area: 1 / 2 / 3 / 3;
  align-self: center;
  width: .42rem;
  height: .42rem;
  margin-inline-end: .2rem;
  border: solid currentColor;
  border-width: 2px 2px 0 0;
  rotate: 45deg;
}

.weather-credits-note { margin-top: .85rem; color: var(--muted); font-size: .8rem; }

@media (max-width: 36rem) {
  .weather-credits {
    --credits-enter: ifl-sheet-in;
    width: 100%;
    inset: auto 0 0;
    margin: 0;
    border-radius: 1.8rem 1.8rem 0 0;
    padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  }
}

/* Match the InFlite sheet entrance in roof/roof.css. */
@keyframes ifl-sheet-in { from { transform: translateY(100%); } }
@keyframes ifl-sheet-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes ifl-fade-in { from { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  .weather-credits[open] {
    animation: var(--credits-enter) var(--credits-duration) var(--ifl-motion-glide, cubic-bezier(.32, .72, 0, 1));
  }
  .weather-credits[open]::backdrop { animation: ifl-fade-in var(--credits-duration) ease; }
}

.product-preview .preview-weather-reading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .15rem .53rem;
  margin-block: .22rem;
  color: #fff;
  font-size: clamp(.78rem, 1.1vw, .98rem);
  font-weight: 560;
  line-height: 1.25;
}

.product-preview .preview-weather-reading strong {
  font-size: clamp(1.9rem, 4.15vw, 3.15rem);
  line-height: .98;
  font-weight: 650;
  letter-spacing: -.055em;
}

.product-preview .preview-weather-card:has([data-sky]) {
  background: radial-gradient(ellipse at 96% 16%, var(--weather-horizon, #476b9f), transparent 68%), #212e4e;
}

.product-preview .preview-weather-card:has([data-sky])::after { content: none; }
.product-preview .preview-weather-card:has([data-sky]) .preview-feature-copy { max-width: 66%; }
.product-preview .preview-weather-card:has([data-sky$="sun"]) { --weather-horizon: #537dad; }
.product-preview .preview-weather-card:has([data-sky="snow"]) { --weather-horizon: #527693; }
.product-preview .preview-weather-card:has([data-sky][data-night]) { --weather-horizon: #354c7d; }

.product-preview .preview-weather-sky[data-sky] {
  display: grid;
  place-items: center;
  position: absolute;
  inset-block: 0;
  inset-inline-end: clamp(.3rem, 1vw, .8rem);
  width: min(44%, 8.25rem);
  z-index: -1;
  pointer-events: none;
}

.preview-weather-sky > .wi { width: 100%; height: 100%; }
.preview-weather-sky .preview-weather-wind {
  display: none;
  position: absolute;
  inset-inline-end: 3%;
  inset-block-end: 13%;
  width: clamp(1.2rem, 4vw, 1.6rem);
  height: auto;
  color: #B4C0CF;
}
.preview-weather-sky[data-windy] .preview-weather-wind { display: block; }

.preview-weather-sky :is(.wi-sun, .wi-moon, .wi-rays, .wi-cloud, .wi-flakes > g, .wi-bolt) {
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes london-light {
  43% { transform: translateY(-1px) rotate(6deg) scale(1.065); }
  76% { transform: translateY(-.5px) rotate(2deg) scale(1.025); }
}

@keyframes london-cloud {
  41% { transform: translate(-2px, -1px) scale(1.025); }
  72% { transform: translate(-1px, .5px); }
}

@keyframes london-cloud-back {
  47% { transform: translate(2px, -1.5px); }
  74% { transform: translate(1px, -.5px); }
}

@keyframes london-rain {
  36% { transform: translate(-2px, 4px); opacity: 0; }
  37% { transform: translate(2px, -4px); opacity: 0; }
  69% { opacity: 1; }
}

@keyframes london-snow {
  41% { transform: translate(2px, 3px) rotate(10deg); opacity: 0; }
  42% { transform: translate(-2px, -3px) rotate(-14deg); opacity: 0; }
  73% { transform: translate(-.5px, -2px) rotate(-4deg); opacity: .9; }
}

@keyframes london-wind {
  24% { transform: translate(-2px, .5px); opacity: .3; }
  61% { transform: translate(2px, -.5px); opacity: 1; }
  84% { transform: translate(3px, -.5px); opacity: .3; }
}

@keyframes london-storm { 48% { transform: translateY(-1.5px) scale(1.045); } }

@media (prefers-reduced-motion: no-preference) and (forced-colors: none) {
  [data-weather-in-view] .preview-scene:not([hidden]) .preview-weather-sky :is(.wi-sun, .wi-moon, .wi-rays) { animation: london-light 4.4s ease-in-out; }
  [data-weather-in-view] .preview-scene:not([hidden]) .preview-weather-sky .wi-cloud { animation: london-cloud 4.35s ease-in-out; }
  [data-weather-in-view] .preview-scene:not([hidden]) .preview-weather-sky[data-sky="cloud"] .wi-cloud:first-child { animation: london-cloud-back 4.8s ease-in-out; }
  [data-weather-in-view] .preview-scene:not([hidden]) .preview-weather-sky .wi-drops > * { animation: london-rain .69s linear 7; }
  [data-weather-in-view] .preview-scene:not([hidden]) .preview-weather-sky .wi-flakes > g { animation: london-snow 2.34s ease-in-out 2; }
  [data-weather-in-view] .preview-scene:not([hidden]) .preview-weather-sky :is(.wi-fog, .preview-weather-wind) > * { animation: london-wind 1.58s ease-in-out 3; }
  [data-weather-in-view] .preview-scene:not([hidden]) .preview-weather-sky .wi-bolt { animation: london-storm 2.3s ease-in-out 2; }
  [data-weather-in-view] .preview-scene:not([hidden]) .preview-weather-sky :is(.wi-drops, .wi-flakes, .wi-fog, .preview-weather-wind) > :nth-child(2) { animation-delay: -.22s; }
  [data-weather-in-view] .preview-scene:not([hidden]) .preview-weather-sky :is(.wi-drops, .wi-flakes, .wi-fog, .preview-weather-wind) > :nth-child(3) { animation-delay: -.43s; }
}

@media (forced-colors: active) {
  .product-preview .preview-weather-sky[data-sky] { display: none; }
  .product-preview .preview-weather-card:has([data-sky]) .preview-feature-copy { max-width: 100%; }
}
