/* ===========================
   Family Page — Scroll Override & Scrollbar Hiding
   =========================== */
html:has(.family-page) {
    scrollbar-width: none;
}

html:has(.family-page)::-webkit-scrollbar {
    display: none;
}

html:has(.family-page),
html:has(.family-page) body {
    overflow: auto;
    height: auto;
}

.family-page {
    position: relative;
    min-height: 100vh;
    background: #0c0c0c;
    padding: 1rem;
}

/* ===========================
   Page Header
   =========================== */
.family-header {
    padding: 8rem 2rem 3rem;
    text-align: center;
}

.family-header h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4.5rem, 12vw, 9rem);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0;
    transform: translateY(30px);
}

.band-bio {
    margin-top: 2rem;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    font-size: 1.6rem;
    line-height: 1.8;
    opacity: 0;
    transform: translateY(20px);
}

/* ===========================
   Timeline Layout
   =========================== */
.timeline {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem 6rem;
    display: flex;
    flex-direction: column;
    gap: 6rem;
}

/* Center vertical line */
.timeline__line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.08);
    transform-origin: top center;
    transform: scaleY(0);
    pointer-events: none;
}

/* Dot on center line */
.timeline__dot {
    position: absolute;
    left: 50%;
    top: 2rem;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: white;
    z-index: 2;
    transform: scale(0);
}

/* ===========================
   Timeline Entry (2-column grid)
   =========================== */
.timeline__entry {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    visibility: hidden;
}

/* Left: photo left, info right, gallery below photo */
.timeline__entry--left .timeline__photo {
    order: 1;
    grid-row: 1;
}
.timeline__entry--left .timeline__info {
    order: 2;
    grid-row: 1;
}
.timeline__entry--left .timeline__gallery {
    order: 3;
    grid-column: 1;
    grid-row: 2;
}

/* Right: info left, photo right, gallery below photo */
.timeline__entry--right .timeline__photo {
    order: 2;
    grid-row: 1;
}
.timeline__entry--right .timeline__info {
    order: 1;
    grid-row: 1;
}
.timeline__entry--right .timeline__gallery {
    order: 3;
    grid-column: 2;
    grid-row: 2;
}

/* FOUC prevention — unhide when GSAP ready */
.gsap-ready .timeline__entry,
.gsap-ready .timeline__dot {
    visibility: visible;
}

.gsap-ready .family-header h1,
.gsap-ready .band-bio {
    opacity: 0.85;
    transform: translateY(0);
}

/* ===========================
   Main Photo Panel (matches banner.css)
   =========================== */
.family-page .panel {
    position: relative;
    overflow: visible;
    filter: drop-shadow(4px 6px 12px rgba(0, 0, 0, 0.6))
            drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.4));
}

.lightbox-trigger {
    cursor: pointer;
}

.timeline__entry--left .panel {
    transform: rotate(-1.5deg);
}

.timeline__entry--right .panel {
    transform: rotate(1.5deg);
}

.family-page .panel-inner,
.family-page .panel .paper-edge {
    clip-path: polygon(0.0% 0%, 5.0% 4.2%, 10.0% 0.1%, 15.0% 1.0%, 20.0% 0.8%, 25.0% 2.6%, 30.0% 2.4%, 35.0% 3.1%, 40.0% 0.3%, 45.0% 1.5%, 50.0% 0.1%, 55.0% 0.8%, 60.0% 1.8%, 65.0% 0.1%, 70.0% 0.7%, 75.0% 2.3%, 80.0% 1.9%, 85.0% 0.8%, 90.0% 2.1%, 95.0% 2.8%, 100.0% 0%, 100.0% 5.0%, 97.2% 10.0%, 97.6% 15.0%, 98.8% 20.0%, 99.5% 25.0%, 96.6% 30.0%, 98.8% 35.0%, 99.7% 40.0%, 99.7% 45.0%, 97.0% 50.0%, 97.9% 55.0%, 97.2% 60.0%, 97.4% 65.0%, 98.1% 70.0%, 96.6% 75.0%, 98.7% 80.0%, 98.1% 85.0%, 97.1% 90.0%, 97.8% 95.0%, 100% 100.0%, 95.0% 97.0%, 90.0% 98.0%, 85.0% 97.5%, 80.0% 99.8%, 75.0% 99.2%, 70.0% 99.0%, 65.0% 99.7%, 60.0% 99.2%, 55.0% 99.6%, 50.0% 99.0%, 45.0% 97.8%, 40.0% 98.7%, 35.0% 98.7%, 30.0% 99.3%, 25.0% 99.1%, 20.0% 96.7%, 15.0% 97.7%, 10.0% 97.9%, 5.0% 99.4%, 0.0% 100%, 2.6% 95.0%, 0.6% 90.0%, 1.3% 85.0%, 3.5% 80.0%, 2.2% 75.0%, 1.9% 70.0%, 2.4% 65.0%, 2.9% 60.0%, 2.7% 55.0%, 0.8% 50.0%, 0.1% 45.0%, 1.1% 40.0%, 0.9% 35.0%, 0.7% 30.0%, 3.3% 25.0%, 3.1% 20.0%, 1.1% 15.0%, 2.3% 10.0%, 1.4% 5.0%);
}

