/* The public site's seasonal decoration (PUBLIC-WEB-SEASON-01). public/season.mjs sets data-season on <html> and the
   strip images as custom properties only when the site's season is running, so none of this applies otherwise.
   Decoration sits on frames and edges, never over text, and takes no pointer events. */
@keyframes season-arrive {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Snow built up along the header's bottom rule, icicles hanging below it. */
:root[data-season] .sq-public-header {
  position: relative;
  z-index: 2;
}
:root[data-season] .sq-public-header::after {
  content: '';
  position: absolute;
  left: -.35rem;
  right: -.35rem;
  top: calc(100% - 12px);
  height: 40px;
  background: var(--season-snow) left top / auto 100% repeat-x;
  pointer-events: none;
  animation: season-arrive .8s ease-out both;
}

/* Snow along the hero's bottom edge, drawn from the section below it so the icicles can hang past the hero's clip. */
:root[data-season] .discover-section {
  position: relative;
}
:root[data-season] .discover-section::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -19px;
  height: 48px;
  z-index: 1;
  background: var(--season-snow) left top / auto 100% repeat-x;
  pointer-events: none;
  animation: season-arrive .8s ease-out both;
}

/* Seasonal repaints of the full-bleed art fade in over the everyday art. */
.season-art {
  opacity: 0;
  transition: opacity .9s ease-out;
}
.season-art.season-art-shown {
  opacity: 1;
}

/* Light snowfall over the hero art only: below the hero's text and buttons, never over them. A tall flake layer slides
   down by one tile so the compositor can move it without repainting the hero. */
.season-snowfall {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  /* Thin out the flakes over the text side so the copy stays crisp. */
  mask-image: linear-gradient(90deg, transparent 0%, #0006 35%, #000 55%);
  animation: season-arrive 1.2s ease-out both;
}
.season-snowfall::before {
  content: '';
  position: absolute;
  inset: -260px 0 0 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fffffff0 50%, transparent 51%),
    radial-gradient(2px 2px at 90px 140px, #ffffffd0 50%, transparent 51%),
    radial-gradient(3px 3px at 160px 60px, #ffffffe0 50%, transparent 51%),
    radial-gradient(2px 2px at 230px 190px, #ffffffc0 50%, transparent 51%),
    radial-gradient(3px 3px at 60px 220px, #ffffffd8 50%, transparent 51%),
    radial-gradient(2px 2px at 140px 10px, #ffffffb0 50%, transparent 51%);
  background-size: 260px 260px;
  will-change: transform;
  animation: season-snowfall 14s linear infinite;
}
@keyframes season-snowfall {
  from { transform: translate(0, 0); }
  to { transform: translate(0, 260px); }
}

/* Snow caps on two of the six "What awaits" frames. */
:root[data-season] .realm-card:nth-child(3n + 1) {
  position: relative;
  overflow: visible;
}
:root[data-season] .realm-card:nth-child(3n + 1) img {
  border-radius: 5px 0 0 5px;
}
/* Room under the icicles so they never touch the card's heading. */
:root[data-season] .realm-card:nth-child(3n + 1) > div {
  padding-top: 1.1rem;
}
:root[data-season] .realm-card:nth-child(3n + 1)::before {
  content: '';
  position: absolute;
  left: -3px;
  right: -3px;
  top: -12px;
  height: 28px;
  background: var(--season-snow) left top / auto 100% repeat-x;
  pointer-events: none;
  animation: season-arrive .8s ease-out both;
}

/* Evergreen garlands draped along the top of the two "Latest from the Realm" frames, under their ribbons. */
:root[data-season] .latest-panel::before {
  content: '';
  position: absolute;
  left: .35rem;
  right: .35rem;
  top: -15px;
  height: 38px;
  background: var(--season-garland) left top / auto 100% repeat-x;
  pointer-events: none;
  animation: season-arrive .8s ease-out both;
}
:root[data-season] .latest-panel .ribbon {
  z-index: 1;
}

/* On the Realm Bulletin and Updates lists, the first story's frame gets the garland. */
:root[data-season] .bulletin-grid > .bulletin-card:first-child {
  position: relative;
}
:root[data-season] .bulletin-grid > .bulletin-card:first-child::before {
  content: '';
  position: absolute;
  left: .35rem;
  right: .35rem;
  top: -15px;
  height: 38px;
  background: var(--season-garland) left top / auto 100% repeat-x;
  pointer-events: none;
  animation: season-arrive .8s ease-out both;
}

@media (max-width: 760px) {
  :root[data-season] .sq-public-header::after {
    height: 30px;
    top: calc(100% - 9px);
  }
  :root[data-season] .discover-section::before {
    top: -16px;
    height: 40px;
  }
  :root[data-season] .realm-card:nth-child(3n + 1)::before {
    top: -9px;
    height: 20px;
  }
  /* Phone heroes put the copy across the whole art, so no snow falls over it. */
  .season-snowfall {
    display: none;
  }
  :root[data-season] .latest-panel::before,
  :root[data-season] .bulletin-grid > .bulletin-card:first-child::before {
    top: -12px;
    height: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .season-snowfall {
    display: none;
  }
  .season-art {
    transition: none;
  }
  :root[data-season] .sq-public-header::after,
  :root[data-season] .discover-section::before,
  :root[data-season] .realm-card:nth-child(3n + 1)::before,
  :root[data-season] .latest-panel::before,
  :root[data-season] .bulletin-grid > .bulletin-card:first-child::before {
    animation: none;
  }
}
