/* Barrett Motorwerks: temporary Christmas decorations, layered over style.css.
   On the live site since 30 Nov 2026 (approved by Barrett). To take them down, set XMAS = false in
   build/partials.php, rebuild and upload (see NOTES.md). Bump VER there after changing any file in xmas/.

   Static (shown even when motion is off): Santa hat, lights, holly on the section labels, baubles
   hanging in each content section, a gift bow on the photos, candy-cane stripes, footer greeting.
   Moving (stopped by the "Stop the snow" button at the top of the page, the bauble, or reduced motion):
   snow over the whole page, twinkling lights, swaying baubles.
   Cut on 28 Nov as too much (artwork kept in ~/bmw-wip/xmas/unused/): snow caps on every card. */

:root {
  /* Santa hat on the header logo, in units of the logo's height (52px, 44px at <=960px, 38px at <=480px).
     tools/preview-hat.php reads these four values to draw a check image. */
  --hat-w: .44; --hat-x: .737; --hat-y: -.235; --hat-tilt: -10deg;
  --logo-h: 52px;
  --xmas-red: #d42630;
  --xmas-wire: #3f6a4b;
  --wrap-right: max(var(--gutter), calc((100% - var(--max)) / 2)); /* inset of .wrap's right edge */
}
@media (max-width: 960px) { :root { --logo-h: 44px; } }
@media (max-width: 480px) { :root { --logo-h: 38px; } }

/* ---------- Santa hat on the "B" of the header logo ---------- */
.masthead .brand { position: relative; }
.masthead .brand::after {
  content: ""; position: absolute; pointer-events: none;
  left: calc(var(--logo-h) * var(--hat-x));
  top: calc(8px + var(--logo-h) * var(--hat-y));
  width: calc(var(--logo-h) * var(--hat-w));
  aspect-ratio: 64 / 52;
  background: url("xmas-hat.svg") no-repeat center / contain;
  transform: rotate(var(--hat-tilt)); transform-origin: 48.4% 80.8%;
}

