/* ==========================================================================
   Weihnachten & Silvester am 19. Loch — the seasonal hero.

   The page opens in the dark: the mascot pulls the cord, the tree lights
   up, and the hero's copy comes up with the light (assets/xmas.js drives it
   off the film's clock). Built exactly like the Halloween hero was.

   Every rule in this file hangs off html.h19-xmas. The season script at the
   top of index.html sets that class (with data-xm-cut and data-xm-mode)
   only inside the window, before the first paint; outside it this file
   changes nothing and the hero is the scroll film as always.
   ========================================================================== */

/* ---- one screen instead of the scroll runway ------------------------------
   Decided before the first paint, so nothing shifts. svh: the copy and the
   buttons sit near the bottom edge and must not slide under a phone's
   toolbar. 2px short of the full screen on purpose: Chrome never counts a
   full-viewport background as the Largest Contentful Paint; one hair
   shorter, the dark poster is the LCP at the first paint. */
html.h19-xmas .hero,
html.h19-xmas.no-js .hero { height: auto; }
html.h19-xmas .hero__pin,
html.h19-xmas.no-js .hero__pin {
  position: relative;
  height: calc(100vh - 2px);
  height: calc(100svh - 2px);
  min-height: 360px;
  background-color: var(--green-900);
  background-repeat: no-repeat;
  background-size: cover;
}

/* ---- the poster of the cut: dark for the film, lit for the still ----------
   The same picture as the film's first frame, so page, poster and film are
   one dark surface; it is also the LCP image, preloaded by the season
   script. The anchor matches the film's object-position (and CUTS in
   xmas.js): the landscape cut is anchored a little right of centre so the
   copy keeps the night sky on the left to itself on 3:2 and 4:3 screens. */
html.h19-xmas[data-xm-cut="landscape"] .hero__pin { background-image: url('xmas/intro-desktop-poster.jpg'); background-position: 62% 50%; }
html.h19-xmas[data-xm-cut="portrait"]  .hero__pin { background-image: url('xmas/intro-mobile-poster.jpg');  background-position: 50% 50%; }
html.h19-xmas[data-xm-cut="landscape"][data-xm-mode="still"] .hero__pin, html.h19-xmas[data-xm-cut="landscape"].xm-lit-poster .hero__pin { background-image: url('xmas/intro-desktop-lit.jpg'); }
html.h19-xmas[data-xm-cut="portrait"][data-xm-mode="still"]  .hero__pin, html.h19-xmas[data-xm-cut="portrait"].xm-lit-poster  .hero__pin { background-image: url('xmas/intro-mobile-lit.jpg'); }

/* ---- the everyday hero steps aside -----------------------------------------
   Its poster stays in the markup as the last fallback (html.xm-failed). */
html.h19-xmas .hero__poster { visibility: hidden; }
html.h19-xmas .hero__film,
html.h19-xmas .hero__flash,
html.h19-xmas .hero__ring,
html.h19-xmas .hero__bar,
html.h19-xmas .hero__rail { display: none !important; }
html.h19-xmas .hero.xm-ready .hero__beat { display: none; }
/* Failsafe: should xmas.js never run, the closing beat of the everyday
   hero (name, line, the buttons) stands up after four seconds. */
html.h19-xmas .hero:not(.xm-ready) .hero__beat[data-beat="3"] { animation: xm-failsafe 0.6s ease 4s both; }
@keyframes xm-failsafe { from { opacity: 0; } to { opacity: 1; } }

/* Nothing of the Christmas media could be shown: the everyday poster again. */
html.h19-xmas.xm-failed .hero__pin { background-image: none !important; }
html.h19-xmas.xm-failed .hero__poster { visibility: visible; }
html.h19-xmas.xm-failed .xm-film,
html.h19-xmas.xm-failed .xm-glow { display: none; }

/* ---- the film --------------------------------------------------------------- */
html.h19-xmas .xm-film {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  background: transparent;
}
html.h19-xmas[data-xm-cut="landscape"] .xm-film { object-position: 62% 50%; }
html.h19-xmas .hero.xm-video-off .xm-film { display: none; }

/* ---- the glow: the lit tree breathing after the film, never blinking ------
   A warm light centred on the tree (xmas.js places it in px for the crop the
   viewport makes), over 4.2s. No blend mode anywhere: that is what made
   phones stutter. */
