/* ==========================================================================
   Animations — Scroll reveals, hover effects, transitions
   Ratzel Rechtsanwaelte Theme
   ========================================================================== */

/* ==========================================================================
   1. Scroll-triggered fade-in animations (IntersectionObserver)
   ========================================================================== */

/* Initial hidden state — applied via JS */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: opacity, transform;
}

/* Slide-left variant (e.g. spec-image) */
.animate-on-scroll.slide-left {
    transform: translateX(-40px);
}

/* Slide-up-small variant (e.g. paragraphs) */
.animate-on-scroll.slide-up-sm {
    transform: translateY(20px);
}

/* Slide-up-large variant (e.g. hero image) */
.animate-on-scroll.slide-up-lg {
    transform: translateY(40px);
}

/* Visible state — added by IntersectionObserver */
.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translate(0, 0);
}

/* Stagger delay classes for grouped elements */
.animate-on-scroll.stagger-1 { transition-delay: 0.1s; }
.animate-on-scroll.stagger-2 { transition-delay: 0.2s; }
.animate-on-scroll.stagger-3 { transition-delay: 0.3s; }
.animate-on-scroll.stagger-4 { transition-delay: 0.4s; }
.animate-on-scroll.stagger-5 { transition-delay: 0.5s; }
.animate-on-scroll.stagger-6 { transition-delay: 0.6s; }
.animate-on-scroll.stagger-7 { transition-delay: 0.7s; }
.animate-on-scroll.stagger-8 { transition-delay: 0.8s; }

/* Content delay (for paragraphs following headings) */
.animate-on-scroll.delay-1 { transition-delay: 0.15s; }
.animate-on-scroll.delay-2 { transition-delay: 0.3s; }
.animate-on-scroll.delay-3 { transition-delay: 0.45s; }


/* ==========================================================================
   2. Attorney card hover effects
   ========================================================================== */

.attorney-card a {
    display: block;
}

/* Image wrapper clips the zoom — card size stays fixed */
.attorney-card__image-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

.attorney-card__image-wrap .attorney-card__image {
    display: block;
    width: 100%;
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.attorney-card:hover .attorney-card__image {
    transform: scale(1.05);
}

/* Info row: name/position left, arrow button right */
.attorney-card__info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-top: 16px;
}

.attorney-card__text {
    flex: 1;
}

/* Arrow always aligns to the top of the info row */
.attorney-card__arrow {
    margin-top: 4px;
}

/* Black arrow button — square with slight radius */
.attorney-card__arrow {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background-color: var(--color-text-heading);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attorney-card__arrow svg {
    transition: transform 0.3s ease;
}

.attorney-card:hover .attorney-card__arrow svg {
    transform: rotate(-45deg);
}


/* ==========================================================================
   3. Button hover — handled in components.css, no overrides needed here
   ========================================================================== */


/* ==========================================================================
   4. Practice area row hover
   ========================================================================== */

/* Arrow slides in from left on hover */
.practice-area-row__arrow {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.practice-area-row:hover .practice-area-row__arrow {
    opacity: 1;
    transform: translateX(0);
}


/* ==========================================================================
   5. Nav link hover underline (desktop only)
   ========================================================================== */

@media (min-width: 1024px) {
    /* Exclude the last nav item (CTA button) */
    .nav-list li:not(:last-child) a {
        position: relative;
    }

    .nav-list li:not(:last-child) a::after {
        content: '';
        position: absolute;
        bottom: -4px;
        left: 0;
        width: 100%;
        height: 1px;
        background-color: var(--color-accent-red);
        transform: scaleX(0);
        transform-origin: left center;
        transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    }

    .nav-list li:not(:last-child) a:hover::after {
        transform: scaleX(1);
    }
}


/* ==========================================================================
   6. FAQ accordion smooth transitions
   ========================================================================== */

.accordion__content {
    transition: max-height 0.4s ease;
}

.accordion__icon {
    transition: transform 0.3s ease;
}


/* ==========================================================================
   7. General transitions
   ========================================================================== */

/* Links */
a {
    transition: color 0.3s ease;
}

/* Images */
img {
    transition: transform 0.5s ease;
}

/* Hero image containers */
.hero-image,
.page-hero-image,
.news-hero,
.vortraege-hero {
    overflow: hidden;
}

/* Hero image reveal animation */
@keyframes heroReveal {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes heroSlideIn {
    0% { opacity: 0; transform: translateX(-40px); }
    100% { opacity: 1; transform: translateX(0); }
}

.news-hero__image,
.vortraege-hero__image,
.page-hero-image img,
.hero-image img,
.hero-offset__img img {
    animation: heroReveal 1s ease-out 0.1s both;
}

.hero-text h1 {
    animation: heroSlideIn 0.8s ease-out 0.15s both;
}

.hero-text > p {
    animation: heroSlideIn 0.8s ease-out 0.35s both;
}

.hero-text .btn {
    animation: heroSlideIn 0.8s ease-out 0.55s both;
}

.hero-offset__text {
    animation: heroReveal 0.8s ease-out 0.3s both;
}

@media (prefers-reduced-motion: reduce) {
    .news-hero__image,
    .vortraege-hero__image,
    .page-hero-image img,
    .hero-image img,
    .hero-offset__img img,
    .hero-offset__text,
    .hero-text h1,
    .hero-text > p,
    .hero-text .btn {
        animation: none;
    }
}

/* Cards: news-card, practice-area-card */
.news-card,
.practice-area-card {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.news-card:hover,
.practice-area-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

/* Link-arrow enhanced hover */
.link-arrow::after {
    transition: transform 0.3s ease;
}


/* ==========================================================================
   8. Reduced motion — respect user preference
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
        will-change: auto;
    }

    .animate-on-scroll.slide-left,
    .animate-on-scroll.slide-up-sm,
    .animate-on-scroll.slide-up-lg {
        transform: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