.family-page .panel-inner {
    position: relative;
    filter: grayscale(100%) contrast(1.1) brightness(0.8);
    transition: filter 0.4s ease;
    /* Dark background to hide white anti-aliasing artifacts at torn edges */
    background: #000;
}

.family-page .panel:hover .panel-inner {
    filter: grayscale(0%) contrast(1) brightness(1);
}

.family-page .panel-inner img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===========================
   Paper Edge (matches banner.css)
   =========================== */
.family-page .paper-edge {
    position: absolute;
    inset: -10px;
    z-index: -1;
    background: #f0f0f0;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(200, 200, 200, 0.25) 3px,
            rgba(200, 200, 200, 0.25) 4px,
            transparent 4px,
            transparent 7px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 6px,
            rgba(210, 210, 210, 0.12) 6px,
            rgba(210, 210, 210, 0.12) 7px,
            transparent 7px,
            transparent 14px
        );
}

.family-page .paper-edge::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.18;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
    background-size: 150px;
    mix-blend-mode: multiply;
}

/* ===========================
   Tape (matches banner.css)
   =========================== */
.family-page .tape {
    position: absolute;
    width: 60px;
    height: 18px;
    background: rgba(245, 245, 230, 0.85);
    z-index: 5;
    transform: rotate(var(--tape-rot, -5deg));
    border-radius: 1px;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    opacity: 0.9;
    pointer-events: none;
    border: 1px solid rgba(220, 220, 200, 0.6);
}

.family-page .tape::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.4) 45%, transparent 60%),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.02) 2px,
            rgba(0, 0, 0, 0.02) 3px
        );
    border-radius: inherit;
}

/* ===========================
   Member Info
   =========================== */
.member__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.1;
}

.member__role {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.4;
    margin-top: 0.5rem;
}

.member__bio {
    margin-top: 1.5rem;
    font-size: 1.125rem;
    line-height: 1.7;
    opacity: 0.8;
    max-width: 500px;
}

/* ===========================
   Gallery (scattered-stack overlap)
   =========================== */
.timeline__gallery {
    display: flex;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-left: 15px;
    padding-right: 15px;
}

.gallery-item {
    position: relative;
    width: 120px;
    overflow: visible;
    margin-left: -15px;
    margin-right: -15px;
    filter: drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s ease, z-index 0.3s ease;
}

.gallery-item__inner,
.gallery-item .paper-edge {
    clip-path: polygon(0.0% 0%, 5.0% 0.9%, 10.0% 3.7%, 15.0% 3.8%, 20.0% 0.1%, 25.0% 3.4%, 30.0% 2.9%, 35.0% 2.7%, 40.0% 0.0%, 45.0% 3.3%, 50.0% 1.5%, 55.0% 3.2%, 60.0% 2.1%, 65.0% 3.0%, 70.0% 2.9%, 75.0% 1.4%, 80.0% 2.7%, 85.0% 3.9%, 90.0% 3.6%, 95.0% 3.6%, 100.0% 0%, 99.6% 5.0%, 97.4% 10.0%, 96.6% 15.0%, 98.8% 20.0%, 99.8% 25.0%, 97.0% 30.0%, 97.7% 35.0%, 96.1% 40.0%, 99.0% 45.0%, 99.6% 50.0%, 97.7% 55.0%, 96.6% 60.0%, 97.4% 65.0%, 99.6% 70.0%, 98.6% 75.0%, 99.5% 80.0%, 98.4% 85.0%, 96.9% 90.0%, 98.2% 95.0%, 100% 100.0%, 95.0% 97.9%, 90.0% 99.1%, 85.0% 97.9%, 80.0% 96.0%, 75.0% 98.4%, 70.0% 98.8%, 65.0% 97.2%, 60.0% 96.5%, 55.0% 99.8%, 50.0% 97.4%, 45.0% 97.6%, 40.0% 97.6%, 35.0% 97.9%, 30.0% 97.3%, 25.0% 96.6%, 20.0% 99.0%, 15.0% 99.4%, 10.0% 99.4%, 5.0% 97.8%, 0.0% 100%, 1.0% 95.0%, 1.9% 90.0%, 2.1% 85.0%, 1.7% 80.0%, 2.5% 75.0%, 2.1% 70.0%, 2.1% 65.0%, 3.1% 60.0%, 1.5% 55.0%, 0.1% 50.0%, 3.6% 45.0%, 1.4% 40.0%, 1.6% 35.0%, 0.5% 30.0%, 2.3% 25.0%, 3.2% 20.0%, 0.3% 15.0%, 2.3% 10.0%, 0.2% 5.0%);
}