html.h19-xmas .xm-glow {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse 34% 46% at var(--px, 72%) var(--py, 52%), rgba(255, 196, 110, 0.16), transparent 70%);
  opacity: 0;
  transition: opacity 1.4s ease;
}
html.h19-xmas .hero.xm-ended .xm-glow,
html.h19-xmas .hero.xm-static .xm-glow { opacity: 0.7; animation: xm-breathe 4.2s ease-in-out infinite; }
@keyframes xm-breathe {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* ---- scrims: night sky behind the copy, the snow under it ----------------- */
html.h19-xmas .hero__scrim {
  background:
    linear-gradient(90deg, rgba(8, 22, 14, 0.8) 0%, rgba(8, 22, 14, 0.52) 22%, rgba(8, 22, 14, 0.16) 38%, transparent 50%),
    linear-gradient(to top, rgba(8, 22, 14, 0.7) 0%, rgba(8, 22, 14, 0.3) 16%, transparent 30%),
    linear-gradient(to bottom, rgba(8, 22, 14, 0.5) 0%, transparent 15%);
}
/* portrait: the sky stays as it is; the copy stands on the snow under a
   strong floor scrim, the nav on a light one at the top */
html.h19-xmas[data-xm-cut="portrait"] .hero__scrim {
  background:
    linear-gradient(to bottom, rgba(8, 22, 14, 0.6) 0%, rgba(8, 22, 14, 0.2) 12%, transparent 22%),
    linear-gradient(to top, rgba(8, 22, 14, 0.96) 0%, rgba(8, 22, 14, 0.86) 22%, rgba(8, 22, 14, 0.5) 38%, rgba(8, 22, 14, 0.12) 48%, transparent 56%);
}

/* ---- the copy ----------------------------------------------------------------
   One grid; each cut places its parts where the picture leaves room:
   landscape — a column over the night sky left of the mascot: the name and
   the headline at the top, the subline and the buttons on the snow;
   portrait — the name is the nav's (the h1 stays for screen readers and
   search), kicker, headline, subline and buttons stand on the snow. */
html.h19-xmas .xm-beat {
  position: absolute; z-index: 1;
  pointer-events: auto;
  display: grid;
  justify-items: start;
  text-align: left;
  top: clamp(92px, 13vh, 150px);
  bottom: clamp(40px, 7vh, 84px);
  left: clamp(20px, 4vw, 80px);
  width: min(32vw, 580px);
  grid-template-areas: "lockup" "kicker" "line" "." "sub" "count" "actions";
  grid-template-rows: auto auto auto 1fr auto auto auto;
  --xm-top-w: 30vw;
}
html.h19-xmas .xm-beat .hero__lockup,
html.h19-xmas .xm-beat .xm-kicker,
html.h19-xmas .xm-beat .xm-line { max-width: var(--xm-top-w); }

/* The lockup: the name with the double hairline under it, one block, so the
   hairlines are exactly as wide as the name. */
html.h19-xmas .xm-beat .hero__lockup {
  grid-area: lockup;
  display: inline-flex; flex-direction: column; align-items: stretch;
  margin: 0;
  text-align: center;
}
html.h19-xmas .xm-beat .hero__lockup-name { font-size: clamp(46px, min(6vw, 10.5vh), 108px); }
html.h19-xmas .xm-beat .hero__lockup-rule { max-width: none; margin: clamp(10px, 1.6vh, 16px) 0 0; gap: 12px; }
html.h19-xmas .xm-beat .hero__lockup-rule::before,
html.h19-xmas .xm-beat .hero__lockup-rule::after { min-width: 26px; }
html.h19-xmas .xm-beat .hero__lockup-rule span { font-size: clamp(9.5px, 0.8vw, 11.5px); letter-spacing: 0.42em; margin-right: -0.42em; }

html.h19-xmas .xm-beat .xm-kicker { grid-area: kicker; margin: clamp(18px, 3vh, 32px) 0 clamp(10px, 1.6vh, 16px); }
html.h19-xmas .xm-beat .xm-line { grid-area: line; font-size: clamp(30px, min(3.6vw, 6.4vh), 64px); line-height: 1.02; }
html.h19-xmas .xm-beat .xm-sub { grid-area: sub; margin: 0; max-width: 38ch; font-size: clamp(14px, min(1.15vw, 2.1vh), 18px); text-wrap: balance; }
html.h19-xmas .xm-beat .xm-sub-p { display: none; }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-sub-l { display: none; }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-sub-p { display: inline; }
html.h19-xmas .xm-beat .hero__actions { grid-area: actions; justify-content: flex-start; margin-top: clamp(14px, 2.4vh, 24px); }

/* Silvester: the countdown to midnight, tabular, gold */
html.h19-xmas .xm-beat .xm-count {
  grid-area: count;
  display: flex; gap: 0;
  margin: clamp(10px, 1.8vh, 18px) 0 0;
  font-variant-numeric: tabular-nums;
}
html.h19-xmas .xm-beat .xm-count[hidden] { display: none; }
html.h19-xmas .xm-beat .xm-count > span { padding: 0 14px; text-align: center; }
html.h19-xmas .xm-beat .xm-count > span:first-child { padding-left: 0; }
html.h19-xmas .xm-beat .xm-count > span + span { border-left: 1px solid rgba(201, 162, 75, 0.3); }
html.h19-xmas .xm-beat .xm-count b { display: block; font-family: var(--serif); font-weight: 600; font-size: clamp(24px, min(2.2vw, 4.4vh), 40px); line-height: 1; color: #f6e3ad; min-width: 2ch; }
html.h19-xmas .xm-beat .xm-count small { display: block; margin-top: 6px; font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--cream-52); }

/* portrait: the name is the nav's; the rest stands on the snow, buttons in one row */
html.h19-xmas[data-xm-cut="portrait"] .xm-beat {
  left: 5vw; right: 5vw; width: auto;
  top: auto; bottom: clamp(44px, 6.5vh, 70px);
  justify-items: center; text-align: center;
  grid-template-areas: "kicker" "line" "sub" "count" "actions";
  grid-template-rows: auto auto auto auto auto;
  --xm-top-w: 100%;
}
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .hero__lockup {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-kicker { margin: 0 0 10px; font-size: 10px; letter-spacing: 0.3em; }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-line { font-size: clamp(34px, 10vw, 54px); }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-sub { margin-top: 12px; max-width: 34ch; font-size: clamp(14px, 3.8vw, 16.5px); line-height: 1.5; }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-count { justify-content: center; margin-top: 12px; }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-count > span { padding: 0 12px; }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-count > span:first-child { padding-left: 0; }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-count b { font-size: clamp(22px, 6.4vw, 30px); }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .hero__actions { justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .btn { min-height: 44px; padding: 0 18px; font-size: 11px; letter-spacing: 0.1em; white-space: nowrap; }
/* the game, a line of gold type under the two buttons, as in the everyday hero on phones */
html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-game {
  flex-basis: 100%; width: 100%; justify-content: center; align-self: center;
  min-height: 0; padding: 6px 2px; border: 0; border-radius: 0; background: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  text-decoration: underline; text-decoration-color: rgba(201, 162, 75, 0.6); text-decoration-thickness: 1px; text-underline-offset: 6px;
  font-size: 11px; letter-spacing: 0.2em;
  text-shadow: 0 1px 2px rgba(8, 22, 14, 0.95), 0 2px 10px rgba(8, 22, 14, 0.9);
}
html.h19-xmas[data-xm-cut="portrait"] .hero__cue { bottom: 8px; gap: 6px; }
html.h19-xmas[data-xm-cut="portrait"] .hero__cue span { height: 24px; }
/* The buttons take the phone's whole width: replay waits top right, under the menu. */
html.h19-xmas[data-xm-cut="portrait"] .xm-replay { top: clamp(80px, 10.5vh, 108px); bottom: auto; right: 16px; }
/* A short phone (an iPhone SE at 667px): the game line and the scroll hint
   step aside, the rest sits a little closer, so the tree keeps its screen. */
@media (max-height: 700px) {
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat { bottom: 26px; }
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-game { display: none; }
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-line { font-size: clamp(30px, 9vw, 44px); }
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-sub { margin-top: 8px; }
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat .hero__actions { margin-top: 12px; }
  html.h19-xmas[data-xm-cut="portrait"] .hero__cue { display: none; }
}
/* An upright tablet: the same portrait film, the copy a size larger. */
@media (min-width: 700px) {
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat { bottom: clamp(60px, 8vh, 110px); }
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-line { font-size: clamp(44px, 7vw, 72px); }
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-sub { max-width: 46ch; font-size: clamp(16px, 2.2vw, 19px); }
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat .btn { min-height: 50px; padding: 0 26px; font-size: 12px; letter-spacing: 0.14em; }
  html.h19-xmas[data-xm-cut="portrait"] .xm-beat .xm-game { flex-basis: auto; width: auto; min-height: 50px; padding: 0 26px; border: 1px solid rgba(201, 162, 75, 0.6); border-radius: 100px; text-decoration: none; font-size: 12px; letter-spacing: 0.14em; }
}

/* A landscape phone: everything a size smaller, the buttons in one row. The
   nav's wordmark sits right above: the hero's name stays the page's h1 for
   screen readers and search, but is not drawn a second time. */
@media (orientation: landscape) and (max-height: 520px) {
  html.h19-xmas .xm-beat { top: 76px; bottom: 16px; width: min(40vw, 380px); --xm-top-w: 38vw; }
  html.h19-xmas .xm-beat .xm-game { display: none; }   /* the mascot stands right beside the column */
  html.h19-xmas .xm-beat .hero__lockup {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  html.h19-xmas .xm-beat .xm-kicker { margin: 10px 0 6px; font-size: 9.5px; letter-spacing: 0.32em; }
  html.h19-xmas .xm-beat .xm-line { font-size: clamp(20px, 6.6vh, 30px); }
  html.h19-xmas .xm-beat .xm-sub { font-size: 12.5px; line-height: 1.5; max-width: none; }
  html.h19-xmas .xm-beat .xm-count { margin-top: 8px; }
  html.h19-xmas .xm-beat .xm-count b { font-size: 20px; }
  html.h19-xmas .xm-beat .hero__actions { margin-top: 10px; gap: 8px; flex-wrap: wrap; }
  html.h19-xmas .xm-beat .btn { min-height: 40px; padding: 0 16px; font-size: 10.5px; letter-spacing: 0.08em; white-space: nowrap; }
  html.h19-xmas .hero__cue { display: none; }
}

/* ---- the reveal, step by step (classes from xmas.js) ------------------------
   0     everything is there, invisible
   xm-s1 the lights come on: the hairlines draw out from the centre, the name
         and the kicker come up, the nav's gold to full
   xm-s2 + 0.6s: the headline, line by line
   xm-s3 the tree fully lit: subline, countdown and buttons
   xm-s4 the scroll hint */
html.h19-xmas .xm-beat .hero__lockup-name {
  opacity: 0;
  transform: scale(0.965);
  transition: opacity 0.9s var(--ease), transform 1.2s var(--ease), filter 1.2s var(--ease);
}
html.h19-xmas .xm-beat .hero__lockup-rule span { opacity: 0; transition: opacity 0.6s var(--ease) 0.3s; }
html.h19-xmas .xm-beat .hero__lockup-rule::before,
html.h19-xmas .xm-beat .hero__lockup-rule::after {
  transform: scaleX(0);
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
html.h19-xmas .xm-beat .hero__lockup-rule::before { transform-origin: 100% 50%; }
html.h19-xmas .xm-beat .hero__lockup-rule::after  { transform-origin: 0 50%; }
html.h19-xmas .xm-beat .xm-kicker { opacity: 0; transform: translateY(12px); transition: opacity 0.7s var(--ease) 0.1s, transform 0.7s var(--ease) 0.1s; }
html.h19-xmas .xm-beat .xm-ln { display: block; opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
html.h19-xmas .xm-beat .xm-ln + .xm-ln { transition-delay: 0.12s; }
html.h19-xmas .xm-beat .xm-sub,
html.h19-xmas .xm-beat .xm-count,
html.h19-xmas .xm-beat .hero__actions { opacity: 0; transform: translateY(14px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
html.h19-xmas .xm-beat .xm-count { transition-delay: 0.08s; }
html.h19-xmas .xm-beat .hero__actions { transition-delay: 0.16s; }
html.h19-xmas .hero__cue { opacity: 0; transition: opacity 0.8s var(--ease); }

html.h19-xmas .hero.xm-s1 .xm-beat .hero__lockup-name {
  opacity: 1;
  transform: none;
  filter: drop-shadow(0 3px 2px rgba(8, 22, 14, 0.55))
          drop-shadow(0 14px 40px rgba(8, 22, 14, 0.8))
          drop-shadow(0 0 42px rgba(224, 197, 121, 0.42));
}
html.h19-xmas .hero.xm-s1 .xm-beat .hero__lockup-rule span { opacity: 1; }
html.h19-xmas .hero.xm-s1 .xm-beat .hero__lockup-rule::before,
html.h19-xmas .hero.xm-s1 .xm-beat .hero__lockup-rule::after { transform: none; }
html.h19-xmas .hero.xm-s1 .xm-beat .xm-kicker { opacity: 1; transform: none; }
html.h19-xmas .hero.xm-s2 .xm-beat .xm-ln { opacity: 1; transform: none; }
html.h19-xmas .hero.xm-s3 .xm-beat .xm-sub,
html.h19-xmas .hero.xm-s3 .xm-beat .xm-count,
html.h19-xmas .hero.xm-s3 .xm-beat .hero__actions { opacity: 1; transform: none; }
html.h19-xmas .hero.xm-s4 .hero__cue { opacity: 1; }

/* Still, autoplay refused, film failed: all there at once, nothing moves in. */
html.h19-xmas .hero.xm-static .xm-beat,
html.h19-xmas .hero.xm-static .xm-beat *,
html.h19-xmas .hero.xm-static .xm-beat *::before,
html.h19-xmas .hero.xm-static .xm-beat *::after,
html.h19-xmas .hero.xm-static .hero__cue { transition: none !important; }

/* Replay: the copy goes in 300ms, then everything is reset in one frame. */
html.h19-xmas .hero.xm-rewind .xm-beat,
html.h19-xmas .hero.xm-rewind .hero__cue { opacity: 0 !important; transition: opacity 0.3s ease !important; }
html.h19-xmas .hero.xm-instant .xm-beat,
html.h19-xmas .hero.xm-instant .xm-beat *,
html.h19-xmas .hero.xm-instant .xm-beat *::before,
html.h19-xmas .hero.xm-instant .xm-beat *::after,
html.h19-xmas .hero.xm-instant .hero__cue { transition: none !important; }

/* The nav is there from the first frame, its gold at 60% until the light. */
html.h19-xmas .nav__mark,
html.h19-xmas .nav__sub { transition: opacity 0.7s var(--ease); }
html.h19-xmas .nav__cta {
  transition: opacity 0.7s var(--ease), transform 0.4s var(--ease), background 0.4s var(--ease),
              border-color 0.4s var(--ease), color 0.4s var(--ease);
}
html.h19-xmas:not(.xm-lit) .nav__mark,
html.h19-xmas:not(.xm-lit) .nav__sub,
html.h19-xmas:not(.xm-lit) .nav__cta { opacity: 0.6; }

/* ---- replay: "Licht aus, Licht an" ------------------------------------------ */
html.h19-xmas .xm-replay {
  position: absolute; z-index: 7;
  right: clamp(16px, 3vw, 40px);
  bottom: clamp(16px, 3.4vh, 34px);
  width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(224, 197, 121, 0.72);
  background: var(--green-800);
  color: var(--gold-400);
  box-shadow: 0 8px 26px rgba(8, 22, 14, 0.55);
  cursor: pointer;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease);
}
html.h19-xmas .xm-replay[hidden] { display: none; }
html.h19-xmas .xm-replay svg { width: 18px; height: 18px; }
@media (hover: hover) {
  html.h19-xmas .xm-replay:hover { background: var(--green-700); border-color: var(--gold-400); transform: rotate(-40deg); }
}
html.h19-xmas .xm-replay:focus-visible { outline: 2px solid var(--gold-400); outline-offset: 3px; }

/* ---- reduced motion: the lit picture and the copy, nothing that moves ------ */
@media (prefers-reduced-motion: reduce) {
  html.h19-xmas .xm-glow { animation: none !important; opacity: 0.8 !important; }
  html.h19-xmas .xm-beat *, html.h19-xmas .hero__cue, html.h19-xmas .nav__mark,
  html.h19-xmas .nav__sub, html.h19-xmas .nav__cta { transition: none !important; }
}
