/* Prize calendar (booost.cms:lions) - docs/features/PRIZE_CALENDAR.md.
   Brand surfaces use booost's bg-primary / text-bg-primary classes in the
   templates: booost keeps those at the brand colour in dark mode, where a
   plain var(--bs-primary) is lightened. The board is pinned to the light
   scheme (its doors are paper on a picture in both modes).
   The board is a 12 x 17 grid in the aspect of the season's picture, so
   the same staggered layout scales from a phone to a wide screen; door sizes and
   type follow the board through container query units. Colours come from
   the theme (primary / secondary), so the site's registry sets them. */

.prize-calendar {
  --prize-ink: var(--bs-primary, #00338d);
  --prize-accent: var(--bs-warning, #ebb700);
  --prize-paper: rgba(255, 255, 255, 0.3);
  --prize-paper-closed: rgba(255, 255, 255, 0.1);
  --prize-radius: 0.5rem;
}

/* ---- the page: on the brand blue -------------------------------------- */

/* The calendar and door pages stand on the brand primary (--prize-night,
   set by the view from the theme), in light and dark mode, like the start
   page's primary hero. A fixed layer behind the content: the body
   background belongs to booost. The templates put title, description and
   content in the dark scheme (white text), the lookup box in the light one. */
.prize-calendar::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  background-color: var(--prize-night, transparent);
  /* a winter night: scattered stars, a few of them gold */
  background-image:
    radial-gradient(1px 1px at 23px 41px, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1px 1px at 147px 97px, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 91px 171px, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 211px 223px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(2px 2px at 263px 61px, rgba(235, 183, 0, 0.7), transparent),
    radial-gradient(1px 1px at 301px 151px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 37px 263px, rgba(255, 255, 255, 0.55), transparent);
  background-size: 331px 283px;
}

/* snow, falling slowly behind the content: one tile of flakes moved by
   exactly its own height, so the loop has no seam (transform only) */
.prize-calendar::after {
  --snow-tile: 360px;
  content: "";
  position: fixed;
  z-index: -1;
  top: calc(-1 * var(--snow-tile));
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  background-image:
    radial-gradient(3px 3px at 40px 60px, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(2px 2px at 180px 20px, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(4px 4px at 300px 140px, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(2.5px 2.5px at 110px 230px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(3px 3px at 250px 300px, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(2px 2px at 20px 330px, rgba(255, 255, 255, 0.45), transparent);
  background-size: var(--snow-tile) var(--snow-tile);
  animation: prize-snow 28s linear infinite;
  will-change: transform;
}

@keyframes prize-snow {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-40px, var(--snow-tile), 0);
  }
}

/* the lightened dark-scheme primary is too weak on the brand blue: links
   in gold; panels and the accordion on a translucent navy. With the
   attribute, to outrank the theme's own [data-bs-theme=dark] block. */
.prize-calendar[data-bs-theme] {
  --ar-link-color: var(--bs-warning);
  --ar-link-color-rgb: var(--bs-warning-rgb);
  --bs-link-color: var(--bs-warning);
  --bs-link-color-rgb: var(--bs-warning-rgb);
  --ar-link-hover-color: #fff;
  --bs-link-hover-color: #fff;
}

.prize-calendar .prize-panel {
  background: rgba(13, 34, 64, 0.55);
}

.prize-calendar .accordion {
  --ar-accordion-bg: rgba(13, 34, 64, 0.55);
  --bs-accordion-bg: rgba(13, 34, 64, 0.55);
}

/* ---- the board --------------------------------------------------------- */

.prize-board {
  /* resolved again inside the board's light scheme: the value inherited
     from a dark page would be booost's lightened primary */
  --prize-ink: var(--bs-primary, #00338d);
  --board-gutter: clamp(0.75rem, 2vw, 2rem);
  position: relative;
  container-type: inline-size;
  /* nearly edge to edge on phones and tablets, up to 64rem: the board may
     leave the content column */
  width: min(100vw - 2 * var(--board-gutter), 64rem);
  max-width: none;
  margin: 0 0 2rem calc(50% - min(50vw - var(--board-gutter), 32rem));
  padding: clamp(0.5rem, 1.5cqi, 1.5rem);
  border-radius: var(--prize-radius);
  background-color: var(--prize-ink);
  background-image: var(--calendar-image, none);
  background-position: center;
  background-size: cover;
  box-shadow: 0 1rem 2.5rem rgba(13, 34, 64, 0.25);
}

/* always portrait, in the aspect of the season's picture (set by the view
   as --calendar-ratio), so the whole picture shows; 12 x 17 without one */
.prize-board-staggered {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(17, 1fr);
  aspect-ratio: var(--calendar-ratio, 12 / 17);
}

@media (min-width: 768px) {
  .prize-board-staggered .prize-door {
    scale: 0.82;
  }
}

.prize-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  gap: 0.75rem;
}

.prize-board-grid .prize-door {
  aspect-ratio: 1;
}

/* ---- a door ------------------------------------------------------------ */

.prize-door {
  position: relative;
  display: block;
  margin: var(--door-inset, 3%);
  perspective: 60rem;
  color: var(--prize-ink);
  text-decoration: none;
  /* smaller than its slot: the picture shows between the doors */
  scale: 0.86;
  transform: rotate(var(--door-tilt, 0deg));
  transition: transform 0.2s ease;
}

.prize-door:hover,
.prize-door:focus-visible {
  transform: rotate(0deg) scale(1.03);
  z-index: 2;
}

.prize-door:focus-visible {
  outline: 3px solid var(--prize-accent);
  outline-offset: 3px;
}

.prize-door-flap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(255, 255, 255, 0.95);
  border-radius: 0.35rem;
  background: var(--prize-paper);
  backdrop-filter: blur(1px);
  box-shadow: 0 0.25rem 0.75rem rgba(13, 34, 64, 0.25);
  transform-origin: left center;
  transition: transform 0.35s ease, background-color 0.2s ease;
}

.prize-door-number {
  font-family: var(--bs-headings-font-family, inherit);
  font-size: clamp(1.1rem, 5.5cqi, 3.5rem);
  font-weight: 700;
  line-height: 1;
}

.prize-door-xl .prize-door-number {
  font-size: clamp(2rem, 11cqi, 7rem);
}

.prize-door-l .prize-door-number {
  font-size: clamp(1.5rem, 7.5cqi, 4.5rem);
}

.prize-door-state {
  margin-top: 0.25em;
  font-size: clamp(0.6rem, 1.6cqi, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* closed: frosted, quiet */
.prize-door.is-closed .prize-door-flap {
  background: var(--prize-paper-closed);
  color: rgba(13, 34, 64, 0.85);
  text-shadow: 0 0 0.5em rgba(255, 255, 255, 0.9);
}

/* open: the door stands ajar, gold shows behind it */
.prize-door.is-open::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0.35rem;
  background: var(--prize-accent);
  opacity: 0.45;
}

.prize-door.is-open .prize-door-flap {
  transform: rotateY(-14deg);
}

.prize-door.is-open:hover .prize-door-flap,
.prize-door.is-open:focus-visible .prize-door-flap {
  transform: rotateY(-28deg);
}

.prize-door[aria-expanded="true"] .prize-door-flap {
  transform: rotateY(-48deg);
  background: #fff;
}

/* today: gold frame and a gentle glow */
.prize-door.is-today .prize-door-flap {
  border: 3px solid var(--prize-accent);
  background: #fff;
  box-shadow:
    0 0 0 0.35rem rgba(235, 183, 0, 0.35),
    0 0.5rem 1.5rem rgba(13, 34, 64, 0.35);
}

.prize-door.is-today .prize-door-flap {
  animation: prize-candle 2.6s ease-in-out infinite alternate;
}

@keyframes prize-candle {
  from {
    box-shadow:
      0 0 0 0.3rem rgba(235, 183, 0, 0.3),
      0 0.5rem 1.5rem rgba(13, 34, 64, 0.35);
  }
  to {
    box-shadow:
      0 0 0 0.45rem rgba(235, 183, 0, 0.5),
      0 0 2.5rem rgba(235, 183, 0, 0.55);
  }
}

.prize-door.is-preview .prize-door-flap {
  border-style: dotted;
}

/* phones: the countdown does not fit the narrow doors; keep "today" */
@media (max-width: 575.98px) {
  .prize-door:not(.is-today) .prize-door-state {
    display: none;
  }

  /* the open door's panel and its prize cards share the narrow width:
     less padding and a smaller date, or at 320 px the date breaks next to
     the close button and only two numbers fit a row (lions 2026-11-26) */
  /* .prize-panels in front: the base rule further down would win */
  .prize-panels .prize-panel {
    padding: 1rem;
  }

  .prize-panel-header h2.h3 {
    font-size: 1.25rem;
  }

  .prize-panel .prize-card .card-body {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prize-door,
  .prize-door-flap {
    transition: none;
  }

  .prize-door.is-today .prize-door-flap,
  .prize-calendar::after,
  .prize-win::after {
    animation: none;
  }

  .prize-calendar::after,
  .prize-win::after {
    display: none;
  }
}

/* ---- panels (the drop-down) ------------------------------------------- */

.prize-panels {
  max-width: 64rem;
  margin: 0 auto;
}

.prize-panel {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border-top: 0.375rem solid var(--prize-accent);
  border-radius: var(--prize-radius);
  background: var(--bs-tertiary-bg, #f4f6fa);
  scroll-margin-top: 6rem;
}

.prize-panel:focus {
  outline: none;
}

.prize-panel-header {
  margin-bottom: 1.25rem;
}

.prize-panel-door,
.prize-today-door {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5em;
  height: 2.5em;
  margin-right: 0.5rem;
  border-radius: 50%;
  font-size: 0.75em;
  font-weight: 700;
  vertical-align: middle;
}

.prize-card {
  border: 0;
  box-shadow: 0 0.125rem 0.5rem rgba(13, 34, 64, 0.08);
}

.prize-number {
  min-width: 3.5rem;
  padding: 0.3rem 0.6rem;
  border-radius: 0.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.prize-sponsor-logo img {
  display: block;
  max-width: min(100%, 13rem);
  max-height: 6.5rem;
  object-fit: contain;
  padding: 0.375rem;
  border-radius: 0.25rem;
  background: #fff;
}

/* ---- lookup ------------------------------------------------------------ */

.prize-lookup {
  /* resolved again in the box's light scheme (inherited: the lightened
     dark-scheme primary) */
  --prize-ink: var(--bs-primary);
  --ar-link-color: var(--bs-primary);
  --ar-link-color-rgb: var(--bs-primary-rgb);
  --bs-link-color: var(--bs-primary);
  --bs-link-color-rgb: var(--bs-primary-rgb);
  max-width: 40rem;
  margin: 2.5rem auto;
  padding: 2rem;
  border-top: 0.375rem solid var(--prize-accent);
  border-radius: var(--prize-radius);
  color: var(--bs-body-color);
  text-align: center;
  box-shadow: 0 1rem 2.5rem rgba(13, 34, 64, 0.35);
}

.prize-lookup h2 {
  color: var(--bs-primary);
}

.prize-lookup-form {
  justify-content: center;
}

.prize-lookup-form .form-control {
  max-width: 14rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.prize-lookup .btn-warning {
  min-width: 8rem;
}

.prize-lookup-result {
  text-align: left;
}

/* a win: festive gold instead of the plain success alert, and a short
   burst of gold and blue confetti */
.prize-lookup .prize-win {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--prize-accent);
  background: #fffbea;
  color: var(--bs-body-color);
  text-align: center;
}

.prize-lookup .prize-win .alert-heading {
  color: var(--prize-ink);
}

.prize-lookup .prize-win .alert-heading::before,
.prize-lookup .prize-win .alert-heading::after {
  content: "\2605";
  margin: 0 0.4em;
  color: var(--prize-accent);
}

.prize-win::after {
  content: "";
  position: absolute;
  inset: -60% 0 0;
  pointer-events: none;
  background-image:
    radial-gradient(7px 7px at 8% 22%, var(--prize-accent) 50%, transparent 52%),
    radial-gradient(5px 9px at 19% 6%, var(--prize-ink) 50%, transparent 52%),
    radial-gradient(8px 8px at 31% 34%, var(--prize-accent) 50%, transparent 52%),
    radial-gradient(5px 9px at 44% 12%, #d4202c 50%, transparent 52%),
    radial-gradient(7px 7px at 56% 28%, var(--prize-accent) 50%, transparent 52%),
    radial-gradient(5px 9px at 67% 4%, var(--prize-ink) 50%, transparent 52%),
    radial-gradient(8px 8px at 78% 30%, var(--prize-accent) 50%, transparent 52%),
    radial-gradient(5px 9px at 90% 14%, #d4202c 50%, transparent 52%),
    radial-gradient(6px 6px at 96% 40%, var(--prize-accent) 50%, transparent 52%),
    radial-gradient(6px 6px at 24% 48%, var(--prize-ink) 50%, transparent 52%),
    radial-gradient(7px 7px at 62% 52%, var(--prize-accent) 50%, transparent 52%),
    radial-gradient(5px 8px at 84% 56%, var(--prize-ink) 50%, transparent 52%);
  animation: prize-confetti 2.6s ease-out forwards;
}

@keyframes prize-confetti {
  0% {
    opacity: 1;
    transform: translateY(-25%);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(50%);
  }
}

/* ---- the note under the lookup ----------------------------------------- */

.prize-lookup-note {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  text-align: center;
  opacity: 0.75;
}

.prize-lookup-note p:last-child {
  margin-bottom: 0;
}

/* ---- sponsors ---------------------------------------------------------- */

.prize-sponsors {
  margin-top: 3rem;
  text-align: center;
}

.prize-sponsor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.prize-sponsor-grid li {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
  padding: 0.75rem;
  border-radius: 0.375rem;
  background: #fff;
  box-shadow: 0 0.125rem 0.5rem rgba(13, 34, 64, 0.08);
}

.prize-sponsor-grid img {
  max-width: 100%;
  max-height: 4rem;
  object-fit: contain;
}

.prize-sponsor-name {
  color: #0d2240;
  font-weight: 600;
}

/* ---- information accordion -------------------------------------------- */

.prize-infos {
  max-width: 52rem;
  margin: 3rem auto 0;
}

.prize-infos > h2,
.prize-sponsors > h2 {
  margin-bottom: 1.25rem;
  text-align: center;
}

.prize-text {
  max-width: 52rem;
  margin: 3rem auto 0;
}

/* ---- "Today's door" tile (tiles/prize_today.py) ------------------------- */

.prize-today-kicker {
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prize-today .prize-card {
  box-shadow: 0 0.25rem 1rem rgba(13, 34, 64, 0.1);
}

.prize-share {
  white-space: nowrap;
}
