/* =========================================================
   Church of Madness — site overrides on top of Pico CSS dark
   ========================================================= */

/* Force black background / white text regardless of Pico theme */
:root {
    --pico-background-color: #000000;
    --pico-color: #ffffff;
    --pico-secondary-color: #cccccc;
    --pico-muted-color: #999999;
    --pico-border-color: #333333;
    --pico-card-background-color: #0d0d0d;
    --pico-card-border-color: #333333;
    --pico-primary: #ffffff;
    --pico-primary-hover: #dddddd;
    --pico-primary-focus: rgba(255,255,255,0.25);
    --pico-primary-inverse: #000000;
}

html, body {
    background: #000;
    color: #fff;
}

/* ── Header ─────────────────────────────────────────────── */

/*
 * Offset anchor scroll targets so they clear the sticky header.
 * scroll-padding-top covers elements that don't have scroll-margin-top set;
 * scroll-margin-top on sections is the per-element override.
 *
 * Desktop header is ~56px (single row). Mobile header is ~56px collapsed but
 * grows when the burger menu is open — use a generous value there.
 */
html {
    scroll-padding-top: 72px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #000;
    border-bottom: 1px solid #222;
    padding: 0 var(--pico-spacing);
}

.site-logo {
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #fff;
}

.site-header nav a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.site-header nav a:hover {
    color: #fff;
}

.site-header nav a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    border-radius: 2px;
}

/* ── Burger button (hidden on wide screens) ──────────────── */
.nav-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0.3rem;
    background: transparent;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    margin-left: auto;
}

.nav-burger__bar {
    display: block;
    width: 100%;
    height: 2px;
    background: #ccc;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Animated X when open */
.nav-burger[aria-expanded="true"] .nav-burger__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-burger[aria-expanded="true"] .nav-burger__bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.nav-burger[aria-expanded="true"] .nav-burger__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Responsive nav ─────────────────────────────────────── */
@media (max-width: 1000px) {
    #about .grid {
        grid-template-columns: 1fr;
    }

    #about .dj-card--group {
        margin: 0 auto;
        max-width: 100%;
    }

    .site-header nav {
        flex-wrap: wrap;
        align-items: center;
    }

    .nav-burger {
        display: flex;
    }

    /* The links list: hidden by default, slides down when open */
    #nav-links {
        display: none;
        flex-direction: column;
        gap: 0;
        width: 100%;
        padding: 0.5rem 0 0.75rem;
        margin: 0;
        border-top: 1px solid #222;
    }

    #nav-links.is-open {
        display: flex;
    }

    #nav-links li {
        padding: 0;
        margin: 0;
    }

    #nav-links li a {
        display: block;
        padding: 0.65rem 0.5rem;
        border-bottom: 1px solid #1a1a1a;
    }

    #nav-links li:last-child a {
        border-bottom: none;
    }

}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90vh;
    text-align: center;
    padding: 4rem 1rem;
    position: relative;
    overflow: hidden;
}

/* Background flyer collage — decorative only, aria-hidden */
.hero__bg-flyers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

.hero__bg-flyer {
    position: absolute;
    width: 180px;
    height: 255px;   /* ~A4 ratio */
    background-size: cover;
    background-position: center;
    transform: rotate(var(--r, 0deg));
    pointer-events: none;
    user-select: none;
    border-radius: 3px;
}

.hero__bg-flyer--photo {
    width: 160px;
    height: 160px;
    border-radius: 2px;
}

/* Wrinkled paper texture overlay on each background flyer */
.hero__bg-flyer-texture {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(255,255,255,0.015) 3px,
            rgba(255,255,255,0.015) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 7px,
            rgba(0,0,0,0.04) 7px,
            rgba(0,0,0,0.04) 8px
        );
    pointer-events: none;
}

/* Single dark overlay across the whole collage — fades all flyers uniformly */
.hero__bg-flyers::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

/* Hero content sits above the background flyers */
.hero > *:not(.hero__bg-flyers):not(.hero__twitch-sticker) {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: clamp(3rem, 10vw, 7rem);
    font-weight: 900;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    line-height: 1;
    text-shadow:
        0 0 40px rgba(0, 0, 0, 0.9),
        0 0 80px rgba(0, 0, 0, 0.7),
        0 2px 8px rgba(0, 0, 0, 0.95);
}

