/* =============================================================================
   Christmas 2026 — TEMPORARY. Switches itself off at 2027-01-01 00:00 ET.

   Every rule is scoped to html.k9-xmas. That class is only ever set before
   2027-01-01T05:00:00Z (the homepage's inline flag and xmas-2026.js check the
   same instant), so after New Year nothing here applies and the snowy images
   are never requested. Preview any date with ?season=xmas or ?season=off.

   Owner brief, 2026-11-07: red and green Christmas lights, snow and
   snowflakes, a couple of hanging ornaments, dogs pulling Santa's sleigh on
   the homepage; lights and light snow on every page. Approved comps:
   .impeccable/mocks/home-xmas-academy/r2-a-hero.png, r2-a-paths.png and
   r2-a-mobile.png (in the Academy worktree, git-ignored).
   ========================================================================== */

html.k9-xmas {
  --k9x-lights: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 44'><defs><linearGradient id='r' x1='0' x2='1'><stop offset='0' stop-color='%23ff7277'/><stop offset='.5' stop-color='%23e3202c'/><stop offset='1' stop-color='%23990f19'/></linearGradient><linearGradient id='g' x1='0' x2='1'><stop offset='0' stop-color='%2366e08c'/><stop offset='.5' stop-color='%231ea64b'/><stop offset='1' stop-color='%230d6230'/></linearGradient></defs><path d='M0 3 Q32 23 64 3 Q96 23 128 3' fill='none' stroke='%231d3b2a' stroke-width='1.8'/><g transform='translate(32 12.5) rotate(-6)'><rect x='-3.6' y='-.6' width='7.2' height='7' rx='1.4' fill='%23183424'/><path d='M-4.3 6C-7.4 11.6-7.1 19.4 0 28.4 7.1 19.4 7.4 11.6 4.3 6Z' fill='url(%23r)'/><ellipse cx='-2' cy='13.4' rx='1.2' ry='3.9' fill='%23fff' opacity='.62'/></g><g transform='translate(96 12.5) rotate(6)'><rect x='-3.6' y='-.6' width='7.2' height='7' rx='1.4' fill='%23183424'/><path d='M-4.3 6C-7.4 11.6-7.1 19.4 0 28.4 7.1 19.4 7.4 11.6 4.3 6Z' fill='url(%23g)'/><ellipse cx='-2' cy='13.4' rx='1.2' ry='3.9' fill='%23fff' opacity='.62'/></g></svg>");
  --k9x-glow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 44'><defs><radialGradient id='R'><stop offset='0' stop-color='%23ff3b47' stop-opacity='.85'/><stop offset='1' stop-color='%23ff3b47' stop-opacity='0'/></radialGradient><radialGradient id='G'><stop offset='0' stop-color='%233ee27a' stop-opacity='.8'/><stop offset='1' stop-color='%233ee27a' stop-opacity='0'/></radialGradient></defs><circle cx='32' cy='28' r='17' fill='url(%23R)'/></svg>"), url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 44'><defs><radialGradient id='R'><stop offset='0' stop-color='%23ff3b47' stop-opacity='.85'/><stop offset='1' stop-color='%23ff3b47' stop-opacity='0'/></radialGradient><radialGradient id='G'><stop offset='0' stop-color='%233ee27a' stop-opacity='.8'/><stop offset='1' stop-color='%233ee27a' stop-opacity='0'/></radialGradient></defs><circle cx='96' cy='28' r='17' fill='url(%23G)'/></svg>");
  --k9x-ribbon: linear-gradient(180deg, #8f0d1a, #d2202d);
}

/* ---- Falling snow (canvas from xmas-2026.js) ---------------------------- */
.k9x-snow {
  position: fixed;
  inset: 0;
  z-index: 35;
  pointer-events: none;
}

/* ---- Lights when the promo banner is not on the page ---------------------
   The banner carries its own string; this one appears once the banner has
   been dismissed, or on pages the campaign doesn't target. It hangs behind
   the logo, links and button (z-index -1 inside the header's own stacking
   context): on 65px phone headers the bulbs reached the "Free consult"
   button's label (UX audit, 2026-11-10). */
html.k9-xmas body:not(.ka-promo-bannered) .topnav::before,
html.k9-xmas body:not(.ka-promo-bannered) .topnav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: -1;
  height: 30px;
  background-repeat: repeat-x;
  background-size: 87px 30px;
  pointer-events: none;
}
html.k9-xmas body:not(.ka-promo-bannered) .topnav::before { background-image: var(--k9x-lights); }
html.k9-xmas body:not(.ka-promo-bannered) .topnav::after {
  background-image: var(--k9x-glow);
  animation: k9x-twinkle 2.8s ease-in-out infinite alternate;
}

