/* ==========================================================================
   1. Globale Resets & Basis-Einstellungen (Premium Dunkel-Konzept)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #0d0f12;
    color: #e2e8f0;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: calc(var(--vh, 1vh) * 100);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(110px);
    z-index: 1;
    opacity: 0.35;
    animation: floatGlow 14s ease-in-out infinite alternate;
    pointer-events: none;
}
.bg-glow-1 { width: 480px; height: 480px; background: #d4af37; top: -12%; left: -8%; }
.bg-glow-2 { width: 560px; height: 560px; background: #2563eb; bottom: -14%; right: -10%; animation-delay: -4s; }
.bg-glow-3 { width: 420px; height: 420px; background: #7c3aed; top: 45%; left: 55%; opacity: 0.2; animation-delay: -8s; }

@keyframes floatGlow {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, -20px) scale(1.08); }
}

.card-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100%;
    padding: 20px;
    z-index: 2;
    animation: fadeInCard 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes fadeInCard {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   2. 3D-Bühne & Rotations-Mechanik für Desktop
   ========================================================================== */
.card {
    width: min(750px, 94vw);
    height: min(465px, 82vh, 62vw);
    perspective: 1500px;
    background: transparent;
    border: none;
    cursor: pointer;
    outline: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.card.is-flipped .card-inner {
    transform: rotateY(180deg);
}

/* Einmaliges "Wackeln" beim ersten Besuch: signalisiert, dass die Karte drehbar ist */
@keyframes cardWiggle {
    0%   { transform: rotateY(0deg); }
    20%  { transform: rotateY(-9deg); }
    45%  { transform: rotateY(7deg); }
    70%  { transform: rotateY(-4deg); }
    100% { transform: rotateY(0deg); }
}

.card-inner.wiggle {
    animation: cardWiggle 1.1s ease-in-out;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 24px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.45),
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        inset 0 -1px 1px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.card-face::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 55%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    z-index: 1;
}

.card-face::after {
    content: "";
    position: absolute;
    top: -60%; left: -20%;
    width: 60%; height: 220%;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0) 60%);
    transform: rotate(15deg);
    pointer-events: none;
    z-index: 1;
}

