:root {
    color-scheme: dark;
}

html {
    scroll-behavior: smooth;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow-x: hidden;
}

section[id] {
    scroll-margin-top: 104px;
}

.dynamic-space-bg {
    position: relative;
    isolation: isolate;
}

.dynamic-space-bg::before,
.dynamic-space-bg::after {
    content: '';
    position: fixed;
    inset: -20%;
    z-index: -3;
    pointer-events: none;
    will-change: transform, filter;
}

.dynamic-space-bg::before {
    background:
        radial-gradient(circle at 22% 22%, rgba(91, 160, 255, 0.3), transparent 52%),
        radial-gradient(circle at 78% 18%, rgba(23, 114, 255, 0.26), transparent 56%),
        radial-gradient(circle at 52% 74%, rgba(36, 183, 255, 0.24), transparent 50%);
    animation: gradientShift 18s ease-in-out infinite alternate;
    filter: blur(6px);
}

.dynamic-space-bg::after {
    background:
        radial-gradient(circle at 62% 38%, rgba(179, 223, 255, 0.22), transparent 43%),
        radial-gradient(circle at 30% 78%, rgba(74, 147, 255, 0.2), transparent 46%);
    animation: gradientFlow 22s linear infinite;
}

.glass-card {
    position: relative;
    transform-style: preserve-3d;
    border: 1px solid rgba(136, 190, 255, 0.42);
    background:
        linear-gradient(150deg, rgba(15, 28, 58, 0.56), rgba(8, 19, 43, 0.74));
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow:
        inset 0 1px 0 rgba(232, 244, 255, 0.35),
        inset 0 -1px 0 rgba(140, 194, 255, 0.16),
        0 18px 60px rgba(0, 0, 0, 0.45);
}

.glass-card::before,
.glass-card::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
}

.glass-card::before {
    background:
        linear-gradient(128deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.03) 42%, transparent 54%);
    opacity: 0.8;
    mix-blend-mode: screen;
}

.glass-card::after {
    inset: -1px;
    border: 1px solid rgba(139, 220, 255, 0.5);
    box-shadow: 0 0 26px rgba(108, 182, 255, 0.35);
    opacity: 0.92;
}

.card-tilt {
    transform-style: preserve-3d;
    transition: transform 220ms cubic-bezier(.2, .65, .2, 1), box-shadow 220ms ease;
    will-change: transform;
}

.card-tilt.is-active {
    box-shadow:
        inset 0 1px 0 rgba(232, 244, 255, 0.48),
        inset 0 -1px 0 rgba(140, 194, 255, 0.23),
        0 25px 70px rgba(0, 0, 0, 0.52);
}

.card-content-layer {
    transform: translateZ(24px);
}

.floating-layer {
    position: absolute;
    pointer-events: none;
    border-radius: 999px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(148, 204, 255, 0.45);
    background: rgba(11, 31, 68, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 14px 35px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.floating-layer svg {
    width: 20px;
    height: 20px;
    color: rgba(198, 233, 255, 0.96);
}

.floating-layer.layer-a {
    width: 54px;
    height: 54px;
    top: 10%;
    left: 3%;
    animation: floatA 10s ease-in-out infinite;
}

.floating-layer.layer-b {
    width: 70px;
    height: 70px;
    top: 23%;
    right: 7%;
    animation: floatB 12s ease-in-out infinite;
}

.floating-layer.layer-c {
    width: 46px;
    height: 46px;
    bottom: 14%;
    left: 9%;
    animation: floatC 11s ease-in-out infinite;
}

.floating-layer.layer-d {
    width: 62px;
    height: 62px;
    bottom: 8%;
    right: 3%;
    animation: floatA 13s ease-in-out infinite reverse;
}

.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    opacity: 0.2;
    background-image:
        linear-gradient(rgba(107, 159, 230, 0.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(107, 159, 230, 0.18) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: radial-gradient(circle at center, black 20%, transparent 80%);
}

.star-field {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 15% 30%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 28% 76%, rgba(255, 255, 255, 0.56), transparent),
        radial-gradient(2px 2px at 55% 18%, rgba(220, 241, 255, 0.76), transparent),
        radial-gradient(1px 1px at 82% 22%, rgba(220, 241, 255, 0.5), transparent),
        radial-gradient(2px 2px at 73% 68%, rgba(255, 255, 255, 0.66), transparent),
        radial-gradient(1px 1px at 37% 58%, rgba(255, 255, 255, 0.44), transparent);
    opacity: 0.42;
}

@keyframes gradientShift {
    0% {
        transform: translate3d(-2%, -3%, 0) scale(1);
    }
    100% {
        transform: translate3d(2%, 2%, 0) scale(1.06);
    }
}

@keyframes gradientFlow {
    0% {
        transform: rotate(0deg) scale(1.02);
    }
    100% {
        transform: rotate(360deg) scale(1.06);
    }
}

@keyframes floatA {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -12px, 0);
    }
}

@keyframes floatB {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(-8px, -14px, 0);
    }
}

@keyframes floatC {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(8px, -10px, 0);
    }
}

@media (max-width: 900px) {
    .floating-layer.layer-b,
    .floating-layer.layer-d {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .dynamic-space-bg::before,
    .dynamic-space-bg::after,
    .floating-layer {
        animation: none !important;
    }

    .card-tilt {
        transition: none !important;
    }
}
