/* ---------------------------------------------------------------------------
   Motion — shared keyframes and utilities. See MOTION.md.
   --------------------------------------------------------------------------- */

@property --num { syntax: '<integer>'; inherits: false; initial-value: 0; }
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* 01 · Scroll reveal. Animates `translate` so it never fights a card's hover `transform`. */
@keyframes reveal-rise {
    from { opacity: 0; translate: 0 18px; }
    to { opacity: 1; translate: none; }
}

@supports (animation-timeline: view()) {
    .reveal { animation: reveal-rise linear both; animation-timeline: view(); animation-range: entry 0% cover 26%; }
    .reveal-d1 { animation-range: entry 8% cover 32%; }
    .reveal-d2 { animation-range: entry 16% cover 38%; }
}

/* 02 · Heading entrance and the signature full stop */
.word-in {
    display: inline-block;
    opacity: 0;
    animation: word-in .6s var(--ease-out) forwards;
    animation-delay: calc(var(--i) * 70ms);
}

@keyframes word-in {
    from { opacity: 0; transform: translateY(.35em); filter: blur(6px); }
    to { opacity: 1; transform: none; filter: blur(0); }
}

.brand-dot {
    display: inline-block;
    animation: dot-glow 3.2s ease-in-out infinite;
}

h1 .brand-dot {
    opacity: 0;
    animation: dot-pop .5s cubic-bezier(.3, 1.6, .5, 1) forwards, dot-glow 3.2s ease-in-out infinite;
    animation-delay: var(--dot-delay, 620ms), calc(var(--dot-delay, 620ms) + .6s);
}

@keyframes dot-pop {
    0% { opacity: 0; transform: scale(0); }
    70% { opacity: 1; transform: scale(1.45); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes dot-glow {
    0%, 100% { text-shadow: 0 0 0 rgba(255, 140, 0, 0); }
    50% { text-shadow: 0 0 14px rgba(255, 140, 0, .55); }
}

/* 03 · Restart affordance */
.spin-once { animation: spin-once .8s var(--ease-out); }

@keyframes spin-once {
    to { transform: rotate(360deg); }
}

/* 04 · Count-up numbers */
.count-up { --num: 0; counter-reset: n var(--num); font-variant-numeric: tabular-nums; }
.count-up::after { content: counter(n); }

@supports (animation-timeline: view()) {
    .count-up { animation: count-to 1.2s var(--ease-out) both; animation-timeline: view(); animation-range: entry 10% cover 30%; }
}

@supports not (animation-timeline: view()) {
    .count-up { animation: count-to 1.2s var(--ease-out) both; }
}

@keyframes count-to {
    to { --num: var(--to); }
}

.tick-window { display: inline-block; overflow: hidden; vertical-align: bottom; }
.tick-in { display: inline-block; animation: tick-in .45s var(--ease-out); }

@keyframes tick-in {
    from { opacity: 0; transform: translateY(60%); }
    to { opacity: 1; transform: none; }
}

/* 05 · Spotlight cards. The glow sits under the card's content inside its own stacking context. */
[data-spotlight] {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    transition: transform .25s var(--ease-out), box-shadow .25s;
}

[data-spotlight]:hover,
[data-spotlight]:has(:focus-visible) {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(59, 79, 245, .12);
}

[data-spotlight] .spotlight {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 140, 0, .14), transparent 65%);
}

[data-spotlight]:hover .spotlight { opacity: 1; }

.theme-dark [data-spotlight] .spotlight {
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 140, 0, .10), transparent 65%);
}

[data-spotlight]:hover .progress-line-fill,
[data-spotlight]:has(:focus-visible) .progress-line-fill { transform: scaleX(1); }

[data-spotlight]:hover .arrow-link-circle,
[data-spotlight]:has(:focus-visible) .arrow-link-circle { transform: translateX(3px); }

/* 09 · Service illustrations float on card hover */
.card-art { transition: transform .4s var(--ease-out); }

[data-spotlight]:hover .card-art,
[data-spotlight]:has(:focus-visible) .card-art { transform: translateY(-4px) rotate(-1.5deg); }

/* 06 · Animated border. Hover cards keep their resting border width so nothing shifts. */
@keyframes border-spin {
    to { --ang: 360deg; }
}

.sweep-border { border: 1.5px solid transparent; }

.sweep-border,
.sweep-on-hover:hover {
    border-color: transparent;
    background:
        linear-gradient(var(--card-fill, var(--panel-bg)), var(--card-fill, var(--panel-bg))) padding-box,
        conic-gradient(from var(--ang), transparent 0deg, transparent 240deg, var(--snappy-orange) 320deg, transparent 360deg) border-box,
        linear-gradient(var(--panel-border), var(--panel-border)) border-box;
    animation: border-spin 3.5s linear infinite;
}

.sweep-on-hover:hover { animation-duration: 2.5s; }

/* 07 · Frosted sticky header */
.site-header {
    border-bottom: 1px solid transparent;
    transition: background-color .3s, border-color .3s, box-shadow .3s, backdrop-filter .3s;
}

.site-header.is-scrolled {
    background: rgba(255, 255, 255, .72);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
    backdrop-filter: blur(14px) saturate(1.5);
    border-bottom-color: rgba(233, 236, 243, .95);
    box-shadow: 0 6px 20px rgba(40, 50, 110, .06);
}

.theme-dark .site-header.is-scrolled {
    background: rgba(18, 20, 28, .72);
    border-bottom-color: rgba(255, 255, 255, .08);
}

/* 08 · View transitions */
@view-transition { navigation: auto; }

::view-transition-group(*) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .25s; }

/* Reduced motion: nothing moves, nothing stays hidden */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal { animation: none; }
    .count-up { animation: none; --num: var(--to); }
    .word-in, h1 .brand-dot { opacity: 1; animation: none; }
}
