/* =========================================================
   RESET
========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* =========================================================
   ROOT TYPOGRAPHY SYSTEM
========================================================= */

:root {
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;

    --fs-body: clamp(1rem, 0.92rem + 0.35vw, 1.18rem);
    --fs-lead: clamp(1.15rem, 1rem + 0.65vw, 1.55rem);

    --fs-h1: clamp(3rem, 1.65rem + 6vw, 6.4rem);
    --fs-h2: clamp(2rem, 1.35rem + 3vw, 3.8rem);
    --fs-h3: clamp(1.25rem, 1rem + 1vw, 1.8rem);

    --lh-tight: 0.92;
    --lh-heading: 1.02;
    --lh-body: 1.62;

    --space-xs: clamp(0.75rem, 0.6rem + 0.6vw, 1rem);
    --space-sm: clamp(1rem, 0.8rem + 1vw, 1.6rem);
    --space-md: clamp(1.8rem, 1.2rem + 2vw, 3rem);
    --space-lg: clamp(3rem, 2rem + 4vw, 6rem);

    --color-bg: #000000;
    --color-text: #ffffff;
    --color-text-soft: rgba(255,255,255,0.82);
    --color-border: #222222;
}

/* =========================================================
   BASE
========================================================= */

html {
    scroll-behavior: smooth;
    background-color: var(--color-bg);
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-main);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    letter-spacing: -0.01em;
    overflow-x: hidden;

    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a{text-decoration: underline; color:#fff;}

/* =========================================================
   SPOTLIGHT OVERLAY
========================================================= */

.spotlight-overlay {
    position: fixed;
    /* Verwende negative Werte, um iOS Rubber-Banding abzufangen */
    top: -50px;
    bottom: -50px;
    left: 0;
    right: 0;
    width: 100%;

    background:
        radial-gradient(
            circle 450px at center,
            rgba(0,0,0,0) 0%,
            rgba(0,0,0,0) 55%,
            rgba(0,0,0,1) 100%
        );

    pointer-events: none;
    z-index: 5;
}

/* =========================================================
   HEADER / LOGO / MENU
========================================================= */

.site-header {
    position: fixed;
    top: 40px;
    left: 40px;
    right: 40px;
    z-index: 110;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    pointer-events: none;
    overflow: visible;

    /* Hardware-Beschleunigung für flüssiges Scrollen auf iOS */
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

.logo-container,
.menu-toggle {
    pointer-events: auto;
}

.logo-container {
    display: block;
    width: 100px;
    height: 100px;
    overflow: visible;
}

.logo-container img {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    filter:
        invert(1)
        drop-shadow(0 0 10px rgba(255,255,255,0.95))
        drop-shadow(0 0 24px rgba(255,255,255,0.55));
}

.menu-toggle {
    width: 30px;
    height: 20px;
    margin-top: 10px;

    background: none;
    border: none;
    cursor: pointer;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #ffffff;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

body.menu-open .menu-toggle span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

body.menu-open .menu-toggle span:nth-child(2) {
    transform: translateY(-9px) rotate(-45deg);
}

/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
    position: fixed;
    top: 0;
    left: -400px;

    width: 350px;
    /* Nutzt dynamische Viewport-Höhe auf modernen iPhones */
    height: 100vh;
    height: 100dvh;

    padding: 150px 40px;

    background: #000000;
    border-right: 1px solid #111111;

    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
}

body.menu-open .sidebar {
    transform: translateX(400px);
}

.sidebar h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    margin-bottom: 2rem;
    opacity: 0.45;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 1.5rem;
}

.sidebar a {
    font-size: 1.45rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.sidebar a:hover {
    opacity: 0.7;
    transform: translateX(3px);
}

/* =========================================================
   CONTENT CONTAINER
========================================================= */

.content-container {
    position: relative;
    z-index: 1;

    width: 100%;
    max-width: 820px;
    margin: 0 auto;

    padding: clamp(24px, 5vw, 56px) 20px;
}

.page-section {
    margin-bottom: var(--space-lg);
}

/* =========================================================
   TYPOGRAPHY
========================================================= */

h1, h2, h3 {
    font-weight: 800;
    letter-spacing: -0.055em;
    text-wrap: balance;
}

h1 {
    font-size: var(--fs-h1);
    line-height: var(--lh-tight);
    margin-bottom: var(--space-md);
    max-width: 11ch;
}

h2 {
    font-size: var(--fs-h2);
    line-height: var(--lh-heading);
    margin-bottom: var(--space-sm);
    max-width: 14ch;
}

h3 {
    font-size: var(--fs-h3);
    line-height: 1.15;
    margin-bottom: var(--space-xs);
}

p {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    margin-bottom: var(--space-sm);
    max-width: 62ch;
    color: var(--color-text-soft);
}

h1 + p, .lead {
    font-size: var(--fs-lead);
    line-height: 1.42;
    color: rgba(255,255,255,0.92);
    max-width: 48ch;
}

/* =========================================================
   IMAGES
========================================================= */

.image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: #080808;
    border-radius: 18px;
    margin: var(--space-md) 0;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-wrapper.ai-badge {
    position: relative;
}

.image-wrapper.ai-badge::after {
    content: "AI-generated / enhanced";
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 2;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(178,255,196,0.92);
    color: #052e13;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(220,255,228,0.85);
    box-shadow: 0 8px 24px rgba(0,0,0,0.28), 0 0 18px rgba(178,255,196,0.45);
}

/* =========================================================
   BUTTONS
========================================================= */

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: var(--space-md) 0;
}

.project-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9em 1.45em;
    border-radius: 999px;
    background: #ffffff;
    color: #000000;
    text-decoration: none;
    font-weight: 700;
    font-size: clamp(0.9rem, 0.84rem + 0.25vw, 1rem);
    line-height: 1;
    transition: transform 0.25s ease, background-color 0.25s ease, opacity 0.25s ease;
}

