/* ========================================
   Kontira - Custom Styles
   ======================================== */

/* --- Base --- */
html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* --- Page entrance animation --- */
@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

main {
    animation: page-fade-in 0.5s ease-out;
}

/* --- Page exit animation --- */
main.page-exit {
    animation: page-fade-out 0.3s ease-in forwards;
}

@keyframes page-fade-out {
    to { opacity: 0; transform: translateY(-8px); }
}

/* --- Stagger system for child elements --- */
.stagger > * {
    opacity: 0;
    transform: translateY(20px);
    animation: stagger-in 0.6s ease-out forwards;
}

@keyframes stagger-in {
    to { opacity: 1; transform: translateY(0); }
}

.stagger > *:nth-child(1) { animation-delay: 0.08s; }
.stagger > *:nth-child(2) { animation-delay: 0.16s; }
.stagger > *:nth-child(3) { animation-delay: 0.24s; }
.stagger > *:nth-child(4) { animation-delay: 0.32s; }
.stagger > *:nth-child(5) { animation-delay: 0.40s; }
.stagger > *:nth-child(6) { animation-delay: 0.48s; }
.stagger > *:nth-child(7) { animation-delay: 0.56s; }
.stagger > *:nth-child(8) { animation-delay: 0.64s; }

/* --- Navbar glass effect --- */
#navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(202, 240, 248, 0.3);
    transition: all 0.3s ease;
}

#navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 20px rgba(3, 4, 94, 0.06);
}

/* --- Language flags --- */
.lang-flag,
.lang-flag-option {
    font-size: 1.25rem;
    line-height: 1;
}

.lang-flag-btn {
    font-size: 1.5rem;
    padding: 0.25rem;
    border-radius: 0.5rem;
    transition: transform 0.15s ease;
    background: none;
    border: none;
    cursor: pointer;
}

.lang-flag-btn:hover {
    transform: scale(1.15);
}

/* --- Scroll reveal animations --- */
.reveal-up {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.65s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.reveal-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }
.delay-400 { transition-delay: 0.4s; }

/* --- Stagger-reveal: children animate in sequence when section scrolls into view --- */
.stagger-reveal > * {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.stagger-reveal.is-visible > *:nth-child(1) { opacity: 1; transform: none; transition-delay: 0.05s; }
.stagger-reveal.is-visible > *:nth-child(2) { opacity: 1; transform: none; transition-delay: 0.12s; }
.stagger-reveal.is-visible > *:nth-child(3) { opacity: 1; transform: none; transition-delay: 0.19s; }
.stagger-reveal.is-visible > *:nth-child(4) { opacity: 1; transform: none; transition-delay: 0.26s; }
.stagger-reveal.is-visible > *:nth-child(5) { opacity: 1; transform: none; transition-delay: 0.33s; }
.stagger-reveal.is-visible > *:nth-child(6) { opacity: 1; transform: none; transition-delay: 0.40s; }
.stagger-reveal.is-visible > *:nth-child(7) { opacity: 1; transform: none; transition-delay: 0.47s; }
.stagger-reveal.is-visible > *:nth-child(8) { opacity: 1; transform: none; transition-delay: 0.54s; }

/* --- Hide scrollbar utility --- */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* --- Calculator plan button --- */
.calc-plan-btn {
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-plan-btn.active {
    border-color: #0077B6;
    background-color: rgba(0, 119, 182, 0.05);
    color: #0077B6;
}

/* --- Details/Summary arrow hide (use custom icon) --- */
details summary::-webkit-details-marker {
    display: none;
}

details summary::marker {
    display: none;
    content: '';
}

/* --- Selection color --- */
::selection {
    background-color: #CAF0F8;
    color: #03045E;
}

/* --- Focus styles --- */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #0077B6;
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.12);
}

/* --- Checkbox styling --- */
input[type="checkbox"] {
    accent-color: #0077B6;
}

/* --- Smooth scroll offset for anchor links --- */
[id] {
    scroll-margin-top: 8rem;
}

/* --- Slide-in from left --- */
.reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.reveal-left.in { opacity: 1; transform: translateX(0); }