.hero p {
    font-size: 1.1rem;
    color: #aaa;
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ── Hero "Request a track" button ──────────────────────── */
.hero__request-ring {
    position: relative;
    display: inline-block;
    border-radius: var(--pico-border-radius);
    isolation: isolate;
}

/* Rotating gradient ring — identical colours and speed to .request-box */
.hero__request-ring::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(
        from var(--rg-angle),
        #000,
        #008080,
        #000,
        #008080,
        #000
    );
    z-index: -1;
    animation: rg-spin 16s linear infinite;
}

/* Solid fill so only the 2px strip shows through */
.hero__request-ring::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #000;
    z-index: -1;
}

.hero__request-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff;
    text-decoration: none;
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0;
    border-radius: var(--pico-border-radius);
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.hero__request-btn:hover,
.hero__request-btn:focus-visible {
    color: #008080;
    outline: none;
}

/* ── Hero inline request form ────────────────────────────── */
.hero__request-form {
    width: 100%;
    max-width: 860px;
    margin-top: 2rem;
}

/* ── Sections ────────────────────────────────────────────── */
section {
    padding: 1em 0;
    border-bottom: none;
}

section h2 {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 2rem;
}

/* ── sr-only utility ──────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ── Events / Flyers board — carousel stage ───────────────── */
/*
   --carousel-sides tells JS how many side slots are visible at this
   breakpoint without any JS media-query polling.
   Values: 3 (≥1100 px) · 2 (769–1099 px) · 1 (≤768 px)

   Desktop sizing targets ~80 vw total spread:
     Active card: 20 vw wide (A4 ratio → 28.3 vw tall)
     Side slots spaced 17 vw apart, scaling down 0.2 per step.
     7-item spread: 51vw + 9vw (half active + half outermost) × 2 ≈ 80 vw.
*/
.flyers-board {
    --carousel-sides: 3;
    display: block;
    position: relative;
    overflow: hidden;
    padding: 3rem 0 4rem;
    /* stage height = active card height (28.3 vw) + breathing room */
    min-height: calc(28.3vw + 6rem);
}

/* ── Flyer card — shared carousel base ───────────────────── */
.flyer {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20vw;
    height: 28.3vw;  /* 20vw × 1.414 — A4 ratio */
    margin: 0;
    /* hidden by default — JS assigns carousel-* classes */
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%);
    perspective: 900px;
    cursor: pointer;
    outline: none;
    border: none;
    background: none;
    padding: 0;
    transition:
        transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        filter     0.4s ease,
        opacity    0.3s ease,
        z-index    0s;
}

/* ── Active (centre) card — full size, full colour ── */
.flyer.carousel-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
    transform: translate(-50%, -50%) scale(1);
    filter: none;
}

/* ── Side slots — progressive overlap, outermost behind innermost ──
   Offsets are chosen so each card's edge slightly overlaps the card
   one step closer to centre, mirroring a fanned-out stack of flyers.
   Active half-width = 10vw.
   ±1 apparent half = 8vw  → centre at 10vw (overlaps active by 8vw)
   ±2 apparent half = 6vw  → centre at 19vw (overlaps ±1 by 7vw)
   ±3 apparent half = 4.5vw→ centre at 27vw (overlaps ±2 by 6.5vw)  */

/* slot ±1 */
.flyer.carousel-side-prev-1 {
    opacity: 1;
    pointer-events: auto;
    z-index: 9;
    transform: translate(calc(-50% - 10vw), -50%) scale(0.8);
    filter: saturate(0.5) brightness(0.5);
    cursor: pointer;
}
.flyer.carousel-side-next-1 {
    opacity: 1;
    pointer-events: auto;
    z-index: 9;
    transform: translate(calc(-50% + 10vw), -50%) scale(0.8);
    filter: saturate(0.5) brightness(0.5);
    cursor: pointer;
}

