/* ============================================
   BÄRLOCHER PRODUCTIONS — NARRATIVE EFFECTS
   Every animation serves the story:
   "Complexity → Clarity"
   ============================================ */

/* ============================================
   1. INK BLOOM — Hero Background
   An idea forming, not random particles
   ============================================ */
.hero__ink-bloom {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.hero__ink-bloom::before,
.hero__ink-bloom::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0;
    animation: inkBloom 4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero__ink-bloom::before {
    width: 60vw;
    height: 60vw;
    max-width: 700px;
    max-height: 700px;
    top: 10%;
    left: 20%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
    animation-delay: 0.5s;
}

.hero__ink-bloom::after {
    width: 40vw;
    height: 40vw;
    max-width: 500px;
    max-height: 500px;
    bottom: 15%;
    right: 15%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.08) 0%, transparent 70%);
    animation-delay: 1.2s;
}

@keyframes inkBloom {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    60% {
        opacity: 1;
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slow breathing after bloom */
.hero__ink-bloom.is-bloomed::before {
    animation: inkBreathe 8s ease-in-out infinite;
}

.hero__ink-bloom.is-bloomed::after {
    animation: inkBreathe 10s ease-in-out infinite reverse;
}

@keyframes inkBreathe {

    0%,
    100% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }

    50% {
        transform: scale(1.08) translate(2%, -1%);
        opacity: 0.85;
    }
}

/* ============================================
   2. HERO KNOCKOUT — Gold on Darkness
   Candlelight on engraved text, not a rainbow
   ============================================ */
@keyframes goldPulse {

    0%,
    100% {
        background-position: 0% 50%;
        filter: brightness(1);
    }

    50% {
        background-position: 100% 50%;
        filter: brightness(1.1);
    }
}

.text-knockout-animated {
    color: transparent !important;
    -webkit-text-stroke: 0 !important;
    text-stroke: 0 !important;
    background: linear-gradient(135deg,
            #d4af37 0%,
            #f5e7b2 30%,
            #d4af37 50%,
            #c9a227 70%,
            #f5e7b2 100%) !important;
    background-size: 200% 200% !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    animation: goldPulse 6s ease-in-out infinite !important;
}

[data-theme="light"] .text-knockout-animated {
    background: linear-gradient(135deg,
            #1a1a2e 0%,
            #4a4a6a 30%,
            #1a1a2e 50%,
            #2a2a4a 70%,
            #4a4a6a 100%) !important;
    background-size: 200% 200% !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
}

/* ============================================
   3. TYPEWRITER SUBTITLE REVEAL
   Live editorial process feeling
   ============================================ */
.hero__subtitle[data-typewriter-reveal] {
    overflow: hidden;
}

.hero__subtitle .typewriter-word {
    display: inline;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero__subtitle .typewriter-word.is-typed {
    opacity: 1;
    transform: translateY(0);
}

/* Cursor indicator */
.hero__subtitle .typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--color-accent-gold, #d4af37);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s step-end infinite;
}

@keyframes cursorBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ============================================
   4. COMPARISON CARDS — Narrative Differentiation
   Traditional = faded. Bärlocher = luminous.
   ============================================ */
.hybrid__card--traditional {
    transition: filter 1.2s ease, opacity 1.2s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hybrid__card--traditional.is-contrasted {
    filter: brightness(0.65) saturate(0.5);
    opacity: 0.7;
}

.hybrid__card--baerlocher {
    transition: filter 1.2s ease, box-shadow 1.2s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hybrid__card--baerlocher.is-contrasted {
    box-shadow: 0 0 60px rgba(212, 175, 55, 0.08), 0 20px 80px rgba(0, 0, 0, 0.3);
}

.hybrid__card--baerlocher.is-contrasted .caption {
    color: var(--color-accent-gold, #d4af37);
}

/* ============================================
   5. PROCESS PIPELINE — Thread Drawing
   A narrative thread connecting the steps
   ============================================ */
.process-pipeline {
    position: relative;
}

.process-pipeline .process-thread {
    position: absolute;
    top: 50%;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-accent-gold, #d4af37), rgba(139, 92, 246, 0.6));
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 1.8s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 0;
}

.process-pipeline.is-threaded .process-thread {
    transform: scaleX(1);
}

.process-step {
    position: relative;
    z-index: 1;
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.process-pipeline.is-threaded .process-step:nth-child(1) {
    transition-delay: 0.2s;
}

.process-pipeline.is-threaded .process-step:nth-child(3) {
    transition-delay: 0.6s;
}

.process-pipeline.is-threaded .process-step:nth-child(5) {
    transition-delay: 1.0s;
}

/* ============================================
   6. CINEMATIC PROJECT REVEALS
   B&W → Color, like a documentary edit
   ============================================ */
.project-showcase__image {
    filter: grayscale(100%) brightness(0.8);
    transition: filter 1.4s cubic-bezier(0.16, 1, 0.3, 1), transform 8s ease-out;
}

.project-showcase__item.is-visible .project-showcase__image,
.project-showcase__item:hover .project-showcase__image {
    filter: grayscale(0%) brightness(1);
}

/* Ken Burns — subtle slow zoom */
.project-showcase__item.is-visible .project-showcase__image {
    transform: scale(1.04);
}

/* Curtain wipe reveal */
.project-showcase__image-wrapper {
    position: relative;
    overflow: hidden;
}

.project-showcase__image-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--color-dark, #0a0a0a);
    transform-origin: left;
    transform: scaleX(1);
    transition: transform 1.2s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 2;
}

[data-theme="light"] .project-showcase__image-wrapper::after {
    background: var(--color-bg, #f8f6f0);
}

.project-showcase__item.is-visible .project-showcase__image-wrapper::after {
    transform: scaleX(0);
    transform-origin: right;
}

/* Category type-in effect */
.project-showcase__category {
    font-family: var(--font-mono, 'Courier New', monospace);
    letter-spacing: 0.08em;
    overflow: hidden;
    white-space: nowrap;
}

/* Arrow-draw CTA */
.project-showcase__cta svg {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateX(-4px);
    opacity: 0.5;
}

.project-showcase__item:hover .project-showcase__cta svg {
    transform: translateX(4px);
    opacity: 1;
}

/* ============================================
   7. SIGNATURE BLOCK — Personal & Intimate
   Handwriting-style reveal with drawn line
   ============================================ */
.signature-block {
    position: relative;
    padding-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.3s, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

.signature-block.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.signature-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--color-accent-gold, #d4af37), transparent);
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.signature-block.is-visible::before {
    width: 120px;
}

.signature-name {
    font-family: var(--font-display, 'Playfair Display', serif);
    font-style: italic;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.6s ease 0.8s, transform 0.6s ease 0.8s;
}

.signature-block.is-visible .signature-name {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   8. CAPTION ENTRANCE — Typesetter placing type
   ============================================ */
.section-header .caption {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    letter-spacing: 0.08em;
    transition: opacity 0.6s ease, transform 0.6s ease, letter-spacing 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-header.is-visible .caption,
.section-header.fade-in.is-visible .caption {
    opacity: 1;
    transform: translateY(0);
    letter-spacing: 0.2em;
}

/* ============================================
   9. PROFILE — Polaroid Portrait Reveal
   Film-frame borders that draw, then image fades
   ============================================ */
.profile__image-wrapper {
    position: relative;
}

.profile__image-wrapper::before {
    content: '';
    position: absolute;
    inset: -8px;
    border: 1px solid rgba(212, 175, 55, 0);
    transition: border-color 0.8s ease 0.3s;
    z-index: 2;
    pointer-events: none;
}

.profile__image-wrapper.is-visible::before {
    border-color: rgba(212, 175, 55, 0.3);
}

/* Subtle gold corner accents */
.profile__image-wrapper::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    width: 40px;
    height: 40px;
    border-top: 2px solid var(--color-accent-gold, #d4af37);
    border-left: 2px solid var(--color-accent-gold, #d4af37);
    opacity: 0;
    transition: opacity 0.6s ease 0.6s;
    z-index: 3;
    pointer-events: none;
}

.profile__image-wrapper.is-visible::after {
    opacity: 1;
}

/* Bottom-right corner accent (via JS-injected element) */
.profile__corner-accent {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 40px;
    height: 40px;
    border-bottom: 2px solid var(--color-accent-gold, #d4af37);
    border-right: 2px solid var(--color-accent-gold, #d4af37);
    opacity: 0;
    transition: opacity 0.6s ease 0.8s;
    z-index: 3;
    pointer-events: none;
}

.profile__image-wrapper.is-visible .profile__corner-accent {
    opacity: 1;
}

.profile__image-caption {
    transition: opacity 0.6s ease 1s, transform 0.6s ease 1s;
    opacity: 0;
    transform: translateY(8px);
}

.profile__image-wrapper.is-visible .profile__image-caption {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   10. BIO PROGRESS — Left border that draws
   Reading progress indicator
   ============================================ */
.profile__bio {
    position: relative;
    padding-left: 1.5rem;
}

.profile__bio::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 0;
    background: linear-gradient(180deg, var(--color-accent-gold, #d4af37), rgba(139, 92, 246, 0.4));
    transition: height 2s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile__bio.is-visible::before {
    height: 100%;
}

/* ============================================
   11. CREDENTIAL COUNTERS — Gold glow
   ============================================ */
.credential__value {
    transition: text-shadow 0.6s ease, color 0.6s ease;
}

.credential__value.is-counting {
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
    color: var(--color-accent-gold, #d4af37);
}

/* ============================================
   12. TESTIMONIAL — Editorial Slide
   Quote marks draw, card slides, author delays
   ============================================ */
.testimonial-card {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.4s ease,
        border-color 0.6s ease;
    position: relative;
}

/* Editorial top-light */
.testimonial-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.testimonial-card--active::before {
    opacity: 1;
}

/* Author reveal delay */
.testimonial-card__author {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease 0.4s, transform 0.5s ease 0.4s;
}

.testimonial-card--active .testimonial-card__author {
    opacity: 1;
    transform: translateY(0);
}

/* Quote mark entrance */
.testimonial-card__quote-mark {
    opacity: 0;
    transform: scale(0.7) translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.testimonial-card--active .testimonial-card__quote-mark {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* ============================================
   13. CONTACT — Split Screen Reveal
   Statement from left, form from right
   ============================================ */
.contact__statement {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.contact__statement.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.contact__form {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease 0.2s, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.contact__form.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Form field draw — border from center outward */
.form-input,
.form-textarea {
    position: relative;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    background-image: linear-gradient(var(--color-accent-gold, #d4af37), var(--color-accent-gold, #d4af37));
    background-size: 0% 2px;
    background-position: center bottom;
    background-repeat: no-repeat;
    transition: background-size 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s ease;
}

.form-input:focus,
.form-textarea:focus {
    background-size: 100% 2px;
    border-bottom-color: transparent;
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-textarea {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

/* Submit button ripple */
.btn--primary {
    position: relative;
    overflow: hidden;
}

.btn--primary .btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Trust line word-by-word */
.form-trust .trust-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.form-trust.is-visible .trust-word {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   14. CURSOR RIBBON TRAIL
   Flow, not just a dot
   ============================================ */
.cursor-ribbon {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

.cursor-ribbon__segment {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--color-accent-gold, #d4af37);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Cursor label on hover */
.cursor-label {
    position: fixed;
    pointer-events: none;
    z-index: 10001;
    font-family: var(--font-mono, monospace);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-off-white, #f0e6d8);
    opacity: 0;
    transform: translate(20px, -10px);
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.cursor-label.is-active {
    opacity: 0.6;
}

/* ============================================
   15. SCROLL VELOCITY SKEW
   Fast = motion. Slow = precision.
   ============================================ */
.velocity-skew {
    transition: transform 0.3s ease-out;
    will-change: transform;
}

/* ============================================
   16. THEME TRANSITION — Radial Wipe
   Light switch, not a jump cut
   ============================================ */
.theme-wipe {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-wipe.is-wiping {
    transform: scale(3);
}

/* ============================================
   17. SECTION DIVIDER — Minimal, purposeful
   ============================================ */
.section-divider {
    width: 100%;
    max-width: 120px;
    height: 1px;
    background: linear-gradient(90deg, var(--color-accent-gold, #d4af37), transparent);
    margin: 0 auto;
    border: none;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: opacity 0.8s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-divider.is-visible {
    opacity: 0.5;
    transform: scaleX(1);
}

/* ============================================
   18. NAV LINK UNDERLINE — Draw-in
   ============================================ */
.nav__link {
    position: relative;
}

.nav__link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-accent-gold, #d4af37);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav__link:hover::after,
.nav__link.active::after {
    width: 100%;
}

/* Footer links */
.footer__nav a {
    position: relative;
    display: inline-block;
}

.footer__nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: rgba(212, 175, 55, 0.5);
    transition: width 0.3s ease;
}

.footer__nav a:hover::after {
    width: 100%;
}

/* ============================================
   19. CARD HOVER — Subtle lift + gold accent
   ============================================ */
.hybrid__card,
.mandate-card,
.article-card {
    position: relative;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.5s ease;
}

.hybrid__card:hover,
.mandate-card:hover,
.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(212, 175, 55, 0.1);
}

/* ============================================
   20. CUSTOM SCROLLBAR — Thin, Gold accent
   ============================================ */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.6);
}

html {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.3) transparent;
}

/* ============================================
   21. SUBPAGE CONTENT ENTRANCE
   ============================================ */
.case-header,
.subpage-hero,
.service-hero {
    opacity: 0;
    animation: narrativeEntrance 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

@keyframes narrativeEntrance {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   22. STAGGER REVEAL — Cascading children
   ============================================ */
.stagger-reveal>* {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger-reveal.is-visible>* {
    opacity: 1;
    transform: translateY(0);
}

.stagger-reveal.is-visible>*:nth-child(1) {
    transition-delay: 0ms;
}

.stagger-reveal.is-visible>*:nth-child(2) {
    transition-delay: 100ms;
}

.stagger-reveal.is-visible>*:nth-child(3) {
    transition-delay: 200ms;
}

.stagger-reveal.is-visible>*:nth-child(4) {
    transition-delay: 300ms;
}

.stagger-reveal.is-visible>*:nth-child(5) {
    transition-delay: 400ms;
}

.stagger-reveal.is-visible>*:nth-child(6) {
    transition-delay: 500ms;
}

/* ============================================
   23. PREMIUM FOCUS STATES — Accessible
   ============================================ */
:focus-visible {
    outline: 2px solid var(--color-accent-gold, #d4af37) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15) !important;
}

/* ============================================
   24. PAGE ENTRANCE
   ============================================ */
body {
    animation: pageIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pageIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ============================================
   25. IMAGE REVEAL — Wipe mask
   ============================================ */
.reveal-image {
    position: relative;
    overflow: hidden;
}

.reveal-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--color-dark, #0a0a0a);
    transform: scaleX(1);
    transform-origin: right;
    transition: transform 1.2s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 1;
}

[data-theme="light"] .reveal-image::after {
    background: var(--color-bg, #f8f6f0);
}

.reveal-image.is-revealed::after {
    transform: scaleX(0);
}

/* ============================================
   26. HERO BADGE — Subtle pulse
   ============================================ */
@keyframes badgePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(212, 175, 55, 0);
    }
}

.hero__badge-dot {
    animation: badgePulse 3s ease-in-out infinite;
}

/* ============================================
   27. REDUCED MOTION — Respect the user
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    .hero__ink-bloom::before,
    .hero__ink-bloom::after,
    .text-knockout-animated,
    .hero__badge-dot,
    .reveal-image::after,
    .section-divider,
    body {
        animation: none !important;
    }

    .typewriter-word,
    .stagger-reveal>*,
    .signature-block,
    .signature-name,
    .contact__statement,
    .contact__form,
    .trust-word,
    .profile__bio::before {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .project-showcase__image {
        filter: none !important;
    }

    .project-showcase__image-wrapper::after {
        display: none;
    }
}