/* ============================================
   KERBHOLZ - Welcome Page 2025 Redesign
   Aesthetic: "Sports Broadcast meets Premium Tech"
   ============================================ */

/* ---------- Custom Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Manrope:wght@400;500;600;700;800&display=swap');

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

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

/* ---------- Welcome Overlay Base ---------- */
#welcomeOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    opacity: 1;
    pointer-events: all;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);

    /* Deep dark with subtle warm undertone */
    background: #050508;

    /* GPU acceleration */
    will-change: opacity, transform;
    contain: layout style paint;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;

    /* iOS Safe Areas */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

#welcomeOverlay.visible {
    opacity: 1;
    pointer-events: all;
}

#welcomeOverlay.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in, transform 0.5s ease-in;
    transform: scale(1.05);
    filter: blur(8px);
}

/* Noise overlay - subtle texture */
.noise-overlay {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: overlay;
}

/* ---------- Hero Section ---------- */
.welcome-hero {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    z-index: 2;
}

/* Animated gradient orb - main visual */
.hero-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: min(700px, 150vw);
    height: min(700px, 150vw);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;

    /* Vibrant gradient with cyan and orange */
    background:
        radial-gradient(ellipse at 30% 30%, rgba(0, 212, 255, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(255, 107, 53, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(123, 44, 191, 0.25) 0%, transparent 60%);

    filter: blur(80px);
    animation: orbPulse 8s ease-in-out infinite alternate;
}

.hero-glow::after {
    content: '';
    position: absolute;
    inset: 15%;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
    filter: blur(40px);
    animation: innerGlow 6s ease-in-out infinite alternate-reverse;
}

@keyframes orbPulse {
    0% {
        transform: translate(-50%, -60%) scale(1) rotate(0deg);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -60%) scale(1.15) rotate(10deg);
        opacity: 1;
    }
}

@keyframes innerGlow {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }

    100% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* ---------- Typography - Bold & Sporty ---------- */
.hero-title {
    font-family: 'Bebas Neue', Impact, 'Arial Black', sans-serif;
    font-size: clamp(4rem, 15vw, 10rem);
    font-weight: 400;
    line-height: 0.9;
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;

    /* Stagger animation */
    opacity: 0;
    animation: heroTitleIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.2s;
}