/* slot ±2 */
.flyer.carousel-side-prev-2 {
    opacity: 1;
    pointer-events: auto;
    z-index: 8;
    transform: translate(calc(-50% - 19vw), -50%) scale(0.6);
    filter: saturate(0.3) brightness(0.35);
    cursor: pointer;
}
.flyer.carousel-side-next-2 {
    opacity: 1;
    pointer-events: auto;
    z-index: 8;
    transform: translate(calc(-50% + 19vw), -50%) scale(0.6);
    filter: saturate(0.3) brightness(0.35);
    cursor: pointer;
}

/* slot ±3 */
.flyer.carousel-side-prev-3 {
    opacity: 1;
    pointer-events: auto;
    z-index: 7;
    transform: translate(calc(-50% - 27vw), -50%) scale(0.45);
    filter: saturate(0.2) brightness(0.25);
    cursor: pointer;
}
.flyer.carousel-side-next-3 {
    opacity: 1;
    pointer-events: auto;
    z-index: 7;
    transform: translate(calc(-50% + 27vw), -50%) scale(0.45);
    filter: saturate(0.2) brightness(0.25);
    cursor: pointer;
}

/* Hover cue only for the active card */
.flyer:not(.carousel-active) .flyer__hover-cue { display: none; }

/* Active card hover / focus — lift slightly */
.flyer.carousel-active:hover,
.flyer.carousel-active:focus-visible {
    transform: translate(-50%, calc(-50% - 8px)) scale(1.06);
    z-index: 30;
    box-shadow: 0 16px 40px rgba(0,0,0,0.8);
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 3px;
}

/* While flipped: sit on top */
.flyer.is-flipped {
    z-index: 30;
}

/* The inner element is the thing that actually rotates */
.flyer__inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.45, 0.05, 0.55, 0.95);
    border-radius: 4px;
    box-shadow: 4px 6px 18px rgba(0,0,0,0.7);
}

.flyer.is-flipped .flyer__inner {
    transform: rotateY(180deg);
}

/* Shared face styles */
.flyer__front,
.flyer__back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 4px;
    overflow: hidden;
}

/* ── Front face ───────────────────────────────────────────── */
.flyer__bg {
    position: absolute;
    inset: 0;
    background-color: #1a1a2e;   /* fallback when no image */
    background-size: cover;
    background-position: center;
    transition: filter 0.25s ease;
}

.flyer:hover .flyer__bg,
.flyer:focus-visible .flyer__bg {
    filter: brightness(0.75);
}

/* Paper/crease texture overlay — layered above the image */
.flyer__texture {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(255,255,255,0.015) 3px,
            rgba(255,255,255,0.015) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 7px,
            rgba(0,0,0,0.04) 7px,
            rgba(0,0,0,0.04) 8px
        );
    pointer-events: none;
}

/* "See details" cue — visible on hover/focus */
.flyer__hover-cue {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.9);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.flyer--no-image:hover .flyer__hover-cue,
.flyer--no-image:focus-visible .flyer__hover-cue {
    opacity: 1;
}

/* Date strip along the bottom of the front — hidden when a flyer image is present */
.flyer__date-strip {
    display: none;
}

.flyer--no-image .flyer__date-strip {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.85);
    text-align: center;
}

/* ── Back face ────────────────────────────────────────────── */
.flyer__back {
    transform: rotateY(180deg);
    background-color: #0d0d0d;
    background-image: url('../img/flyer-back-placeholder.svg');
    background-size: cover;
    background-position: center;
    border: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.flyer__back-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    z-index: 1;
    flex-shrink: 0;
}

.flyer__back-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.flyer__back-content {
    padding: 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow-y: auto;
    flex: 1;
    /* top padding leaves room for the close button */
    padding-top: 2.5rem;
}

.flyer__back-date {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888;
    margin: 0;
}

.flyer__back-title {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.25rem;
    color: #fff;
    line-height: 1.2;
}

.flyer__back-desc {
    font-size: 0.8rem;
    color: #bbb;
    margin: 0 0 0.4rem;
    line-height: 1.5;
}

.flyer__back-section {
    margin-top: 0.25rem;
}

