/**
 * Bombelli Analytics — Globale App-Styles
 * Persona-Adaption, Scroll-Progress, Exit-Modal, Reduced-Data
 */

/* ============================================================
 * Design-Tokens
 * ============================================================ */
:root {
    /* Easing-Kurven: drei Rollen, konsequent angewendet */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);      /* Reveals on-scroll */
    --ease-in-cubic: cubic-bezier(0.47, 0, 0.745, 0.715);/* Hover-Color-Shift */
    --ease-swiss: cubic-bezier(0.65, 0.05, 0, 1);        /* Transform-Hover, Line-Grow */
}

/* ============================================================
 * Typography-Fine-Tuning: enger, editorial
 * Adapts equipe-Style ohne Font-Lizenz-Kosten
 * text-wrap: balance sorgt fuer gleich lange Zeilen in Headlines,
 * statt dass das letzte Wort als "Witwe" auf einer Zeile haengt.
 * Browser-Support: Chrome 114+, Safari 17.5+, Firefox 121+.
 * ============================================================ */
h1, h2, h3 {
    text-wrap: balance;
}
p, li, blockquote, figcaption {
    text-wrap: pretty;
}
h1 {
    letter-spacing: -0.022em;
    line-height: 1.03;
}
h2 {
    letter-spacing: -0.018em;
    line-height: 1.08;
}
.counter,
.font-mono {
    font-variant-numeric: tabular-nums;
}

/* ============================================================
 * Line-Reveals: Divider wachsen von links ein
 * Bindung per .reveal-Observer, siehe app.js
 * ============================================================ */
.line-reveal {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.9s var(--ease-swiss);
    will-change: transform;
}
.line-reveal.visible,
.reveal.visible .line-reveal {
    transform: scaleX(1);
}

/* ============================================================
 * Process-Track: 5-Schritte-Prozess mit kontinuierlich
 * laufendem Light-Beam — ambient, nicht scroll-getriggert.
 * Der Beam zieht in den Grid-Gaps zwischen den Cards durch.
 * ============================================================ */
.process-track {
    position: relative;
}
.process-beam {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: 50%;
    height: 1px;
    transform: translateY(-50%);
    background: linear-gradient(to right,
        rgba(13, 139, 125, 0) 0%,
        rgba(13, 139, 125, 0.12) 18%,
        rgba(13, 139, 125, 0.6) 50%,
        rgba(13, 139, 125, 0.12) 82%,
        rgba(13, 139, 125, 0) 100%);
    background-size: 30% 100%;
    background-repeat: no-repeat;
    background-position: -30% 0;
    pointer-events: none;
    z-index: 0;
    animation: process-beam-loop 4.5s linear infinite;
}
@keyframes process-beam-loop {
    0%   { background-position: -30% 0; }
    100% { background-position: 130% 0; }
}
.process-step {
    position: relative;
    z-index: 1;
}
/* Beam auf Mobile vertikal (Cards stapeln untereinander) */
@media (max-width: 639px) {
    .process-beam {
        left: 50%;
        right: auto;
        top: 1rem;
        bottom: 1rem;
        height: auto;
        width: 1px;
        transform: translateX(-50%);
        background: linear-gradient(to bottom,
            rgba(13, 139, 125, 0) 0%,
            rgba(13, 139, 125, 0.12) 18%,
            rgba(13, 139, 125, 0.6) 50%,
            rgba(13, 139, 125, 0.12) 82%,
            rgba(13, 139, 125, 0) 100%);
        background-size: 100% 30%;
        background-position: 0 -30%;
        animation: process-beam-loop-vertical 4.5s linear infinite;
    }
    @keyframes process-beam-loop-vertical {
        0%   { background-position: 0 -30%; }
        100% { background-position: 0 130%; }
    }
}
@media (prefers-reduced-motion: reduce) {
    .process-beam {
        animation: none;
        background-position: 50% 50%;
    }
}

/* Scroll-Commitment-Indicator (I-06) */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #0D8B7D;
    transform: scaleX(0);
    transform-origin: left;
    z-index: 99;
    pointer-events: none;
    will-change: transform;
}

