/* Taskly — graphics: aurora background, pointer glow, sign-in showcase,
 * Pulse rhythm chart, Focus motes, greeting sky and small illustrations.
 * Loaded last. Every animation is listed in the reduced-motion block at the end.
 */

/* ============================================================== Aurora */
body::before { display: none; }           /* replaced by the moving aurora below */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; border-radius: 50%; will-change: transform; }
.aurora i:nth-child(1) { width: 62vmax; height: 62vmax; right: -22vmax; top: -30vmax; background: radial-gradient(closest-side, rgba(52, 208, 207, 0.16), transparent 70%); animation: aurora-a 34s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 54vmax; height: 54vmax; left: 18vmax; top: -34vmax; background: radial-gradient(closest-side, rgba(161, 73, 212, 0.11), transparent 70%); animation: aurora-b 42s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { width: 66vmax; height: 66vmax; right: -26vmax; bottom: -40vmax; background: radial-gradient(closest-side, rgba(44, 88, 221, 0.12), transparent 70%); animation: aurora-c 48s ease-in-out infinite alternate; }
:root[data-theme="dark"] .aurora i:nth-child(1) { background: radial-gradient(closest-side, rgba(52, 208, 207, 0.13), transparent 70%); }
:root[data-theme="dark"] .aurora i:nth-child(2) { background: radial-gradient(closest-side, rgba(161, 73, 212, 0.16), transparent 70%); }
:root[data-theme="dark"] .aurora i:nth-child(3) { background: radial-gradient(closest-side, rgba(68, 104, 230, 0.20), transparent 70%); }
@keyframes aurora-a { to { transform: translate(-14vmax, 10vmax) scale(1.15); } }
@keyframes aurora-b { to { transform: translate(16vmax, 8vmax) scale(0.9); } }
@keyframes aurora-c { to { transform: translate(-18vmax, -12vmax) scale(1.1); } }

/* A soft light that trails the pointer, seen in the gaps between cards. */
.cursor-aura {
  position: fixed; left: 0; top: 0; z-index: -1; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%;
  pointer-events: none; opacity: 0; transition: opacity 600ms ease; will-change: transform;
  background: radial-gradient(closest-side, rgba(44, 88, 221, 0.10), rgba(52, 208, 207, 0.05) 45%, transparent 70%);
}
:root[data-theme="dark"] .cursor-aura { background: radial-gradient(closest-side, rgba(143, 168, 255, 0.13), rgba(52, 208, 207, 0.06) 45%, transparent 70%); }
.cursor-aura.on { opacity: 1; }
@media (hover: none), (pointer: coarse) { .cursor-aura { display: none; } }

/* ===================================================== Sign-in showcase */
.auth-show { display: none; }
@media (min-width: 980px) {
  body.locked .auth-gate { grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr); gap: 0; padding: 0; place-items: stretch; }
  body.locked .auth-gate .auth-card { align-self: center; justify-self: center; margin: 24px; }
  body.locked .auth-show {
    position: relative; display: grid; align-content: center; padding: 64px clamp(40px, 6vw, 96px); overflow: hidden; color: #fff;
    background: linear-gradient(135deg, #0B1030 0%, #18257A 34%, #2C58DD 62%, #6F3CC2 100%);
    background-size: 160% 160%; animation: hero-pan 18s ease-in-out infinite alternate;
  }
}
.auth-show::before, .auth-show::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.auth-show::before { width: 520px; height: 520px; right: -160px; top: -200px; background: radial-gradient(closest-side, rgba(52, 208, 207, 0.55), transparent 70%); animation: drift 14s ease-in-out infinite; }
.auth-show::after { width: 420px; height: 420px; left: -140px; bottom: -220px; background: radial-gradient(closest-side, rgba(251, 189, 8, 0.38), transparent 70%); animation: drift 19s ease-in-out infinite reverse; }
.auth-stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-show-text { position: relative; z-index: 2; max-width: 520px; }
.auth-kicker { margin: 0 0 14px; font-family: var(--display); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.8rem; opacity: 0.85; }
.auth-headline { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(2.2rem, 4.2vw, 3.6rem); line-height: 1.06; letter-spacing: -0.03em; animation: rise-in 700ms cubic-bezier(0.2, 0.8, 0.2, 1) 120ms backwards; }
.auth-headline span { background: linear-gradient(90deg, #7FE6E5, #FBBD08); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { margin: 18px 0 0; font-size: 1.05rem; line-height: 1.55; max-width: 44ch; opacity: 0.9; animation: rise-in 700ms cubic-bezier(0.2, 0.8, 0.2, 1) 260ms backwards; }
.auth-float {
  position: absolute; z-index: 2; display: grid; gap: 8px; padding: 14px 16px; border-radius: 18px; color: #fff;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.24); backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(5, 8, 30, 0.35); animation: bob 7s ease-in-out infinite;
}
.auth-float.f1 { right: 7%; top: 12%; max-width: 280px; }
.auth-float.f2 { right: 16%; bottom: 13%; grid-template-columns: auto 1fr; align-items: center; gap: 12px; animation-duration: 9s; animation-delay: -3s; }
.auth-float.f3 { left: clamp(40px, 6vw, 96px); bottom: 9%; width: 190px; animation-duration: 8s; animation-delay: -5s; }
@keyframes bob { 50% { transform: translateY(-14px) rotate(-1deg); } }
.af-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; }
.af-quote { font-size: 0.95rem; line-height: 1.35; }
.af-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.af-chips b { font-size: 0.7rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.2); animation: chip-in 500ms cubic-bezier(0.2, 1.3, 0.4, 1) backwards; }
.af-chips b:nth-child(1) { animation-delay: 900ms; } .af-chips b:nth-child(2) { animation-delay: 1100ms; }
.af-chips b:nth-child(3) { animation-delay: 1300ms; } .af-chips b:nth-child(4) { animation-delay: 1500ms; }
.af-chips b.hi { background: rgba(244, 114, 52, 0.55); } .af-chips b.te { background: rgba(52, 208, 207, 0.45); } .af-chips b.pu { background: rgba(161, 73, 212, 0.6); }
.af-ring { width: 52px; height: 52px; }
.af-ring circle { fill: none; stroke: rgba(255, 255, 255, 0.25); stroke-width: 6; }
.af-ring .arc { stroke: #FBBD08; stroke-linecap: round; stroke-dasharray: 163.4; animation: ring-spin 9s linear infinite; }
@keyframes ring-spin { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 163.4; } }
.auth-float.f2 strong { display: block; font-family: var(--display); }
.auth-float.f2 em { font-style: normal; font-size: 0.78rem; opacity: 0.85; }
.af-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; align-items: end; height: 54px; }
.af-bars i { height: var(--h); border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, #7FE6E5, rgba(255, 255, 255, 0.6)); transform-origin: bottom; animation: bar-breathe 3.6s ease-in-out infinite; }
.af-bars i:nth-child(2n) { animation-delay: -1.2s; } .af-bars i:nth-child(3n) { animation-delay: -2.1s; }
@keyframes bar-breathe { 50% { transform: scaleY(0.72); } }
body.locked .auth-card { animation: rise-in 600ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }

/* ========================================================= Pulse rhythm */
.rhythm { position: relative; width: 100%; }
.rhythm svg { display: block; width: 100%; height: auto; overflow: visible; }
.rhythm .grid line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; }
.rhythm .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.rhythm .line { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-line 1400ms cubic-bezier(0.3, 0.7, 0.2, 1) 120ms forwards; }
.rhythm .line.cap { stroke: var(--accent); }
.rhythm .line.done { stroke: var(--done-yellow, #FBBD08); animation-delay: 360ms; }
.rhythm .area { animation: area-in 900ms ease 700ms backwards; }
.rhythm .dot { stroke: var(--surface); stroke-width: 2; animation: heat-pop 420ms cubic-bezier(0.2, 1.3, 0.4, 1) backwards; animation-delay: calc(900ms + var(--i) * 40ms); transform-box: fill-box; transform-origin: center; }
.rhythm .dot.cap { fill: var(--accent); } .rhythm .dot.done { fill: var(--done-yellow, #FBBD08); }
.rhythm .hit { fill: transparent; cursor: default; }
.rhythm .hit:hover + .guide { opacity: 1; }
.rhythm .guide { opacity: 0; pointer-events: none; transition: opacity 160ms ease; }
.rhythm .guide line { stroke: var(--border-strong); stroke-width: 1; }
.rhythm .guide rect { fill: var(--text); }
.rhythm .guide text { fill: var(--surface); font-size: 11px; font-weight: 600; font-family: var(--font); }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes area-in { from { opacity: 0; } }

/* ========================================================== Focus motes */
.focus-motes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 800ms ease; }
.focus-stage[data-state="running"] .focus-motes { opacity: 1; }
.focus-stage[data-state="running"] .focus-dial { filter: drop-shadow(0 0 22px rgba(52, 208, 207, 0.35)); }
.focus-stage[data-state="done"] .focus-dial { animation: dial-done 900ms cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes dial-done { 40% { transform: scale(1.07); filter: drop-shadow(0 0 30px rgba(251, 189, 8, 0.6)); } }

/* ============================================================== Greeting */
.sky { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: 6px; vertical-align: -6px; }
.sky svg { width: 26px; height: 26px; overflow: visible; }
.sky .rays { transform-origin: 13px 13px; animation: spin-slow 18s linear infinite; }
.sky .star { animation: twinkle 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.sky .star:nth-child(3) { animation-delay: -0.8s; } .sky .star:nth-child(4) { animation-delay: -1.6s; }
.sky .moon { animation: bob-small 5s ease-in-out infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes twinkle { 50% { opacity: 0.25; transform: scale(0.6); } }
@keyframes bob-small { 50% { transform: translateY(-1.5px); } }

/* ============================================== Illustrations and touches */
/* Empty lists get a small drawn mark instead of bare text. */
.empty.small::before, .mx-empty::before {
  content: ""; display: block; width: 46px; height: 46px; margin: 0 auto 8px; animation: bob-small 4.5s ease-in-out infinite;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='24' cy='26' r='15' fill='%232C58DD' fill-opacity='.10'/%3E%3Cpath d='M12 27l5-10h14l5 10v8a2 2 0 0 1-2 2H14a2 2 0 0 1-2-2z' stroke='%232C58DD' stroke-width='2.2'/%3E%3Cpath d='M12 27h7l2 3.500h6l2-3.500h7' stroke='%232C58DD' stroke-width='2.2'/%3E%3Cpath d='M24 4v5M21.500 6.500h5' stroke='%23FBBD08' stroke-width='2.2'/%3E%3Cpath d='M38 9v4M36 11h4' stroke='%2334D0CF' stroke-width='2'/%3E%3Cpath d='M9 10v3M7.500 11.500h3' stroke='%23A149D4' stroke-width='2'/%3E%3C/svg%3E");
}
/* The welcome header moves, with two soft lights. */
.welcome-art { background-size: 180% 180%; animation: hero-pan 12s ease-in-out infinite alternate; overflow: hidden; }
.welcome-art::before { content: ""; position: absolute; width: 150px; height: 150px; left: 8%; top: -70px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, 0.4), transparent 70%); animation: drift 9s ease-in-out infinite; }
/* Home tiles: the icon chip reacts on hover. */
button.stat .tone-chip, button.tile .icon, button.tile .tone-chip { transition: transform 320ms cubic-bezier(0.2, 1.4, 0.4, 1); }
button.stat:hover .tone-chip, button.tile:hover .tone-chip { transform: rotate(-8deg) scale(1.12); }
button.tile:hover > .icon { transform: scale(1.14); }
/* Ticking a task off draws the tick. */
.completing button.check { animation: check-pop 420ms cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes check-pop { 40% { transform: scale(1.28); } }
/* Sidebar badges with something overdue pulse gently. */
.badge.alert { animation: badge-pulse 2.6s ease-in-out infinite; }
@keyframes badge-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger-fill, #E5484D) 18%, transparent); } }
/* Page titles underline themselves in brand colours. */
.page-header h1 { position: relative; display: inline-block; }
.page-header h1::after { content: ""; position: absolute; left: 0; bottom: -6px; height: 3px; width: 46px; border-radius: 3px; background: linear-gradient(90deg, #2C58DD, #34D0CF, #A149D4); transform-origin: left; animation: grow-x 700ms cubic-bezier(0.2, 0.8, 0.2, 1) 120ms backwards; }

@media (prefers-reduced-motion: reduce) {
  .aurora i, .auth-show, .auth-show::before, .auth-show::after, .auth-headline, .auth-sub, .auth-float, .af-chips b,
  .af-ring .arc, .af-bars i, body.locked .auth-card, .rhythm .area, .rhythm .dot, .sky .rays, .sky .star, .sky .moon,
  .empty.small::before, .mx-empty::before, .welcome-art, .welcome-art::before, .completing button.check,
  .badge.alert, .page-header h1::after, .focus-stage[data-state="done"] .focus-dial { animation: none !important; }
  .rhythm .line { animation: none !important; stroke-dashoffset: 0; }
  .cursor-aura { display: none; }
}