.flyer__back-label {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #666;
    margin: 0 0 0.2rem;
}

.flyer__back-list,
article .flyer__back-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0;
    font-size: 0.8rem;
    color: #ddd;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.6rem;
}

/* Pico sets `ul li { list-style: square }` directly on li — override it here */
.flyer__back-list li {
    list-style: none !important;
    padding: 0;
}

.flyer__back-list a {
    color: #ddd;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.flyer__back-list a:hover { color: #fff; }

.flyer__back-actions {
    margin-top: auto;
    padding-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.flyer__back-btn {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 3px;
    background: #fff;
    color: #000;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.flyer__back-btn:hover { background: #ddd; }

.flyer__back-btn--secondary {
    background: transparent;
    color: #ccc;
    border: 1px solid #444;
}

.flyer__back-btn--secondary:hover { border-color: #888; color: #fff; }

/* Reduced motion — disable the flip animation */
@media (prefers-reduced-motion: reduce) {
    .flyer__inner { transition: none; }
    .flyer.carousel-active:hover,
    .flyer.carousel-active:focus-visible { transform: translate(-50%, -50%) scale(1); }
}

/* ── Parallax ────────────────────────────────────────────── */
/* Smooth the custom property update only when parallax-enabled is present.
   The transition is kept short (0.1s) so it tracks scroll without lag. */
.parallax-enabled .flyer,
.parallax-enabled .polaroid,
.parallax-enabled .dj-card {
    transition: transform 0.1s linear;
}

/* Disable parallax entirely when motion is not welcome */
@media (prefers-reduced-motion: reduce) {
    .parallax-enabled .flyer,
    .parallax-enabled .polaroid,
    .parallax-enabled .dj-card {
        transition: none;
    }
}

/* ── Responsive breakpoints — carousel slot count ── */

/* 769 px – 1099 px: 5 items (±2 sides) */
@media (min-width: 769px) and (max-width: 1099px) {
    .flyers-board { --carousel-sides: 2; }
}

/* ≤ 768 px: 3 items (±1 side), fluid vw sizing */
@media (max-width: 768px) {
    .flyers-board {
        --carousel-sides: 1;
        padding: 2rem 0 2.5rem;
        /* Use visible so side cards are never hard-clipped at the viewport edge */
        overflow: visible;
        min-height: calc(50.9vw + 5rem);
    }

    /* Active card: 36 vw wide, A4 ratio height */
    .flyer {
        width: 36vw;
        height: 50.9vw;
    }

    /* Side card offset: 22vw — outer edge sits at 22 + (36×0.5/2)=22+9=31vw from centre */
    .flyer.carousel-side-prev-1 {
        transform: translate(calc(-50% - 22vw), -50%) scale(0.5);
    }
    .flyer.carousel-side-next-1 {
        transform: translate(calc(-50% + 22vw), -50%) scale(0.5);
    }

    /* Request a Track button — wider and larger on mobile */
    .hero__request-ring {
        display: block;
        width: 80vw;
    }
    .hero__request-btn {
        display: block;
        width: 100%;
        text-align: center;
        font-size: 1.25rem;
        padding: 1rem 1.5rem;
    }
}

/* ── Gallery ─────────────────────────────────────────────── */
.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 2rem 1rem 4rem;
    justify-content: center;
    max-width: 1300px;
    margin-inline: auto;
}

/* ── Polaroid card ── */
.polaroid {
    background: #fff;
    color: #111;
    aspect-ratio: 5 / 6;
    padding: 0.6rem 0.6rem 1rem;
    margin: -1rem -0.8rem;          /* negative margin creates overlap */
    width: 220px;
    flex-shrink: 0;
    box-shadow: 3px 4px 14px rgba(0,0,0,0.7);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, z-index 0s;
    position: relative;
    z-index: 1;
}

.polaroid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
    display: block;
    filter: grayscale(20%);
    transition: filter 0.2s ease;
}

.polaroid figcaption {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Submit-photo card — small until activated, then enlarged over the gallery */
.polaroid--submit {
    z-index: 20;
    background: #fff;
}

.polaroid--submit .polaroid__inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.polaroid__front,
.polaroid__form {
    position: absolute;
    inset: 0;
}

.polaroid__front {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.polaroid__submit-icon { font-size: 4rem; line-height: 1; color: #333; }
.polaroid__form {
    display: none;
    overflow-y: auto;
    background: #fff;
    color: #111;
    padding: 0.8rem;
}

.polaroid--submit.is-flipped .polaroid__front { display: none; }
.polaroid--submit.is-flipped .polaroid__form { display: block; }

.photo-submit-form { font-size: 0.85rem; }
.photo-submit-form h3 {
    color: #222;
    font-size: 1.1rem;
    margin: 0 0 0.8rem;
    text-align: center;
}
.photo-submit-form label { margin-bottom: 0.45rem; }
.photo-submit-form input,
.photo-submit-form select,
.photo-submit-form textarea { font-size: 0.72rem; padding: 0.35rem; margin-bottom: 0.25rem; }
.photo-submit-form button { font-size: 0.72rem; padding: 0.4rem 0.6rem; }
.photo-submit-form small { display: block; color: #767676; }
.photo-submit-message { padding-top: 2rem; text-align: center; color: #6fcf6f; }

/* Unique rotation per card — cycles every 8 items */
.polaroid:nth-child(8n+1) { transform: rotate(-3deg)   translateY(var(--parallax-y, 0px)); }
.polaroid:nth-child(8n+2) { transform: rotate( 2deg)   translateY(var(--parallax-y, 0px)); }
.polaroid:nth-child(8n+3) { transform: rotate(-1.5deg) translateY(var(--parallax-y, 0px)); }
.polaroid:nth-child(8n+4) { transform: rotate( 4deg)   translateY(var(--parallax-y, 0px)); }
.polaroid:nth-child(8n+5) { transform: rotate(-4deg)   translateY(var(--parallax-y, 0px)); }
.polaroid:nth-child(8n+6) { transform: rotate( 1deg)   translateY(var(--parallax-y, 0px)); }
.polaroid:nth-child(8n+7) { transform: rotate( 3deg)   translateY(var(--parallax-y, 0px)); }
.polaroid:nth-child(8n+8) { transform: rotate(-2deg)   translateY(var(--parallax-y, 0px)); }

.polaroid--submit:hover {
    transform: rotate(0deg) scale(1.02) translateY(-6px);
}

.polaroid__close {
    float: right;
    padding: 0 0.3rem;
    background: transparent;
    border: 0;
    color: #555;
    font-size: 1.4rem;
}

/* Expand the available form area without scaling its text or moving the row.
   !important ensures these beat the nth-child rotation rules and :hover. */
.gallery-grid .polaroid--submit.is-flipped,
.gallery-grid .polaroid--submit.is-flipped:hover {
    transform: none !important;
    z-index: 20;
}

.gallery-grid .polaroid--submit.is-flipped .polaroid__inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 440px;
    height: 550px;
    background: #fff;
    box-shadow: 6px 10px 28px rgba(0,0,0,0.85);
}

/* Hover — lift, straighten, colour */
.polaroid:hover {
    transform: rotate(0deg) scale(1.08) translateY(-6px);
    box-shadow: 6px 10px 28px rgba(0,0,0,0.85);
    z-index: 10;
}

.polaroid:hover img {
    filter: grayscale(0%);
}

/* Two polaroids side-by-side on mobile */
@media (max-width: 768px) {
    .gallery-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        padding: 1rem 0.75rem 3rem;
        justify-content: unset;
        overflow: visible;
    }
    .polaroid {
        width: 100%;
        margin: -0.6rem -0.5rem;
        aspect-ratio: 5 / 6;
        flex-shrink: unset;
    }
    /* Stronger rotations on mobile — matches desktop character */
    .polaroid:nth-child(8n+1) { transform: rotate(-3deg)   translateY(var(--parallax-y, 0px)); }
    .polaroid:nth-child(8n+2) { transform: rotate( 2.5deg) translateY(var(--parallax-y, 0px)); }
    .polaroid:nth-child(8n+3) { transform: rotate(-2deg)   translateY(var(--parallax-y, 0px)); }
    .polaroid:nth-child(8n+4) { transform: rotate( 4deg)   translateY(var(--parallax-y, 0px)); }
    .polaroid:nth-child(8n+5) { transform: rotate(-4deg)   translateY(var(--parallax-y, 0px)); }
    .polaroid:nth-child(8n+6) { transform: rotate( 1.5deg) translateY(var(--parallax-y, 0px)); }
    .polaroid:nth-child(8n+7) { transform: rotate( 3deg)   translateY(var(--parallax-y, 0px)); }
    .polaroid:nth-child(8n+8) { transform: rotate(-2.5deg) translateY(var(--parallax-y, 0px)); }
}

/* Mobile photo-submit modal — rendered at body level, outside any transformed ancestor */
.photo-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.photo-modal-box {
    background: #fff;
    width: min(440px, calc(100vw - 2rem));
    height: min(550px, calc(100dvh - 2rem));
    box-shadow: 6px 10px 28px rgba(0, 0, 0, 0.85);
    overflow: hidden;
    position: relative;
}

.photo-modal-box .polaroid__form {
    position: static;
    display: block;
    height: 100%;
    width: 100%;
    overflow-y: auto;
}

/* Lightbox overlay */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 999;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
}

#lightbox.open {
    display: flex;
}

/* The polaroid card inside the lightbox */
#lightbox-polaroid {
    position: relative;
    background: #fff;
    padding: 1rem 1rem 4rem;
    box-shadow: 6px 10px 40px rgba(0,0,0,0.9);
    transform: rotate(-1.5deg);
    max-width: min(80vw, 540px);
    width: 100%;
}

#lightbox img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
    display: block;
    filter: grayscale(5%);
}

#lightbox-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 1rem;
}

