/* ==========================================================================
 * referenzen.css
 * Design for the Referenzen (References) page – IBC Website
 *
 * Sections:
 *  §1  Hero Section
 *  §2  Section intro / counters
 *  §3  Filters
 *  §4  References Grid
 *  §5  Project Cards
 *  §6  CTA Card
 *  §7  Animations & Reveal
 *  §8  Hover effects (pointer-aware)
 *  §9  Responsive – Tablet (max 991 px)
 * §10  Responsive – Mobile (max 767 px)
 * §11  Responsive – Small Mobile (max 480 px)
 * §12  Reduced-motion overrides
 * ========================================================================== */

/* ══════════════════════════════════════════════════════════════════════════
   §1  HERO SECTION
   ══════════════════════════════════════════════════════════════════════════ */

.page-hero-section {
    background: linear-gradient(135deg, var(--ibc-blue) 0%, var(--ibc-green) 100%);
    padding: clamp(5rem, 12vw, 9rem) 0 clamp(4rem, 8vw, 7rem);
    position: relative;
    overflow: hidden;
}

/* Decorative orbs – desktop only (hidden below 768 px) */
.page-hero-section::before,
.page-hero-section::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.page-hero-section::before {
    width: clamp(280px, 35vw, 480px);
    height: clamp(280px, 35vw, 480px);
    background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 70%);
    top: -15%;
    right: -8%;
    animation: heroOrbFloat 12s ease-in-out infinite alternate;
}

.page-hero-section::after {
    width: clamp(200px, 25vw, 360px);
    height: clamp(200px, 25vw, 360px);
    background: radial-gradient(circle, rgba(109,151,68,.18) 0%, transparent 70%);
    bottom: -20%;
    left: -5%;
    animation: heroOrbFloat 16s ease-in-out infinite alternate-reverse;
}

@keyframes heroOrbFloat {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(20px, -20px) scale(1.08); }
}

/* ══════════════════════════════════════════════════════════════════════════
   §2  REFERENCES SECTION WRAPPER
   ══════════════════════════════════════════════════════════════════════════ */

.references-section {
    padding: clamp(4rem, 8vw, 7rem) 0 clamp(5rem, 10vw, 8rem);
    background: var(--bg-color-light);
    position: relative;
}

/* ══════════════════════════════════════════════════════════════════════════
   §3  FILTERS
   ══════════════════════════════════════════════════════════════════════════ */

.filters-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 3.5rem;
    padding: 2rem 1.5rem;
    background: #ffffff;
    border-radius: var(--border-radius-card, 24px);
    box-shadow:
        0 2px 8px rgba(32,35,74,.06),
        0 8px 24px rgba(32,35,74,.07);
    border: 1px solid rgba(32,35,74,.06);
}

.filter-group {
    text-align: center;
}

.filter-group + .filter-group {
    padding-top: 2rem;
    border-top: 1px solid rgba(32,35,74,.06);
}

.filter-group-title {
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ibc-blue);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.filter-group-title::before,
.filter-group-title::after {
    content: '';
    flex: 1;
    max-width: 80px;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(32,35,74,.15));
}

.filter-group-title::after {
    background: linear-gradient(to left, transparent, rgba(32,35,74,.15));
}

.filter-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    padding: 0 0.5rem;
}