/* ---- Mobile menus get a string along the top ---------------------------- */
html.k9-xmas .mobile-drawer-panel,
html.k9-xmas .ka-drawer-panel { padding-top: 44px; }
html.k9-xmas .mobile-drawer-panel::before,
html.k9-xmas .ka-drawer-panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 36px;
  background: var(--k9x-lights) repeat-x;
  background-size: 105px 36px;
  pointer-events: none;
}

/* ---- Shared pieces ------------------------------------------------------- */
html.k9-xmas .xmas-cap {
  display: block;
  position: absolute;
  left: -7px;
  right: -7px;
  top: -17px;
  z-index: 1;
  height: 31px;
  background: url("/assets/seasonal/xmas-2026/snowcap.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 2px rgba(70, 90, 120, 0.18));
  pointer-events: none;
}

html.k9-xmas .xmas-orn {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--orn, 58px);
  transform-origin: 50% 0;
  animation: k9x-sway var(--sway, 6s) ease-in-out infinite alternate;
}
html.k9-xmas .xmas-orn::before {
  content: "";
  display: block;
  width: 2px;
  height: var(--drop, 40px);
  margin-bottom: -5px;
  border-radius: 1px;
  background: var(--k9x-ribbon);
}
html.k9-xmas .xmas-orn img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 10px rgba(20, 24, 40, 0.28));
}

/* ---- Homepage hero ------------------------------------------------------- */
/* The bridge goes big and snowy, and its left edge dissolves into snow
   rather than a plain gradient. */
/* Snow-white haze where the photo begins (the band's size and fade come
   from the homepage's comp geometry). */