/* --- Slide-in from right --- */
.reveal-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.reveal-right.in { opacity: 1; transform: translateX(0); }

/* --- Scale up --- */
.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.reveal-scale.in { opacity: 1; transform: scale(1); }

/* --- Subtle float animation for mock elements --- */
@keyframes subtle-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.float-subtle { animation: subtle-float 4s ease-in-out infinite; }

/* --- Pulse for notification badges --- */
@keyframes subtle-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.pulse-subtle { animation: subtle-pulse 3s ease-in-out infinite; }

/* --- Animated bar growth (GPU-accelerated with transform) --- */
@keyframes bar-wave {
    0%, 100% { transform: scaleY(0.5); }
    25% { transform: scaleY(0.85); }
    50% { transform: scaleY(0.65); }
    75% { transform: scaleY(1); }
}
.bar-animate {
    transform-origin: bottom;
    animation: bar-wave 4s ease-in-out infinite;
}

/* --- Animated background shapes --- */
@keyframes bg-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-15px, 15px) scale(0.95); }
    75% { transform: translate(20px, 25px) scale(1.03); }
}

@keyframes bg-drift-reverse {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-25px, 20px) scale(1.03); }
    50% { transform: translate(20px, -15px) scale(0.97); }
    75% { transform: translate(-15px, -20px) scale(1.05); }
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.bg-animate-drift { animation: bg-drift 12s ease-in-out infinite; }
.bg-animate-drift-reverse { animation: bg-drift-reverse 15s ease-in-out infinite; }
.bg-gradient-animate {
    background-size: 200% 200%;
    animation: gradient-shift 8s ease-in-out infinite;
}

/* --- Trail / Swoosh decoration --- */
@keyframes swoosh-move {
    0% { transform: translateX(-100%) rotate(-5deg); opacity: 0; }
    10% { opacity: 0.3; }
    50% { opacity: 0.15; }
    100% { transform: translateX(100%) rotate(5deg); opacity: 0; }
}
.swoosh-animate { animation: swoosh-move 20s ease-in-out infinite; }

/* --- Counter animation for numbers --- */
@keyframes count-up {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* --- Section wave dividers --- */
.wave-divider {
    position: relative;
    overflow: hidden;
}
.wave-divider::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 60px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 60'%3E%3Cpath fill='%23ffffff' d='M0,30 C360,60 720,0 1080,30 C1260,45 1380,20 1440,30 L1440,60 L0,60 Z'/%3E%3C/svg%3E") no-repeat center;
    background-size: cover;
}
.wave-divider-accent::after {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 60'%3E%3Cpath fill='%23CAF0F8' fill-opacity='0.3' d='M0,30 C360,60 720,0 1080,30 C1260,45 1380,20 1440,30 L1440,60 L0,60 Z'/%3E%3C/svg%3E") no-repeat center;
    background-size: cover;
}

/* --- Gradient border glow for cards --- */
.card-glow {
    position: relative;
    overflow: hidden;
}
.card-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0077B6, #00B4D8, #90E0EF, #00B4D8, #0077B6);
    background-size: 200% 100%;
    animation: gradient-shift 4s ease-in-out infinite;
    border-radius: 16px 16px 0 0;
}

/* --- Login success checkmark draw --- */
@keyframes checkmark-draw {
    to { stroke-dashoffset: 0; }
}

/* --- Dashboard transition overlay --- */
.dash-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #f8fffe;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.dash-overlay.active { opacity: 1; }

