/* ==========================================================================
   Custom Styles for JustCloud.pl Landing Page
   ========================================================================== */

/* Tailwind Configuration */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* ==========================================================================
   SEO & Accessibility - Screen Reader Only
   ========================================================================== */

/* Visually hidden but accessible to screen readers and crawlers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Browser Compatibility Layer
   ========================================================================== */

/* Force hardware acceleration for better performance in all browsers */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Mobile touch optimization */
@media (hover: none) and (pointer: coarse) {

    /* This targets touch devices like mobile */
    * {
        -webkit-tap-highlight-color: rgba(0, 167, 228, 0.1);
    }

    /* Disable hover effects on touch devices */
    .pillar-card:hover,
    .presentation-card:hover,
    .blog-post-card:hover {
        transform: none !important;
    }

    /* Touch-friendly click targets */
    button,
    a,
    input,
    textarea {
        min-height: 44px;
    }
}

/* Ensure backdrop-filter works with fallbacks */
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    .backdrop-blur {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Custom Font Families */
:root {
    --font-inter: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-space-mono: 'Space Mono', 'Courier New', monospace;
}

.font-inter {
    font-family: var(--font-inter);
}

.font-space-mono {
    font-family: var(--font-space-mono);
}

/* Color Palette - JustCloud Brand Colors */
:root {
    /* Light Mode Colors */
    --jc-color-white: #FFFFFF;
    --jc-color-black: #000000;
    --jc-color-gray-50: #F5F5F7;
    --jc-color-gray-100: #E5E7EB;
    --jc-color-gray-400: #6B7280;
    --jc-color-gray-600: #374151;

    /* Brand Blue Colors */
    --jc-color-blue-primary: #00A7E4;
    --jc-color-blue-hover: #0090C7;
    --jc-color-blue-light: #E6F7FD;
    --jc-color-blue-dark: #007AAA;
    --jc-color-blue-lighter: #07BDFF;

    /* Applied Colors (Light Mode) */
    --color-primary: var(--jc-color-blue-primary);
    --color-primary-dark: var(--jc-color-blue-hover);
    --color-primary-darker: var(--jc-color-blue-dark);
    --color-accent: var(--jc-color-blue-lighter);
    --color-bg-light: var(--jc-color-white);
    --color-bg-dark: #111827;
    --color-text-light: var(--jc-color-black);
    --color-text-dark: #F9FAFB;

    /* Section Background Colors */
    --section-bg-secondary: var(--jc-color-gray-50);
    --section-bg-tertiary: #F8FAFC;
}

/* Dark Mode Color Overrides */
[data-theme='dark'],
html.dark {
    /* Dark Mode Grays */
    --jc-color-gray-900: #111827;
    --jc-color-gray-800: #1F2937;
    --jc-color-gray-700: #374151;
    --jc-color-gray-600: #4B5563;
    --jc-color-gray-500: #9CA3AF;
    --jc-color-gray-400: #D1D5DB;
    --jc-color-gray-300: #E5E7EB;
    --jc-color-gray-200: #F3F4F6;
    --jc-color-gray-100: #F9FAFB;
    --jc-color-gray-50: #FFFFFF;

    /* Brand Blue Colors (Dark Mode) */
    --jc-color-blue-primary-dark: #1FBFFF;
    --jc-color-blue-hover-dark: #0AACEC;
    --jc-color-blue-light-dark: #1A3A4D;
    --jc-color-blue-dark-dark: #00C4FF;

    /* Applied Colors (Dark Mode) */
    --color-primary: var(--jc-color-blue-primary-dark);
    --color-primary-dark: var(--jc-color-blue-hover-dark);
    --color-primary-darker: var(--jc-color-blue-dark);
    --color-accent: var(--jc-color-blue-dark-dark);
    --color-bg-light: var(--jc-color-gray-900);
    --color-bg-dark: var(--jc-color-gray-800);
    --color-text-light: #F9FAFB;
    --color-text-dark: var(--jc-color-gray-500);

    /* Section Background Colors */
    --section-bg-secondary: var(--jc-color-gray-800);
    --section-bg-tertiary: #0F172A;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
}

body {
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
    /* Optimize rendering on mobile */
    -webkit-overflow-scrolling: touch;
}

/* Fix for mobile viewport height */
@supports (-webkit-touch-callout: none) {

    /* iOS Safari specific */
    .min-h-screen {
        min-height: -webkit-fill-available;
    }
}

/* Viewport-Aware Section Spacing */
:root {
    --section-padding-y: clamp(2rem, 5vh, 5rem);
    --section-spacing: clamp(1.5rem, 3vh, 3rem);
    --header-spacing: clamp(1rem, 2vh, 2rem);
    --scroll-offset: 5rem;
    /* 80px - exact header height */
}

/* Responsive scroll offset for fixed header */
@media (min-width: 1024px) {
    :root {
        --scroll-offset: 5rem;
        /* 80px - exact header height */
    }
}

@media (min-width: 1536px) {
    :root {
        --scroll-offset: 5rem;
        /* 80px - exact header height */
    }
}

/* Custom Scrollbar (Webkit) */
::-webkit-scrollbar {
    width: 10px;
    /* Fallback for Brave */
    background-color: transparent;
}

::-webkit-scrollbar-track {
    background-color: #E5E7EB;
    /* Fallback with !important for strict browsers */
    background: #E5E7EB !important;
}

html.dark ::-webkit-scrollbar-track {
    background-color: #1F2937;
    /* Fallback with !important for strict browsers */
    background: #1F2937 !important;
}

::-webkit-scrollbar-thumb {
    background-color: #6B7280;
    border-radius: 9999px;
    /* Fallback with !important for strict browsers */
    background: #6B7280 !important;
}

html.dark ::-webkit-scrollbar-thumb {
    background-color: #374151;
    /* Fallback with !important for strict browsers */
    background: #374151 !important;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #9CA3AF;
    /* Fallback with !important for strict browsers */
    background: #9CA3AF !important;
}

/* ==========================================================================
   Hero Section - WOW Effects (Optimized)
   ========================================================================== */

/* Hero Background Image - Subtle zoom effect */
.hero-bg {
    animation: hero-zoom 30s ease-in-out infinite alternate;
    object-fit: cover;
    object-position: center;
    will-change: transform;
    transform: scale(1);
}

@keyframes hero-zoom {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.05);
    }
}

