/* ============================================================
   Effects: canvas background, aurora, reveal, tilt, ticker,
   rainbow (LED) mode, toast. All motion is guarded by
   prefers-reduced-motion.
   ============================================================ */

.fx-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.aurora {
    position: fixed;
    inset: -20vh -10vw auto -10vw;
    height: 120vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    filter: blur(70px) saturate(130%);
    opacity: calc(var(--glow) * 1.1);
    -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent 86%);
    mask-image: linear-gradient(180deg, #000 45%, transparent 86%);
}
.aurora i {
    position: absolute;
    display: block;
    border-radius: 50%;
    mix-blend-mode: screen;
    will-change: transform;
}
html[data-theme="paper"] .aurora i { mix-blend-mode: multiply; }
.aurora .b1 { width: 46vw; height: 46vw; left: -6vw; top: -8vh; background: radial-gradient(circle, color-mix(in srgb, var(--c1) 55%, transparent), transparent 68%); animation: drift-a 26s ease-in-out infinite; }
.aurora .b2 { width: 40vw; height: 40vw; right: -4vw; top: 4vh; background: radial-gradient(circle, color-mix(in srgb, var(--c2) 50%, transparent), transparent 68%); animation: drift-b 31s ease-in-out infinite; }
.aurora .b3 { width: 36vw; height: 36vw; left: 34vw; top: 26vh; background: radial-gradient(circle, color-mix(in srgb, var(--c5) 45%, transparent), transparent 68%); animation: drift-c 37s ease-in-out infinite; }

.aurora { display: none; }
html.js .aurora { display: block; }
html[data-theme="mono"] .aurora { opacity: .35; }
html[data-theme="paper"] .aurora { opacity: .5; filter: blur(90px) saturate(120%); }

/* ---------------- Cursor spotlight ---------------- */
.fx-spot {
    position: fixed;
    left: 0;
    top: 0;
    width: 460px;
    height: 460px;
    margin: -230px 0 0 -230px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity .4s ease;
    background: radial-gradient(circle, color-mix(in srgb, var(--c1) 16%, transparent), transparent 60%);
    mix-blend-mode: screen;
}
html[data-theme="paper"] .fx-spot { mix-blend-mode: multiply; background: radial-gradient(circle, color-mix(in srgb, var(--c1) 9%, transparent), transparent 62%); }
.fx-spot[data-on="1"] { opacity: 1; }

/* ---------------- Scroll reveal ----------------
   Cards and text blocks start hidden and rise in when observed. The
   entrance is an animation (not a transition), so a stalled animation
   engine still leaves the content visible, and the pointer tilt keeps
   its own fast transform transition on the cards. */
.js .reveal, .js .tile { opacity: 0; }
.js .reveal.in, .js .tile.in { opacity: 1; animation: rise-in .6s cubic-bezier(.2, .7, .2, 1) calc(var(--d, 0) * 70ms) backwards; }
@keyframes rise-in { from { opacity: 0; transform: translateY(22px) scale(.985); } }

/* ---------------- Tile tilt ---------------- */
.js .tile { transition: transform .16s ease-out, border-color .2s ease, box-shadow .25s ease, background .2s ease; }
.js .tile > * { transform: translateZ(14px); }

/* ---------------- Keyframes ---------------- */
@keyframes drift-a { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(8vw, 6vh, 0) scale(1.15); } }
@keyframes drift-b { 0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); } 50% { transform: translate3d(-9vw, 10vh, 0) scale(.9); } }
@keyframes drift-c { 0%, 100% { transform: translate3d(0, 0, 0) scale(.95); } 50% { transform: translate3d(6vw, -8vh, 0) scale(1.2); } }

@keyframes ticker-run { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker:hover .ticker-track { animation-play-state: paused; }

@keyframes led-breathe {
    0%, 100% { opacity: .25; }
    50% { opacity: 1; }
}

@keyframes caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.rotator::after { content: ""; display: inline-block; width: .55em; height: 1em; margin-left: .18em; background: var(--c2); vertical-align: -.15em; animation: caret-blink 1.1s steps(1) infinite; }

/* ---------------- Rainbow / LED mode (easter egg) ---------------- */
html.led-mode .aurora i { animation-duration: 7s; }
html.led-mode .hero-title { animation: hue-spin 6s linear infinite; }
html.led-mode .ticker-track { animation-duration: 12s; }
html.led-mode .fx-spot { background: radial-gradient(circle, color-mix(in srgb, var(--c2) 22%, transparent), transparent 60%); }
html.led-mode .hero-chip .led { animation-duration: .7s; }
@keyframes hue-spin { to { filter: hue-rotate(360deg) drop-shadow(0 0 26px color-mix(in srgb, var(--c1) 45%, transparent)); } }

/* ---------------- Toast ---------------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translate(-50%, 20px);
    z-index: 60;
    padding: 11px 18px;
    border-radius: 999px;
    background: var(--bg-raised);
    border: 1px solid color-mix(in srgb, var(--c3) 55%, transparent);
    color: var(--text);
    font-family: var(--mono);
    font-size: .84rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    box-shadow: var(--shadow);
}
.toast[data-on="1"] { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
    .fx-bg, .aurora, .fx-spot { display: none; }
    .ticker-track { animation: none; }
    .hero-title { animation: none !important; }
    .rotator::after { animation: none; }
    .js .reveal { opacity: 1; transform: none; transition: none; }
    .js .tile { transform: none !important; transition: none; }
    .js .tile { opacity: 1; animation: none !important; }
    .hero-chip .led { animation: none; }
}
