/* ==========================================================================
   JORIE DAILY — web-design.css · Phase 33.4
   Web Design Practice: the activity-card palette and artwork, plus the
   small completion reward. Everything here is ADDITIONAL and scoped to
   .act--webdesign / .act-art--webdesign / .wd-reward — no existing
   selector, keyframe or animation is changed. Loaded on Today and
   Calendar just BEFORE design-system.css (Phase 33.2 rule: design-system.css
   stays the last stylesheet); every selector here is unique to Web Design.
   Brand colours only: burgundy, pink, beige, white (+ the tokens built on
   them), so light and dark mode follow the site theme automatically.
   ========================================================================== */

/* ---- Card palette (same variables as German / Design / Illustration) ---- */
.act--webdesign {
  --act-a: color-mix(in srgb, var(--beige) 55%, var(--pink));
  --act-b: var(--burgundy);
  --act-c: color-mix(in srgb, var(--pink) 70%, var(--burgundy));
  --act-tile: color-mix(in srgb, var(--pink) 14%, var(--white));
}
:root[data-theme="dark"] .act--webdesign {
  --act-tile: rgb(var(--pink-rgb) / 0.09);
  --act-a: rgb(var(--pink-rgb) / 0.85);
  --act-c: var(--pink);
}

/* ---- Card artwork: a browser window, code lines, a heart ---- */
.act-art__code {
  fill: none;
  stroke: var(--act-b);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 0;
  opacity: 0.7;
  animation: wdType 5.4s var(--ease-in-out) infinite;
}
.act-art__twinkle {
  transform-box: fill-box;
  transform-origin: center;
  animation: wdTwinkle 3.2s var(--ease-in-out) infinite;
}
:root[data-theme="dark"] .act-art__code { stroke: var(--pink); }

@keyframes wdType { 0% { stroke-dashoffset: 24; } 45%, 100% { stroke-dashoffset: 0; } }
@keyframes wdTwinkle { 0%, 100% { transform: scale(0.7); opacity: 0.55; } 50% { transform: scale(1.1); opacity: 1; } }

/* ---- Completion reward: a tiny laptop pops up in the card's corner ----
   Bottom-right: after a completion that corner is empty (the "completed"
   pill, Change and "Add actual time" sit on the left), so it never covers
   the title, time or buttons.
   Added by js/script.js → webDesignReward() after a Web Design completion
   is saved on Today. ~2.8 s in total, then removed. Pure CSS. */
.wd-reward {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 2;
  width: 112px;
  height: 86px;
  padding: 4px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
  pointer-events: none;
  transform-origin: 85% 85%;
  animation: wdRewardLife 2.8s var(--ease-spring) both;
}
.wd-reward__svg { display: block; width: 100%; height: 100%; overflow: visible; }

.wd-reward__glow   { fill: rgb(var(--pink-rgb) / 0.45); }
.wd-reward__lid    { fill: var(--burgundy); }
.wd-reward__screen { fill: var(--white); }
.wd-reward__bar    { fill: none; stroke: rgb(var(--burgundy-rgb) / 0.18); stroke-width: 1.2; }
.wd-reward__dot    { fill: var(--pink); }
.wd-reward__base   { fill: color-mix(in srgb, var(--burgundy) 82%, var(--pink)); }
.wd-reward__code   { fill: none; stroke: var(--burgundy); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 26; stroke-dashoffset: 26; }
.wd-reward__code--2 { stroke: color-mix(in srgb, var(--pink) 55%, var(--burgundy)); }
.wd-reward__heart  { fill: var(--pink); stroke: var(--burgundy); stroke-width: 1.4; transform-box: fill-box; transform-origin: center; transform: scale(0); }
.wd-reward__spark  { fill: color-mix(in srgb, var(--pink) 75%, var(--burgundy)); transform-box: fill-box; transform-origin: center; transform: scale(0); opacity: 0; }

:root[data-theme="dark"] .wd-reward__glow   { fill: rgb(var(--pink-rgb) / 0.16); }
:root[data-theme="dark"] .wd-reward__lid    { fill: var(--pink); }
:root[data-theme="dark"] .wd-reward__screen { fill: var(--beige); }
:root[data-theme="dark"] .wd-reward__base   { fill: color-mix(in srgb, var(--pink) 70%, var(--beige)); }
:root[data-theme="dark"] .wd-reward__spark  { fill: var(--pink); }

/* Sequence: pop in → screen code types itself → heart → sparkle → fade */
.wd-reward__code--1 { animation: wdCode 420ms ease-out 360ms forwards; }
.wd-reward__code--2 { animation: wdCode 480ms ease-out 640ms forwards; }
.wd-reward__code--3 { animation: wdCode 360ms ease-out 980ms forwards; }
.wd-reward__heart   { animation: wdHeart 620ms var(--ease-spring) 1220ms forwards; }
.wd-reward__spark--1 { animation: wdSpark 900ms ease-out 1480ms forwards; }
.wd-reward__spark--2 { animation: wdSpark 900ms ease-out 1640ms forwards; }
.wd-reward__spark--3 { animation: wdSpark 800ms ease-out 1760ms forwards; }

@keyframes wdRewardLife {
  0%   { opacity: 0; transform: translateY(6px) scale(0.6); }
  12%  { opacity: 1; transform: translateY(0) scale(1); }
  84%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-4px) scale(0.92); }
}
@keyframes wdCode  { to { stroke-dashoffset: 0; } }
@keyframes wdHeart { 0% { transform: scale(0); } 70% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes wdSpark {
  0%   { transform: scale(0) rotate(0deg); opacity: 0; }
  45%  { transform: scale(1.15) rotate(20deg); opacity: 1; }
  100% { transform: scale(0.8) rotate(45deg); opacity: 0.85; }
}

@media (max-width: 519px) {
  .wd-reward { width: 80px; height: 62px; bottom: 8px; right: 8px; border-radius: 14px; }
}

/* Reduced motion: the script never adds the reward, and the card art is still. */
@media (prefers-reduced-motion: reduce) {
  .act-art__code, .act-art__twinkle { animation: none !important; }
  .wd-reward { display: none !important; }
}