html.k9-xmas .hero { --haze: #fff4ea; --haze0: rgba(255, 244, 234, 0); }
html.k9-xmas .hero .skyline-img { display: none; }
html.k9-xmas .hero .skyline::after {
  /* below the sleigh's band: the haze keeps "Calmer homes." and every line
     under it off the photo itself */
  background: linear-gradient(90deg, var(--haze) 0, var(--haze) calc(var(--fs, 80px) * 2.4), var(--haze0) calc(var(--fs, 80px) * 3.7));
  -webkit-mask-image: linear-gradient(180deg, transparent 0, transparent calc(var(--fs, 80px) * 1.85), #000 calc(var(--fs, 80px) * 2.12));
  mask-image: linear-gradient(180deg, transparent 0, transparent calc(var(--fs, 80px) * 1.85), #000 calc(var(--fs, 80px) * 2.12));
}
/* Once xmas-2026.js has drawn the line-following snowy haze, it replaces
   both gradient hazes (which stay as the no-script fallback). */
html.k9-xmas .hero .skyline.k9x-haze-ready::before {
  background:
    var(--k9x-haze) 0 0 / 100% 100% no-repeat,
    linear-gradient(180deg, rgba(18, 26, 52, 0.16), transparent 24%);
}
html.k9-xmas .hero .skyline.k9x-haze-ready::after { display: none; }
html.k9-xmas .hero .skyline::before {
  /* full height, but short: "Good dogs." ends on light ground while the
     lead dogs fly over open sky; a faint shade at the top seats the ornaments */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, var(--haze) 0, var(--haze) calc(var(--fs, 80px) * 0.85), var(--haze0) calc(var(--fs, 80px) * 1.45)),
    linear-gradient(180deg, rgba(18, 26, 52, 0.16), transparent 24%);
  pointer-events: none;
}
html.k9-xmas .hero .skyline-xmas {
  display: block;
  position: absolute;
  left: 0;
  top: -12%;
  width: 100%;
  height: 124%;
  background: #33416e url("/assets/seasonal/xmas-2026/bridge-snow-1536.webp") 58% 42% / cover no-repeat;
  transform: translate3d(0, var(--par, 0px), 0);
  will-change: transform;
}
html.k9-xmas .hero .skyline-snowedge {
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  left: -2px;
  z-index: 1;
  right: 0;
  /* porous frost and snow-laden branches: the bridge shows through the gaps */
  background: url("/assets/seasonal/xmas-2026/frostedge-1000.webp") left center / auto 100% no-repeat;
  /* keep the branches to the photo's left edge; the sky around the sleigh
     stays open */
  -webkit-mask-image:
    radial-gradient(calc(var(--fs, 80px) * 3.9) calc(var(--fs, 80px) * 0.8) at 0 0, #000 45%, transparent 100%),
    radial-gradient(calc(var(--fs, 80px) * 1.3) calc(var(--fs, 80px) * 8) at 0 100%, #000 50%, transparent 100%),
    radial-gradient(calc(var(--fs, 80px) * 3.8) calc(var(--fs, 80px) * 1.8) at 0 100%, #000 50%, transparent 100%);
  -webkit-mask-composite: source-over;
  mask-image:
    radial-gradient(calc(var(--fs, 80px) * 3.9) calc(var(--fs, 80px) * 0.8) at 0 0, #000 45%, transparent 100%),
    radial-gradient(calc(var(--fs, 80px) * 1.3) calc(var(--fs, 80px) * 8) at 0 100%, #000 50%, transparent 100%),
    radial-gradient(calc(var(--fs, 80px) * 3.8) calc(var(--fs, 80px) * 1.8) at 0 100%, #000 50%, transparent 100%);
  mask-composite: add;
}

html.k9-xmas .xmas-sky {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
html.k9-xmas .xmas-sky canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
html.k9-xmas .xmas-sleigh {
  position: absolute;
  /* flies level with "Good dogs.", nose clear of "Calmer homes.", and Santa
     stops short of the ornaments */
  top: calc(var(--fs, 80px) * 0.62);
  left: calc(var(--gut, 96px) + var(--fs, 80px) * 6);
  width: min(42.5vw, 760px);
  animation: k9x-arrive 2.8s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}
/* The sleigh bobs as one body, carrying the point its trail leaves from. */
html.k9-xmas .xmas-sleigh-body {
  display: block;
  position: relative;
  z-index: 1;
  animation: k9x-bob 4.6s ease-in-out 3.2s infinite alternate;
}
html.k9-xmas .xmas-sleigh-body > img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 14px rgba(10, 16, 40, 0.35));
}
/* The rear tip of the runner's curl, measured on sleigh-1100.webp
   (x 1075 / 1100, y 204 / 220). xmas-2026.js emits the trail from here. */
html.k9-xmas .xmas-trail-tip {
  position: absolute;
  left: 97.7%;
  top: 92.7%;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
/* Canvas trail, behind the sleigh (first child of .xmas-sky). */
html.k9-xmas .xmas-trail-canvas {
  position: absolute;
  pointer-events: none;
}

/* No-script fallback: the painted trail, its bright end tucked behind the
   runner tip so it streams back from under the sleigh. */
html.k9-xmas .xmas-trail {
  position: absolute;
  z-index: 0;
  left: 96.5%;
  top: 92.7%;
  width: 62%;
  transform: translateY(-48%) rotate(-4deg);
  transform-origin: 0 48%;
  pointer-events: none;
}
html.k9-xmas .xmas-trail img {
  display: block;
  width: 100%;
  height: auto;
}
html.k9-xmas .xmas-sleigh.k9x-trail-live .xmas-trail { display: none; }
/* the old hero's floating paw prints would sit in the night sky */
html.k9-xmas .hero .paw-bg { display: none; }

html.k9-xmas .xmas-ornaments--hero {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: absolute;
  top: 0;
  /* on very wide screens they hang with the rest of the hero, not at the
     far edge (--hero-right is set on the homepage hero past 2000px) */
  right: calc(clamp(18px, 2.6vw, 48px) + var(--hero-right, 0px));
  z-index: 2;
  pointer-events: none;
}

/* ---- Homepage: the scrolling marquee ------------------------------------
   Approved comp r3-marquee-a.png: the ink band wears a cap of snow, gold
   snowflakes replace the orange dots, and red-over-green piping runs along
   its foot, where the bulb string of "Pick your path" hangs. After New Year
   it is the plain orange-dot band again. */
html.k9-xmas .marquee {
  position: relative;
  /* the snow rises above the band; the words still clip at its sides */
  overflow: visible;
  overflow-x: clip;
  border-top: 0;
  border-bottom: 0;
  padding-block: 13px 17px;
}
html.k9-xmas .marquee::before,
html.k9-xmas .marquee::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
}
html.k9-xmas .marquee::before {
  top: -27px;
  height: 36px;
  background: url("/assets/seasonal/xmas-2026/snowcap-tile.webp") 0 100% / auto 36px repeat-x;
  filter: drop-shadow(0 2px 2px rgba(70, 90, 120, 0.22));
}
html.k9-xmas .marquee::after {
  bottom: 0;
  height: 6px;
  background: linear-gradient(180deg, #b3141f 0 3px, #17703a 3px 6px);
}
html.k9-xmas .marquee-track .bullet {
  width: 21px;
  height: 21px;
  border-radius: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E8B64C' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M12 1.6v20.8M9.3 4.2 12 6.9l2.7-2.7M9.3 19.8 12 17.1l2.7 2.7'/><path transform='rotate(60 12 12)' d='M12 1.6v20.8M9.3 4.2 12 6.9l2.7-2.7M9.3 19.8 12 17.1l2.7 2.7'/><path transform='rotate(120 12 12)' d='M12 1.6v20.8M9.3 4.2 12 6.9l2.7-2.7M9.3 19.8 12 17.1l2.7 2.7'/></svg>") center / contain no-repeat;
}

/* ---- Homepage: Pick your path ------------------------------------------- */
html.k9-xmas .xmas-garland {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  height: 40px;
  background: var(--k9x-lights) repeat-x;
  background-size: 116px 40px;
  pointer-events: none;
}
html.k9-xmas .xmas-garland::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--k9x-glow);
  background-repeat: repeat-x;
  background-size: 116px 40px;
  animation: k9x-twinkle 2.8s ease-in-out infinite alternate;
}
html.k9-xmas .xmas-garland .xmas-orn {
  position: absolute;
  top: 12px;
  --orn: 64px;
}
html.k9-xmas .xmas-garland .xmas-orn:first-child { left: max(16px, calc(50% - 690px)); }
html.k9-xmas .xmas-garland .xmas-orn:last-child { right: max(16px, calc(50% - 690px)); }
html.k9-xmas .paths .path-card .banner,
html.k9-xmas .paths .path-ribbon { z-index: 2; }

/* ---- Phones -------------------------------------------------------------- */
@media (max-width: 900px) {
  /* The photo becomes a band across the top of the hero, ending in a drift.
     56vw (the photo's own 3:2 shape, less a little sky) rather than 80vw, so
     on a 390x844 phone the headline and "Book a free consultation" are in the
     first screen above the call bar (UX audit, 2026-11-10). Tablets keep 360px.
     Homepage only: the Gallery's hero is also .hero and was getting the
     photo band's padding with no photo in it (a ~270px empty gap). */
  html.k9-xmas .ka-home-page .hero { --k9x-band: min(56vw, 360px); padding-top: calc(var(--k9x-band) + 18px); }
  html.k9-xmas .hero .skyline {
    inset: 0 0 auto 0;
    width: 100%;
    height: var(--k9x-band);
    -webkit-mask-image: none;
    mask-image: none;
  }
  html.k9-xmas .hero .skyline::after,
  html.k9-xmas .hero .skyline::before { display: none; }
  html.k9-xmas .hero .skyline-xmas {
    top: 0;
    height: 100%;
    background-image: url("/assets/seasonal/xmas-2026/bridge-snow-1024.webp");
    background-position: 62% 46%;
    transform: none;
  }
  html.k9-xmas .hero .skyline-snowedge {
    top: auto;
    left: -4px;
    right: -4px;
    bottom: -2px;
    width: auto;
    height: 46px;
    -webkit-mask-image: none;
    mask-image: none;
    background: url("/assets/seasonal/xmas-2026/snowcap.webp") center bottom / 100% 100% no-repeat;
  }
  html.k9-xmas .hero .skyline-snowedge::before {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 14px;
    background: var(--bg, #fff4ea);
  }
  html.k9-xmas .xmas-sky { bottom: auto; height: var(--k9x-band); }
  html.k9-xmas .xmas-sleigh {
    top: 11%;
    left: auto;
    right: 24vw;
    width: 70vw;
  }
  html.k9-xmas .xmas-ornaments--hero { right: 12px; gap: 8px; }
  html.k9-xmas .xmas-ornaments--hero .xmas-orn { --orn: 36px; --drop: 14px !important; }
  html.k9-xmas .xmas-ornaments--hero .xmas-orn:nth-child(3) { display: none; }
  html.k9-xmas .xmas-garland .xmas-orn { --orn: 44px; }
}

/* ---- Short phones (UX audit round 2, 2026-11-10) -------------------------
   On 360x740, 375x667 (iPhone SE) and 360x640 the band pushed the headline
   and "Book a free consultation" under the call bar. Here the band gives up
   height to fit the screen: 100svh less the banner + header above it
   (--k9x-top) and the ~380px the headline, h1, button and call bar need. The
   location label steps aside, since the h1 right under it already says
   "Chattanooga, TN". Taller phones (390x844 and up) are unchanged. */
@media (max-width: 480px) and (max-height: 820px) {
  html.k9-xmas body.ka-home-page { --k9x-top: 116px; } /* the "Now enrolling" bar + header, once the banner is closed */
  html.k9-xmas body.ka-home-page.ka-promo-bannered { --k9x-top: 181px; }
  html.k9-xmas .ka-home-page .hero { --k9x-band: clamp(84px, calc(100vh - var(--k9x-top) - 380px), min(56vw, 360px)); }
  html.k9-xmas .ka-home-page .hero .eyebrow { display: none; }
  html.k9-xmas .ka-home-page .hero .hero-display { margin-top: 0; }
}
@supports (height: 100svh) {
  @media (max-width: 480px) and (max-height: 820px) {
    html.k9-xmas .ka-home-page .hero { --k9x-band: clamp(84px, calc(100svh - var(--k9x-top) - 380px), min(56vw, 360px)); }
  }
}
/* Under 340px the holiday banner is 145px tall, not 116px. */
@media (max-width: 339px) and (max-height: 820px) {
  html.k9-xmas body.ka-home-page.ka-promo-bannered { --k9x-top: 210px; }
}

/* ---- Motion -------------------------------------------------------------- */
@keyframes k9x-twinkle {
  0% { opacity: 0.3; }
  60% { opacity: 1; }
  100% { opacity: 0.6; }
}
@keyframes k9x-sway {
  from { transform: rotate(-3.5deg); }
  to { transform: rotate(3.5deg); }
}
@keyframes k9x-arrive {
  from { transform: translate3d(34vw, -26px, 0); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes k9x-bob {
  from { transform: translate3d(0, -5px, 0) rotate(-0.6deg); }
  to { transform: translate3d(-10px, 6px, 0) rotate(0.5deg); }
}

@media (prefers-reduced-motion: reduce) {
  html.k9-xmas .xmas-orn,
  html.k9-xmas .xmas-sleigh,
  html.k9-xmas .xmas-sleigh-body,
  html.k9-xmas .xmas-garland::after,
  html.k9-xmas body:not(.ka-promo-bannered) .topnav::after { animation: none; }
}
