:root {
    --primary-color: #2D5A27;
    --accent-color: #00e5ff;
    --bg-light: #f4f6f8;
    --bg-dark: #070d0a;
    --bs-primary: #2D5A27;
}

[data-bs-theme="dark"] {
    --bs-body-bg: var(--bg-dark);
    --bs-body-color: #f8f9fa;
    --bs-secondary-color: #ced4da;
}

[data-bs-theme="light"] {
    --bs-body-bg: var(--bg-light);
    --bs-body-color: #212529;
    --bs-secondary-color: #495057;
}

/* Light Mode Overrides for Navigation Elements Hardcoded as White */
[data-bs-theme="light"] .navbar-brand.text-white {
    color: var(--bs-body-color) !important;
}

[data-bs-theme="light"] .navbar .btn-link.text-white {
    color: var(--bs-body-color) !important;
}

body {
    font-family: 'Inter', sans-serif;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.font-display {
    font-family: 'Outfit', sans-serif;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-accent {
    color: var(--accent-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
    color: #fff;
}

.bg-accent {
    background-color: var(--accent-color) !important;
}

/* Custom Utilities */
.inset-0 {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.z-0 {
    z-index: 0;
}

.z-1 {
    z-index: 1;
}

.z-2 {
    z-index: 2;
}

.z-3 {
    z-index: 3;
}

/* Typography & Layout adjustments */
.brand-text {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

[data-bs-theme="dark"] .nav-brand-dev {
    color: var(--accent-color) !important;
}

[data-bs-theme="light"] .nav-brand-dev {
    color: var(--primary-color) !important;
}

[data-bs-theme="dark"] .h1-accent {
    color: var(--accent-color) !important;
    text-shadow: 0 0 20px rgba(64, 224, 208, 0.3);
}

[data-bs-theme="light"] .h1-accent {
    color: var(--primary-color) !important;
}

.hover-text-primary {
    transition: color 0.2s;
}

.hover-text-primary:hover {
    color: var(--primary-color) !important;
}

[data-bs-theme="dark"] .hover-text-primary:hover {
    color: var(--accent-color) !important;
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes drift {
    0% {
        transform: translateX(-5%);
    }

    100% {
        transform: translateX(5%);
    }
}

@keyframes butterflyFly {
    0% {
        transform: translate(0, 0) scale(0.6) rotate(10deg);
        opacity: 0;
    }

    5% {
        opacity: 1;
    }

    25% {
        transform: translate(25vw, -10vh) scale(0.9) rotate(0deg);
    }

    50% {
        transform: translate(50vw, 5vh) scale(0.7) rotate(-15deg);
    }

    75% {
        transform: translate(75vw, -15vh) scale(1) rotate(20deg);
    }

    95% {
        opacity: 1;
    }

    100% {
        transform: translate(110vw, -5vh) scale(0.6) rotate(5deg);
        opacity: 0;
    }
}

@keyframes butterflyFlap {
    0% {
        transform: scaleX(1);
    }

    100% {
        transform: scaleX(0.2);
    }
}

@keyframes pulse-slow {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.2;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.3;
    }
}

@keyframes fireFly {
    0% {
        transform: translate(10vw, 80vh) scale(0.8);
        opacity: 0;
        filter: drop-shadow(0 0 10px #bbff00);
    }

    10% {
        opacity: 1;
        filter: drop-shadow(0 0 20px #aaff00) brightness(1.2);
    }

    30% {
        transform: translate(30vw, 40vh) scale(1.1);
        filter: drop-shadow(0 0 30px #bbff00) brightness(1.5);
    }

    50% {
        transform: translate(60vw, 20vh) scale(0.9);
        filter: drop-shadow(0 0 15px #88ff00) brightness(1.3);
    }

    70% {
        transform: translate(80vw, 50vh) scale(1.2);
        filter: drop-shadow(0 0 40px #ccff00) brightness(1.6);
    }

    90% {
        opacity: 1;
        filter: drop-shadow(0 0 25px #aaff00) brightness(1.2);
    }

    100% {
        transform: translate(110vw, 10vh) scale(0.8);
        opacity: 0;
        filter: drop-shadow(0 0 10px #bbff00);
    }
}

.floating-content {
    animation: float 6s ease-in-out infinite;
}

.float-delay-1 {
    animation: float 7s ease-in-out infinite 1s;
}

.float-delay-2 {
    animation: float 5s ease-in-out infinite 0.5s;
}

.drift-animation {
    animation: drift 25s linear infinite alternate;
}

.pulse-slow {
    animation: pulse-slow 8s ease-in-out infinite;
}

.pulse-slow-delay {
    animation: pulse-slow 10s ease-in-out infinite 2s;
}

.butterfly-container {
    width: 60px;
    height: 60px;
    top: 50%;
    left: -10%;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    animation: butterflyFly 22s ease-in-out infinite;
}

.butterfly-wing {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 6px rgba(64, 224, 208, 0.5));
    animation: butterflyFlap 0.12s infinite alternate linear;
    transform-origin: center;
}

.fire-container {
    width: 80px;
    height: 80px;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    animation: fireFly 18s ease-in-out infinite;
}

.fire-glow {
    width: 100%;
    height: auto;
    animation: butterflyFlap 0.12s infinite alternate linear, pulse-slow 2s infinite alternate;
    transform-origin: center;
}

/* Theme visibility toggles */
[data-bs-theme="dark"] .light-mode-element {
    display: none !important;
}

[data-bs-theme="light"] .dark-mode-element {
    display: none !important;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .glass-panel {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.05), 0 8px 32px rgba(0, 0, 0, 0.4);
}

.darkable-box {
    background-color: white !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-bs-theme="dark"] .darkable-box {
    background-color: #1e293b !important;
    /* slate-800 */
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Background Handling */
.bg-image {
    background-image: url('../kuvia/lake1.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.65;
    transition: background-image 0.8s ease, opacity 0.5s ease;
    filter: brightness(1.1);
}

[data-bs-theme="dark"] .bg-image {
    background-image: url('../kuvia/revontulet.jpg');
    opacity: 0.75;
    filter: brightness(0.8);
}

.bg-gradient-overlay {
    background: radial-gradient(circle at center, transparent 0%, var(--bg-light) 90%);
}

[data-bs-theme="dark"] .bg-gradient-overlay {
    background: radial-gradient(circle at center, transparent 0%, var(--bg-dark) 90%);
}

.mist-layer {
    background: linear-gradient(90deg, transparent, rgba(45, 90, 39, 0.08), transparent);
    filter: blur(40px);
}

[data-bs-theme="dark"] .mist-layer {
    background: linear-gradient(90deg, transparent, rgba(64, 224, 208, 0.05), transparent);
}

.hover-lift {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-lift:hover .move-icon {
    transform: translateX(5px);
}

.move-icon {
    transition: transform 0.3s ease;
}

.code-card {
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.code-card:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg) scale(1.02) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1) !important;
}

[data-bs-theme="dark"] .code-card:hover {
    box-shadow: 0 20px 40px rgba(64, 224, 208, 0.1) !important;
}

.pulse-dot {
    display: block;
    width: 10px;
    height: 10px;
    position: relative;
}

.pulse-dot::before {
    content: '';
    position: absolute;
    inset: -4px;
    background-color: inherit;
    border-radius: 50%;
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0.7;
}

@keyframes ping {

    75%,
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

.tracking-wide {
    letter-spacing: 0.1em;
}

.social-icon {
    transition: color 0.3s, transform 0.3s;
}

.social-icon:hover {
    color: var(--primary-color) !important;
    transform: translateY(-3px);
}

[data-bs-theme="dark"] .social-icon:hover {
    color: var(--accent-color) !important;
}

.badge-glass {
    background: rgba(45, 90, 39, 0.05);
    border-color: rgba(45, 90, 39, 0.2) !important;
}

.badge-text {
    color: var(--primary-color);
}

[data-bs-theme="dark"] .badge-glass {
    background: rgba(64, 224, 208, 0.08);
    border-color: rgba(64, 224, 208, 0.2) !important;
}

[data-bs-theme="dark"] .badge-text {
    color: var(--accent-color);
}

.bg-glass-btn {
    background: rgba(255, 255, 255, 0.5) !important;
}

[data-bs-theme="dark"] .bg-glass-btn {
    background: rgba(15, 23, 17, 0.5) !important;
    color: white;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

[data-bs-theme="dark"] .bg-glass-btn:hover {
    border-color: var(--accent-color) !important;
    color: white;
}

.hover-bg-light:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .hover-bg-light:hover {
    background: rgba(255, 255, 255, 0.1);
}

.blur-blob {
    filter: blur(50px);
    pointer-events: none;
}

.icon-glow {
    text-shadow: 0 0 10px rgba(45, 90, 39, 0.3);
}

[data-bs-theme="dark"] .icon-glow {
    color: var(--accent-color) !important;
    text-shadow: 0 0 15px rgba(64, 224, 208, 0.4);
}

.bg-gradient-primary {
    background: linear-gradient(to bottom, var(--bs-primary), transparent);
}

[data-bs-theme="dark"] .bg-gradient-primary {
    background: linear-gradient(to bottom, var(--accent-color), transparent);
}

/* =========================================
   Osaaminen Page Specific Styles 
   ========================================= */

body.osaaminen-page {
    font-family: "Plus Jakarta Sans", sans-serif;
    background-attachment: fixed;
    transition: background 0.4s ease, color 0.4s ease;
}

[data-bs-theme="light"] body.osaaminen-page {
    color: #0f172a;
    background: linear-gradient(135deg, #e0f6ff 0%, #87ceeb 100%);
}

[data-bs-theme="dark"] body.osaaminen-page {
    color: #f1f5f9;
    background: linear-gradient(135deg, #020408 0%, #0d121c 100%);
}

.text-gradient {
    /* light mode */
    background: linear-gradient(135deg, #1e3a1a 0%, #3a5f35 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-bs-theme="dark"] .text-gradient {
    /* dark mode */
    background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-bs-theme="dark"] .glass-header {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-card-osaaminen {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-bs-theme="dark"] .glass-card-osaaminen {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.05);
}

.glass-card-osaaminen:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .glass-card-osaaminen:hover {
    background: rgba(30, 41, 59, 0.85);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
}

.tag-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

[data-bs-theme="light"] .tag-badge {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

[data-bs-theme="dark"] .tag-badge {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #e0e7ff;
}

.icon-box {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.875rem;
    transition: transform 0.3s ease;
}

.glass-card-osaaminen:hover .icon-box {
    transform: scale(1.1);
}

/* Base custom colors */
.text-custom-primary {
    color: #2d5a27 !important;
}

.bg-custom-primary {
    background-color: #2d5a27 !important;
    color: white !important;
}

/* The large faded background icons */
.bg-icon-eco {
    position: fixed;
    bottom: 2.5rem;
    left: 4.5rem;
    pointer-events: none;
    opacity: 0.9;
    z-index: 0;
}

/* Realistic Dark Mode Saturn */
.saturn-container {
    position: relative;
    width: 120px;
    height: 120px;
    animation: float 8s ease-in-out infinite;
}

.saturn-body {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #f4d0a4, #d5a065, #9c6e3b 70%, #5a3f22);
    box-shadow: inset -10px -10px 20px rgba(0, 0, 0, 0.7), 0 0 15px rgba(213, 160, 101, 0.3);
    z-index: 2;
}

.ring-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 240px;
    height: 240px;
    margin-top: -120px;
    margin-left: -120px;
    transform: rotate(-15deg);
}

.ring-wrapper.back {
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
}

.ring-wrapper.front {
    z-index: 3;
    clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);
}

.ring-scaler {
    width: 100%;
    height: 100%;
    transform: scaleY(0.35);
}

.ring-surface {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    -webkit-mask-image: radial-gradient(circle, transparent 52%, black 53.5%, black 66%, transparent 67%, transparent 68.5%, black 69%, black 100%);
    mask-image: radial-gradient(circle, transparent 52%, black 53.5%, black 66%, transparent 67%, transparent 68.5%, black 69%, black 100%);
    background: conic-gradient(#d2b48c, #a67c52, #deb887, #8b5a2b,
            #d2b48c, #cd853f, #deb887, #8b5a2b,
            #d2b48c, #a67c52, #deb887, #8b5a2b,
            #d2b48c, #cd853f, #deb887, #8b5a2b, #d2b48c);
    animation: spinRingSurface 12s linear infinite;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

@keyframes spinRingSurface {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Realistic Light Mode Cloud */
.cloud-container {
    position: relative;
    width: 180px;
    height: 100px;
    animation: float 6s ease-in-out infinite;
    filter: drop-shadow(0 15px 15px rgba(0, 0, 0, 0.1));
}

.cloud-puff {
    position: absolute;
    background: radial-gradient(circle at 40% 30%, #ffffff 0%, #f4f4f4 50%, #e8e8e8 100%);
    border-radius: 50%;
}

.cloud-puff.puff-1 {
    width: 70px;
    height: 70px;
    bottom: 10px;
    left: 10px;
}

.cloud-puff.puff-2 {
    width: 90px;
    height: 90px;
    bottom: 20px;
    left: 45px;
    background: radial-gradient(circle at 40% 30%, #ffffff 0%, #f8f8f8 60%, #e2e2e2 100%);
}

.cloud-puff.puff-3 {
    width: 60px;
    height: 60px;
    bottom: 10px;
    right: 15px;
}

.cloud-puff.puff-4 {
    width: 50px;
    height: 50px;
    bottom: 35px;
    left: 25px;
}

.cloud-puff.puff-5 {
    width: 140px;
    height: 50px;
    bottom: 10px;
    left: 20px;
    border-radius: 30px;
}

.celestial-body {
    position: fixed;
    top: 15vh;
    right: 15vw;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    transition: all 1s ease-in-out;
}

/* Light Mode: Sun */
[data-bs-theme="light"] .celestial-body {
    background: radial-gradient(circle at 30% 30%, #fffde7 0%, #fff59d 20%, #ffeb3b 60%, #fbc02d 100%);
    box-shadow:
        0 0 60px 30px rgba(255, 235, 59, 0.4),
        0 0 100px 60px rgba(255, 193, 7, 0.2),
        inset 0 0 40px rgba(255, 255, 255, 0.8);
    animation: sunGlow 4s infinite alternate ease-in-out;
}

@keyframes sunGlow {
    0% {
        box-shadow:
            0 0 50px 20px rgba(255, 235, 59, 0.4),
            0 0 80px 40px rgba(255, 193, 7, 0.2),
            0 0 150px 80px rgba(255, 152, 0, 0.1),
            inset 0 0 40px rgba(255, 255, 255, 0.8);
    }

    100% {
        box-shadow:
            0 0 70px 40px rgba(255, 235, 59, 0.6),
            0 0 120px 70px rgba(255, 193, 7, 0.4),
            0 0 200px 100px rgba(255, 152, 0, 0.2),
            inset 0 0 60px rgba(255, 255, 255, 0.9);
    }
}

/* Dark Mode: Moon */
[data-bs-theme="dark"] .celestial-body {
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #e0e0e0 40%, #9e9e9e 80%, #757575 100%);
    /* Creates moon craters via multiple box-shadows inside the circle */
    box-shadow:
        inset -15px -15px 40px rgba(0, 0, 0, 0.5),
        inset 10px 10px 20px rgba(255, 255, 255, 0.8),
        0 0 40px 15px rgba(224, 224, 224, 0.4),
        0 0 80px 30px rgba(64, 224, 208, 0.1);
    animation: moonGlow 5s infinite alternate ease-in-out;
}

/* Dark Mode Craters - Using pseudo-element to layer craters onto the moon */
[data-bs-theme="dark"] .celestial-body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background-image:
        radial-gradient(circle at 20% 60%, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.2) 5%, transparent 10%),
        radial-gradient(circle at 70% 30%, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.15) 8%, transparent 15%),
        radial-gradient(circle at 60% 70%, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.25) 4%, transparent 8%),
        radial-gradient(circle at 40% 40%, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.1) 15%, transparent 20%);
    opacity: 0.8;
}

@keyframes moonGlow {
    0% {
        box-shadow:
            inset -15px -15px 40px rgba(0, 0, 0, 0.5),
            inset 10px 10px 20px rgba(255, 255, 255, 0.8),
            0 0 30px 10px rgba(224, 224, 224, 0.3),
            0 0 60px 20px rgba(64, 224, 208, 0.05);
    }

    100% {
        box-shadow:
            inset -15px -15px 40px rgba(0, 0, 0, 0.5),
            inset 10px 10px 20px rgba(255, 255, 255, 0.9),
            0 0 50px 20px rgba(224, 224, 224, 0.6),
            0 0 100px 40px rgba(64, 224, 208, 0.2);
    }
}

.bottom-fade-gradient {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8rem;
    pointer-events: none;
    z-index: 0;
}

[data-bs-theme="light"] .bottom-fade-gradient {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.3), transparent);
}

[data-bs-theme="dark"] .bottom-fade-gradient {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
}

/* =========================================
   Wow Animations for Professional Look
   ========================================= */

@keyframes gradientPulse {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.text-gradient-wow {
    background: linear-gradient(270deg, #2d5a27, #1e3a1a, #2d5a27);
    background-size: 200% 200%;
    animation: gradientPulse 6s ease infinite;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-bs-theme="dark"] .text-gradient-wow {
    background: linear-gradient(270deg, var(--accent-color), #94a3b8, var(--accent-color));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes fadeInUpWow {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.animate-fade-in-up {
    animation: fadeInUpWow 0.8s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
    opacity: 0;
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.3s;
}

.delay-3 {
    animation-delay: 0.5s;
}

.delay-4 {
    animation-delay: 0.7s;
}

.glass-card-osaaminen {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, border-color 0.4s ease;
}

[data-bs-theme="dark"] .glass-card-osaaminen:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(64, 224, 208, 0.2);
    border-color: rgba(64, 224, 208, 0.4);
}

.tag-badge {
    transition: all 0.3s ease;
    cursor: default;
}

.tag-badge:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .tag-badge:hover {
    background: rgba(64, 224, 208, 0.15);
    border-color: rgba(64, 224, 208, 0.5);
    color: #fff;
    box-shadow: 0 0 12px rgba(64, 224, 208, 0.3);
}

/* =========================================
   Mobile Responsiveness & Layout Fixes
   ========================================= */
@media (max-width: 767.98px) {

    /* Font resizing for headings to fit mobile screens comfortably */
    .display-3 {
        font-size: 2.2rem !important;
    }

    .lead {
        font-size: 1rem !important;
    }

    /* Padding adjustments for glass cards so they don't consume extreme horizontal space */
    .glass-card-osaaminen {
        padding: 1.5rem !important;
    }

    /* Scale down large celestial bodies */
    .celestial-body {
        width: 120px !important;
        height: 120px !important;
        top: 5vh;
        right: 0vw;
        opacity: 0.6;
        /* Fade out slightly against text */
    }

    /* Scale and position bottom-left animated backgrounds (Saturn/Cloud) safely */
    .bg-icon-eco {
        left: 1rem;
        bottom: 1rem;
        transform: scale(0.65);
        transform-origin: bottom left;
        opacity: 0.5;
        /* Ensure they don't distract or hide mobile content too strongly */
    }

    /* Bottom fade gradient can be shorter on mobile to give more readable space */
    .bottom-fade-gradient {
        height: 4rem;
    }

    /* Ensure no horizontal scroll */
    body {
        overflow-x: hidden;
    }
}

/* Koulutus / Kokemus Page Backgrounds */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.fixed-star {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    opacity: 0.1;
    animation: twinkle 4s infinite alternate;
}

@keyframes twinkle {
    0% {
        opacity: 0.2;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.5);
        box-shadow: 0 0 5px white;
    }
}

.shooting-star {
    position: absolute;
    top: -50px;
    right: 15%;
    width: 2px;
    height: 80px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    transform: rotate(45deg);
    opacity: 0;
    animation: shooting 12s linear infinite;
    animation-delay: 3s;
}

@keyframes shooting {
    0% {
        transform: translate(0, 0) rotate(45deg);
        opacity: 0;
    }

    5% {
        opacity: 1;
    }

    15% {
        transform: translate(-1000px, 1000px) rotate(45deg);
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

.leaves-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.leaf {
    position: absolute;
    width: 30px;
    height: 30px;
    top: -50px;
    background-color: #6da252;
    border-radius: 0 50% 0 50%;
    opacity: 0.8;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    animation: fall linear infinite;
}

.leaf::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(45deg);
}

@keyframes fall {
    0% {
        transform: translateY(-50px) translateX(0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.9;
    }

    50% {
        transform: translateY(50vh) translateX(50px) rotate(180deg);
        opacity: 0.9;
    }

    90% {
        opacity: 0.9;
    }

    100% {
        transform: translateY(110vh) translateX(-50px) rotate(360deg);
        opacity: 0;
    }
}

/* Kokemus Page Background */
body.kokemus-page {
    background-image: url('../kuvia/koivu.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    transition: background 0.4s ease, color 0.4s ease;
}

[data-bs-theme="dark"] body.kokemus-page {
    background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('../kuvia/koivu.jpg');
}

[data-bs-theme="light"] body.kokemus-page {
    background-image: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)), url('../kuvia/koivu.jpg');
}

/* Improve visibility over koivu.jpg on Kokemus Page */

[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
    background: rgba(15, 23, 17, 0.85);
    /* Darken background of cards */
    border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-bs-theme="light"] body.kokemus-page .glass-card-osaaminen {
    background: rgba(255, 255, 255, 0.85);
    /* Brighten background of cards */
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.kokemus-page h1,
body.kokemus-page h2,
body.kokemus-page h3,
body.kokemus-page h4,
body.kokemus-page p,
body.kokemus-page span,
body.kokemus-page li {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    /* Add text shadow for readability */
}

[data-bs-theme="light"] body.kokemus-page h1,
[data-bs-theme="light"] body.kokemus-page h2,
[data-bs-theme="light"] body.kokemus-page h3,
[data-bs-theme="light"] body.kokemus-page h4,
[data-bs-theme="light"] body.kokemus-page p,
[data-bs-theme="light"] body.kokemus-page span,
[data-bs-theme="light"] body.kokemus-page li {
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
    /* Add lighter text shadow for light mode readability */
}

/* Ensure badges are readable over background */
[data-bs-theme="dark"] body.kokemus-page .tag-badge {
    background: rgba(0, 0, 0, 0.6);
}

[data-bs-theme="light"] body.kokemus-page .tag-badge {
    background: rgba(255, 255, 255, 0.8);
}

/* The top tag element */
body.kokemus-page .d-inline-flex.align-items-center {
    background: rgba(255, 255, 255, 0.8) !important;
}

[data-bs-theme="dark"] body.kokemus-page .d-inline-flex.align-items-center {
    background: rgba(0, 0, 0, 0.6) !important;
}


/* Add more overlay gradient on body to fade the background more */
[data-bs-theme="dark"] body.kokemus-page {
    background-image: linear-gradient(rgba(10, 15, 12, 0.85), rgba(10, 15, 12, 0.9)), url('../kuvia/koivu.jpg') !important;
}

[data-bs-theme="light"] body.kokemus-page {
    background-image: linear-gradient(rgba(240, 245, 240, 0.85), rgba(240, 245, 240, 0.9)), url('../kuvia/koivu.jpg') !important;
}

/* Remove koivu background from dark mode */
[data-bs-theme="dark"] body.kokemus-page {
    background-image: none !important;
}

/* Fix header text for Kokemus to match other styles and not be overly white */
body.kokemus-page h1,
body.kokemus-page .lead {
    text-shadow: none !important;
}

/* Using existing text-gradient or text-gradient-wow classes on the page handles the styling properly */

/* Reverting text-shadow override from earlier and just explicitly overriding header texts */
[data-bs-theme="dark"] body.kokemus-page .display-3.text-gradient-wow {
    color: #e2e8f0;
    text-shadow: none !important;
}

[data-bs-theme="light"] body.kokemus-page .display-3.text-gradient-wow {
    color: #1e3a1a;
    text-shadow: none !important;
}

[data-bs-theme="dark"] body.kokemus-page p.lead.animate-fade-in-up {
    color: #adb5bd !important;
    text-shadow: none !important;
}

[data-bs-theme="light"] body.kokemus-page p.lead.animate-fade-in-up {
    color: #495057 !important;
    text-shadow: none !important;
}

/* Also ensure normal page styles from other pages match the header */
body.kokemus-page .text-gradient-wow {
    background: linear-gradient(135deg, #1e3a1a 0%, #3a5f35 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-bs-theme="dark"] body.kokemus-page .text-gradient-wow {
    background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Ensuring the lead text also doesn't have custom overrides making it invisible */
[data-bs-theme="dark"] body.kokemus-page p.lead.animate-fade-in-up {
    color: #cbd5e1 !important;
    /* Lighter text for dark mode lead */
}

[data-bs-theme="light"] body.kokemus-page p.lead.animate-fade-in-up {
    color: #475569 !important;
    /* Darker text for light mode lead */
}

/* Fix text-gradient-wow to match the one in osaaminen.html exactly */
body.kokemus-page .text-gradient-wow {
    background: linear-gradient(135deg, #1e3a1a 0%, #3a5f35 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-bs-theme="dark"] body.kokemus-page .text-gradient-wow {
    background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* The lead paragraph needs proper margin so it doesn't get scrunched up too much under the main heading */
body.kokemus-page p.lead.animate-fade-in-up {
    margin-top: 1.5rem !important;
}

/* Add background to the text container */
body.kokemus-page .text-center.mb-5.pb-3.mt-4 {
    background: rgba(15, 23, 17, 0.4);
    padding-top: 2rem;
    padding-bottom: 2rem !important;
    border-radius: 1rem;
}

[data-bs-theme="light"] body.kokemus-page .text-center.mb-5.pb-3.mt-4 {
    background: rgba(255, 255, 255, 0.7);
}

/* Cards styling logic - dark mode - to look like real stars (glowing, pulsing) */
[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
    background: radial-gradient(circle at center, rgba(30, 40, 50, 0.4) 0%, rgba(10, 15, 20, 0.85) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    animation: starlight-pulse 4s infinite alternate;
}

@keyframes starlight-pulse {
    0% {
        box-shadow:
            0 0 10px rgba(255, 255, 255, 0.1),
            inset 0 0 5px rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.15) !important;
    }

    100% {
        box-shadow:
            0 0 15px rgba(255, 255, 255, 0.3),
            0 0 30px rgba(255, 255, 255, 0.1),
            inset 0 0 15px rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.4) !important;
    }
}

/* Morphing the cards in dark mode to look like pulsating realistic stars / celestial bodies rather than plain boxes */

[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
    border-radius: 35% 65% 55% 45% / 45% 35% 65% 55% !important;
    animation: star-morph 8s ease-in-out infinite alternate, starlight-pulse 4s infinite alternate;
    padding: 3rem 2rem !important;
    /* Increase vertical padding slightly to fit text inside the morphing shape */
    background: radial-gradient(circle at center, rgba(30, 45, 60, 0.6) 0%, rgba(5, 10, 15, 0.9) 100%);
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    position: relative;
    overflow: visible;
}

[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

@keyframes star-morph {
    0% {
        border-radius: 35% 65% 55% 45% / 45% 35% 65% 55%;
    }

    33% {
        border-radius: 65% 35% 45% 55% / 55% 65% 35% 45%;
    }

    66% {
        border-radius: 45% 55% 65% 35% / 35% 45% 55% 65%;
    }

    100% {
        border-radius: 55% 45% 35% 65% / 65% 55% 45% 35%;
    }
}

/* Override previous morphing shape to perfect circles */
[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
    border-radius: 50% !important;
    /* Perfect circle */
    aspect-ratio: 1 / 1;
    /* Keep width and height equal */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    animation: starlight-pulse 4s infinite alternate !important;
    /* Remove star-morph */
}

/* Adjust list within the circles to be centered */
[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen .d-flex.align-items-start {
    align-items: center !important;
}

[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen .position-absolute.top-0.start-0 {
    /* For the 'Avainrooli' badge, adjust so it doesn't get cut by circular overflow if we apply hidden, 
       but we have overflow: visible so it should be fine. Center it around the top edge instead. */
    top: 5% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-left: 0 !important;
}

/* Add staggered animation delays to the pulsing cards so they don't pulse at the same time */
[data-bs-theme="dark"] body.kokemus-page .col-md-4:nth-child(1) .glass-card-osaaminen {
    animation-delay: 0s !important;
}

[data-bs-theme="dark"] body.kokemus-page .col-md-4:nth-child(2) .glass-card-osaaminen {
    animation-delay: 1.5s !important;
}

[data-bs-theme="dark"] body.kokemus-page .col-md-4:nth-child(3) .glass-card-osaaminen {
    animation-delay: 3s !important;
}

/* Make the dark background match Osaaminen perfectly */
[data-bs-theme="dark"] body.kokemus-page {
    color: #f1f5f9;
    background: linear-gradient(135deg, #020408 0%, #0d121c 100%) !important;
}

/* Make the circles glow like the moon on Osaaminen */
[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
    animation: moon-card-glow 5s infinite alternate ease-in-out !important;
}

@keyframes moon-card-glow {
    0% {
        box-shadow:
            inset -15px -15px 40px rgba(0, 0, 0, 0.5),
            inset 10px 10px 20px rgba(255, 255, 255, 0.2),
            0 0 30px 10px rgba(224, 224, 224, 0.1),
            0 0 60px 20px rgba(64, 224, 208, 0.05);
    }

    100% {
        box-shadow:
            inset -15px -15px 40px rgba(0, 0, 0, 0.5),
            inset 10px 10px 20px rgba(255, 255, 255, 0.4),
            0 0 50px 20px rgba(224, 224, 224, 0.2),
            0 0 100px 40px rgba(64, 224, 208, 0.15);
    }
}

/* The user wants the previous star-morph shape back, but keeping the new moon glow */
[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
    border-radius: 35% 65% 55% 45% / 45% 35% 65% 55% !important;
    /* Reverting border-radius to the morphing shape */
    animation: star-morph 8s ease-in-out infinite alternate, moon-card-glow 5s infinite alternate ease-in-out !important;
    /* Keep moon-glow, add back star-morph */
    aspect-ratio: auto;
    /* Remove perfect circle constraint */
}

/* Fix inner padding for the morphing shape */
[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
    padding: 3rem 2rem !important;
}

/* User wants perfect circles with the moon glow */
[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
    border-radius: 50% !important;
    /* Force perfect circle */
    aspect-ratio: 1 / 1 !important;
    /* Keep width/height equal */
    animation: moon-card-glow 5s infinite alternate ease-in-out !important;
    /* Only moon glow, NO star-morph */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem !important;
    /* Reset padding to be even for a circle */
}

/* Ensure contents are centered within the new perfect circles */
[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen .d-flex.align-items-start {
    align-items: center !important;
}

[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen .position-absolute.top-0.start-0 {
    top: 5% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-left: 0 !important;
}

/* Adjusting the moon glow animation to lighten the inner shadow so it doesn't obscure content */
@keyframes moon-card-glow {
    0% {
        box-shadow:
            inset -5px -5px 15px rgba(0, 0, 0, 0.3),
            /* Lightened inner shadow */
            inset 5px 5px 10px rgba(255, 255, 255, 0.1),
            /* Lightened inner highlight */
            0 0 30px 10px rgba(224, 224, 224, 0.1),
            0 0 60px 20px rgba(64, 224, 208, 0.05);
    }

    100% {
        box-shadow:
            inset -5px -5px 15px rgba(0, 0, 0, 0.3),
            inset 5px 5px 10px rgba(255, 255, 255, 0.2),
            0 0 50px 20px rgba(224, 224, 224, 0.2),
            0 0 100px 40px rgba(64, 224, 208, 0.15);
    }
}

/* Adjust the positioning of the star-cards inside the columns */
[data-bs-theme="dark"] body.kokemus-page .col-md-4 .glass-card-osaaminen {
    padding-top: 3.5rem !important;
    /* Push text further down inside the circle so the top badge fits better */
}

/* Ensure the top element starts lower */
[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen>.icon-box {
    margin-top: 1rem !important;
}

[data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen .position-absolute.top-0.start-0 {
    top: 8% !important;
    /* Move 'Avainrooli' slightly lower */
}

/* Make circles responsive for mobile phones */
@media (max-width: 767.98px) {
    [data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
        border-radius: 20px !important;
        /* On very small screens, exact circles can squish text. Reverting to a rounded rectangle looks better. */
        aspect-ratio: auto !important;
        /* Allow it to be as tall as necessary to fit the text */
        padding: 2.5rem 1.5rem !important;
        /* Keep the moon glow but remove the tight circular constraints on mobile */
    }

    [data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen>.icon-box {
        margin-top: 0 !important;
    }

    [data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen .position-absolute.top-0.start-0 {
        top: 0 !important;
        transform: translate(-50%, -50%) !important;
        left: 50% !important;
    }
}

/* Ensure padding is solid on Desktop */
@media (min-width: 768px) {
    [data-bs-theme="dark"] body.kokemus-page .glass-card-osaaminen {
        aspect-ratio: 1 / 1;
        height: auto;
    }

    /* =========================================
   TV7 Case Study Page Specific Styles 
   ========================================= */

    .before-after-slider {
        user-select: none;
        -webkit-user-drag: none;
    }

    .ba-handle {
        border: 2px solid rgba(255, 255, 255, 0.8);
        transition: transform 0.1s;
    }

    .before-after-slider:active .ba-handle {
        transform: translate(-50%, -50%) scale(0.9) !important;
    }
}

/* Laptop Mockup */
.laptop-frame {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.laptop-screen {
    background: #111;
    border-radius: 12px 12px 0 0;
    padding: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.laptop-bottom {
    height: 16px;
    background: #94a3b8;
    /* slate-400 equivalent */
    width: 110%;
    transform: translateX(-4.5%);
    border-radius: 0 0 16px 16px;
    border-top: 1px solid #cbd5e1;
}

[data-bs-theme="dark"] .laptop-bottom {
    background: #334155;
    /* slate-700 equivalent */
    border-top: 1px solid #1e293b;
}

/* =========================================
   Projektit Page Specific Styles 
   ========================================= */

body.projektit-page {
    background-color: var(--bg-light);
}

[data-bs-theme="dark"] body.projektit-page {
    background-color: var(--bg-dark);
}

/* Glass Card for Projects */
.glass-card-projektit {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

[data-bs-theme="dark"] .glass-card-projektit {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-card-projektit:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .glass-card-projektit:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.02);
}

/* Device Mockup Lift */
.device-mockup {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.group-card:hover .device-mockup {
    transform: translateY(-8px) scale(1.02);
}

/* Tag Badges */
.tag-badge-projektit {
    font-size: 0.70rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    display: inline-block;
}

[data-bs-theme="light"] .tag-badge-projektit {
    background-color: rgba(45, 90, 39, 0.1);
    color: var(--primary-color);
}

[data-bs-theme="dark"] .tag-badge-projektit {
    background-color: rgba(45, 90, 39, 0.2);
    color: #4ade80;
}

.tag-badge-projektit.badge-light {
    background-color: rgba(0, 0, 0, 0.05);
    color: #495057;
}

[data-bs-theme="dark"] .tag-badge-projektit.badge-light {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ced4da;
}

/* Buttons */
.btn-project-link {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--bs-body-color);
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .btn-project-link {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-project-link:hover {
    background-color: var(--primary-color);
    color: white !important;
}

[data-bs-theme="dark"] .btn-project-link:hover {
    background-color: var(--primary-color);
}

.group-btn:hover .group-hover-translate {
    transform: translateX(4px);
}

.group-hover-translate {
    transition: transform 0.3s ease;
}

/* Image wrapper for gradient overlay */
.img-wrapper img {
    object-position: top;
}

/* =========================================
   Ota Yhteyttä Page Specific Styles 
   ========================================= */

/* Light Mode Summer Theme Background */
body.contact-page {
    background-color: var(--bg-light);
    background-image: linear-gradient(rgba(244, 246, 248, 0.6), rgba(244, 246, 248, 0.6)), url('../kuvia/koivu.jpg');
    background-size: cover;
    background-position: center bottom;
    background-attachment: fixed;
    animation: contactSummerBreathe 40s ease-in-out infinite alternate;
}

@keyframes contactSummerBreathe {
    0% { background-position: center bottom; background-size: 110%; }
    100% { background-position: left center; background-size: 120%; }
}

[data-bs-theme="dark"] body.contact-page {
    background-image: none;
    background-color: #02050e; /* Deep space background */
}

/* Summer Butterfly Animation (Light Mode) */
.summer-butterfly {
    position: absolute;
    top: 20%;
    left: -10%;
    z-index: 1;
    animation: fly-butterfly 25s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    pointer-events: none;
}

.summer-butterfly img {
    animation: flap-wings 0.3s ease-in-out infinite alternate;
    transform-origin: center;
}

@keyframes fly-butterfly {
    0% { transform: translate(0, 0) scale(1) rotate(15deg); }
    25% { transform: translate(30vw, -10vh) scale(1.2) rotate(-10deg); }
    50% { transform: translate(60vw, 5vh) scale(0.9) rotate(20deg); }
    75% { transform: translate(90vw, -15vh) scale(1.1) rotate(-5deg); }
    100% { transform: translate(120vw, 0) scale(1) rotate(15deg); }
}

@keyframes flap-wings {
    0% { transform: scaleY(1) rotateX(0deg); }
    100% { transform: scaleY(0.7) rotateX(45deg); }
}

/* Flying Flies Animation (Light Mode) */
.summer-flies {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.summer-fly {
    position: absolute;
    font-size: 1.2rem;
    filter: drop-shadow(2px 5px 3px rgba(0,0,0,0.2));
}

.sf-1 { left: 15%; top: 30%; animation: flight-1 8s linear infinite; }
.sf-2 { left: 75%; top: 60%; animation: flight-2 11s linear infinite; }
.sf-3 { left: 45%; top: 80%; animation: flight-3 9s linear infinite; }
.sf-4 { left: 85%; top: 20%; animation: flight-4 13s linear infinite; }
.sf-5 { left: 30%; top: 50%; animation: flight-1 10s linear infinite reverse; }

@keyframes flight-1 {
    0% { transform: translate(0, 0) scaleX(1); }
    25% { transform: translate(150px, -80px) scaleX(1); }
    26% { transform: translate(150px, -80px) scaleX(-1); }
    50% { transform: translate(-50px, -20px) scaleX(-1); }
    51% { transform: translate(-50px, -20px) scaleX(1); }
    75% { transform: translate(80px, 120px) scaleX(1); }
    100% { transform: translate(0, 0) scaleX(1); }
}

@keyframes flight-2 {
    0% { transform: translate(0, 0) scaleX(-1); }
    33% { transform: translate(-100px, -150px) scaleX(-1); }
    34% { transform: translate(-100px, -150px) scaleX(1); }
    66% { transform: translate(120px, 50px) scaleX(1); }
    67% { transform: translate(120px, 50px) scaleX(-1); }
    100% { transform: translate(0, 0) scaleX(-1); }
}

@keyframes flight-3 {
    0% { transform: translate(0, 0) scaleX(1); }
    30% { transform: translate(200px, -100px) scaleX(1); }
    31% { transform: translate(200px, -100px) scaleX(-1); }
    60% { transform: translate(-100px, -200px) scaleX(-1); }
    61% { transform: translate(-100px, -200px) scaleX(1); }
    100% { transform: translate(0, 0) scaleX(1); }
}

@keyframes flight-4 {
    0% { transform: translate(0, 0) scaleX(-1); }
    20% { transform: translate(-150px, 80px) scaleX(-1); }
    21% { transform: translate(-150px, 80px) scaleX(1); }
    50% { transform: translate(50px, -150px) scaleX(1); }
    51% { transform: translate(50px, -150px) scaleX(-1); }
    80% { transform: translate(-80px, -50px) scaleX(-1); }
    100% { transform: translate(0, 0) scaleX(-1); }
}

.contact-input {
    background: rgba(255, 255, 255, 0.5) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.contact-input:focus {
    background: rgba(255, 255, 255, 0.8) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(45, 90, 39, 0.25) !important;
}

[data-bs-theme="dark"] .contact-input {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

[data-bs-theme="dark"] .contact-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

[data-bs-theme="dark"] .contact-input:focus {
    background: rgba(30, 41, 59, 0.8) !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(64, 224, 208, 0.25) !important;
}

/* Space Background Animation (Dark Mode Only) */
.space-background {
    display: none;
}

[data-bs-theme="dark"] .space-background {
    display: block;
}

.space-gradient {
    background: radial-gradient(circle at 20% 80%, rgba(45, 10, 80, 0.4) 0%, transparent 40%),
                radial-gradient(circle at 80% 20%, rgba(10, 60, 90, 0.4) 0%, transparent 40%);
}

.stars {
    background-image: 
    radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.8), rgba(0,0,0,0)),
    radial-gradient(1px 1px at 50px 160px, rgba(255,255,255,0.9), rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 90px 40px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 130px 80px, rgba(255,255,255,0.6), rgba(0,0,0,0)),
    radial-gradient(1px 1px at 160px 120px, #ffffff, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: starsRotate 200s linear infinite;
    opacity: 0.8;
}

@keyframes starsRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Uranus */
.planet-uranus {
    position: absolute;
    top: 25%;
    left: 15%;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    /* Ice giant cyan/blue gradient */
    background: radial-gradient(circle at 30% 30%, #c9f1ff 0%, #7cd7f7 40%, #0d96cc 80%, #06405c 100%);
    box-shadow: inset -20px -20px 40px rgba(0, 0, 0, 0.9), 
                0 0 40px rgba(124, 215, 247, 0.4);
    animation: float-uranus 40s ease-in-out infinite alternate;
    transform-style: preserve-3d;
    z-index: 1;
}

.uranus-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    /* Visually distinct borders to make rotation visible */
    border: 10px solid transparent;
    border-top-color: rgba(200, 240, 255, 0.8);
    border-right-color: rgba(200, 240, 255, 0.3);
    border-bottom-color: rgba(200, 240, 255, 0.8);
    border-left-color: rgba(200, 240, 255, 0.1);
    transform: translate(-50%, -50%) rotateX(75deg) rotateY(15deg);
    animation: spin-ring 6s linear infinite;
}

@keyframes spin-ring {
    0% { transform: translate(-50%, -50%) rotateX(75deg) rotateY(15deg) rotateZ(0deg); }
    100% { transform: translate(-50%, -50%) rotateX(75deg) rotateY(15deg) rotateZ(360deg); }
}

@keyframes float-uranus {
    0% { transform: translateY(0px) rotate(5deg); }
    100% { transform: translateY(-40px) rotate(-5deg); }
}

/* Earth */
.planet-earth {
    position: absolute;
    bottom: 15%;
    right: 15%;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    /* Blue and green gradient mimicking continents/oceans */
    background: radial-gradient(circle at 40% 40%, #4b9bea 0%, #1e5cce 40%, #14387c 80%, #06193b 100%);
    box-shadow: inset -15px -15px 30px rgba(0, 0, 0, 0.9), 
                inset 5px 5px 20px rgba(255, 255, 255, 0.2),
                0 0 30px rgba(75, 155, 234, 0.4);
    animation: float-earth 35s ease-in-out infinite alternate-reverse;
    overflow: hidden;
    z-index: 1;
}

/* Add some green landmass patches and clouds via pseudo elements */
.planet-earth::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 60%, rgba(45, 135, 60, 0.6) 0%, transparent 20%),
                radial-gradient(circle at 70% 30%, rgba(60, 160, 75, 0.5) 0%, transparent 25%);
    top: -50%;
    left: -50%;
    border-radius: 50%;
    animation: spin-earth 60s linear infinite;
}

.planet-earth::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Cloud layer atmosphere glow without dots */
    box-shadow: inset 10px 10px 20px rgba(255, 255, 255, 0.4),
                inset -20px 20px 30px rgba(255, 255, 255, 0.1);
    opacity: 0.5;
}

@keyframes float-earth {
    0% { transform: translateY(0px) rotate(-10deg); }
    100% { transform: translateY(-30px) rotate(10deg); }
}

@keyframes spin-earth {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === TV7 Case Study Specific Styles === */
.page-bg-fixed {
    background-color: #050b14;
    background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('../kuvia/revontulet.jpg');
    background-size: 150%;
    background-position: center bottom;
    background-attachment: fixed;
    animation: slowPan 60s linear infinite alternate;
    position: relative;
}

@keyframes slowPan {
    0% {
        background-position: 0% 100%;
        background-size: 140%;
    }

    100% {
        background-position: 100% 0%;
        background-size: 160%;
    }
}

/* Light Mode Specific Overrides for TV7 Case */
[data-bs-theme="light"] {
    --accent-color: #008080 !important;
    /* Mute/dark cyan */
}

[data-bs-theme="light"] .case-study-badge {
    color: #ffffff !important;
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
}

[data-bs-theme="light"] .page-bg-fixed {
    background-color: var(--bg-light);
    background-image: linear-gradient(rgba(244, 246, 248, 0.45), rgba(244, 246, 248, 0.45)), url('../kuvia/lake1.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    animation: lakeWave 40s ease-in-out infinite alternate;
}

@keyframes lakeWave {
    0% {
        background-position: left center;
        background-size: 110%;
    }

    100% {
        background-position: right center;
        background-size: 130%;
    }
}

[data-bs-theme="light"] .page-bg-fixed::before,
[data-bs-theme="light"] .page-bg-fixed::after {
    display: none;
}

/* === Kokemus Page Dark Mode Stars (muutettu planeetoiksi) === */
.dark-mode-element .planet {
    position: absolute;
    border-radius: 50%;
    opacity: 0.95;
    box-shadow: inset -5px -5px 15px rgba(0, 0, 0, 0.8), inset 2px 2px 5px rgba(255, 255, 255, 0.4), 0 0 15px rgba(255, 255, 255, 0.1);
    animation: float-planet 25s infinite ease-in-out alternate;
}

@keyframes float-planet {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    100% {
        transform: translateY(-20px) rotate(10deg);
    }
}

.planet-mars {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 30% 30%, #ff7e5f, #feb47b, #8a2300);
    top: 15%;
    left: 80%;
    animation-delay: -5s;
}

.planet-neptune {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 35% 35%, #00c6ff, #0072ff, #001a4d);
    top: 60%;
    left: 15%;
    animation-delay: -10s;
    animation-duration: 30s;
}

.planet-venus {
    width: 45px;
    height: 45px;
    background: radial-gradient(circle at 30% 30%, #f6d365, #fda085, #b84a00);
    top: 25%;
    left: 25%;
    animation-delay: -2s;
    animation-duration: 20s;
}

.planet-purple {
    width: 35px;
    height: 35px;
    background: radial-gradient(circle at 30% 30%, #c471f5, #fa71cd, #4a0072);
    top: 75%;
    left: 75%;
    animation-delay: -15s;
    animation-duration: 22s;
}

/* Tehdään korteista planeettoja dark-modessa */
[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen {
    border-radius: 50% !important;
    /* Pohjaväri, jonka päälle kukin kortti voi heijastaa oman sävynsä */
    background: radial-gradient(circle at 30% 20%, var(--planet-color-light, #3a4a5a) 0%, var(--planet-color-mid, #151f28) 50%, var(--planet-color-dark, #060a0f) 100%) !important;
    box-shadow: inset -15px -15px 35px rgba(0, 0, 0, 0.9), inset 5px 5px 25px rgba(255, 255, 255, 0.2), 0px 0px 30px var(--planet-glow, rgba(13, 110, 253, 0.4)) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    animation: pulsate-glow 4s infinite alternate ease-in-out;

    /* Keskitys sisällöille pyöreässä ulkoasussa */
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding: 10% 5% 5% 5% !important;
    aspect-ratio: 1 / 1;
    height: auto !important;
}

@keyframes pulsate-glow {
    0% {
        box-shadow: inset -15px -15px 35px rgba(0, 0, 0, 0.9), inset 5px 5px 25px rgba(255, 255, 255, 0.2), 0px 0px 20px var(--planet-glow, rgba(13, 110, 253, 0.3)) !important;
    }

    100% {
        box-shadow: inset -15px -15px 35px rgba(0, 0, 0, 0.9), inset 5px 5px 25px rgba(255, 255, 255, 0.4), 0px 0px 45px var(--planet-glow, rgba(13, 110, 253, 0.7)) !important;
    }
}

/* Työkokemus 1 (Vihreä tuki) */
[data-bs-theme="dark"] .kokemus-page .row>div:nth-child(1) .glass-card-osaaminen {
    --planet-color-light: #3e6d35;
    --planet-color-mid: #1d3617;
    --planet-color-dark: #0a1407;
    --planet-glow: rgba(45, 90, 39, 0.6);
}

/* Työkokemus 2 / Koulutus 2 (Sininen) */
[data-bs-theme="dark"] .kokemus-page .row>div:nth-child(2) .glass-card-osaaminen {
    --planet-color-light: #3d78d8;
    --planet-color-mid: #133a75;
    --planet-color-dark: #07162e;
    --planet-glow: rgba(13, 110, 253, 0.6);
}

/* Työkokemus 3 / Koulutus 3 (Harmaa/Purppura) */
[data-bs-theme="dark"] .kokemus-page .row>div:nth-child(3) .glass-card-osaaminen {
    --planet-color-light: #7b59c4;
    --planet-color-mid: #412873;
    --planet-color-dark: #1a0f30;
    --planet-glow: rgba(111, 66, 193, 0.6);
}

/* Koulutus 4 (Oranssi) */
[data-bs-theme="dark"] .kokemus-page .row>div:nth-child(4) .glass-card-osaaminen {
    --planet-color-light: #d67c38;
    --planet-color-mid: #783b10;
    --planet-color-dark: #2e1504;
    --planet-glow: rgba(253, 126, 20, 0.6);
}

/* Koulutus 1 (Punainen/Kulta) - Jos valitsee erilaisen */
[data-bs-theme="dark"] .kokemus-page .row+.row>div:nth-child(1) .glass-card-osaaminen {
    --planet-color-light: #d64949;
    --planet-color-mid: #7a1e1e;
    --planet-color-dark: #330b0b;
    --planet-glow: rgba(220, 53, 69, 0.6);
}

/* Säädetään kortin sisältöjen asettelua selkeämmäksi keskitetyssä tilassa */
[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen .icon-box {
    margin: 0 auto 0.75rem auto !important;
    transform: scale(0.85);
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen h3 {
    margin-bottom: 0.25rem !important;
    font-size: 1.25rem;
}

[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen p {
    margin-bottom: 0.5rem !important;
    font-size: 0.9rem;
}

[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen ul {
    text-align: left;
    width: 85%;
    margin: 0 auto 0.5rem auto !important;
    font-size: 0.8rem;
    line-height: 1.5 !important;
}

[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen .badge,
[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen .tag-badge {
    justify-content: center;
    margin: 0 auto;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
}

[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen>div.position-absolute {
    /* Aavainrooli yms merkki - siirretään enemmän keskelle ylös / peitetään */
    top: 5% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin: 0 !important;
}

/* Pakotetaan dark moden planeettojen kaikki tekstit kirkkaan valkoisiksi paremman kontrastin vuoksi */
[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen h3,
[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen h4,
[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen p,
[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen span,
[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen li {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen .text-secondary {
    color: rgba(255, 255, 255, 0.9) !important;
}

[data-bs-theme="dark"] .kokemus-page .glass-card-osaaminen .text-custom-primary {
    color: rgba(255, 255, 255, 0.95) !important;
}

[data-bs-theme="dark"] .kokemus-page .section-badge {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .kokemus-page .section-badge-dot {
    background-color: #ffffff !important;
}