/* ============================================================
   TITO.TRADE – FEATURES
   Übernommen aus dem React-Bits-Portfolio, TITO-Look:
   Copy-E-Mail-Button, Skill-Stack (Matter.js), Portrait-Morph,
   Timeline (Erfahrung/Ausbildung), Fraunces-Display, Lenis.
   ============================================================ */

/* ---------- Fraunces als Display-Serif (eigener Touch) ---------- */
:root {
    --font-display-serif: "Fraunces", ui-serif, Georgia, serif;
}
.section-title,
.contact-title {
    font-family: var(--font-display-serif);
    font-weight: 620;
    letter-spacing: -0.035em;
}
/* Sekundaer-Zeilen kursiv als Signatur */
.section-title .line2,
.contact-title .line2,
.contact-title .line3 {
    font-style: italic;
    font-weight: 560;
}

/* ---------- Lenis ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Copy-E-Mail-Button (Kontakt) ---------- */
.copy-email { margin-top: 2.25rem; }
.copy-email[hidden] { display: none; }
.copy-email-btn {
    --w-front: 200px;
    --w-rear: 260px;
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 52px;
    padding: 0 1.4rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-accent);
    color: #0a0b0c;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    width: var(--w-front);
    overflow: hidden;
    transition:
        width 0.5s var(--ease-smooth),
        background 0.3s var(--ease-smooth),
        color 0.3s var(--ease-smooth),
        box-shadow 0.3s var(--ease-smooth),
        border-color 0.3s var(--ease-smooth);
    will-change: width;
}
.copy-email-btn:hover,
.copy-email-btn:focus-visible {
    width: var(--w-rear);
    box-shadow: var(--glow-accent);
}
.copy-email-btn.is-copied {
    background: #000000;
    color: var(--color-accent);
    border-color: var(--color-accent);
    box-shadow: var(--glow-accent);
}
.copy-email-btn .ce-face {
    grid-area: 1 / 1;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    white-space: nowrap;
    width: max-content;
    transition: opacity 0.32s var(--ease-smooth), filter 0.32s var(--ease-smooth), transform 0.5s var(--ease-smooth);
}
.copy-email-btn .ce-rear { opacity: 0; filter: blur(8px); transform: translateX(8px); }
.copy-email-btn:hover .ce-front,
.copy-email-btn:focus-visible .ce-front { opacity: 0; filter: blur(8px); transform: translateX(-8px); }
.copy-email-btn:hover .ce-rear,
.copy-email-btn:focus-visible .ce-rear { opacity: 1; filter: blur(0); transform: translateX(0); }
.copy-email-btn .ce-copied-text { display: none; align-items: center; gap: 0.55rem; }
.copy-email-btn .ce-copied-check { display: inline-flex; }
.copy-email-btn .ce-copied-check svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.copy-email-btn.is-copied .ce-email-text { display: none; }
.copy-email-btn.is-copied .ce-copied-text { display: inline-flex; }

/* ---------- Skill-Stack (Matter.js) ---------- */
.stack-box {
    position: relative;
    margin-top: clamp(1.5rem, 4vw, 2.5rem);
    height: 280px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-large);
    background:
        radial-gradient(420px circle at 50% 120%, rgba(251, 255, 255, 0.05), transparent 70%),
        var(--color-surface-solid);
    overflow: hidden;
}
.stack-box[hidden] { display: none; }
.stack-stage {
    position: absolute;
    inset: 0;
    cursor: grab;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}
.stack-chip {
    position: absolute;
    top: 0; left: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.28rem 0.8rem 0.28rem 0.32rem;
    background: #101116;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    color: var(--color-text);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    pointer-events: none;
    will-change: transform;
}
.stack-chip-icon {
    display: inline-grid;
    place-items: center;
    width: 26px; height: 26px;
    border-radius: 9px;
    background: #fbffff;
    color: #0a0a0b;
    font-size: 0.72rem;
    font-weight: 700;
}
.stack-chip-icon img { width: 16px; height: 16px; }
.stack-hint {
    position: absolute;
    left: 50%; bottom: 0.8rem;
    transform: translateX(-50%);
    font-size: var(--fs-tiny);
    letter-spacing: 0.22em;
    color: var(--color-text-faint);
    pointer-events: none;
    animation: stackHintPulse 2.6s var(--ease-smooth) infinite;
}
@keyframes stackHintPulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}
.stack-reset {
    position: absolute;
    top: 0.8rem; right: 0.8rem;
    z-index: 5;
    width: 34px; height: 34px;
    display: inline-grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.25s, border-color 0.25s, transform 0.45s var(--ease-out);
}
.stack-reset:hover { color: var(--color-accent); border-color: var(--color-accent); transform: rotate(-180deg); }

