/* The xmas festive mode's stylesheet (landing/festive.py; DESIGN.md, "Festive Modes").
   Loaded by the mode's "head" piece on every landing page while the mode is on, after landing.css, and never
   otherwise: outside the season no rule of it reaches a visitor. It styles the mode's own pieces: the Santa hat
   on the wordmark and on the home headline, the snow, the home page's kicker as a link to the Christmas draw,
   and on the early-access page the team in Santa hats, the countdown and the prize.

   Red and gold appear here and nowhere else on the landing pages. They are the season's, on the hat, the
   present and the mode's small marks; the interface keeps its one blue, and the logo keeps its own colours in
   every season. */

/* ---------- The hat on the wordmark (navigation) ---------- */
/* The hat is an image of its own laid over the logo, at the first letter of the wordmark. Its place and size are
   shares of the logo's box (1000 by 245 in the file; the "S" stands from 301 to 405 across and 45 to 173 down),
   so it sits right at every size of the logo. The two share a box of exactly the logo's size, because the brand
   link itself is as wide as its column of the bar. Tilted to the left, as a hat hung on a letter is. */
.landing-brand-dressed {
  position: relative;
  display: inline-flex;
}

.landing-brand-hat {
  position: absolute;
  top: -13%;
  left: 27.5%;
  width: 12%;
  height: auto;
  pointer-events: none;
  transform: rotate(-20deg);
  transform-origin: 45% 78%;
}

/* A phone's bar shows the handshake alone (landing.css): no wordmark, so no hat. */
@media (max-width: 560px) {
  .landing-brand-hat {
    display: none;
  }
}

/* ---------- The hat on the home headline ---------- */
/* xmas.js finds the "S" of "Softwarify" in the headline's answer and puts the hat on it, sized to the
   letter; until then, and without the script, the hat is not shown. The hat stands in the box of the words
   themselves (.landing-display-shine, which is positioned), so it keeps its letter when the line is centred
   anew under a longer or shorter question. It lies over the words and their band of light and takes no pointer. */
.landing-hat {
  position: absolute;
  z-index: 2;
  height: auto;
  pointer-events: none;
  transform: rotate(-18deg);
  transform-origin: 45% 78%;
}

.landing-hat[hidden] {
  display: none;
}

/* ---------- Snow ---------- */
/* A canvas in a page's ambient layer, behind every word; xmas.js lets pixel snow fall on it. */
.landing-snow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- The home page's kicker, as the way to the draw ---------- */
/* The kicker's pill as a link, dressed like a present: a ring of red and gold that slowly turns (the pill's own
   dark fill inside a border that shows a wide gradient, moved along), a soft red glow under it, the present at
   the left, what there is to win in gold, by when in ink, and an arrow. A narrow band of light crosses the pill
   every few seconds, and five small sparkles twinkle around it. All of it is light on purpose: one slow ring,
   one pass of light, sparkles of a few pixels. Every motion stops with "prefers-reduced-motion: reduce", where
   the pill keeps its ring and its sparkles standing still. */
.landing-kicker-christmas {
  position: relative;
  gap: 9px;
  padding: 8px 15px 8px 11px;
  border-color: transparent;
  background:
    linear-gradient(rgba(7, 16, 36, 0.94), rgba(7, 16, 36, 0.94)) padding-box,
    linear-gradient(100deg, #dc2626, #facc15, #fef3c7, #facc15, #dc2626, #facc15, #fef3c7, #facc15, #dc2626) border-box;
  background-size: 100% 100%, 200% 100%;
  box-shadow:
    0 0 0 4px rgba(220, 38, 38, 0.1),
    0 8px 30px rgba(220, 38, 38, 0.3);
  color: var(--landing-ink);
  animation: kicker-ring 7s linear infinite;
  transition: box-shadow 200ms var(--landing-ease);
}

.landing-kicker-christmas:hover,
.landing-kicker-christmas:focus-visible {
  box-shadow:
    0 0 0 4px rgba(250, 204, 21, 0.16),
    0 10px 36px rgba(220, 38, 38, 0.46);
}

.landing-kicker-christmas strong {
  color: #fcd34d;
  font-weight: 700;
}

/* The present: 16 by 12 cells at a pixel and a half each, bobbing like the one on the early-access page. */
.landing-kicker-gift {
  flex: none;
  width: 24px;
  height: 18px;
  margin-top: -3px;
  animation: access-bob 1.6s steps(2, jump-none) infinite;
}

.landing-kicker-christmas .landing-icon {
  width: 0.95em;
  height: 0.95em;
  transition: transform 200ms var(--landing-ease);
}

.landing-kicker-christmas:hover .landing-icon,
.landing-kicker-christmas:focus-visible .landing-icon {
  transform: translateX(3px);
}

/* The band of light: clipped to the pill by a layer of its own, so that the sparkles may stand outside it. */
.landing-kicker-sheen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.landing-kicker-sheen::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 34%;
  background: linear-gradient(100deg, transparent, rgba(254, 243, 199, 0.3), transparent);
  content: "";
  animation: kicker-sheen 5.5s ease-in-out infinite;
}