.gallery-item__inner {
    filter: grayscale(100%) contrast(1.1) brightness(0.8);
    transition: filter 0.4s ease;
    /* Dark background to hide white anti-aliasing artifacts at torn edges */
    background: #000;
}

.gallery-item:hover .gallery-item__inner {
    filter: grayscale(0%) contrast(1) brightness(1);
}

.gallery-item__inner img {
    width: 100%;
    height: auto;
    display: block;
}

/* Varied rotations + vertical offsets for scattered look */
.gallery-item:nth-child(1) { transform: rotate(-3deg) translateY(4px); z-index: 1; }
.gallery-item:nth-child(2) { transform: rotate(2deg) translateY(-6px); z-index: 2; }
.gallery-item:nth-child(3) { transform: rotate(-1deg) translateY(2px); z-index: 3; }
.gallery-item:nth-child(4) { transform: rotate(2.5deg) translateY(-4px); z-index: 2; }
.gallery-item:nth-child(5) { transform: rotate(-1.5deg) translateY(5px); z-index: 1; }

/* Hover: straighten, lift, and bring to front */
.gallery-item:hover {
    z-index: 10 !important;
    transform: rotate(0deg) translateY(-8px) scale(1.08);
}

/* ===========================
   Grain Overlay
   =========================== */
.family-page > .grain {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    opacity: 0.08;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px;
}

/* ===========================
   Lightbox
   =========================== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox__close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    padding: 0;
    width: 3rem;
    height: 3rem;
    z-index: 1001;
}

.lightbox__close:hover {
    opacity: 1;
}

.lightbox__prev,
.lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 3rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, background 0.2s ease;
    padding: 1rem 1.5rem;
    z-index: 1001;
    border-radius: 4px;
}

.lightbox__prev:hover,
.lightbox__next:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

.lightbox__prev {
    left: 2rem;
}

.lightbox__next {
    right: 2rem;
}

.lightbox__counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 0.9rem;
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

/* Hide navigation for single images */
.lightbox.single-image .lightbox__prev,
.lightbox.single-image .lightbox__next,
.lightbox.single-image .lightbox__counter {
    display: none;
}

.lightbox__image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    filter: grayscale(100%) contrast(1.1) brightness(0.9);
}

/* ===========================
   Responsive: Mobile (<= 768px)
   =========================== */
@media (max-width: 768px) {
    .family-header {
        padding: 5rem 1.5rem 2rem;
    }

    .timeline {
        padding: 0 1.5rem 5rem;
        gap: 4rem;
    }

    /* Hide timeline line and dots on mobile */
    .timeline__line,
    .timeline__dot {
        display: none;
    }

    .timeline__entry {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Always photo first on mobile */
    .timeline__entry--left .timeline__photo,
    .timeline__entry--right .timeline__photo {
        order: 1;
        grid-row: 1;
    }
    .timeline__entry--left .timeline__info,
    .timeline__entry--right .timeline__info {
        order: 2;
        grid-row: 2;
    }
    .timeline__entry--left .timeline__gallery,
    .timeline__entry--right .timeline__gallery {
        order: 3;
        grid-column: 1;
        grid-row: 3;
    }

    .family-page .panel {
        transform: rotate(-1deg) !important;
    }

    .gallery-item {
        width: 100px;
        margin-left: -10px;
        margin-right: -10px;
    }

    .timeline__gallery {
        padding-left: 10px;
        padding-right: 10px;
    }

    .lightbox__prev,
    .lightbox__next {
        font-size: 2rem;
        padding: 0.75rem 1rem;
    }

    .lightbox__prev {
        left: 1rem;
    }

    .lightbox__next {
        right: 1rem;
    }
}
