/* ==========================================================================
   JORIE DAILY — winter-arc.css · Phase 36 · Winter Arc ❄
   --------------------------------------------------------------------------
   Loaded LAST on every page. EVERY rule is scoped to :root[data-winter],
   which js/winter-season.js sets only between the Toronto-local dates of the
   December solstice and the March equinox. Outside winter this file does
   nothing at all, so the original Light and Dark themes return untouched.

   How the palette is applied: Jorie Daily derives (almost) every colour from
   four brand primitives (--burgundy, --pink, --beige, --white and their
   -rgb channels). Winter Arc re-points those primitives to the winter
   palette — separately for Light and Dark — and then fine-tunes the
   semantic tokens. No filters, no hue-rotate, no image changes. Fonts,
   radii, spacing, layout and animations are unchanged.

   Approved winter colours
     Snowflake #DCE1E6 · Mist #91A0AF · Pine #2D3741 · Berry #64282D
     Warm Stone #BEB4AA · White #FFFFFF · Icy Blue #B4E1FA (restrained)
   Derived: Snow canvas #EEF1F4 · Frost #D2E2EC · Pine Night #222B34 ·
            Night Frost #C9D6E0 · Snow ink #E3E8ED

   Celebration looks (birthdays, holidays, Christmas, confetti) keep their own
   colours — they are personal and must look exactly as before.

   Contents
   01. Winter Light primitives & tokens
   02. Winter Dark primitives & tokens
   03. Atmosphere (canvas glow, grain, selection)
   04. Fixed colours in existing components → winter equivalents
   05. Winter Arc countdown card (Today)
   06. Seasonal welcome line (Today)
   07. Winter snowfall (desktop, once a day)
   08. Small screens & reduced motion
   ========================================================================== */