/* A sparkle: a pixel cross of two-pixel cells (a centre and four arms, drawn as its shadows), in the colour of
   its own rule. Each twinkles at its own pace, so the five never blink together. */
.landing-kicker-sparkles i {
  position: absolute;
  width: 2px;
  height: 2px;
  background: currentColor;
  box-shadow:
    0 -3px currentColor,
    0 3px currentColor,
    -3px 0 currentColor,
    3px 0 currentColor;
  color: #fcd34d;
  pointer-events: none;
  animation: kicker-twinkle 2.6s steps(4, jump-none) infinite;
}

.landing-kicker-sparkles i:nth-child(1) {
  top: -9px;
  left: -13px;
}

.landing-kicker-sparkles i:nth-child(2) {
  top: -12px;
  right: 22%;
  color: #f8fafc;
  animation-duration: 3.1s;
  animation-delay: 0.7s;
}

.landing-kicker-sparkles i:nth-child(3) {
  right: -15px;
  bottom: 3px;
  animation-duration: 2.2s;
  animation-delay: 1.3s;
}

.landing-kicker-sparkles i:nth-child(4) {
  bottom: -11px;
  left: 24%;
  color: #f87171;
  animation-duration: 3.4s;
  animation-delay: 0.3s;
}

.landing-kicker-sparkles i:nth-child(5) {
  top: 4px;
  right: -26px;
  color: #f8fafc;
  animation-duration: 2.9s;
  animation-delay: 1.9s;
}

@keyframes kicker-ring {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 0 0, 200% 0; }
}

/* One pass in the first third of the time, then a rest. */
@keyframes kicker-sheen {
  0% { left: -45%; }
  32% { left: 112%; }
  100% { left: 112%; }
}

@keyframes kicker-twinkle {
  0% { opacity: 0; transform: scale(0.4); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.4); }
}

@media (prefers-reduced-motion: reduce) {
  .landing-kicker-christmas,
  .landing-kicker-gift,
  .landing-kicker-sparkles i {
    animation: none;
  }

  .landing-kicker-sheen {
    display: none;
  }

  .landing-kicker-christmas .landing-icon {
    transition: none;
  }
}

/* Where the two halves of the words do not fit one line, they stand on two: what there is to win over what to
   do, left-aligned beside the present, without the dot between them. The pill's corners are then 20px, so two
   lines do not make a lozenge. */
@media (max-width: 720px) {
  .landing-kicker-christmas {
    border-radius: 20px;
    text-align: left;
  }

  .landing-kicker-words {
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.15;
  }

  .landing-kicker-dash {
    display: none;
  }
}

/* On a phone the pill keeps the kicker's own size there, and the sparkles stay inside the page's edge. */
@media (max-width: 560px) {
  .landing-kicker-christmas {
    gap: 9px;
    padding: 7px 13px 7px 11px;
    letter-spacing: 0.08em;
  }

  .landing-kicker-gift {
    width: 20px;
    height: 15px;
  }

  .landing-kicker-sparkles i:nth-child(1) {
    left: -8px;
  }

  .landing-kicker-sparkles i:nth-child(3) {
    right: -8px;
  }

  .landing-kicker-sparkles i:nth-child(5) {
    right: -10px;
  }
}