#lightbox-close {
    position: absolute;
    top: -1rem;
    right: -1rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    background: #222;
    border: 2px solid #555;
    border-radius: 50%;
    z-index: 1;
}

#lightbox-close:hover,
#lightbox-close:focus-visible {
    background: #444;
    border-color: #aaa;
    outline: 2px solid #fff;
    outline-offset: 3px;
}

#lightbox-prev,
#lightbox-next {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    color: #fff;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    transition: background 0.15s, border-color 0.15s;
}

#lightbox-prev:hover,
#lightbox-next:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.5);
}

#lightbox-prev:focus-visible,
#lightbox-next:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

#lightbox-prev:disabled,
#lightbox-next:disabled {
    opacity: 0.2;
    cursor: default;
    pointer-events: none;
}

/* ── About ───────────────────────────────────────────────── */
#about .grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

/* ── DJ Cards ────────────────────────────────────────────── */
.dj-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 1rem 5rem;
}

.dj-card {
    width: 240px;
    aspect-ratio: 5 / 6;   /* matches .polaroid exactly */
    perspective: 800px;
    cursor: pointer;
    outline: none;
    border: none;
    background: none;
    padding: 0;
    flex-shrink: 0;
    position: relative;
}

/* Unique rotation per card + parallax composition.
   Card 1 = group photo, cards 2-4 = individual DJs. */
