/* Base styles */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Offset for the sticky header */
}

body {
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism System */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.dark .glass-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Spotlight Effect */
.glass-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(800px circle at var(--mouse-x, 0) var(--mouse-y, 0),
            rgba(0, 0, 0, 0.04),
            transparent 40%);
    z-index: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.dark .glass-card::before {
    background: radial-gradient(800px circle at var(--mouse-x, 0) var(--mouse-y, 0),
            rgba(255, 255, 255, 0.06),
            transparent 40%);
}

.glass-card:hover::before {
    opacity: 1;
}

.card-content {
    position: relative;
    z-index: 10;
}

/* Animations */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }

/* Animated Gradient Border */
.border-gradient-animated {
    position: relative;
    background-clip: padding-box;
    border: 2px solid transparent;
}
.border-gradient-animated::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    margin: -2px;
    border-radius: inherit;
    background: linear-gradient(45deg, #3b82f6, #10b981, #8b5cf6, #3b82f6);
    background-size: 300% 300%;
    animation: gradient-flow 4s ease infinite;
}
@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    border-left: 2px solid rgba(59, 130, 246, 0.3);
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -0.4rem;
    top: 0.25rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Media Placeholder */
.media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(148, 163, 184, 0.4);
    background: rgba(248, 250, 252, 0.5);
    transition: all 0.3s ease;
}
.dark .media-placeholder {
    border-color: rgba(71, 85, 105, 0.4);
    background: rgba(15, 23, 42, 0.3);
}
.media-placeholder:hover {
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(239, 246, 255, 0.5);
}
.dark .media-placeholder:hover {
    background: rgba(30, 58, 138, 0.2);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* Page Transitions */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slide-from-right {
    from { transform: translateX(20px); }
    to { transform: translateX(0); }
}

/* View Transitions API */
::view-transition-old(root) {
    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both fade-out;
}

::view-transition-new(root) {
    animation: 400ms cubic-bezier(0.4, 0, 0.2, 1) both fade-in,
               500ms cubic-bezier(0.4, 0, 0.2, 1) both slide-from-right;
}

/* Initial entry animation for non-supported browsers or first load */
.page-fade-in {
    animation: fade-in 0.6s ease-out forwards;
}

/* Solutions Carousel */
#solutions-carousel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
}

.solutions-tab {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    scroll-snap-align: center;
    flex-shrink: 0;
}

.solutions-tab.active {
    background: rgba(59, 130, 246, 0.05);
    border-bottom-color: var(--system-color, #3b82f6);
}

.dark .solutions-tab.active {
    background: rgba(59, 130, 246, 0.1);
}

.solutions-tabs-container {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    padding-right: 15%; /* ensures the last item can be scrolled fully into view */
}

.solutions-tabs-container::-webkit-scrollbar {
    display: none;
}

.solutions-tabs-container [role="tablist"] {
    display: flex;
    gap: 0.5rem;
}

.solutions-panel.hidden {
    display: none;
}

.solutions-panel:not(.hidden) {
    animation: solutionFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes solutionFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.solutions-card-container {
    height: 340px;
}

/* Desktop: vertical tabs on left, card center, description right */
@media (min-width: 1024px) {
    #solutions-carousel {
        display: grid;
        grid-template-columns: 260px 1fr 1fr;
        gap: 3rem;
        align-items: start;
    }

    .solutions-card-container {
        height: 450px;
    }

    .solutions-tabs-container {
        overflow-x: visible;
        scroll-snap-type: none;
        mask-image: none;
        -webkit-mask-image: none;
        padding-right: 0;
    }

    .solutions-tabs-container [role="tablist"] {
        flex-direction: column;
        gap: 0.25rem;
    }

    .solutions-tab {
        border-bottom: none;
        border-left: 3px solid transparent;
        white-space: normal;
        scroll-snap-align: unset;
    }

    .solutions-tab.active {
        border-left-color: var(--system-color, #3b82f6);
        border-bottom-color: transparent;
    }
}

/* SEO Crawler Visibility — Animation states only apply when JS is loaded */
.js-loaded .scroll-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