.project-btn:hover {
    transform: translateY(-2px);
}

.project-btn.secondary {
    background: #0e0e0e;
    color: #ffffff;
}

/* =========================================================
   TOGGLE / FAQ
========================================================= */

.toggle-box {
    margin: 2rem 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.toggle-question {
    width: 100%;
    padding: 20px 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: #ffffff;
    text-align: left;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font: inherit;
    font-size: clamp(1rem, 0.9rem + 0.45vw, 1.2rem);
    font-weight: 800;
    line-height: 1.3;
    cursor: pointer;
}

.toggle-answer {
    display: none;
    padding-bottom: 20px;
}

.toggle-box.open .toggle-answer {
    display: block;
}

/* =========================================================
   LISTS
========================================================= */

.feature-list {
    margin: var(--space-md) 0;
    padding-left: 1.15em;
}

.feature-list li {
    font-size: var(--fs-body);
    line-height: 1.55;
    margin-bottom: 0.7rem;
    color: rgba(255,255,255,0.84);
}

/* =========================================================
   SCROLL SENTINEL
========================================================= */

#scroll-sentinel {
    width: 100%;
    height: 300px;
}

/* =========================================================
   MOBILE RESPONSIVENESS (<= 640px)
========================================================= */

@media (max-width: 640px) {

    .spotlight-overlay {
        z-index: 0;
    }

    /* 
       Optimierter Mobile-Header mit 30px "Überhang" nach oben (top: -30px),
       um Render-Lücken beim Einklappen der Safari-Adressleiste komplett zu kaschieren.
    */
    .site-header {
        position: fixed;
        top: -30px; 
        left: 0;
        right: 0;
        transform: none;

        width: 100%;
        max-width: 100%;

        /* Erhöhtes Padding oben fängt die -30px Verschiebung + die Safe-Area (Notch) ab */
        padding: calc(env(safe-area-inset-top, 0px) + 42px) 20px 24px 20px;
        min-height: auto;

        display: flex;
        align-items: center;
        justify-content: space-between;

        /* Der Farbverlauf startet mit 30px solidem Schwarz (für die Überhangs-Fläche) */
        background: linear-gradient(
            to bottom,
            rgba(0,0,0,1) 0%,
            rgba(0,0,0,1) 30px,
            rgba(0,0,0,0.95) 65%,
            rgba(0,0,0,0) 100%
        );

        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);

        z-index: 110;
        pointer-events: none;

        /* Erzwingt GPU-Rendering auf iOS, um Scroll-Ruckeln zu verhindern */
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    .logo-container,
    .menu-toggle {
        pointer-events: auto;
    }

    .logo-container {
        width: 64px;
        height: 64px;
        flex: 0 0 64px;
    }

    .menu-toggle {
        margin-top: 0;
        width: 30px;
        height: 20px;
        flex: 0 0 30px;
    }

    .content-container {
        padding-inline: 18px;
        /* Verhindert Kollision des Inhalts mit der Notch und dem Header */
        padding-top: calc(env(safe-area-inset-top, 0px) + 115px);
    }

    .sidebar {
        width: 100%;
        left: -100%;
        height: 100vh;
        height: 100dvh;
        padding: calc(env(safe-area-inset-top, 0px) + 110px) 28px 40px 28px;
    }

    body.menu-open .sidebar {
        transform: translateX(100%);
    }

    h1 {
        max-width: 9.5ch;
        letter-spacing: -0.06em;
    }

    p {
        max-width: 100%;
    }

    h1 + p, .lead {
        line-height: 1.46;
    }

    .project-btn {
        width: 100%;
    }

    .image-wrapper {
        margin: var(--space-md) 0;
    }

    /* 
       Optimierter Mobile-Bottom-Fade mit 30px "Unterhang" (bottom: -30px),
       damit beim Vergrößern des Safari-Fensters nach unten kein weißer Spalt entsteht.
    */
    .mobile-bottom-fade {
        display: block;
        position: fixed;
        bottom: -30px; 
        left: 0;
        right: 0;
        width: 100%;
        
        /* Höhe fängt iOS-Balken unten (safe-area-inset-bottom) perfekt ab */
        height: calc(env(safe-area-inset-bottom, 0px) + 110px);
        
        /* Startet unten mit 30px solidem Schwarz für die Pufferzone */
        background: linear-gradient(
            to top,
            rgba(0,0,0,1) 0%,
            rgba(0,0,0,1) 30px,
            rgba(0,0,0,0.88) 65%,
            rgba(0,0,0,0) 100%
        );
        
        pointer-events: none; /* Macht den Layer komplett durchklickbar */
        z-index: 90;

        /* GPU-Beschleunigung auf iOS aktivieren */
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
}