/* ============ Schriften (selbst gehostet) ============ */
@font-face { font-family: 'Archivo'; src: url('fonts/archivo-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('fonts/archivo-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('fonts/geist-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('fonts/geist-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('fonts/geist-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

/* ============ Farben ============ */
:root {
    --black: #000000;
    --white: #ffffff;
    --silver: #c3c7cd;
    --silver-dim: #8d929a;
    --gold: #c9a45c;
    --line: rgba(255, 255, 255, 0.16);
    --font-display: 'Archivo', 'Arial Black', system-ui, sans-serif;
    --font-text: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

    /* Video etwas nach oben, damit über dem Kopf wenig Platz bleibt */
    --video-shift: -5%;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--black);
}

body {
    font-family: var(--font-text);
    color: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-font-smoothing: antialiased;
}

/* ============ Große Bildschirme: unscharfer Hintergrund ============ */
.ambient {
    position: fixed;
    inset: -10%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.ambient img,
.ambient video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(50px) brightness(0.85) saturate(1.2);
    transform: scale(1.1);
}
.ambient::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.7) 100%);
}

/* ============ Karte ============ */
.card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    height: min(calc(100dvh - 60px), 860px);
    border-radius: 36px;
    overflow: hidden;
    background: var(--black);
    text-align: center;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.07);
}

/* ============ Living Portrait ============ */
.portrait {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: var(--black);
}
.portrait-poster,
.portrait-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transform: translateY(var(--video-shift));
    pointer-events: none;
}
.portrait-video { opacity: 0; transition: opacity 0.4s ease; }
.portrait-video.is-playing { opacity: 1; }

/* Fester dunkler Verlauf: Text bleibt lesbar, auch wenn im Video geblitzt wird */
.shade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.55) 28%,
        rgba(0, 0, 0, 0.88) 55%,
        #000 100%);
}

/* ============ M-Zeichen oben links ============ */
.mark {
    position: absolute;
    z-index: 4;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 14px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mark img {
    display: block;
    height: 30px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}

/* ============ Inhalt ============ */
.content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 22px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 9.4vw, 2.35rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    white-space: nowrap;
    text-shadow: 0 0 14px rgba(225, 230, 240, 0.28), 0 2px 12px rgba(0, 0, 0, 0.6);
}

.title {
    margin-top: 6px;
    font-weight: 500;
    font-size: 1rem;
    color: var(--silver);
    letter-spacing: 0.01em;
}

.founder {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 14px;
}
/* wie im Logo: dünn, hellgrau, weit gesperrt */
.founder-label {
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    color: #b9bcc2;
}
.founder-logo {
    display: block;
    height: 30px;
    width: auto;
}