/* The narrowest phones: a slightly smaller face, so the longer line keeps inside the page. */
@media (max-width: 380px) {
  .landing-kicker-christmas {
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
  }
}

/* ---------- The early-access page in the season ---------- */
/* The page's frames carry Santa's red as their hard shadow instead of the blue (early-access.css reads the
   property). */
[data-festive="xmas"] .access {
  --access-frame-shadow: rgba(220, 38, 38, 0.42);
}

/* ---------- The team in Santa hats ---------- */
/* Five sprites from the home page's office, painted by the mode's early-access.js with a hat each: 8 by 14 cells (two rows
   over the sprite's twelve for the hat) at six pixels a cell. Before the script runs the canvases are transparent
   and keep the row's height. */
/* They stand on top of the form, their feet on its upper edge. The room for a speech bubble over their heads is
   the page's own space above the form. */
.access-party {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  min-height: 84px;
  margin: 0;
}

.access-party-member {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.access-party canvas {
  width: 48px;
  height: 84px;
  image-rendering: pixelated;
  animation: access-bob 1.6s steps(2, jump-none) infinite;
}

.access-party-member:nth-of-type(2n) canvas {
  animation-delay: 0.4s;
}

.access-party-member:nth-of-type(3n) canvas {
  animation-delay: 0.8s;
}

/* What one of them says when the pointer reaches it (or a finger taps it): the careers party's speech bubble. */
.access-bubble {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  z-index: 2;
  padding: 4px 10px 5px;
  border: 2px solid var(--landing-canvas);
  background: var(--landing-ink);
  box-shadow: 3px 3px 0 var(--access-frame-shadow);
  color: var(--landing-canvas);
  font-family: var(--access-pixel);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
  animation: access-pop 180ms steps(2, jump-none) both;
}

.access-bubble[hidden] {
  display: none;
}

.access-bubble::after {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--landing-ink);
  content: "";
}

.access-bubble.is-heart {
  color: #e11d48;
}

/* ---------- The countdown and the prize ---------- */
/* While the draw is open the page makes room for it: the offer takes the place under the lede, beside the form
   (the countdown, then the prize under it), and the steps move under both columns, side by side. Without the
   offer (after the draw's deadline) the page keeps its ordinary layout. */
.access-draw {
  display: grid;
  grid-area: offer;
  gap: 20px;
  max-width: 560px;
}

@media (min-width: 861px) {
  .access-layout:has(.access-draw) {
    grid-template-areas:
      "title form"
      "intro form"
      "offer form"
      "steps steps";
    grid-template-rows: auto auto 1fr auto;
  }

  .access-layout:has(.access-draw) .access-how {
    max-width: none;
    margin-top: 64px;
  }

  .access-layout:has(.access-draw) .access-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
  }
}

.access-countdown {
  padding: 24px 26px 22px;
  text-align: center;
}

.access-clock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 14px;
  padding: 0;
  list-style: none;
}

.access-clock li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 4px 12px;
  border: 2px solid var(--landing-border);
  background: var(--landing-canvas);
}

/* The numbers stay in Space Mono: every digit is as wide as the next, so a tile does not jump as it counts. */
.access-clock-number {
  font-size: clamp(2rem, 5.4vw, 3.5rem);
  font-weight: 700;
  line-height: 1;
}