.dj-card:nth-child(1) { transform: rotate(-4deg)   translateY(var(--parallax-y, 0px)); z-index: 4; }
.dj-card:nth-child(2) { transform: rotate( 3deg)   translateY(var(--parallax-y, 0px)); z-index: 3; }
.dj-card:nth-child(3) { transform: rotate(-5deg)   translateY(var(--parallax-y, 0px)); z-index: 2; }
.dj-card:nth-child(4) { transform: rotate( 2.5deg) translateY(var(--parallax-y, 0px)); z-index: 1; }

/* Lift on hover/focus — straighten and bring forward */
.dj-card:hover,
.dj-card:focus-visible {
    transform: rotate(0deg) scale(1.05) translateY(-8px);
    z-index: 10;
}

/* Group photo card — purely decorative, no pointer or hover effect */
.dj-card--group {
    cursor: default;
    pointer-events: none;
    width: 336px;          /* 240px × 1.4 */
}

.dj-card--group .dj-card__inner {
    width: 336px;
}

.dj-card--group .dj-card__name {
    padding: 0.3rem 0.3rem 0.4rem;  /* tighter — less gap under photo */
}

/* Always position __inner absolutely centred so that the width animation
   between closed (240px) and open (420px) is symmetrical on both open and close. */
.dj-card__inner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 240px;
    aspect-ratio: 5 / 6;
    transform: translateX(-50%) translateY(-50%) rotateY(0deg);
    transform-style: preserve-3d;
    border-radius: 4px;
    box-shadow: 4px 6px 18px rgba(0,0,0,0.7);
}