/* Exit-Intent-Modal (I-08) */
.exit-modal {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: 440px;
    width: calc(100vw - 32px);
    border-radius: 16px;
    overflow: hidden;
}
.exit-modal::backdrop {
    background: rgba(26, 26, 46, 0.55);
    backdrop-filter: blur(2px);
}
.exit-modal .exit-form {
    background: #FFFFFF;
    padding: 28px;
    display: grid;
    gap: 14px;
    color: #1a1a2e;
}
.exit-modal h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: #1a1a2e;
}
.exit-modal p {
    margin: 0;
    color: rgba(26, 26, 46, 0.7);
    font-size: 14px;
    line-height: 1.5;
}
.exit-modal label {
    display: grid;
    gap: 4px;
    font-size: 12px;
    color: rgba(26, 26, 46, 0.6);
    font-weight: 500;
}
.exit-modal input,
.exit-modal select,
.exit-modal textarea {
    padding: 12px 14px;
    border: 1px solid rgba(26, 26, 46, 0.15);
    border-radius: 10px;
    font-size: 15px;
    background: #FAFAF5;
    color: #1a1a2e;
    min-height: 48px;
    font-family: inherit;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
    width: 100%;
    box-sizing: border-box;
}
.exit-modal textarea {
    resize: vertical;
    min-height: 88px;
    line-height: 1.5;
}
.exit-modal .exit-trust {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(26, 26, 46, 0.08);
    font-size: 13px;
    line-height: 1.55;
    color: rgba(26, 26, 46, 0.72);
}
.exit-modal .exit-note {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(26, 26, 46, 0.52);
}
.exit-modal select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%230D8B7D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 8 10 13 15 8'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    cursor: pointer;
    font-weight: 500;
}
.exit-modal input:hover,
.exit-modal select:hover,
.exit-modal textarea:hover {
    border-color: rgba(26, 26, 46, 0.3);
    background-color: #ffffff;
}
.exit-modal input:focus,
.exit-modal select:focus,
.exit-modal textarea:focus {
    outline: none;
    border-color: #0D8B7D;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(13, 139, 125, 0.15);
}
.exit-modal .exit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}
.exit-modal .exit-actions button {
    padding: 10px 18px;
    border: 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.exit-modal .exit-actions button[value="cancel"] {
    background: transparent;
    color: rgba(26, 26, 46, 0.6);
}
.exit-modal .exit-actions button[value="submit"] {
    background: #0D8B7D;
    color: #FFFFFF;
}

/* Reduced-Motion respect */
@media (prefers-reduced-motion: reduce) {
    .scroll-progress { display: none; }
}

/* Reduced-Data respect */
.data-saver .scroll-progress { display: none; }
.data-saver .cartography-bg { display: none; }

/* ============================================================
 * Consent-Banner (tracking.js)
 * ============================================================ */
/* Scroll-Indicator: Fade-Schatten auf horizontal scrollbaren Tabellen-Wrappern */
.overflow-x-auto {
    position: relative;
    background-image:
        linear-gradient(to right, white 30%, rgba(255, 255, 255, 0)),
        linear-gradient(to right, rgba(255, 255, 255, 0), white 70%) 100% 0,
        radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)),
        radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}

.consent-banner {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: 680px;
    margin: 0 auto;
    background: #1a1a2e;
    color: #FAFAF5;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 200;
    animation: consent-in 360ms ease-out;
}
.consent-banner-inner {
    padding: 20px 24px;
    display: grid;
    gap: 12px;
}
.consent-banner p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(250, 250, 245, 0.85);
}
.consent-banner a {
    color: #0D8B7D;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.consent-banner a:hover {
    color: #FFFFFF;
}
.consent-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.consent-actions button {
    padding: 12px 16px;
    border: 1px solid rgba(250, 250, 245, 0.18);
    border-radius: 8px;
    background: transparent;
    color: rgba(250, 250, 245, 0.85);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    min-height: 48px;
    transition: background 200ms, border-color 200ms;
}
.consent-actions button:hover {
    background: rgba(250, 250, 245, 0.05);
    border-color: rgba(250, 250, 245, 0.3);
}
.consent-actions button.primary {
    background: #0D8B7D;
    border-color: #0D8B7D;
    color: #FFFFFF;
}
.consent-actions button.primary:hover {
    background: #0a7268;
}
@keyframes consent-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .consent-banner { animation: none; }
}
@media (max-width: 640px) {
    .consent-banner { bottom: 8px; left: 8px; right: 8px; }
    .consent-banner-inner { padding: 16px; }
    .consent-actions { flex-direction: column; }
    .consent-actions button { width: 100%; }
}