/* ---------- Fairy lights hanging under the header (built by xmas.js) ---------- */
.xmas-lights {
  position: absolute; left: 0; right: 0; top: calc(100% - 1px); height: 30px;
  display: flex; overflow: hidden; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16'%3E%3Cpath d='M0 1.5Q24 13 48 1.5' fill='none' stroke='%233f6a4b' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x 0 0 / 48px 16px;
}
.xmas-lights i {
  --c: #ff4040;
  position: relative; display: block; flex: none; width: 48px; height: 100%;
  transform: rotate(7deg); transform-origin: 50% 7px;
}
.xmas-lights i:nth-child(even) { transform: rotate(-7deg); }
.xmas-lights i:nth-child(4n+2) { --c: #ffb100; }
.xmas-lights i:nth-child(4n+3) { --c: #2fd36f; }
.xmas-lights i:nth-child(4n+4) { --c: #4aa3ff; }
.xmas-lights i::before { /* socket */
  content: ""; position: absolute; left: 50%; top: 5px; width: 5px; height: 6px; margin-left: -2.5px;
  border-radius: 1.5px; background: #24432f;
}
.xmas-lights i::after { /* bulb */
  content: ""; position: absolute; left: 50%; top: 10px; width: 8px; height: 13px; margin-left: -4px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .9) 0 1px, transparent 2.6px), var(--c);
  box-shadow: 0 0 6px 1px var(--c);
  box-shadow: 0 0 6px 1px var(--c), 0 0 16px 3px color-mix(in srgb, var(--c) 50%, transparent);
  animation: xmas-twinkle var(--t, 3s) ease-in-out var(--d, 0s) infinite;
}
@keyframes xmas-twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ---------- Snow switch: a bauble hanging from the end of the lights ----------
   It sits at the top of the hero, just under the header (in the header only if a page has no hero). */
.xmas-toggle {
  position: absolute; z-index: 1; top: 14px; right: var(--wrap-right);
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer; color: #fff;
  background: radial-gradient(circle at 34% 30%, #ff8585, #c8102e 52%, #6e0717);
  box-shadow: 0 8px 18px -6px rgba(8, 6, 29, .6), inset 0 -3px 6px rgba(0, 0, 0, .25);
  transform-origin: 50% -14px;
  animation: xmas-swing 4s ease-in-out infinite;
}
.xmas-toggle::before { /* cap */
  content: ""; position: absolute; top: -5px; left: 50%; width: 11px; height: 6px; margin-left: -5.5px;
  border-radius: 2px 2px 1px 1px; background: linear-gradient(90deg, #a8812c, #f3d27a 45%, #a8812c);
}
.xmas-toggle::after { /* thread up to the wire */
  content: ""; position: absolute; bottom: 100%; left: 50%; width: 1.5px; height: 13px; margin-left: -.75px;
  background: var(--xmas-wire);
}
.masthead .xmas-toggle { top: calc(100% + 14px); }
.xmas-toggle:hover, .xmas-toggle:focus-visible { animation-play-state: paused; }
.xmas-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:is(.xmas-toggle, .xmas-switch) .xmas-off { display: none; }
.xmas-still :is(.xmas-toggle, .xmas-switch) .xmas-on { display: none; }
.xmas-still :is(.xmas-toggle, .xmas-switch) .xmas-off { display: block; }
.xmas-off .xmas-flake { opacity: .55; }
.xmas-off .xmas-slash-bg { stroke: #6e0717; stroke-width: 4.5; }
.xmas-tip { /* the button's name, shown as a tooltip on hover and keyboard focus */
  position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  padding: .45em .8em; border-radius: 8px; white-space: nowrap; pointer-events: none;
  font-size: .84rem; font-weight: 700; letter-spacing: .02em; line-height: 1.2;
  background: var(--ink); color: #fff; box-shadow: 0 6px 18px -6px rgba(8, 6, 29, .6);
  opacity: 0; transition: opacity .15s;
}
.xmas-toggle:hover .xmas-tip, .xmas-toggle:focus-visible .xmas-tip { opacity: 1; }
@keyframes xmas-swing {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}
/* Phones: the plain heroes start with text right at the top, so make room for the bauble */
@media (max-width: 900px) {
  .hero--plain .hero__in { padding-top: 66px; }
}

/* ---------- Snow over the whole page (one fixed canvas, drawn by xmas.js) ---------- */
.xmas-snow { position: fixed; inset: 0; z-index: 70; width: 100%; height: 100%; pointer-events: none; } /* over the sticky header and call bar, as on the Vintec demo */
.xmas-still .xmas-snow { display: none; }

/* ---------- Holly in place of the bar on every section label ---------- */
.eyebrow::before {
  width: 2.6em; height: 1.02em; transform: none;
  background: url("xmas-holly.svg") no-repeat center / contain;
}

/* ---------- Baubles hanging at the top right of each content section ---------- */
.section { position: relative; }
.section::before {
  content: ""; position: absolute; top: 0; right: var(--wrap-right); pointer-events: none;
  height: calc(var(--sec-pad) * .86); aspect-ratio: 90 / 108;
  background: url("xmas-baubles.svg") no-repeat center top / contain;
  transform-origin: 50% 0; animation: xmas-sway 7s ease-in-out infinite;
}
.section:nth-of-type(even)::before { animation-delay: -3.5s; }
@keyframes xmas-sway {
  0%, 100% { transform: rotate(-1.6deg); }
  50% { transform: rotate(1.6deg); }
}

/* ---------- A gift bow on the corner of the photos ---------- */
.ph:not(.ph--strap)::after {
  content: ""; position: absolute; top: 0; right: 0; pointer-events: none;
  width: clamp(76px, 24%, 128px); aspect-ratio: 1;
  background: url("xmas-bow.svg") no-repeat right top / contain;
  filter: drop-shadow(-2px 3px 3px rgba(8, 6, 29, .3));
}

/* ---------- Candy-cane stripes in place of the hazard tape ---------- */
.hazard { background: repeating-linear-gradient(-45deg, var(--xmas-red) 0 16px, #fff 16px 32px); }
.callcard::after { background: repeating-linear-gradient(-45deg, var(--xmas-red) 0 14px, #fff 14px 28px); }

/* ---------- "Stop the snow" button at the top of the page (in the strip above the header) ----------
   xmas.js puts it at the end of .utility__links. Wide screens: on the right, after the email address.
   The strip can't fit it beside everything below about 950px, so it wraps onto a second line (right-aligned).
   Phones (<=720px, where the site hides the email and the area): only the button is kept, and it sits next
   to the on-call clock if there's room, under it if not (the clock text alone is up to ~341px). */
.utility__in { flex-wrap: wrap; row-gap: 4px; padding-block: 5px; }
.utility__links { align-items: center; margin-left: auto; }
.xmas-switch {
  display: inline-flex; align-items: center; gap: .45em; min-height: 28px; margin-left: .5em; padding: 0 .85em 0 .7em;
  border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; background: none; cursor: pointer;
  font: inherit; font-weight: 600; line-height: 1; color: #fff; white-space: nowrap;
}
.xmas-switch:hover { border-color: var(--amber); color: var(--amber); }
.xmas-switch svg { flex: none; width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.xmas-switch .xmas-slash-bg { stroke: var(--night); }
@media (max-width: 720px) {
  .utility__links { display: flex; margin-left: 0; }
  .utility__links > :not(.xmas-switch) { display: none; }
  .xmas-switch { margin-left: 0; }
}

/* ---------- Footer greeting ---------- */
.xmas-greeting { display: flex; flex-wrap: wrap; align-items: center; gap: .3em .55em; margin-top: 1.1rem; font-weight: 600; color: #fff; }
.xmas-greeting svg { flex: none; width: 1.6em; height: 1.6em; }
.xmas-greeting span { flex: 1 1 14em; }

/* Stopped: no snow, steady lights, still baubles */
.xmas-still .xmas-lights i::after, .xmas-still .xmas-toggle, .xmas-still .section::before { animation: none; }

@media print {
  .xmas-lights, .xmas-snow, .xmas-toggle, .xmas-greeting, .masthead .brand::after,
  .section::before, .ph::after { display: none !important; }
}