.text-white {
    color: #ffffff;
    display: block;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.text-gradient {
    display: block;
    background: linear-gradient(135deg, #00D4FF 0%, #FF6B35 50%, #00D4FF 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 4s ease-in-out infinite;
    filter: drop-shadow(0 4px 20px rgba(0, 212, 255, 0.3));
}

@keyframes heroTitleIn {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
        filter: blur(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% center;
    }

    50% {
        background-position: 200% center;
    }
}

.hero-subtitle {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: clamp(1rem, 3vw, 1.35rem);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    max-width: 500px;
    margin: 0 auto 3rem;
    line-height: 1.7;
    letter-spacing: 0.01em;

    opacity: 0;
    animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.5s;
}

@keyframes fadeSlideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Hero Button ---------- */
.magnet-wrap {
    display: inline-block;
    position: relative;
    z-index: 10;
    opacity: 0;
    animation: buttonReveal 1s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.7s;
}

@keyframes buttonReveal {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.btn-hero {
    font-family: 'Manrope', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #050508;
    background: #ffffff;
    border: none;
    padding: 20px 48px;
    border-radius: 100px;
    cursor: pointer;
    position: relative;
    overflow: hidden;

    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow:
        0 20px 40px -10px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.btn-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-hero:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 30px 60px -15px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(0, 212, 255, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

.btn-hero:hover::before {
    left: 100%;
}

.btn-hero:active {
    transform: translateY(-2px) scale(0.98);
}

.btn-hero:focus-visible {
    outline: 3px solid rgba(0, 212, 255, 0.8);
    outline-offset: 4px;
}

/* ---------- Phone Mockup (Redesigned with SVG) ---------- */
.hero-phone-wrap {
    margin-top: 4rem;
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: center;

    opacity: 0;
    animation: phoneReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.9s;
}

@keyframes phoneReveal {
    0% {
        opacity: 0;
        transform: translateY(60px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.phone-mockup-container {
    position: relative;
    width: min(300px, 75vw);
    aspect-ratio: 450 / 902;
    filter: drop-shadow(0 40px 80px rgba(0, 0, 0, 0.5));
    animation: phoneFloat 6s ease-in-out infinite;
    /* Fill any transparent gaps in corners */
    background: #0a0a1a;
    border-radius: 13.3%;
    /* Ensure proper clipping at corners */
    overflow: hidden;
    isolation: isolate;
}

@keyframes phoneFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.phone-screen {
    position: absolute;
    /* Fill entire screen area matching SVG: x=27, y=27, 396x848 in 450x902 */
    top: 3%;
    left: 6%;
    width: 88%;
    height: 94%;
    object-fit: cover;
    object-position: center top;
    /* Match SVG inner corner radius (44px) */
    border-radius: 44px;
    z-index: 1;
    background: #0a0a1a;
    /* Clip to rounded rectangle matching the screen area */
    clip-path: inset(0 round 44px);
}

.phone-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Mockup Overlays Removed for Authenticity */

/* Mobile Adjustments */
@media (max-width: 480px) {
    .phone-mockup-container {
        width: 220px;
    }

    .phone-status-bar {
        font-size: 11px;
    }

    .hero-phone-wrap {
        margin-top: 2rem;
    }
}

/* ---------- Scroll Indicator ---------- */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 28px;

    opacity: 0;
    animation: fadeIn 1s ease forwards 1.5s, scrollBounce 2s ease-in-out infinite 2s;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes scrollBounce {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(12px);
    }
}

/* ---------- Bento Section ---------- */
.bento-section {
    padding: 6rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 20;
}

.section-title {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-align: center;
    margin-bottom: 4rem;
    color: #ffffff;

    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.section-title.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Bento Grid ---------- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(200px, auto);
    gap: 20px;
}

.bento-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;

    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.hero-phone-wrap {
    will-change: transform;
}

.bento-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Optimization: Disable expensive effects ONLY on very small mobile devices */
@media (max-width: 480px) {
    .welcome-overlay {
        background: #0a0a1a !important;
        /* Solid background for performance */
    }

    .bento-card,
    .btn-hero,
    .iphone-17-pro {
        transition: opacity 0.4s ease !important;
        animation: none !important;
        will-change: auto !important;
    }

    /* Scale down the mockup for mobile instead of hiding */
    .iphone-17-pro {
        width: 220px !important;
        transform: rotateX(5deg) rotateY(-5deg) rotateZ(2deg) scale(0.9) !important;
    }

    .hero-phone-wrap {
        margin-top: 2rem !important;
    }

    .bento-card {
        padding: 24px;
        transform: none !important;
    }

    /* Only hide the background glow on mobile */
    .hero-glow {
        display: none !important;
    }
}

/* Tablet & Large Mobile: Keep visuals but reduce animation complexity */
@media (min-width: 481px) and (max-width: 768px) {
    .iphone-17-pro {
        animation: none !important;
        /* Remove float animation to save CPU */
        transform: rotateX(5deg) rotateY(-5deg) rotateZ(2deg) !important;
    }
}

.bento-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 28px;
    background: radial-gradient(ellipse at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(0, 212, 255, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

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

.bento-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-8px) scale(1.01);
    box-shadow:
        0 30px 60px -20px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 212, 255, 0.08);
}

/* Large feature card */
.bento-large {
    grid-column: span 2;
    background: linear-gradient(145deg, rgba(0, 212, 255, 0.08) 0%, rgba(123, 44, 191, 0.05) 100%);
    border-color: rgba(0, 212, 255, 0.15);
    min-height: 280px;
}

/* Card content */
.bento-icon {
    font-size: 2.5rem;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: auto;

    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-mockup-wrap {
    width: 100%;
    height: 160px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
}

.bento-mockup {
    width: 120%;
    height: 120%;
    object-fit: cover;
    object-position: top;
    transform: rotateX(10deg) rotateY(-10deg) rotateZ(5deg);
    transition: transform 0.6s var(--bounce);
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}

.bento-card:hover .bento-mockup {
    transform: rotateX(5deg) rotateY(-5deg) rotateZ(2deg) scale(1.1);
}

.bento-card:hover .bento-icon {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.bento-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 1.35rem;
    margin-bottom: 8px;
    margin-top: 24px;
    color: #ffffff;
}

.bento-desc {
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
}

/* Demo card special effect */
.demo-card {
    cursor: pointer;
}

.demo-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    pointer-events: none;
}

.demo-card:active::after {
    width: 400px;
    height: 400px;
}

/* ---------- Footer ---------- */
.welcome-footer {
    text-align: center;
    padding: 4rem 2rem;
    padding-bottom: calc(4rem + env(safe-area-inset-bottom));
    font-family: 'Manrope', sans-serif;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.8;
    letter-spacing: 0.02em;
}

.welcome-footer-legal {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.welcome-footer-legal a {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.welcome-footer-legal a:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* ---------- Accessibility ---------- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: #00D4FF;
    color: #050508;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 10002;
    transition: top 0.3s ease;
    text-decoration: none;
    font-weight: 700;
    font-family: 'Manrope', sans-serif;
}

.skip-link:focus {
    top: 20px;
}

/* High contrast support */
@media (prefers-contrast: high) {
    .bento-card {
        border: 2px solid rgba(255, 255, 255, 0.5);
    }

    .btn-hero {
        border: 2px solid white;
    }

    .hero-subtitle,
    .bento-desc {
        color: rgba(255, 255, 255, 0.85);
    }
}

/* ---------- Responsive Design ---------- */

/* Large screens */
@media (min-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .bento-large {
        grid-column: span 2;
    }
}

/* Tablets */
@media (max-width: 1023px) and (min-width: 768px) {
    .welcome-hero {
        min-height: 90vh;
    }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento-large {
        grid-column: span 2;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .welcome-hero {
        min-height: 100svh;
        min-height: 100dvh;
        padding: 2rem 1.5rem;
        padding-top: max(60px, calc(env(safe-area-inset-top) + 40px));
        padding-bottom: 3rem;
        justify-content: flex-start;
        gap: 0;
    }

    .hero-title {
        font-size: clamp(3rem, 14vw, 5rem);
        margin-bottom: 1rem;
        margin-top: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        padding: 0 0.5rem;
    }

    .btn-hero {
        padding: 16px 32px;
        font-size: 0.95rem;
    }

    .hero-phone-wrap {
        margin-top: 2rem;
        flex-shrink: 0;
    }

    .iphone-17-pro {
        width: min(200px, 55vw);
    }

    .hero-glow {
        width: 150vw;
        height: 150vw;
        top: 30%;
    }

    .bento-section {
        padding: 4rem 1.25rem;
    }

    .bento-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .bento-large {
        grid-column: span 1;
        min-height: 220px;
    }

    .bento-card {
        padding: 24px;
        border-radius: 24px;
    }

    .bento-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
        border-radius: 16px;
    }

    .bento-title {
        font-size: 1.2rem;
        margin-top: 20px;
    }

    .bento-desc {
        font-size: 0.95rem;
    }

    .section-title {
        margin-bottom: 2.5rem;
    }

    .scroll-indicator {
        bottom: 20px;
    }
}

/* Small phones */
@media (max-width: 375px) {
    .hero-title {
        font-size: clamp(3rem, 16vw, 4rem);
    }

    .btn-hero {
        padding: 14px 28px;
        font-size: 0.95rem;
    }

    .iphone-17-pro {
        width: min(200px, 60vw);
        border-radius: 32px;
    }

    .bento-card {
        padding: 20px;
        border-radius: 20px;
    }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    .welcome-hero {
        min-height: auto;
        padding: 2rem;
    }

    .hero-title {
        font-size: 3rem;
        margin-bottom: 0.75rem;
    }

    .hero-subtitle {
        margin-bottom: 1.5rem;
        font-size: 0.95rem;
    }

    .hero-phone-wrap {
        display: none;
    }

    .scroll-indicator {
        display: none;
    }

    .hero-glow {
        width: 100vw;
        height: 100vw;
    }
}

/* Foldables */
@media (min-width: 280px) and (max-width: 320px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .btn-hero {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .bento-grid {
        gap: 12px;
    }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .bento-card:active {
        transform: scale(0.98);
        background: rgba(255, 255, 255, 0.08);
    }

    .btn-hero:active {
        transform: scale(0.96);
    }
}

/* Print */
@media print {
    #welcomeOverlay {
        display: none !important;
    }
}