/* Großer weißer Button */
.save {
    margin-top: 18px;
    width: 100%;
    max-width: 368px;
    min-height: 54px;
    border-radius: 999px;
    background: var(--white);
    color: var(--black);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.save svg { width: 20px; height: 20px; fill: currentColor; }
.save:active { transform: scale(0.98); }
@media (hover: hover) { .save:hover { background: #ececec; } }

/* Icon-Reihe: immer sichtbar */
.links {
    margin-top: 14px;
    width: 100%;
    max-width: 368px;
    display: flex;
    justify-content: space-between;
}
.links a,
.links button {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--silver);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.links svg { width: 19px; height: 19px; fill: currentColor; }
.links a:active,
.links button:active { background: rgba(255, 255, 255, 0.16); }
@media (hover: hover) {
    .links a:hover,
    .links button:hover { color: var(--white); border-color: rgba(255, 255, 255, 0.4); }
}
/* QR-Button leicht golden */
#qr-btn { color: var(--gold); border-color: rgba(201, 164, 92, 0.45); }

/* Sichtbarer Fokus für Tastatur */
.save:focus-visible, .links a:focus-visible,
.links button:focus-visible, .mark:focus-visible, .qr-close:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

/* ============ QR im Vollbild ============ */
.qr {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #ffffff;
    color: #000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(env(safe-area-inset-top, 0px) + 24px) 24px calc(env(safe-area-inset-bottom, 0px) + 24px);
}
.qr[hidden] { display: none; }
.qr-code { padding: 16px; background: #ffffff; }
.qr-svg { display: block; width: min(78vw, 58vh, 420px); height: auto; }
.qr-hint { margin-top: 22px; font-size: 0.95rem; font-weight: 500; color: #333333; }
.qr-url { margin-top: 6px; font-size: 0.8rem; color: #777777; letter-spacing: 0.06em; }
.qr-close {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: 12px;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.qr-close svg { width: 20px; height: 20px; fill: #000000; }

/* ============ Intro (< 1,2 s, nur erster Besuch) ============ */
.intro {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    transform-origin: 50% 45%;
    animation: cameraPush 0.7s cubic-bezier(0.55, 0, 0.35, 1) 0.3s both;
}
.intro-light {
    position: absolute;
    inset: -20%;
    opacity: 0;
    background: radial-gradient(ellipse 75% 95% at 50% 45%,
        #ffffff 0%, rgba(255, 255, 255, 0.9) 45%, rgba(255, 255, 255, 0.5) 75%, rgba(255, 255, 255, 0.2) 100%);
    animation: lightFlood 0.75s ease-out 0.32s both;
}
.intro-doors {
    position: absolute;
    inset: 0;
    perspective: 1100px;
    perspective-origin: 50% 45%;
}
.intro-door {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50.2%;
    background: #000000;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.intro-door.left  { left: 0;  transform-origin: 0 50%;    animation: doorLeft 0.6s cubic-bezier(0.7, 0, 0.25, 1) 0.3s both; }
.intro-door.right { right: 0; transform-origin: 100% 50%; animation: doorRight 0.6s cubic-bezier(0.7, 0, 0.25, 1) 0.3s both; }

/* Lichtlinie: rein weiß/neutral, kein Farbstich */
.intro-seam {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: #ffffff;
    opacity: 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 0 26px rgba(255, 255, 255, 0.55), 0 0 60px rgba(255, 255, 255, 0.3);
    animation: seamGlow 0.75s ease 0s both;
}

/* Inhalt während des Intros */
.portrait { animation: arrive 0.8s cubic-bezier(0.3, 0, 0.2, 1) 0.3s both; }
.name, .title, .founder, .save, .links {
    animation: riseIn 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.name      { animation-delay: 0.62s; }
.title     { animation-delay: 0.68s; }
.founder   { animation-delay: 0.74s; }
.save      { animation-delay: 0.8s; }
.links     { animation-delay: 0.85s; }

@keyframes seamGlow {
    0%   { opacity: 0; transform: scaleY(0.3); }
    40%  { opacity: 1; transform: scaleY(1); }
    70%  { opacity: 1; width: 10px; margin-left: -5px; }
    100% { opacity: 0; width: 40px; margin-left: -20px; }
}
@keyframes doorLeft  { from { transform: rotateY(0); } to { transform: rotateY(-100deg); } }
@keyframes doorRight { from { transform: rotateY(0); } to { transform: rotateY(100deg); } }
@keyframes cameraPush { from { transform: scale(1); } to { transform: scale(1.7); } }
/* ruhigerer Blitz: max. 55 % Deckkraft, ein einziger weicher Anstieg und Abfall */
@keyframes lightFlood {
    0%   { opacity: 0; }
    35%  { opacity: 0.55; }
    100% { opacity: 0; }
}
@keyframes arrive { from { filter: blur(2px); transform: scale(0.94); } to { filter: none; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Kein Intro (2. Besuch, übersprungen oder reduzierte Bewegung): alles sofort da */
.no-intro .intro { display: none; }
.no-intro .portrait,
.no-intro .name, .no-intro .title, .no-intro .founder,
.no-intro .save, .no-intro .links { animation: none; }

/* Reduzierte Bewegung: nur Standbild, keine Übergänge */
.rm .portrait-video, .rm .ambient video { display: none; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

/* ============ Handy: Vollbild ============ */
@media (max-width: 480px) {
    .ambient { display: none; }
    .card {
        position: fixed;
        inset: 0;
        max-width: none;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Sehr schmale Handys: Icons dürfen umbrechen */
@media (max-width: 352px) {
    .links { flex-wrap: wrap; justify-content: center; gap: 8px; }
    .links a, .links button { width: 44px; height: 44px; }
}

/* Niedrige Bildschirme: etwas kompakter */
@media (max-height: 680px) {
    .name { font-size: 1.9rem; }
    .founder { margin-top: 10px; }
    .save { margin-top: 12px; min-height: 50px; }
    .links { margin-top: 10px; }
}