.access-clock-unit {
  color: var(--landing-muted);
  font-family: var(--access-pixel);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.access-note {
  color: var(--landing-muted);
  font-size: 0.8125rem;
}

/* The present at the left of its words. The frame stands over the countdown above it, because the ticket that
   jumps out of the present reaches over the frame's upper edge for a moment. */
.access-prize {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
}

/* The present: 16 by 12 cells at six pixels a cell, painted by the mode's early-access.js in two halves, the lid
   with its bow (the upper six rows) and the box (the lower six), so that the lid can come off. It is a button,
   and a hidden surprise: nothing but the pointer says that it can be pressed. Pressed, it shakes, the lid flies
   off, a gold ticket jumps out large and settles standing in the box, and confetti flies (the script's). Pressed
   again, it closes. Between the two halves stands the ticket, behind the box, where the closed present hides it. */
.access-gift {
  position: relative;
  flex: none;
  width: 96px;
  height: 72px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  animation: access-bob 1.6s steps(2, jump-none) infinite;
}

/* Until the script has painted it and switched it on, it is no button to anyone. */
.access-gift:disabled {
  cursor: default;
}

.access-gift:focus-visible {
  outline: 2px solid var(--landing-accent);
  outline-offset: 6px;
}

.access-gift canvas {
  position: absolute;
  left: 0;
  width: 96px;
  height: 36px;
  image-rendering: pixelated;
}

.access-gift-lid {
  top: 0;
  z-index: 3;
  transition:
    transform 420ms cubic-bezier(0.2, 0.9, 0.3, 1),
    opacity 420ms linear;
}

.access-gift-box {
  top: 36px;
  z-index: 2;
}

/* The ticket: gold, two lines in the pixel face. Closed, it stands wholly behind the box (the box's lower six
   rows are filled from 12 to 84 pixels across and from 36 to 72 down). */
.access-ticket {
  position: absolute;
  top: 37px;
  left: 16px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 64px;
  height: 34px;
  padding-bottom: 3px;
  border: 2px solid #a16207;
  background: #facc15;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.18);
  color: #1c1917;
  font-family: var(--access-pixel);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform 300ms var(--landing-ease);
}

/* Open: the present stands still, the lid is gone up and to the left, and the ticket stands in the box with both
   its lines showing, its lower edge just behind the box's front. */
.access-gift.is-open {
  animation: none;
}

.access-gift.is-open .access-gift-lid {
  opacity: 0;
  transform: translate(-30px, -44px) rotate(-34deg);
}

.access-gift.is-open .access-ticket {
  transform: translateY(-34px) rotate(-5deg);
}

/* The moment before it opens, and the ticket's jump: out of the box, large over the frame's edge for a moment,
   then down into its place (the same place as the open state's, so nothing jumps when the animation ends). */
.access-gift.is-shaking {
  animation: access-shake 340ms steps(6, jump-none) both;
}

.access-gift.is-popping .access-ticket {
  animation: access-ticket-out 1500ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes access-shake {
  0% { transform: rotate(0deg); }
  20% { transform: rotate(-7deg); }
  40% { transform: rotate(7deg); }
  60% { transform: rotate(-5deg); }
  80% { transform: rotate(5deg); }
  100% { transform: rotate(0deg); }
}

@keyframes access-ticket-out {
  0% { transform: translateY(0) scale(0.8); }
  22% { transform: translateY(-76px) rotate(-9deg) scale(2); }
  34% { transform: translateY(-70px) rotate(4deg) scale(1.9); }
  68% { transform: translateY(-72px) rotate(-3deg) scale(1.9); }
  100% { transform: translateY(-34px) rotate(-5deg) scale(1); }
}

/* The confetti: a canvas over the whole window for the two seconds it flies (early-access.js), taking no pointer. */
.access-confetti {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.access-prize-name {
  margin-top: 6px;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
}

@keyframes access-bob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

@keyframes access-pop {
  0% { transform: translateX(-50%) scale(0.4); }
  100% { transform: translateX(-50%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .access-party canvas,
  .access-gift,
  .access-gift.is-shaking,
  .access-gift.is-popping .access-ticket,
  .access-bubble {
    animation: none;
  }

  .access-gift-lid,
  .access-ticket {
    transition: none;
  }
}

@media (max-width: 860px) {
  /* Under the title on a phone: a little air over their heads for a speech bubble. */
  .access-party {
    gap: 12px;
    margin-top: 28px;
  }

  /* On a phone the offer follows the lede, before the steps. */
  .access-layout:has(.access-draw) {
    grid-template-areas:
      "title"
      "form"
      "intro"
      "offer"
      "steps";
  }

  .access-draw {
    max-width: none;
    margin-bottom: 40px;
  }

  .access-countdown {
    padding: 20px 14px 18px;
  }

  .access-clock {
    gap: 8px;
  }

  .access-clock li {
    padding: 12px 2px 10px;
  }

  .access-clock-unit {
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
  }

  .access-prize {
    padding: 16px;
  }
}