/* Hero Overlay - Static gradient (optimized for performance) */
.hero-overlay {
    background-color: rgba(17, 24, 39, 0.5);
    background-image: linear-gradient(to bottom right, rgba(17, 24, 39, 0.4), rgba(37, 99, 235, 0.4), rgba(31, 41, 55, 0.4));
    background-size: 100% 100%;
}

/* Animated Grid Effect - Removed for performance */
.hero-grid {
    background-color: transparent;
    background-image:
        linear-gradient(rgba(0, 167, 228, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 167, 228, 0.2) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Hero Content Entrance Animations */
.hero-content {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    animation: fade-in-up 1s ease-out;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Hero Title Animation - Reduced intensity */
.hero-title {
    /* Solid fallback text-shadow for Brave */
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    animation: title-glow 3s ease-in-out infinite;
}

@keyframes title-glow {

    0%,
    100% {
        text-shadow: 0 0 20px rgba(59, 130, 246, 0.3), 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    50% {
        text-shadow: 0 0 40px rgba(59, 130, 246, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
    }
}

/* Pulse Effect for Badge */
.animate-pulse-slow {
    /* Fallback opacity for Brave */
    opacity: 1;
    animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-slow {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Hero Subtitle Animation */
.hero-subtitle {
    /* Fallback for Brave - ensure visible */
    opacity: 1;
    transform: translate3d(0, 0, 0);
    animation: fade-in-up 1s ease-out 0.3s both;
}

/* IT Feeds Days Counter - Number Animation */
#days-counter {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* Header Transparency - Unified behavior across sections */
#header {
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
    /* Solid fallback for Brave */
    background-color: rgb(255, 255, 255);
    /* Semi-transparent overlay for Chrome */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

html.dark #header {
    /* Solid fallback for Brave */
    background-color: rgb(17, 24, 39);
    /* Semi-transparent overlay for Chrome */
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#header.scrolled {
    /* Solid fallback for Brave */
    background-color: rgb(255, 255, 255);
    /* Semi-transparent overlay for Chrome */
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

html.dark #header.scrolled {
    /* Solid fallback for Brave */
    background-color: rgb(17, 24, 39);
    /* Semi-transparent overlay for Chrome */
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Component Styles (Optimized for Performance)
   ========================================================================== */

/* Pillar Cards - Optimized hover effects */
.pillar-card {
    position: relative;
    overflow: hidden;
    /* Fallback transform for Brave */
    transform: translate3d(0, 0, 0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s ease;
    will-change: transform;
}

/* Removed ::before sweep animation for better performance */

.pillar-card:hover {
    transform: translate3d(0, -8px, 0);
    /* Enhanced shadow with fallback */
    box-shadow: 0 20px 25px -5px rgba(0, 167, 228, 0.3),
        0 10px 10px -5px rgba(0, 167, 228, 0.2),
        0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

/* Presentation Cards - Optimized */
.presentation-card {
    /* Fallback transform for Brave */
    transform: translate3d(0, 0, 0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.presentation-card:hover {
    transform: translateY(-12px) scale(1.03);
    /* Enhanced shadow with better visibility */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 10px 20px -8px rgba(0, 0, 0, 0.15);
}

/* Blog Post Cards - Optimized */
.blog-post-card {
    /* Fallback transform for Brave */
    transform: translate3d(0, 0, 0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.blog-post-card:hover {
    transform: translate3d(0, -8px, 0);
    box-shadow: 0 20px 25px -5px rgba(0, 167, 228, 0.15),
        0 10px 10px -5px rgba(0, 167, 228, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

/* Line clamp utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Fallback for browsers that don't support line-clamp */
    max-height: 3em;
    line-height: 1.5em;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Fallback for browsers that don't support line-clamp */
    max-height: 4.5em;
    line-height: 1.5em;
}

/* Navigation Links */
.nav-link {
    position: relative;
    display: inline-block;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    /* Solid fallback color for Brave */
    background-color: #00A7E4;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* CTA Buttons - Simplified for performance */
.cta-button-primary,
.cta-button-secondary {
    /* Fallback transform for Brave */
    transform: scale(1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
}

/* Removed ::before ripple effect for better performance */

.cta-button-primary:hover,
.cta-button-secondary:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(0, 167, 228, 0.4),
        0 10px 10px -5px rgba(0, 167, 228, 0.3),
        0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

input:focus,
textarea:focus {
    outline: none;
}

/* Form Validation */
/* Ensure all badges have transparent background and no effects */
img[src*="Badge"] {
    background: transparent !important;
    animation: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* Additional rule for MVP badges specifically */
img[src*="MVP_Badge"] {
    background: none !important;
    backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
    transition: none !important;
}

input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown) {
    border-color: #10B981;
}

/* ==========================================================================
   Cookie Banner Styles
   ========================================================================== */

/* Cookie banner will be controlled via inline styles from JS */
/* Initial state: transform: translateY(100%) and hidden class */
/* Visible state: transform: translateY(0) */

/* ==========================================================================
   Dark Mode Transitions
   ========================================================================== */

* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

/* Prevent transition on page load */
.preload * {
    transition: none !important;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus Visible Styles */
*:focus-visible {
    outline: none;
    /* Solid fallback for Brave */
    box-shadow: 0 0 0 2px #00A7E4, 0 0 0 4px #FFFFFF;
    /* CSS variable version */
    box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 4px var(--color-bg-light);
}

html.dark *:focus-visible {
    /* Solid fallback for Brave */
    box-shadow: 0 0 0 2px #1FBFFF, 0 0 0 4px #111827;
    /* CSS variable version */
    box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 4px var(--color-bg-dark);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ==========================================================================
   Brave Browser Specific Fixes
   ========================================================================== */

/* Brave sometimes blocks backdrop-filter, ensure solid backgrounds work */
@supports not (backdrop-filter: blur(12px)) {
    #header {
        background: rgb(255, 255, 255) !important;
    }

    html.dark #header {
        background: rgb(17, 24, 39) !important;
    }
}

/* Ensure animations work in privacy-focused browsers */
@media (prefers-reduced-motion: no-preference) {
    .hero-bg {
        animation: hero-zoom 30s ease-in-out infinite alternate;
    }

    .hero-title {
        animation: title-glow 3s ease-in-out infinite;
    }

    .animate-pulse-slow {
        animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }
}

/* Mobile Brave Browser Specific Fixes */
@media (max-width: 768px) {
    /* Disable complex effects on mobile for better performance */
    @supports not (backdrop-filter: blur(12px)) {
        .backdrop-blur-sm,
        [class*="backdrop-blur"] {
            background-color: rgba(59, 130, 246, 0.25) !important;
        }
    }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* Mobile: Keep desktop styles but disable animations for performance */
@media (max-width: 640px) {
    .hero-bg {
        animation: none !important;
        transform: scale(1) !important;
    }

    .hero-title {
        animation: none !important;
    }

    .animate-pulse-slow {
        animation: none !important;
        opacity: 1 !important;
    }

    .backdrop-blur-sm,
    [class*="backdrop-blur"] {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background-color: rgba(59, 130, 246, 0.2) !important;
    }

    .cta-button-primary,
    .cta-button-secondary {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        width: 100%;
        max-width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    #header {
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        background: rgba(255, 255, 255, 0.98) !important;
    }

    html.dark #header {
        background: rgba(17, 24, 39, 0.98) !important;
    }
}

/* Mobile landscape specific */
@media (max-width: 896px) and (orientation: landscape) {
    .hero-bg {
        object-position: center center !important;
    }

    .hero-overlay {
        background-color: rgba(17, 24, 39, 0.7) !important;
    }
}

/* Small mobile devices */
@media (max-width: 375px) {
    .hero-title {
        font-size: 1.875rem !important;
        /* text-3xl */
        line-height: 2.25rem !important;
    }

    .hero-subtitle {
        font-size: 1rem !important;
        /* text-base */
    }
}

/* Tablet and Up: Enhanced animations */
@media (min-width: 768px) {
    /* JavaScript handles scroll positioning - no CSS scroll-padding needed */
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {

    header,
    #cookie-banner,
    .cta-button-primary,
    .cta-button-secondary {
        display: none;
    }

    body {
        color: black;
        background: white;
    }

    a {
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

/* Skeleton Loading for Images */
img[loading="lazy"] {
    background: linear-gradient(90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Section Background Utilities */

/* Container Max Width */
.container {
    max-width: 1280px;
}

/* Text Balance for Headings */
h1,
h2,
h3 {
    text-wrap: balance;
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* GPU Acceleration for Animations */
.pillar-card,
.presentation-card,
.cta-button-primary,
.cta-button-secondary {
    will-change: transform;
}

/* Contain Paint for Performance */
.pillar-card,
.presentation-card {
    contain: layout style paint;
}