/* Advent decoration (owner, 26 Nov 2026): loaded only from the first Sunday of Advent to
   24 December (core/advent.py). */
:root {
  --advent-flame: #F2B84B;
  --advent-wax-off: #2C2D6B;  /* a candle not lit yet */
  --advent-line: #6D6EAE;     /* its outline and the wicks */
}

/* The hero banner: the picture lies behind the text, on the left half from 960 px. */
.hero--advent { position: relative; overflow: hidden; }
.advent-decor {
  position: absolute; top: 0; left: 0; z-index: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 0 0; pointer-events: none;
}
/* The hanging gingerbread and the lights of weeks 2 and 3 scale with the width, so they stay
   above the text on a phone too. */
.advent-decor--2, .advent-decor--3 { height: auto; min-width: 560px; }
/* The star of the fourth week hangs on the right: that side must not be cut off. */
.advent-decor--4 { object-position: 100% 0; }
/* The photographs (second design) fade into the colour of the panel; the black right edge of
   the files stays under the transparent part of the mask. Below 960 px the text lies over the
   whole motif, so the photograph is only a faint background. */
.advent-decor.advent-decor--photo {
  object-position: 0 50%; opacity: 0.25;
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 28%, transparent 58%);
  mask-image: linear-gradient(to right, #000 0, #000 28%, transparent 58%);
}
.hero--advent .hero__text, .hero--advent .hero__controls { position: relative; z-index: 1; }
/* The whole banner lies above the side strips (z-index 5) and below the header (30). */
.hero--advent { z-index: 6; }
/* A banner with its own artwork (Banner.hide_advent). */
.hero--advent.is-plain .advent-decor, .hero--advent.is-plain .advent-candles { visibility: hidden; }

/* Candles: between the arrows and the pause button, on their own row where it is narrow. */
.advent-row { container-type: inline-size; }
.hero--advent .hero__controls { flex-wrap: wrap; }
.advent-candles { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin-inline: auto; }
.hero__controls .advent-candles ~ .hero__pause { margin-left: 0; }
.advent-candle__flame { fill: var(--advent-flame); }
.advent-candle__halo { fill: var(--advent-flame); fill-opacity: 0.2; }
.advent-candle__wax { fill: var(--sand); }
.advent-candle__wax-off { fill: var(--advent-wax-off); stroke: var(--advent-line); stroke-width: 1.2; }
.advent-candle__wick { stroke: var(--advent-line); stroke-width: 1.2; }
.advent-candle.is-lit .advent-candle__wick { stroke: var(--lavender); }
/* A single banner has no controls: the row holds just the candles. */
.advent-row--alone { position: relative; z-index: 1; padding-bottom: 24px; }
@container (max-width: 399.98px) {
  .hero__controls .advent-candles { order: -1; flex-basis: 100%; }
  .hero__controls .advent-candles ~ .hero__pause { margin-left: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .advent-candle__flame { transform-origin: 9px 11px; animation: advent-flicker 2.6s ease-in-out infinite; }
  .advent-candle:nth-child(2) .advent-candle__flame { animation-delay: -0.7s; }
  .advent-candle:nth-child(3) .advent-candle__flame { animation-delay: -1.4s; }
  .advent-candle:nth-child(4) .advent-candle__flame { animation-delay: -2s; }
  @keyframes advent-flicker { 50% { transform: scale(1.06, 0.94); } }
}

@media (max-width: 639.98px) {
  .advent-decor { opacity: 0.9; }
  /* Room for the garland above the rule and the eyebrow. */
  .hero--advent .hero__inner { padding-top: 44px; }
}
@media (min-width: 960px) {
  .advent-decor { width: 50%; }
  .advent-row--alone { width: calc(50% - 40px); padding-bottom: 32px; }
  /* Full brightness only in the margin left of the text; beneath the text a quarter of it,
     which keeps white and lavender text readable even over the brightest flake. */
  .advent-decor.advent-decor--photo {
    /* Where the text of the banner starts (.container). */
    --advent-text: max(var(--gutter), calc((100vw - var(--container)) / 2 + var(--gutter)));
    opacity: 1;
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(var(--advent-text) - 48px), rgb(0 0 0 / 0.25) var(--advent-text), rgb(0 0 0 / 0.25) 36%, transparent 58%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(var(--advent-text) - 48px), rgb(0 0 0 / 0.25) var(--advent-text), rgb(0 0 0 / 0.25) 36%, transparent 58%);
  }
}

/* Side strips: only where the margins beside the 1240 px container are wide enough. */
.advent-side { display: none; }
@media (min-width: 1480px) {
  .advent-side {
    display: block; position: fixed; top: 0; z-index: 5;
    width: min(300px, calc((100vw - var(--container)) / 2)); height: auto; max-height: 100vh;
    object-fit: cover; object-position: 0 0; pointer-events: none;
  }
  .advent-side--l { left: 0; }
  .advent-side--r { right: 0; transform: scaleX(-1); }
  /* The strips start at the top of the window. The header lies above them (the banner has to
     pass under it), so it repeats their top part in its own margins: same file, same size. */
  .site-header::before, .site-header::after {
    content: ""; position: absolute; top: 0; bottom: 0; z-index: 21;
    width: min(300px, calc((100vw - var(--container)) / 2));
    background-position: 0 0; background-repeat: no-repeat; background-size: 100% auto;
    pointer-events: none;
  }
  .site-header::before { left: 0; }
  .site-header::after { right: 0; transform: scaleX(-1); }
  .advent-week-1 .site-header::before, .advent-week-1 .site-header::after { background-image: url("../advent/side-1.787f6a635469.svg"); }
  .advent-week-2 .site-header::before, .advent-week-2 .site-header::after { background-image: url("../advent/side-2.a350e41acb12.svg"); }
  .advent-week-3 .site-header::before, .advent-week-3 .site-header::after { background-image: url("../advent/side-3.8a4923d75fa0.svg"); }
  .advent-week-4 .site-header::before, .advent-week-4 .site-header::after { background-image: url("../advent/side-4.8c8293d3a1a3.svg"); }
}

@media print {
  .advent-side, .advent-decor, .advent-candles { display: none; }
  .site-header::before, .site-header::after { display: none; }
}