.card-content,
.card-content-back,
.card-footer {
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   3. Vorderseiten-Inhalt (Profil & Kontakte)
   ========================================================================== */
.card-front {
    transform: rotateY(0deg);
    z-index: 2;
}

.card-content {
    display: flex;
    flex: 1;
    padding: 45px;
    align-items: center;
}

.profile-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.logo-container {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 1px solid rgba(212, 175, 55, 0.4);
    overflow: hidden;
    background-color: #161a21;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 22px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.profile-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.job-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #d4af37;
    margin-bottom: 6px;
}

.name {
    font-size: 1.5rem;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.divider {
    width: 1px;
    height: 75%;
    background: linear-gradient(to bottom, rgba(212,175,55,0), rgba(212,175,55,0.4), rgba(212,175,55,0));
    margin: 0 45px;
}

.contact-section {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    width: 100%;
}

.contact-item {
    font-size: 1.05rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
}

.anim-fade-1 { animation: flyInRight 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards; animation-delay: 0.4s; }
.anim-fade-2 { animation: flyInRight 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards; animation-delay: 0.6s; }
.anim-fade-3 { animation: flyInRight 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards; animation-delay: 0.8s; }

@keyframes flyInRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.contact-icon {
    color: #d4af37;
    width: 24px;
    text-align: center;
    font-size: 1.15rem;
}

.contact-item strong {
    color: #94a3b8;
    width: 78px;
    flex-shrink: 0;
    display: inline-block;
    font-weight: 400;
}

.contact-item a {
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    z-index: 10;
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

.contact-item a:hover {
    color: #d4af37;
    padding-left: 3px;
}

/* Dezenter Hinweis-Pfeil (Eselsohr) unten rechts: signalisiert, dass die Karte drehbar ist */
.flip-hint {
    position: absolute;
    bottom: 58px;
    right: 20px;
    color: #d4af37;
    font-size: 0.95rem;
    opacity: 0.5;
    z-index: 3;
    pointer-events: none;
    animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.3; transform: translateX(0); }
    50%      { opacity: 0.75; transform: translateX(4px); }
}

/* ==========================================================================
   4. RÜCKSEITE-INHALT (Leistungen / Stichpunkte)
   ========================================================================== */
.card-back {
    transform: rotateY(180deg);
}

.card-content-back {
    padding: 40px 50px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.back-title {
    font-size: 1.4rem;
    color: #ffffff;
    font-weight: 500;
    letter-spacing: 1px;
}

.back-divider {
    width: 80px;
    height: 2px;
    background: #d4af37;
    margin: 12px 0 25px 0;
}

.services-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.services-list li {
    font-size: 1.05rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 14px;
    line-height: 1.4;
}

.service-icon {
    color: #d4af37;
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.back-tip {
    font-size: 0.75rem;
    color: #64748b;
    gap: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==========================================================================
   5. Fußzeilen & Rechtliches
   ========================================================================== */
.card-footer {
    width: 100%;
    text-align: center;
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.03);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.footer-link {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
    z-index: 10;
}

.footer-link:hover { color: #d4af37; }

.footer-separator {
    color: rgba(255, 255, 255, 0.1);
    margin: 0 12px;
}

/* ==========================================================================
   6. Rechtsseiten (Impressum & Datenschutz) im gleichen Glas-Design
   ========================================================================== */
.legal-card {
    width: 100%;
    max-width: 820px;
    height: auto;
    perspective: none;
}

.legal-face {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 82vh;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 24px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.45),
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        inset 0 -1px 1px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.legal-face::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    z-index: 1;
}

.legal-header {
    position: relative;
    z-index: 2;
    padding: 40px 55px 0 55px;
    flex-shrink: 0;
}

.legal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: color 0.2s ease;
    margin-bottom: 22px;
}

.legal-back-link:hover { color: #d4af37; }

.legal-kicker {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #d4af37;
    margin-bottom: 6px;
}

.legal-title {
    font-size: 2rem;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.legal-header-divider {
    width: 80px;
    height: 2px;
    background: #d4af37;
    margin: 18px 0 0 0;
}

.legal-content {
    position: relative;
    z-index: 2;
    padding: 30px 55px 40px 55px;
    overflow-y: auto;
    touch-action: pan-y;
    overscroll-behavior: contain;
    flex: 1;
    color: #cbd5e1;
    line-height: 1.7;
}

.legal-content::-webkit-scrollbar { width: 6px; }
.legal-content::-webkit-scrollbar-track { background: transparent; }
.legal-content::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, 0.35); border-radius: 10px; }
.legal-content { scrollbar-width: thin; scrollbar-color: rgba(212, 175, 55, 0.35) transparent; }

.legal-section { margin-bottom: 30px; }
.legal-section:last-child { margin-bottom: 0; }

.legal-section h2 {
    font-size: 1.15rem;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.legal-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #d4af37;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    margin-top: 22px;
}

.legal-section h3:first-child { margin-top: 0; }

.legal-section p { font-size: 0.98rem; margin-bottom: 12px; }

.legal-section ul {
    list-style: none;
    margin: 10px 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legal-section ul li {
    font-size: 0.95rem;
    padding-left: 20px;
    position: relative;
}

.legal-section ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d4af37;
}

.legal-section a {
    color: #ffffff;
    text-decoration: underline;
    text-decoration-color: rgba(212, 175, 55, 0.5);
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.legal-section a:hover { color: #d4af37; }
.legal-section strong { color: #e2e8f0; font-weight: 600; }

/* ==========================================================================
   7. Mobile Optimierung (Sichere Deaktivierung von 3D-Bugs auf Smartphones)
   ========================================================================== */
@media (max-width: 767px) {
    html {
        height: 100%;
        overflow: hidden;
        overscroll-behavior: none;
        touch-action: none;
    }

    body {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        margin: 0;
        overflow: hidden;
        overscroll-behavior: none;
        touch-action: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        height: calc(var(--vh, 1vh) * 100);
    }

    .card-container {
        padding: 15px;
        height: 100%;
        box-sizing: border-box;
    }

    .card {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 88vh;
        max-height: calc(var(--vh, 1vh) * 88);
        perspective: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .card-inner {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .card-inner {
        transform-style: flat;
        transition: none;
    }

    .card.is-flipped .card-inner {
        transform: none;
    }

    /* Mobile Variante des Wackel-Hinweises: Scale/Shake statt rotateY (kein echtes 3D-Flip hier) */
    @keyframes cardWiggle {
        0%   { transform: scale(1) translateX(0); }
        25%  { transform: scale(1.015) translateX(-4px); }
        50%  { transform: scale(1) translateX(3px); }
        75%  { transform: scale(1.01) translateX(-2px); }
        100% { transform: scale(1) translateX(0); }
    }

    .card-face {
        position: relative;
        width: 100%;
        height: 100%;
        border-radius: 20px;
        overflow: hidden;
        backface-visibility: visible;
        -webkit-backface-visibility: visible;
        background: rgba(22, 26, 33, 0.9);
        transition: opacity 0.4s ease-in-out, visibility 0.4s;
    }

    .card-front {
        transform: none;
        z-index: 2;
        opacity: 1;
        visibility: visible;
    }

    .card-back {
        transform: none;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
        opacity: 0;
        visibility: hidden;
    }

    .card.is-flipped .card-front {
        z-index: 1;
        opacity: 0;
        visibility: hidden;
    }

    .card.is-flipped .card-back {
        z-index: 2;
        opacity: 1;
        visibility: visible;
    }

    .card-content {
        flex-direction: column;
        padding: clamp(10px, 4vh, 40px) 25px;
        justify-content: center;
        gap: clamp(8px, 3vh, 30px);
        overflow: hidden;
        min-height: 0;
    }

    .divider {
        width: 60%;
        height: 1px;
        background: linear-gradient(to right, rgba(212,175,55,0), rgba(212,175,55,0.4), rgba(212,175,55,0));
        margin: 0 auto;
    }

    .logo-container {
        width: clamp(70px, 16vh, 115px);
        height: clamp(70px, 16vh, 115px);
        margin-bottom: clamp(6px, 2vh, 15px);
        flex-shrink: 0;
    }

    .contact-section {
        align-items: flex-start;
        padding-left: 10%;
        padding-right: 6%;
        gap: clamp(8px, 2vh, 15px);
    }

    .contact-item a:hover {
        padding-left: 0;
    }

    .card-content-back {
        padding: clamp(16px, 4vh, 40px) 25px;
        overflow: hidden;
        min-height: 0;
    }

    .back-title {
        font-size: 1.25rem;
        text-align: center;
    }

    .back-divider {
        margin: clamp(6px, 1.5vh, 10px) auto clamp(10px, 2.5vh, 20px) auto;
    }

    .services-list {
        gap: clamp(8px, 2vh, 16px);
    }

    .services-list li {
        font-size: 0.95rem;
        align-items: flex-start;
    }

    .service-icon {
        margin-top: 3px;
    }

    @keyframes flyInRight {
        from { opacity: 0; transform: translateY(15px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .flip-hint {
        bottom: 48px;
        right: 14px;
        font-size: 0.85rem;
    }

    .legal-card { max-width: 100%; }
    .legal-face { max-height: 88vh; border-radius: 20px; }
    .legal-header { padding: 30px 24px 0 24px; }
    .legal-title { font-size: 1.5rem; }
    .legal-content { padding: 20px 24px 30px 24px; }
}