/* Filter button base */
.filter-btn {
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.55rem 1.25rem;
    border: 1.5px solid rgba(32,35,74,.14);
    border-radius: var(--border-radius-pill, 50px);
    background: #ffffff;
    color: var(--ibc-text-secondary, #4d5061);
    cursor: pointer;
    transition:
        background 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.2s ease;
    position: relative;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Hover – only on pointer devices */
@media (hover: hover) and (pointer: fine) {
    .filter-btn:hover {
        transform: translateY(-2px);
        border-color: var(--ibc-green, #6D9744);
        color: var(--ibc-green, #6D9744);
        box-shadow: 0 4px 14px rgba(109,151,68,.18);
        background: rgba(109,151,68,.04);
    }
}

/* Active (pressed) feedback on all devices */
.filter-btn:active {
    transform: scale(0.96) translateY(0);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--ibc-green, #6D9744), var(--ibc-blue, #20234A));
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(109,151,68,.3);
    font-weight: 700;
}

.filter-btn.active:active {
    transform: scale(0.97);
}

.filter-btn:focus-visible {
    outline: 3px solid var(--ibc-green, #6D9744);
    outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════════════════════
   §4  REFERENCES GRID
   ══════════════════════════════════════════════════════════════════════════ */

.references-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.5rem, 3vw, 2.5rem);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0.5rem;
    align-items: start;
}

/* ══════════════════════════════════════════════════════════════════════════
   §5  PROJECT CARDS
   ══════════════════════════════════════════════════════════════════════════ */

.project-card {
    background: #ffffff;
    border-radius: var(--border-radius-card, 24px);
    overflow: hidden;
    box-shadow:
        0 2px 8px rgba(32,35,74,.06),
        0 6px 20px rgba(32,35,74,.07);
    border: 1px solid rgba(32,35,74,.06);
    transition:
        box-shadow 0.35s cubic-bezier(0.4,0,0.2,1),
        border-color 0.35s ease,
        transform 0.35s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    /* Reveal state (starts hidden, made visible by JS) */
    opacity: 0;
    transform: translateY(28px);
    will-change: transform, opacity;
}

/* JS adds .is-visible via IntersectionObserver */
.project-card.reveal-fx.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.35s cubic-bezier(0.4,0,0.2,1),
        border-color 0.35s ease;
}

/* Stagger via CSS custom property set in JS */
.project-card {
    transition-delay: var(--animation-delay, 0s);
}

/* ── Card image ── */
.project-card-image {
    height: 200px;
    background: linear-gradient(135deg, #f4f6f8 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.project-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(109,151,68,.08) 0%,
        rgba(32,35,74,.08) 100%
    );
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.project-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    z-index: 1;
}

/* ── Card content ── */
.project-card-content {
    padding: 1.75rem 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    z-index: 2;
}

/* ── Year badge ── */
.project-year-badge {
    position: absolute;
    top: -1.1rem;
    right: 1.5rem;
    background: var(--ibc-blue, #20234A);
    color: #ffffff;
    padding: 0.35rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 12px rgba(32,35,74,.2);
    z-index: 3;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* ── Category pill ── */
.project-category {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.9rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ibc-green, #6D9744);
    background: rgba(109,151,68,.1);
    border-radius: 4px;
    margin-bottom: 0.85rem;
    align-self: flex-start;
    transition: background 0.25s ease, transform 0.25s ease;
}

/* ── Card title ── */
.project-card h3 {
    font-family: var(--font-primary);
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    font-weight: 700;
    color: var(--ibc-blue, #20234A);
    margin: 0 0 0.9rem;
    line-height: 1.35;
    transition: color 0.25s ease;
}

/* ── Card description ── */
.project-card p {
    font-size: 0.92rem;
    color: var(--ibc-text-secondary, #4d5061);
    line-height: 1.65;
    margin: 0;
    flex-grow: 1;
}

/* ══════════════════════════════════════════════════════════════════════════
   §6  CTA CARD
   ══════════════════════════════════════════════════════════════════════════ */

.cta-card {
    background: radial-gradient(ellipse at 80% 10%, #1e2345 0%, #0e1020 100%);
    border-radius: var(--border-radius-card, 24px);
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(0,0,0,.22),
        0 2px 8px rgba(0,0,0,.14);
    border: 1px solid rgba(255,255,255,.08);
    transition:
        box-shadow 0.35s cubic-bezier(0.4,0,0.2,1),
        border-color 0.35s ease,
        transform 0.35s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(2.5rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 2.5rem);
    min-height: 420px;
    position: relative;
    color: #ffffff;
    cursor: default;
    /* Reveal initial state */
    opacity: 0;
    transform: translateY(28px);
    will-change: transform, opacity;
}

/* Decorative glow ring */
.cta-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(109,151,68,0) 0%,
        rgba(109,151,68,.25) 50%,
        rgba(109,151,68,0) 100%
    );
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    z-index: 0;
}

.cta-card > * {
    position: relative;
    z-index: 1;
}

.cta-card.reveal-fx.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.35s cubic-bezier(0.4,0,0.2,1),
        border-color 0.35s ease;
}

.cta-card {
    transition-delay: var(--animation-delay, 0s);
}

/* CTA icon */
.cta-icon {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    color: var(--ibc-green, #6D9744);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(72px, 10vw, 90px);
    height: clamp(72px, 10vw, 90px);
    background: rgba(109,151,68,.12);
    border-radius: 50%;
    animation: ctaIconFloat 4s ease-in-out infinite;
    transition: transform 0.3s ease, background 0.3s ease;
}

@keyframes ctaIconFloat {
    0%, 100% { transform: translateY(0);    }
    50%       { transform: translateY(-8px); }
}

.cta-card h3 {
    font-family: var(--font-primary);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.85rem;
    line-height: 1.25;
}

.cta-card p {
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    color: rgba(255,255,255,.8);
    line-height: 1.65;
    margin-bottom: 2rem;
    max-width: 380px;
}

/* CTA button */
.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--ibc-green, #6D9744);
    border: none;
    border-radius: var(--border-radius-pill, 50px);
    text-decoration: none;
    transition:
        background 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.2s ease;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(109,151,68,.4);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.cta-button:active {
    transform: scale(0.96);
}

.cta-button:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
}

.cta-button .arrow-icon {
    transition: transform 0.25s ease;
    display: inline-flex;
}

/* ══════════════════════════════════════════════════════════════════════════
   §7  ANIMATIONS & REVEAL
   ══════════════════════════════════════════════════════════════════════════ */

/* fade-in-up for the hero container */
.page-hero-section .fade-in-up {
    animation: fadeInUp 0.9s 0.1s both cubic-bezier(0.22, 1, 0.36, 1);
}

/* Grid stagger reveal – JS sets --animation-delay */
.reveal-fx {
    opacity: 0;
    transform: translateY(28px);
}

.reveal-fx.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--animation-delay, 0s),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--animation-delay, 0s);
}

/* ══════════════════════════════════════════════════════════════════════════
   §8  HOVER EFFECTS  (only on true pointer devices)
   ══════════════════════════════════════════════════════════════════════════ */

@media (hover: hover) and (pointer: fine) {
    /* Project card lift */
    .project-card:hover {
        transform: translateY(-10px) scale(1.015);
        box-shadow:
            0 16px 40px rgba(32,35,74,.13),
            0 6px 16px rgba(109,151,68,.12);
        border-color: rgba(109,151,68,.22);
    }

    .project-card:hover .project-card-image::after {
        opacity: 1;
    }

    .project-card:hover .project-card-image img {
        transform: scale(1.07);
    }

    .project-card:hover .project-year-badge {
        transform: translateY(-2px) scale(1.05);
        box-shadow: 0 6px 16px rgba(32,35,74,.28);
    }

    .project-card:hover .project-category {
        background: rgba(109,151,68,.16);
        transform: translateX(3px);
    }

    .project-card:hover h3 {
        color: var(--ibc-green, #6D9744);
    }

    /* CTA card lift */
    .cta-card:hover {
        transform: translateY(-10px) scale(1.015);
        box-shadow:
            0 20px 50px rgba(0,0,0,.32),
            0 6px 16px rgba(109,151,68,.14);
        border-color: rgba(109,151,68,.45);
    }

    .cta-card:hover::before {
        opacity: 1;
    }

    .cta-card:hover .cta-icon {
        background: rgba(109,151,68,.2);
        animation-duration: 2s;
    }

    /* CTA button hover */
    .cta-button:hover {
        background: #7caa52;
        box-shadow: 0 8px 24px rgba(109,151,68,.5);
        transform: translateY(-2px);
        color: #ffffff;
    }

    .cta-button:hover .arrow-icon {
        transform: translateX(5px);
    }
}

/* Touch / no-hover devices: show subtle tap feedback */
@media (hover: none) {
    .project-card:active {
        transform: scale(0.98);
        box-shadow:
            0 2px 8px rgba(32,35,74,.08),
            0 4px 12px rgba(32,35,74,.09);
    }

    .cta-card:active {
        transform: scale(0.98);
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   §9  RESPONSIVE – TABLET (≤ 991 px)
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 991px) {
    .references-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(1.25rem, 3vw, 2rem);
    }

    .filters-wrapper {
        padding: 1.75rem 1.25rem;
        gap: 1.5rem;
    }

    .filter-container {
        gap: 0.5rem;
    }

    .filter-btn {
        font-size: 0.84rem;
        padding: 0.5rem 1.1rem;
    }

    .cta-card {
        min-height: 380px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   §10  RESPONSIVE – MOBILE (≤ 767 px)
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    /* Hero */
    .page-hero-section::before,
    .page-hero-section::after {
        display: none;
    }

    /* Section padding */
    .references-section {
        padding: 3rem 0 4rem;
    }

    /* Filters */
    .filters-wrapper {
        padding: 1.5rem 1rem;
        gap: 1.25rem;
        border-radius: 16px;
        margin-bottom: 2.5rem;
    }

    .filter-group + .filter-group {
        padding-top: 1.25rem;
    }

    .filter-group-title {
        font-size: 0.75rem;
    }

    .filter-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        padding: 0.25rem 0 0.5rem;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;           /* Firefox */
        -ms-overflow-style: none;        /* IE / Edge */
        /* Side fade hint */
        mask-image: linear-gradient(to right, transparent 0%, black 5%, black 90%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 90%, transparent 100%);
    }

    .filter-container::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex-shrink: 0;
        font-size: 0.82rem;
        padding: 0.45rem 1rem;
    }

    /* Grid – single column on phones */
    .references-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 0 0.25rem;
    }

    /* Cards */
    .project-card-image {
        height: 170px;
    }

    .project-card-content {
        padding: 1.5rem 1.5rem 1.75rem;
    }

    .project-card h3 {
        font-size: 1.1rem;
    }

    /* CTA card */
    .cta-card {
        min-height: 340px;
        padding: 2.5rem 1.5rem;
    }

    .cta-card h3 {
        font-size: 1.5rem;
    }

    .cta-card p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .cta-icon {
        width: 70px;
        height: 70px;
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .cta-button {
        padding: 0.85rem 1.75rem;
        font-size: 0.95rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   §11  RESPONSIVE – SMALL MOBILE (≤ 480 px)
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .filters-wrapper {
        padding: 1.25rem 0.875rem;
    }

    .filter-btn {
        font-size: 0.8rem;
        padding: 0.42rem 0.9rem;
    }

    .project-card-image {
        height: 150px;
    }

    .project-card-content {
        padding: 1.25rem 1.25rem 1.5rem;
    }

    .project-year-badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.8rem;
        top: -0.9rem;
        right: 1.25rem;
    }

    .project-card h3 {
        font-size: 1rem;
    }

    .project-card p {
        font-size: 0.88rem;
    }

    .cta-card {
        min-height: 300px;
        padding: 2rem 1.25rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   §12  REDUCED MOTION
   ══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .page-hero-section::before,
    .page-hero-section::after {
        animation: none !important;
    }

    .cta-icon {
        animation: none !important;
    }

    /* Reveal: show immediately without transition */
    .project-card,
    .cta-card,
    .reveal-fx {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }

    /* Keep hover box-shadow feedback but remove transform */
    @media (hover: hover) and (pointer: fine) {
        .project-card:hover,
        .cta-card:hover {
            transform: none !important;
        }

        .filter-btn:hover {
            transform: none !important;
        }
    }
}

/* ── Utility ── */
.hidden {
    display: none !important;
}