.dash-sidebar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 256px;
    background: linear-gradient(180deg, #03045E 0%, #0077B6 50%, color-mix(in srgb, #00B4D8 70%, #03045E) 100%);
    transform: translateX(-100%);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.dash-overlay.active .dash-sidebar {
    transform: translateX(0);
}

.dash-topbar {
    position: absolute;
    top: 0; left: 256px; right: 0;
    height: 80px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(202,240,248,0.3);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.4s ease 0.4s;
}
.dash-overlay.active .dash-topbar { opacity: 1; }

/* Topbar items animate in from top individually */
.dash-topbar-item {
    opacity: 0;
    transform: translateY(-15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.dash-overlay.active .dash-topbar-item:nth-child(1) { opacity: 1; transform: none; transition-delay: 0.5s; }
.dash-overlay.active .dash-topbar-item:nth-child(2) { opacity: 1; transform: none; transition-delay: 0.6s; }
.dash-overlay.active .dash-topbar-item:nth-child(3) { opacity: 1; transform: none; transition-delay: 0.65s; }
.dash-overlay.active .dash-topbar-item:nth-child(4) { opacity: 1; transform: none; transition-delay: 0.7s; }
.dash-overlay.active .dash-topbar-item:nth-child(5) { opacity: 1; transform: none; transition-delay: 0.75s; }

/* Logo morph from navbar to sidebar */
.logo-morph {
    position: fixed;
    z-index: 10000;
    transition: all 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: brightness(0) invert(1);
}

.dash-content {
    position: absolute;
    top: 80px; left: 256px; right: 0; bottom: 0;
    padding: 32px;
    opacity: 0;
    transition: opacity 0.4s ease 0.4s;
}
.dash-overlay.active .dash-content { opacity: 1; }

/* Shimmer loading effect */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

/* Navbar fly away */
@keyframes navbar-fly-up {
    to { transform: translateY(-100%); opacity: 0; }
}
.navbar-exit {
    animation: navbar-fly-up 0.4s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* --- Lock shackle open/close animation --- */
@keyframes lock-shackle {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    40%, 60% { transform: translateY(-6px) rotate(8deg); }
}
.lock-shackle-animate {
    transform-origin: right center;
    animation: lock-shackle 6s ease-in-out infinite;
}

/* --- Colored floating orbs for backgrounds --- */
@keyframes orb-float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(15px, -20px) rotate(120deg); }
    66% { transform: translate(-10px, 10px) rotate(240deg); }
}
.orb-animate { animation: orb-float 20s ease-in-out infinite; }

/* --- 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;
    }

    .reveal-up,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
    }

    .stagger > *,
    .stagger-reveal > * {
        opacity: 1;
        transform: none;
    }

    main {
        animation: none;
    }
}

/* --- Mobile: reduce large background blobs for performance --- */
@media (max-width: 639px) {
    .bg-animate-drift,
    .bg-animate-drift-reverse,
    .orb-animate {
        animation: none;
    }

    .wave-divider::after,
    .wave-divider-accent::after {
        height: 30px;
    }
}

/* --- Print styles --- */
@media print {
    #navbar,
    footer {
        display: none;
    }
    main {
        padding-top: 0 !important;
    }
}

/* ============================================================
   Relaunch-Ergänzungen (Hero-Animation, Signature-Moment, Utils)
   ============================================================ */

/* Dezentes Punkt-Raster */
.bg-grid {
    background-image: radial-gradient(rgba(0, 119, 182, 0.10) 1px, transparent 1px);
    background-size: 22px 22px;
}

/* Mock-Browser Punkte (falls ohne explizite Größe) */
.mock-dots span { width: 11px; height: 11px; border-radius: 9999px; display: inline-block; }

/* Hero: langsam atmendes Hintergrundbild ("bewegte Wellen") */
@keyframes heroDrift { 0% { transform: scale(1.04) translate(0, 0); } 100% { transform: scale(1.12) translate(-1.5%, -1.5%); } }
.hero-bg-anim { animation: heroDrift 32s ease-in-out infinite alternate; will-change: transform; }

/* Signature Moment (scroll-gepinnte Sequenz) */
.sm-frame {
    position: absolute; inset: 0; opacity: 0;
    display: flex; flex-direction: column; justify-content: center;
    padding: 1.5rem;
    transition: opacity .12s linear;
}
.sm-frame.is-active { opacity: 1; }
/* Weiß-Blende: harter, sauberer Schnitt zwischen den Schritten (kein Überlagern) */
.sm-flash {
    position: absolute; inset: 0; background: #fff;
    opacity: 0; visibility: hidden; pointer-events: none; z-index: 5;
}
.sm-step { opacity: .4; transition: opacity .4s ease; }
.sm-step.is-active { opacity: 1; }
.sm-step .sm-bar { transform: scaleY(.25); transform-origin: top; transition: transform .4s ease; opacity: .5; }
.sm-step.is-active .sm-bar { transform: scaleY(1); opacity: 1; }
.sm-progress span { transform: scaleX(0); transform-origin: left; }
.sm-static .sm-body { height: auto !important; }
.sm-static .sm-frame { position: relative; opacity: 1; transform: none; margin-bottom: 1rem; }

/* ---------- Aurora-Hero (animierter Glow statt statischem Foto) ---------- */
.aurora {
    position: absolute; border-radius: 9999px; filter: blur(72px);
    opacity: .55; pointer-events: none; will-change: transform;
    mix-blend-mode: screen;
}
.aurora-1 { width: 46rem; height: 46rem; top: -14rem; left: -10rem;
    background: radial-gradient(circle at 35% 35%, #00B4D8, transparent 62%);
    animation: aurora-a 14s ease-in-out infinite alternate; }
.aurora-2 { width: 42rem; height: 42rem; bottom: -16rem; right: -8rem;
    background: radial-gradient(circle at 50% 50%, #0077B6, transparent 64%);
    animation: aurora-b 17s ease-in-out infinite alternate; }
.aurora-3 { width: 34rem; height: 34rem; top: 18%; right: 22%; opacity: .38;
    background: radial-gradient(circle at 50% 50%, #90E0EF, transparent 60%);
    animation: aurora-c 20s ease-in-out infinite alternate; }
@keyframes aurora-a { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(11rem,6rem) scale(1.32); } }
@keyframes aurora-b { 0% { transform: translate(0,0) scale(1.28); } 100% { transform: translate(-10rem,-5rem) scale(1); } }
@keyframes aurora-c { 0% { transform: translate(0,0) scale(.82); } 100% { transform: translate(-8rem,6rem) scale(1.3); } }

/* Dezentes Raster, zur Mitte ausgeblendet */
.hero-grid {
    background-image:
        linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 35%, transparent 72%);
    mask-image: radial-gradient(ellipse at center, #000 35%, transparent 72%);
}

/* Lebender Farbverlauf – klar sichtbare, langsam fließende Bewegung */
.hero-flow {
    position: absolute; inset: 0;
    background: linear-gradient(125deg, #02033f 0%, #03045E 22%, #0077B6 46%, #00B4D8 60%, #0077B6 80%, #03045E 100%);
    background-size: 280% 280%;
    animation: hero-flow 16s ease-in-out infinite;
    will-change: background-position;
}
@keyframes hero-flow {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Fließende Wellen-Linien (Kontira-Signatur) – nahtloses Endlos-Scrollen */
.wave-wrap { position: absolute; left: 0; right: 0; bottom: 0; height: 72%; overflow: hidden; pointer-events: none; }
.wave { position: absolute; bottom: 0; left: 0; width: 200%; height: 100%; }
.wave-a { animation: wave-flow 23s linear infinite; opacity: .50; }
.wave-b { animation: wave-flow 17s linear infinite; opacity: .40; bottom: -8px; }
.wave-c { animation: wave-flow 12s linear infinite; opacity: .30; bottom: -18px; }
@keyframes wave-flow { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Hero-Bewegung läuft IMMER – auch bei "reduzierter Bewegung".
   Sanfter, nicht-blitzender Ambient-Effekt (Wellen + Glow) gilt als
   unkritisch; so sieht jeder Besucher die Bewegung, ohne am System etwas
   zu ändern. (Klassen-Spezifität schlägt die globale *-Regel trotz !important.) */
@media (prefers-reduced-motion: reduce) {
    .hero-flow { animation-iteration-count: infinite !important; animation-duration: 16s !important; }
    .aurora-1, .aurora-2, .aurora-3 { animation-iteration-count: infinite !important; }
    .aurora-1 { animation-duration: 14s !important; }
    .aurora-2 { animation-duration: 17s !important; }
    .aurora-3 { animation-duration: 20s !important; }
    .wave-a, .wave-b, .wave-c { animation-iteration-count: infinite !important; }
    .wave-a { animation-duration: 23s !important; }
    .wave-b { animation-duration: 17s !important; }
    .wave-c { animation-duration: 12s !important; }
}