@media (prefers-reduced-motion: no-preference) {
    .dj-card__inner {
        transition: transform 0.6s cubic-bezier(0.45, 0.05, 0.55, 0.95),
                    width    0.6s cubic-bezier(0.45, 0.05, 0.55, 0.95),
                    box-shadow 0.6s ease;
    }
}

.dj-card:focus-visible {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Flipped card sits on top while open — outer keeps its layout footprint */
.dj-card.is-flipped {
    z-index: 10;
    transform: rotate(0deg);
}

/* Expand and flip the inner element. The outer .dj-card keeps its layout
   footprint; only __inner visually grows via the width transition. */
.dj-card.is-flipped .dj-card__inner {
    width: 420px;
    transform: translateX(-50%) translateY(-50%) rotateY(180deg);
    box-shadow: 8px 14px 40px rgba(0,0,0,0.9);
    z-index: 10;
}

/* Shared face styles */
.dj-card__front,
.dj-card__back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 4px;
    overflow: hidden;
}

/* Front face — polaroid style */
.dj-card__front {
    background: #fff;
    display: flex;
    flex-direction: column;
    padding: 0.6rem 0.6rem 0;
}

.dj-card__photo {
    flex: 1;
    background-size: cover;
    background-position: center;
    background-color: #222;   /* placeholder colour when no image loaded */
    filter: grayscale(100%);
}

.dj-card__name {
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    font-weight: 600;
    color: #222;
    text-align: center;
    margin: 0;
    padding: 0.45rem 0.3rem 0.55rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Back face — aged paper note */
.dj-card__back {
    transform: rotateY(180deg);
    background: #f5f0e8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.9rem;
}

.dj-card__back-name {
    font-family: 'Caveat', cursive;
    font-size: 1.6rem;
    font-weight: 600;
    color: #2a1a0a;
    margin: 0;
    border-bottom: 1px solid #c8b89a;
    padding-bottom: 0.35rem;
}

.dj-card__back-bio {
    font-size: 0.9rem;
    line-height: 1.55;
    color: #3a2a1a;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
}

.dj-card__back-tag {
    font-size: 0.82rem;
    color: #7a5a3a;
    margin: 0;
    font-style: italic;
    letter-spacing: 0.04em;
}

/* ── Directions ──────────────────────────────────────────── */
.directions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.directions-grid iframe {
    aspect-ratio: 16/9;
    border-radius: var(--pico-border-radius);
    overflow: hidden;
    min-height: 300px;
}

.directions-info address {
    font-style: normal;
    line-height: 2;
    color: #ccc;
}

.directions-info h3 {
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.85rem;
    color: #888;
}

/* ── Track Request form ───────────────────────────────────── */
@property --rg-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

@keyframes rg-spin {
    to { --rg-angle: 360deg; }
}

.request-box {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
    padding: 2rem 2.5rem;
    background: transparent;
    border-radius: var(--pico-border-radius);
    position: relative;
    isolation: isolate;
}

.request-box__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0;
    padding: 0.25rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1;
    color: #888;
    cursor: pointer;
    z-index: 1;
}

.request-box__close:hover,
.request-box__close:focus-visible {
    color: #fff;
    outline: none;
}

/* Rotating gradient ring — sits 2px outside the box */
.request-box::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(
        from var(--rg-angle),
        #000,
        #008080,
        #000,
        #008080,
        #000
    );
    z-index: -1;
    animation: rg-spin 16s linear infinite;
}

