/* =========================================================
   "Xmas me" — festive palette switch (xmas.js toggles html.xmas)
   navy → evergreen, magenta → Christmas red, cool grey → warm snow white.
   ========================================================= */

/* the switch in the hero */
.xmas-btn {
  position: absolute; z-index: 4; right: var(--pad); top: calc(var(--pad) + 132px);
  display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px 10px 12px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--green); color: var(--cream);
  font: 700 12px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  box-shadow: 0 10px 28px -14px rgba(0, 0, 0, 0.6);
  transition: background-color 0.6s, color 0.3s, transform 0.4s var(--ease);
  -webkit-tap-highlight-color: transparent;
  animation: xmas-in 0.9s var(--ease) 1.4s both;
}
/* hover as the site's pills (styles.css .pill): a fill wipes up from below, the letters roll (fx-ch), the icon turns 45° */
.xmas-btn::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--lime);
  clip-path: inset(100% 0 0 0 round 999px); transition: clip-path 0.5s var(--ease); pointer-events: none; }
.xmas-btn:hover::after, .xmas-btn:focus-visible::after { clip-path: inset(0 0 0 0 round 999px); }
.xmas-btn:hover, .xmas-btn:focus-visible { color: var(--black); }
.xmas-btn:active { transform: scale(0.96); }
.xmas-btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.xmas-btn svg { width: 18px; height: 18px; flex: none; color: var(--lime); transition: transform 0.5s var(--ease), color 0.3s; }
.xmas-btn:hover svg, .xmas-btn:focus-visible svg { transform: rotate(45deg); color: currentColor; }
.xmas-btn .xb-off { display: none; }
html.xmas .xmas-btn .xb-on { display: none; }
html.xmas .xmas-btn .xb-off { display: inline; }
/* attention: a magenta glow running round the button while the theme is off */
@property --xg { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.xb-glow { position: absolute; inset: -4px; border-radius: 999px; pointer-events: none; opacity: 0; transition: opacity 0.6s;
  filter: drop-shadow(0 0 4px #f72d9a) drop-shadow(0 0 14px rgba(247, 45, 154, 0.9)); }
.xb-glow i { position: absolute; inset: 0; border-radius: inherit; padding: 3px;
  background: conic-gradient(from var(--xg), transparent 0deg, transparent 110deg, rgba(247, 45, 154, 0.4) 210deg, #f72d9a 320deg, #ffb3dc 350deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: xg-spin 2.6s linear infinite; }
html:not(.xmas) .xb-glow { opacity: 1; }
html.xmas .xb-glow i { animation-play-state: paused; }
@keyframes xg-spin { to { --xg: 360deg; } }
@keyframes xmas-in { from { opacity: 0; translate: 0 -10px; } to { opacity: 1; translate: 0 0; } }
@media (max-width: 760px) {
  .xmas-btn { top: auto; bottom: calc(var(--pad) + 4px); right: var(--pad); padding: 9px 13px 9px 10px; font-size: 10.5px; }
}
@media (hover: none) and (max-width: 760px) { .xmas-btn { bottom: calc(var(--pad) + 62px); } } /* clear the lock button */

/* music on/off, next to the switch (only while the theme is on) */
.xmas-sound {
  position: absolute; z-index: 4; top: calc(var(--pad) + 132px); right: calc(var(--pad) + 156px);
  width: 34px; height: 34px; display: none; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--green); color: var(--cream); -webkit-tap-highlight-color: transparent;
}
html.xmas .xmas-sound { display: grid; animation: xmas-in 0.5s var(--ease) both; }
.xmas-sound svg { width: 17px; height: 17px; }
.xmas-sound .xs-off, .xmas-sound[aria-pressed="false"] .xs-on { display: none; }
.xmas-sound[aria-pressed="false"] .xs-off { display: block; }
html.xmas-music .xmas-sound .xs-on .xs-w { animation: xs-wave 0.8s ease-in-out infinite alternate; }
@keyframes xs-wave { to { opacity: 0.3; } }
@media (max-width: 760px) {
  .xmas-sound { top: auto; bottom: calc(var(--pad) + 46px); right: calc(var(--pad) + 2px); width: 31px; height: 31px; }
}
@media (hover: none) and (max-width: 760px) { .xmas-sound { bottom: calc(var(--pad) + 104px); } }

/* falling snow */
.xmas-snow { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 1.2s; }
html.xmas .xmas-snow { opacity: 1; }

/* soft cross-fade while switching */
html.xmas-anim *, html.xmas-anim *::before, html.xmas-anim *::after {
  transition: background-color 0.9s ease, color 0.9s ease, border-color 0.9s ease, box-shadow 0.9s ease, fill 0.9s ease !important;
}

/* ---------- the palette ---------- */
html.xmas {
  --green: #0f3a26;
  --green-1: #1d5138;
  --green-2: #4f6f5c;
  --olive: #b4bfae;
  --cream: #f6f1e7;
  --cream-2: #ece5d6;
  --line-light: #ddd4c1;
  --line-dark: #255a3d;
  --lime: #d4202f;
  --lime-off: #a3121e;
  --black: #071f12;
}

/* hard-coded tints in styles.css */
html.xmas .hero-card { background: rgba(246, 241, 231, 0.88); }
html.xmas .dot { box-shadow: 0 0 0 3px rgba(212, 32, 47, 0.3); animation-name: pulse-xmas; }
@keyframes pulse-xmas { 50% { box-shadow: 0 0 0 7px rgba(212, 32, 47, 0); } }
html.xmas .glass { box-shadow: inset 0 0 0 1px rgba(15, 58, 38, 0.08), 0 10px 40px rgba(15, 58, 38, 0.08); }
html.xmas .glass-hatch { background: repeating-linear-gradient(-45deg, rgba(212, 32, 47, 0.6) 0 2px, transparent 2px 5px); }
html.xmas .glass-tag { color: rgba(15, 58, 38, 0.65); }
html.xmas .card button:hover, html.xmas .card button:focus-visible { background: rgba(212, 32, 47, 0.04); }
html.xmas .project::backdrop { background: rgba(7, 31, 18, 0.7); }
html.xmas .project.is-case .pj-bar { background: rgba(15, 58, 38, 0.9); }

/* "At a glance" (aag.css) */
html.xmas .aag { --aag-pink: #d4202f; --aag-pink-2: #ff6b6b; --aag-ink: #06180e; }
html.xmas .aag-field { background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(7, 31, 18, 0.55) 100%); }
html.xmas .aag-title {
  background:
    linear-gradient(180deg, rgb(46, 128, 82) 0%, rgb(34, 104, 66) 55%, rgb(22, 80, 50) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html.xmas .aag-body { background: radial-gradient(120% 70% at 0% 0%, rgba(212, 32, 47, 0.16), transparent 60%), linear-gradient(165deg, rgba(24, 74, 48, 0.92), rgba(7, 31, 18, 0.95)); }
html.xmas .aag-3d { filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 22px rgba(212, 32, 47, 0.18)); }
html.xmas .aag-card.is-hover .aag-3d { filter: drop-shadow(0 30px 44px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 34px rgba(212, 32, 47, 0.35)); }
html.xmas .aag-face { background: linear-gradient(150deg, #ff6b6b 0%, #d4202f 35%, #a3121e 70%, #ff6b6b 100%); }
html.xmas .aag-hatch { background: repeating-linear-gradient(-45deg, rgba(212, 32, 47, 0.8) 0 2px, transparent 2px 5px); }
html.xmas .aag-text, html.xmas .aag-list li { color: #dfe3d6; }
html.xmas .aag-foot { color: #7f9886; }
html.xmas .aag-card--lead .aag-face { background: linear-gradient(150deg, #ffd2c8 0%, #d4202f 30%, #ff4b4b 60%, #ffd2c8 100%); }
html.xmas .aag-card--lead .aag-3d { filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 40px rgba(212, 32, 47, 0.55)); }
html.xmas .aag-card--lead.is-hover .aag-3d { filter: drop-shadow(0 30px 44px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 60px rgba(212, 32, 47, 0.75)); }
html.xmas .aag-card--lead .aag-body { background: radial-gradient(110% 80% at 100% 0%, rgba(255, 120, 110, 0.5), transparent 60%), linear-gradient(160deg, #d4202f 0%, #9e1220 45%, #3a0a10 100%); }
html.xmas .aag-card--lead .aag-hatch { background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.9) 0 2px, transparent 2px 5px); }

@media (prefers-reduced-motion: reduce) {
  .xmas-btn, .xb-glow i { animation: none; }
  .xmas-snow { display: none; }
}

/* ---------- fairy lights across the top of the hero (built by xmas.js) ---------- */
.xmas-lights { position: absolute; z-index: 4; left: 0; right: 0; top: 78px; height: 70px; width: 100%; pointer-events: none;
  opacity: 0; translate: 0 -14px; transition: opacity 0.8s, translate 0.9s var(--ease); }
html.xmas .xmas-lights { opacity: 1; translate: 0 0; }
.xmas-lights .xl-wire { fill: none; stroke: #1d3527; stroke-width: 1.6; }
.xmas-lights .xl-b { animation: xl-tw 2.6s ease-in-out infinite; }
.xmas-lights .xl-b ellipse { filter: drop-shadow(0 0 5px var(--c)) drop-shadow(0 0 12px var(--c)); }
/* with the music on, the bulbs flash on the notes instead of the slow twinkle */
html.xmas-music .xmas-lights .xl-b { animation: none; opacity: 0.3; transition: opacity 0.08s; }
html.xmas-music .xmas-lights .xl-b.xl-hit { opacity: 1; }
@keyframes xl-tw { 0%, 100% { opacity: 1; } 45% { opacity: 0.35; } 55% { opacity: 0.35; } }
@media (max-width: 760px) {
  .xmas-lights { top: 54px; height: 42px; }
  html.xmas .hero-mark { translate: 0 18px; transition: translate 0.8s var(--ease); } /* room for the lights above the name */
}
@media (prefers-reduced-motion: reduce) { .xmas-lights .xl-b { animation: none; } }

/* ---------- snow settled on cards and buttons ---------- */
html.xmas .hero-card::before,
html.xmas .nav .pill::before,
html.xmas .xmas-btn::before,
html.xmas .aag-3d::before {
  content: ""; position: absolute; z-index: 2; pointer-events: none;
  left: 6px; right: 6px; top: -7px; height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 16' preserveAspectRatio='none'%3E%3Cpath d='M0 9 C6 3 14 2 22 5 C30 1 42 0 52 4 C62 1 74 2 82 5 C92 0 106 1 116 4 C126 0 140 1 150 4 C160 1 172 1 180 5 C188 2 196 4 200 8 L200 10 C194 11 190 10 186 11 C184 15 180 15 178 11 C160 12 140 11 122 11 C120 15 115 15 113 11 C90 12 70 11 52 11 C50 16 44 16 43 11 C30 12 12 12 0 11 Z' fill='%23fff'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  filter: drop-shadow(0 1px 1px rgba(15, 58, 38, 0.25));
  animation: xmas-cap 0.9s var(--ease-out) both;
}
html.xmas .nav .pill::before { left: 4px; right: 4px; top: -6px; height: 13px; }
html.xmas .xmas-btn::before { left: 10px; right: 10px; top: -6px; height: 11px; }
html.xmas .aag-3d::before { left: 4px; right: calc(var(--cut, 30px) + 2px); top: -8px; height: 15px; }
html.xmas .hero-card { overflow: visible; }
html.xmas .nav .pill { position: relative; }
@keyframes xmas-cap { from { opacity: 0; transform: translateY(-6px) scaleY(0.4); } to { opacity: 1; transform: none; } }