/* ---------- Portrait-Morph (About) ---------- */
.about-portrait {
    margin-top: 2.25rem;
    width: min(300px, 78%);
    aspect-ratio: 4 / 5;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: 26px;
    background: var(--color-surface-solid);
}
.about-portrait[hidden] { display: none; }
.ap-inner { position: relative; width: 100%; height: 100%; border-radius: 20px; overflow: hidden; }
.ap-inner canvas { display: block; width: 100% !important; height: 100% !important; }
.about-portrait .ap-inner,
.about-portrait .ap-static {
    filter: grayscale(100%) contrast(1.02);
}
.ap-static {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    -webkit-user-drag: none;
}

/* ---------- Timeline (Erfahrung + Ausbildung) ---------- */
.timeline-grid {
    margin-top: clamp(2.5rem, 6vw, 4rem);
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: clamp(1rem, 2.5vw, 1.5rem);
    align-items: start;
}
.timeline-grid:has(#exp-box[hidden]):has(#edu-box[hidden]) { display: none; }
.tl-box {
    position: relative;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-large);
    background: var(--color-surface-solid);
    padding: 0.6rem;
    overflow: hidden;
}
.tl-title {
    margin: 0;
    padding: 0.5rem 0.9rem 0.75rem;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--color-text-muted);
}
.tl-list { list-style: none; margin: 0; padding: 0 0.5rem 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.tl-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 64px;
    padding: 0.55rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    background: #000000;
    transition: border-color 0.3s var(--ease-smooth);
}
.tl-item:hover { border-color: var(--color-border-strong); }
.tl-logo {
    flex: 0 0 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 13px;
    background: #ffffff;
    color: #0a0a0b;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
}
.tl-logo img { width: 22px; height: 22px; }
.tl-info { min-width: 0; display: flex; flex-direction: column; }
.tl-name { font-weight: 600; font-size: 1rem; color: var(--color-text); letter-spacing: -0.01em; }
.tl-sub { margin-top: 0.15rem; font-size: var(--fs-small); color: var(--color-text-muted); }
.tl-dot { margin: 0 0.55rem; color: var(--color-text-faint); }
.tl-period { color: var(--color-text-faint); }
#exp-scroll {
    max-height: 172px;            /* ca. 2 Zeilen eingeklappt */
    overflow: hidden;
    transition: max-height 0.55s var(--ease-smooth);
}
#exp-box.is-open #exp-scroll { max-height: var(--tl-full, 2000px); }
.tl-fade {
    position: absolute;
    left: 0; right: 0;
    bottom: 56px;
    height: 86px;
    pointer-events: none;
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 80%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 80%);
}
#exp-box.is-open .tl-fade { display: none; }
.tl-toggle {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 0 0.9rem;
    background: transparent;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--color-text-muted);
    font-family: var(--font-display);
    font-size: var(--fs-small);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.25s;
}
.tl-toggle:hover { color: var(--color-accent); }
.tl-toggle[hidden] { display: none; }
.tl-chev { display: inline-block; transition: transform 0.35s var(--ease-smooth); }
/* Kursiv-Labels (Mehr/Weniger) via i18n-Spans */
.tl-toggle .label-less { display: none; }
#exp-box.is-open .tl-toggle .label-more { display: none; }
#exp-box.is-open .tl-toggle .label-less { display: inline; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .timeline-grid { grid-template-columns: 1fr; }
    .about-portrait { width: min(280px, 100%); }
}
@media (max-width: 720px) {
    .stack-box { height: 230px; }
    .stack-hint { display: none; }
    .copy-email-btn { width: var(--w-rear); } /* Touch: E-Mail direkt sichtbar */
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .copy-email-btn,
    .copy-email-btn .ce-face,
    .stack-hint,
    #exp-scroll,
    .tl-chev,
    .tl-item {
        transition: none !important;
        animation: none !important;
    }
    .stack-hint { display: none; }
}
html.no-motion .copy-email-btn,
html.no-motion .ce-face,
html.no-motion .stack-hint,
html.no-motion #exp-scroll,
html.no-motion .tl-chev,
html.no-motion .tl-item {
    transition: none !important;
    animation: none !important;
}
html.no-motion .stack-hint { display: none; }