/* ---------- 01. WINTER LIGHT ------------------------------------------- */
:root[data-winter],
:root[data-winter][data-theme="light"] {
  --burgundy: #2D3741;           /* Pine — ink, buttons, navigation, feature blocks */
  --pink: #D2E2EC;               /* Frost — Snowflake softened with a little Icy Blue */
  --beige: #EEF1F4;              /* Snow canvas */
  --white: #FFFFFF;
  --burgundy-rgb: 45 55 65;
  --pink-rgb: 210 226 236;
  --beige-rgb: 238 241 244;
  --white-rgb: 255 255 255;
  --cream: #F7F9FB;
  --pink-soft: #E4EDF3;

  /* Winter-only accents */
  --wa-snowflake: #DCE1E6;
  --wa-mist: #91A0AF;
  --wa-pine: #2D3741;
  --wa-berry: #64282D;
  --wa-stone: #BEB4AA;
  --wa-icy: #B4E1FA;
  --wa-icy-rgb: 180 225 250;
  --wa-stone-rgb: 190 180 170;

  /* Secondary text: slightly stronger than the original alphas so Pine on
     the pale canvas stays at WCAG AA (≥ 4.5:1) for small print. */
  --ink-2: rgb(var(--burgundy-rgb) / 0.82);
  --ink-3: rgb(var(--burgundy-rgb) / 0.72);
  --line: rgb(var(--burgundy-rgb) / 0.12);
  --line-2: rgb(var(--burgundy-rgb) / 0.28);
  --accent-soft: rgb(var(--pink-rgb) / 0.7);
  --header-bg: rgb(var(--beige-rgb) / 0.78);
  --focus-halo: rgb(var(--wa-icy-rgb) / 0.75);

  --shadow-sm:
    0 0 0 1px rgb(var(--burgundy-rgb) / 0.035),
    0 1px 2px rgb(var(--burgundy-rgb) / 0.04),
    0 12px 32px -20px rgb(var(--burgundy-rgb) / 0.3);
  --shadow-lg:
    0 0 0 1px rgb(var(--burgundy-rgb) / 0.05),
    0 2px 4px rgb(var(--burgundy-rgb) / 0.04),
    0 30px 60px -30px rgb(var(--burgundy-rgb) / 0.42);
  --jd-glow-1: rgb(var(--wa-icy-rgb) / 0.42);
  --jd-glow-2: rgb(var(--white-rgb) / 0.85);
  --jd-ring: 0 0 0 3px var(--bg), 0 0 0 5px var(--focus-ring), 0 0 0 9px rgb(var(--wa-icy-rgb) / 0.55);

  /* Countdown card */
  --wa-card-bg: linear-gradient(130deg, rgb(var(--white-rgb) / 0.94) 0%, rgb(var(--white-rgb) / 0.82) 46%, rgb(232 242 249 / 0.86) 100%);
  --wa-card-line: rgb(var(--burgundy-rgb) / 0.1);
  --wa-capsule-line: rgb(var(--burgundy-rgb) / 0.2);
  --wa-capsule-bg: rgb(var(--white-rgb) / 0.66);
  --wa-num: var(--wa-pine);
  --wa-track: rgb(var(--burgundy-rgb) / 0.09);
  --wa-fill: linear-gradient(90deg, var(--wa-mist), #8FC3E2);
  --wa-spark: #6C8FA8;            /* Mist deepened toward Icy Blue: visible on white */
  --wa-ornament: rgb(var(--burgundy-rgb) / 0.16);
  --wa-flake: #FFFFFF;
  --wa-flake-shadow: 0 0 0 1px rgb(145 160 175 / 0.4), 0 1px 5px rgb(45 55 65 / 0.16);
  --wa-flake-star: #8FAEC4;
}

/* ---------- 02. WINTER DARK (designed separately, not an inversion) ---- */
:root[data-winter][data-theme="dark"] {
  --burgundy: #222B34;           /* Pine Night — the evening canvas */
  --pink: #C9D6E0;               /* Night Frost — snow-lit, calmer than Frost in the dark */
  --beige: #E3E8ED;              /* Snow ink */
  --burgundy-rgb: 34 43 52;
  --pink-rgb: 201 214 224;
  --beige-rgb: 227 232 237;
  --cream: #2A3540;
  --pink-soft: #33414D;

  --bg: #222B34;
  --surface: #2B3640;            /* a breath lighter than Pine, cozy rather than black */
  --surface-sunk: #1E262E;
  --ink: #E3E8ED;
  --ink-2: rgb(var(--beige-rgb) / 0.84);
  --ink-3: rgb(var(--beige-rgb) / 0.68);
  --line: rgb(var(--pink-rgb) / 0.15);
  --line-2: rgb(var(--pink-rgb) / 0.32);
  --accent-soft: rgb(var(--pink-rgb) / 0.15);
  --tint-bg: #304050;            /* the soft “tint” card (workout) — deep frosted slate */
  --tint-ink: #E3E8ED;
  --tint-chip: rgb(var(--pink-rgb) / 0.12);
  --nav-bg: #2E3A45;
  --toggle-track: #33414D;
  --header-bg: rgb(34 43 52 / 0.8);
  --focus-halo: rgb(var(--wa-icy-rgb) / 0.32);

  --shadow-sm:
    0 0 0 1px rgb(var(--pink-rgb) / 0.05),
    0 14px 34px -22px rgb(8 12 16 / 0.8);
  --shadow-lg:
    0 0 0 1px rgb(var(--pink-rgb) / 0.08),
    0 34px 70px -32px rgb(8 12 16 / 0.9);
  --jd-shadow-press: 0 0 0 1px rgb(var(--pink-rgb) / 0.08), 0 6px 14px -8px rgb(8 12 16 / 0.8);
  --jd-highlight: inset 0 1px 0 rgb(var(--pink-rgb) / 0.07);
  --jd-glow-1: rgb(var(--wa-icy-rgb) / 0.08);
  --jd-glow-2: rgb(var(--wa-stone-rgb) / 0.05);
  --jd-ring: 0 0 0 3px var(--bg), 0 0 0 5px var(--focus-ring), 0 0 0 9px rgb(var(--wa-icy-rgb) / 0.2);
  --jd-line-soft: rgb(var(--pink-rgb) / 0.1);
  --ds-attn-bg: rgb(var(--pink-rgb) / 0.12);

  --wa-card-bg: linear-gradient(130deg, rgb(52 66 79 / 0.95) 0%, rgb(43 54 64 / 0.94) 55%, rgb(48 62 75 / 0.94) 100%);
  --wa-card-line: rgb(var(--pink-rgb) / 0.14);
  --wa-capsule-line: rgb(var(--wa-icy-rgb) / 0.32);
  --wa-capsule-bg: rgb(var(--wa-icy-rgb) / 0.06);
  --wa-num: #EAF2F8;
  --wa-track: rgb(var(--pink-rgb) / 0.12);
  --wa-fill: linear-gradient(90deg, #7F93A6, var(--wa-icy));
  --wa-spark: var(--wa-icy);
  --wa-ornament: rgb(var(--wa-icy-rgb) / 0.16);
  --wa-flake: rgb(var(--white-rgb) / 0.82);
  --wa-flake-shadow: 0 0 6px rgb(var(--wa-icy-rgb) / 0.55);
  --wa-flake-star: rgb(var(--white-rgb) / 0.8);
}

/* ---------- 03. ATMOSPHERE --------------------------------------------- */
/* Same grain as before, re-tinted from burgundy to Pine. */
:root[data-winter] {
  --jd-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.22 0 0 0 0 0.26 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-winter] ::selection { background: rgb(var(--wa-icy-rgb) / 0.75); color: var(--wa-pine); }
:root[data-winter][data-theme="dark"] .site-header.is-scrolled::before { box-shadow: 0 10px 30px -20px rgb(8 12 16 / 0.85); }
:root[data-winter][data-theme="dark"] .sheet__inner { box-shadow: var(--jd-highlight), 0 40px 90px -36px rgb(6 10 14 / 0.95); }
:root[data-winter][data-theme="dark"] .hero,
:root[data-winter][data-theme="dark"] .details { box-shadow: 0 30px 70px -40px rgb(6 10 14 / 0.9); }
:root[data-winter] .day-switch__indicator { box-shadow: inset 0 1px 0 rgb(var(--white-rgb) / 0.5), 0 6px 16px -10px rgb(8 12 16 / 0.55); }
:root[data-winter] .wish-dialog::backdrop { background: rgb(18 24 30 / 0.55); }
:root[data-winter] .account-modal,
:root[data-winter] .account-warning { background: rgb(18 24 30 / 0.7); }
:root[data-winter] .viewer-journal-privacy { background: rgb(18 24 30 / 0.58); }

/* ---------- 04. FIXED COLOURS IN EXISTING COMPONENTS -------------------- */
/* Welcome panels (Marjorie + Scotty) */
:root[data-winter] .scotty-hello { background: linear-gradient(125deg, var(--cream), var(--pink-soft)); }
:root[data-winter][data-theme="dark"] .scotty-hello { background: linear-gradient(125deg, #2F3B47, #27313B); }
:root[data-winter][data-theme="dark"] .scotty-hello h2 { color: #EAF0F5; }

/* “Something special is coming” keeps its layout; only its tints cool down. */
:root[data-winter] .joy-upcoming__sparkle { color: var(--wa-spark); }
:root[data-winter] .joy-event__icon { background: var(--pink-soft); color: var(--wa-pine); }
:root[data-winter][data-theme="dark"] .joy-event { background: rgb(var(--pink-rgb) / 0.05); border-color: rgb(var(--pink-rgb) / 0.1); }
:root[data-winter][data-theme="dark"] .joy-event__unit { background: rgb(var(--pink-rgb) / 0.08); }
:root[data-winter][data-theme="dark"] .joy-event__today { color: #DCEBF5; }
:root[data-winter][data-theme="dark"] .joy-event__icon { background: rgb(var(--pink-rgb) / 0.12); color: var(--ink); }

/* Today’s activities tiles: the warm pinks become cool snow tones (same structure). */
:root[data-winter] .act--german       { --act-a: #E9EEF2; --act-c: var(--pink); --act-tile: #F4F7F9; }
:root[data-winter] .act--design       { --act-a: #E3EAF1; --act-c: #B9CCDA; --act-tile: #F2F6F9; }
:root[data-winter] .act--illustration { --act-a: #EAE7E3; --act-c: var(--wa-stone); --act-tile: #F6F4F2; }

/* Wishlist category art follows the design-system token mixes (already winter);
   only the fixed icon colour in dark mode needs the winter ink. */
:root[data-winter][data-theme="dark"] .wish-art { color: var(--wa-pine); }

/* Plans & appointment category icons: softened to the winter family. */
:root[data-winter] .plan--vet .plan__icon,
:root[data-winter] .plan--nails .plan__icon { background: #E6E3EA; }
:root[data-winter] .plan--facial .plan__icon { background: #E1E8EF; }
:root[data-winter] .plan--hair .plan__icon { background: #ECE6DF; }
:root[data-winter] .plan--medical .plan__icon { background: #DCE8EC; }
:root[data-winter] .plan--care .plan__icon { background: #E3EAE6; }

/* Error / attention text: Berry instead of the warm reds (AA on light surfaces). */
:root[data-winter] .wish-form-error,
:root[data-winter] .account-error { color: var(--wa-berry) !important; }
:root[data-winter] .ch-status.is-error { color: var(--wa-berry); }
:root[data-winter][data-theme="dark"] .ch-status.is-error,
:root[data-winter][data-theme="dark"] .save-confirm__error { color: #F0C9CC; }
:root[data-winter][data-theme="dark"] .ch-card { background: linear-gradient(140deg, var(--surface), #263039); }

/* Celebration days keep their exact original look. The Today hero on
   Christmas, New Year's Eve/Day, Valentine's Day, birthdays, the anniversary
   and holidays switches back to the original brand colours (its artwork,
   confetti and text are unchanged), in both Light and Dark. */
:root[data-winter] .hero:is(.hero--christmas, .hero--newyear, .hero--newday, .hero--valentine, .hero--birthday, .hero--celebrate) {
  --burgundy: #4B1923; --pink: #EBC8CD; --beige: #F0E6E1; --cream: #FBF4EA;
  --burgundy-rgb: 75 25 35; --pink-rgb: 235 200 205; --beige-rgb: 240 230 225;
  --feature-bg: var(--burgundy); --feature-ink: var(--beige); --feature-hi: var(--pink);
  --feature-chip-bg: var(--pink); --feature-chip-ink: var(--burgundy);
}
:root[data-winter][data-theme="dark"] .hero:is(.hero--christmas, .hero--newyear, .hero--newday, .hero--valentine, .hero--birthday, .hero--celebrate) {
  --feature-bg: var(--pink); --feature-ink: var(--burgundy); --feature-hi: var(--burgundy);
  --feature-chip-bg: var(--burgundy); --feature-chip-ink: var(--pink);
  --bg: var(--burgundy); --ink: var(--beige);
  box-shadow: 0 30px 70px -40px rgb(10 2 5 / 0.9);
}

/* ---------- 05. WINTER ARC COUNTDOWN CARD ------------------------------ */
/* Sibling of the launch countdown: same capsule, same display numerals,
   same small uppercase unit label and twinkling corner sparkle — in frost. */
.wa-arc { display: none; }
:root[data-winter] .wa-arc {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "count head"
    "count quote"
    "count progress";
  column-gap: clamp(24px, 3.6vw, 52px);
  row-gap: 10px;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(22px, 3vw, 36px) clamp(22px, 3.4vw, 44px);
  background: var(--wa-card-bg);
  border: 1px solid var(--wa-card-line);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
  backdrop-filter: saturate(1.2) blur(14px);
}
:root[data-winter] .wa-arc[hidden] { display: none; }

/* Decorative snowflake, faint and cropped like the hero's rings */
.wa-arc__ornament {
  position: absolute;
  z-index: -1;
  right: clamp(-70px, -4vw, -30px);
  top: 50%;
  width: clamp(190px, 24vw, 290px);
  height: auto;
  transform: translateY(-50%) rotate(8deg);
  color: var(--wa-ornament);
  pointer-events: none;
}
.wa-arc__ornament path { fill: none; stroke: currentColor; stroke-width: 1.25px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }

.wa-arc__head { grid-area: head; align-self: end; display: grid; gap: 6px; }
.wa-arc__eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); margin: 0; }
.wa-arc__eyebrow svg { width: 15px; height: 15px; color: var(--wa-spark); flex: none; }

/* The capsule — modelled on .prelaunch__countdown */
.wa-arc__count {
  grid-area: count;
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-width: clamp(132px, 15vw, 188px);
  padding: clamp(16px, 2vw, 24px) clamp(18px, 2.4vw, 30px);
  border-radius: 22px;
  border: 1.5px solid var(--wa-capsule-line);
  background: var(--wa-capsule-bg);
  box-shadow: 0 8px 30px rgb(var(--burgundy-rgb) / 0.07), inset 0 1px 0 rgb(var(--white-rgb) / 0.5);
  color: var(--wa-num);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
:root[data-theme="dark"] .wa-arc__count { box-shadow: 0 10px 30px -10px rgb(6 10 14 / 0.5), inset 0 1px 0 rgb(var(--white-rgb) / 0.06); }
.wa-arc__count::after {
  content: "❄";
  position: absolute;
  right: 14px;
  top: -13px;
  padding: 0 4px;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--wa-spark);
  animation: jorieTwinkle 3.6s ease-in-out infinite;   /* same twinkle as the launch sparkle */
  pointer-events: none;
}
.wa-arc__num {
  display: block;
  font: 750 clamp(3.2rem, 2.2rem + 3.6vw, 5.6rem)/0.92 var(--font-display);
  font-variation-settings: "SOFT" 100, "WONK" 0;
  letter-spacing: -0.05em;
}
.wa-arc__unit {
  display: block;
  font: 600 clamp(0.62rem, 0.56rem + 0.3vw, 0.74rem)/1.15 var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}

.wa-arc__quote {
  grid-area: quote;
  margin: 0;
  max-width: 34ch;
  font: italic 400 var(--fs-xl)/1.22 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: pretty;
}

/* Time elapsed — purely informational */
.wa-arc__progress { grid-area: progress; align-self: start; display: grid; gap: 8px; max-width: 560px; margin-top: 6px; }
.wa-arc__track { position: relative; height: 6px; border-radius: 999px; background: var(--wa-track); overflow: hidden; }
.wa-arc__fill {
  position: absolute; inset: 0 auto 0 0;
  width: var(--wa-progress, 0%);
  min-width: 6px;
  border-radius: inherit;
  background: var(--wa-fill);
  transition: width 900ms var(--ease-out);
}
.wa-arc__legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.wa-arc__legend strong { font-weight: 600; color: var(--ink-2); }

/* ---------- 06. SEASONAL WELCOME LINE ---------------------------------- */
.wa-hello { display: none; }
:root[data-winter] .wa-hello {
  display: flex;
  align-items: baseline;
  gap: 8px;
  max-width: 52ch;
  margin: 10px 0 0;
  font: italic 400 var(--fs-md)/1.45 var(--font-display);
  color: var(--ink-2);
  opacity: 1;
}
:root[data-winter] .wa-hello[hidden] { display: none; }
.wa-hello__flake { flex: none; font-style: normal; font-size: 0.85em; color: var(--wa-spark); transform: translateY(-1px); }

/* ---------- 07. WINTER SNOWFALL ---------------------------------------- */
/* A short (≈7 s), light, CSS-only flurry. Fixed and pointer-events: none,
   so it never moves or blocks anything; removed from the page afterwards. */
.wa-snow {
  position: fixed;
  inset: 0;
  z-index: 90;               /* same layer as the existing confetti, which always wins */
  pointer-events: none;
  overflow: hidden;
  contain: strict;
  animation: waSnowLayer 7.2s linear both;
}
.wa-snow i {
  position: absolute;
  left: var(--x);
  top: -3vh;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: var(--wa-flake);
  box-shadow: var(--wa-flake-shadow);
  opacity: 0;
  animation: waFlake var(--d) cubic-bezier(.37, .1, .55, .9) var(--delay) both;
  will-change: transform, opacity;
}
.wa-snow i.wa-snow__star {
  border-radius: 0;
  background: none;
  box-shadow: none;
  width: calc(var(--s) * 2.4);
  height: calc(var(--s) * 2.4);
  color: var(--wa-flake-star);
}
.wa-snow i.wa-snow__star svg { display: block; width: 100%; height: 100%; }
.wa-snow i.wa-snow__star path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@keyframes waFlake {
  0%   { transform: translate3d(0, -4vh, 0) rotate(0deg); opacity: 0; }
  12%  { opacity: 1; }
  80%  { opacity: 0.9; }
  100% { transform: translate3d(var(--drift), 104vh, 0) rotate(var(--spin)); opacity: 0; }
}
@keyframes waSnowLayer { 0%, 86% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- 08. SMALL SCREENS & REDUCED MOTION ------------------------- */
@media (max-width: 1023px) {
  .wa-arc__ornament { top: -34px; right: -48px; width: 170px; transform: rotate(8deg); }
}
@media (max-width: 759px) {
  :root[data-winter] .wa-arc {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "count" "quote" "progress";
    row-gap: 14px;
  }
  .wa-arc__count {
    justify-self: start;
    grid-auto-flow: column;
    align-items: baseline;
    justify-items: start;
    gap: 12px;
    min-width: 0;
    padding: 14px 20px 14px 18px;
  }
  .wa-arc__unit { white-space: nowrap; }
  .wa-arc__progress { margin-top: 2px; }
  .wa-arc__ornament { top: -28px; width: 150px; right: -46px; opacity: 0.8; }
}
@media (max-width: 359px) {
  .wa-arc__count { grid-auto-flow: row; justify-items: start; gap: 6px; }
  .wa-arc__legend { flex-wrap: wrap; row-gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .wa-arc__count::after { animation: none; }
  .wa-arc__fill { transition: none; }
  .wa-snow { display: none !important; }
}
@media print { .wa-snow, .wa-arc__ornament { display: none !important; } }