/* Solid fill that covers the gradient except for the 2px border strip */
.request-box::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #111;
    z-index: -1;
}

.request-form {
    max-width: 100%;
}

.request-form-row {
    align-items: start;
}

.request-form-row button[type="submit"] {
    margin-top: calc(1rem * 1.5 + 0.5rem - 4.75px);
    margin-bottom: 0;
}

.request-success {
    max-width: 640px;
    padding: 1rem 1.25rem;
    background: #0d1f0d;
    border: 1px solid #2a5e2a;
    border-radius: var(--pico-border-radius);
    color: #6fcf6f;
}

.request-success p {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.request-errors {
    max-width: 640px;
    padding: 1rem 1.25rem;
    background: #1f0d0d;
    border: 1px solid #5e2a2a;
    border-radius: var(--pico-border-radius);
    color: #cf6f6f !important;
    margin-bottom: 1rem;
}

.request-errors li {
    color: #cf6f6f !important;
}

.request-errors ul {
    margin: 0;
    padding-left: 1.25rem;
}


/* ── Gallery batch loading ───────────────────────────────── */
@keyframes polaroid-drop {
    from {
        opacity: 0;
        transform: translateY(-60px) rotate(var(--r, 0deg));
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(var(--r, 0deg));
    }
}

.polaroid--dropping {
    animation: polaroid-drop 0.6s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
    .polaroid--dropping {
        animation: none;
        opacity: 1;
    }
}

.gallery-status {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    margin: 1rem 0 0.5rem;
    letter-spacing: 0.05em;
}

.gallery-more {
    display: block;
    margin: 0 auto;
    padding: 0.6rem 2rem;
    background: transparent;
    border: none;
    box-shadow: none;
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: var(--pico-border-radius);
    transition: color 0.2s;
    position: relative;
    isolation: isolate;
    z-index: 1;
}

.gallery-more::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(
        from var(--rg-angle),
        #000,
        #008080,
        #000,
        #008080,
        #000
    );
    z-index: -1;
    animation: rg-spin 16s linear infinite;
}

.gallery-more::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #000;
    z-index: -1;
}

.gallery-more:hover,
.gallery-more:focus-visible {
    color: #008080;
    outline: none;
}

/* ── Instagram section ───────────────────────────────────── */
#instagram {
    text-align: center;
}

.instagram-handle {
    margin: -1rem 0 2rem;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
}

.instagram-handle a {
    color: #aaa;
    text-decoration: none;
    border-bottom: 1px solid #444;
    padding-bottom: 1px;
    transition: color 0.2s, border-color 0.2s;
}

.instagram-handle a:hover {
    color: #fff;
    border-color: #fff;
}

#ig-feed {
    max-width: 960px;
    margin: 0 auto;
}

.ig-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
}

.ig-item {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background: #111;
}

.ig-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s, transform 0.3s;
}

.ig-item:hover img,
.ig-item:focus-visible img {
    opacity: 0.75;
    transform: scale(1.04);
}

.ig-video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.4rem;
    color: rgba(255,255,255,0.85);
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* ── Rules / Accessibility section ──────────────────────── */
.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.rules-grid h3 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #ccc;
    margin-bottom: 0.6rem;
}

.rules-grid ul {
    padding-left: 1.2rem;
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.8;
}

/* ── DJ card — close button on back face ─────────────────── */
.dj-card__back-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    color: #3a2a1a;
    background: transparent;
    border: 1px solid #c8b89a;
    border-radius: 50%;
    padding: 0;
}

.dj-card__back-close:hover,
.dj-card__back-close:focus-visible {
    background: #e8ddd0;
    outline: 2px solid #3a2a1a;
    outline-offset: 2px;
}

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 2rem;
    color: #555;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #888;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-social a:hover,
.footer-social a:focus {
    color: #008080;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    #about .grid {
        grid-template-columns: 1fr;
    }

    #about .dj-card--group {
        margin: 0 auto;
    }

    .event-card {
        grid-template-columns: 4rem 1fr;
    }

    .event-card a[role="button"] {
        grid-column: 1 / -1;
    }

    .directions-grid {
        grid-template-columns: 1fr;
    }
}
