* { box-sizing: border-box; }
:root {
    color-scheme: light;
    --bg: #f5f5f3;
    --card: #ffffff;
    --text: #222;
    --muted: #6d6d6d;
    --accent: #285943;
    --accent-dark: #173b2c;
    --border: #deded8;
}
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
.wrap { width: min(1200px, calc(100% - 32px)); margin-inline: auto; }
.site-header { padding: 28px 0 20px; }
.site-header h1 { margin: 0 0 6px; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.site-header p { margin: 0; color: var(--muted); max-width: 760px; }

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    padding-bottom: 48px;
}
.item-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 9px rgba(0,0,0,.05);
}
.image-button {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    background: #e7e7e2;
    cursor: zoom-in;
    overflow: hidden;
}

/* Prominent diagonal REQUESTED ribbon */
.requested-badge {
    position: absolute;
    z-index: 5;
    width: 150%;
    left: -25%;
    top: 50%;
    transform: translateY(-50%) rotate(-25deg);
    background: #d60000;
    color: #fff;
    padding: 12px 0;
    font-size: clamp(1.25rem, 2.4vw, 2rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
    border-top: 2px solid rgba(255,255,255,.8);
    border-bottom: 2px solid rgba(255,255,255,.8);
    box-shadow: 0 3px 8px rgba(0,0,0,.35),
                inset 0 1px 0 rgba(255,255,255,.25);
    pointer-events: none;
    text-shadow: 0 2px 2px rgba(0,0,0,.3);
}

.image-button:disabled { cursor: default; }
.image-button img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .18s ease;
}
.image-button:hover img { transform: scale(1.025); }
.photo-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: rgba(0,0,0,.72);
    color: white;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: .8rem;
}
.no-photo {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
}
.card-body { padding: 15px; }
.item-number {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.card-body h2 { margin: 4px 0 10px; font-size: 1.15rem; }
.spoken-for, .available, .notes { font-size: .92rem; margin: 8px 0; }
.available { color: var(--muted); }
.spoken-for { color: var(--accent-dark); }

.interest-button, .submit-button {
    width: 100%;
    border: 0;
    border-radius: 9px;
    padding: 10px 13px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.interest-button:hover, .submit-button:hover { background: var(--accent-dark); }

.lightbox[hidden] { display: none; }
.lightbox {
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0,0,0,.94);
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    grid-template-rows: 1fr auto;
    color: #fff;
    touch-action: none;
}
.lightbox-stage {
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.lightbox-stage img {
    max-width: 100%;
    max-height: calc(100vh - 85px);
    object-fit: contain;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
    will-change: transform;
}
.lightbox-close, .lightbox-prev, .lightbox-next {
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 2rem;
}
.lightbox-close {
    position: absolute;
    z-index: 3;
    right: 12px;
    top: 8px;
    width: 48px;
    height: 48px;
}
.lightbox-caption {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 64px;
    padding: 10px 70px;
    font-size: .9rem;
}
.zoom-help { color: #c9c9c9; font-size: .78rem; }

.interest-dialog {
    width: min(560px, calc(100% - 28px));
    border: 0;
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 20px 70px rgba(0,0,0,.3);
}
.interest-dialog::backdrop { background: rgba(0,0,0,.58); }
.interest-dialog form { padding: 22px; position: relative; }
.interest-dialog h2 { margin-top: 0; }
.dialog-close {
    position: absolute;
    right: 10px;
    top: 8px;
    border: 0;
    background: transparent;
    font-size: 1.8rem;
    cursor: pointer;
}
.interest-dialog label { display: block; margin: 12px 0; font-weight: 650; }
.interest-dialog label span { color: var(--muted); font-weight: 400; }
.interest-dialog input[type="text"],
.interest-dialog input[type="email"],
.interest-dialog input:not([type]),
.interest-dialog textarea {
    width: 100%;
    margin-top: 5px;
    border: 1px solid #bbb;
    border-radius: 8px;
    padding: 10px;
    font: inherit;
}
.interest-dialog fieldset { border: 1px solid var(--border); border-radius: 9px; margin: 14px 0; }
.interest-dialog .radio { font-weight: 400; margin: 8px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-message { min-height: 1.3em; font-size: .9rem; }
.form-message.error { color: #a40000; }
.form-message.success { color: #116332; }

@media (max-width: 620px) {
    .wrap { width: min(100% - 20px, 1200px); }
    .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .card-body { padding: 11px; }
    .card-body h2 { font-size: 1rem; }
    .spoken-for, .available, .notes { font-size: .84rem; }
    .interest-button { padding: 9px 8px; font-size: .9rem; }
    .lightbox { grid-template-columns: 42px 1fr 42px; }
    .lightbox-caption { padding-inline: 12px; }
    .zoom-help { width: 100%; text-align: center; }
    .two-col { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 390px) {
    .item-grid { grid-template-columns: 1fr; }
}



/* More prominent close buttons for photo/slideshow and request popups */
.lightbox-close,
.dialog-close {
    z-index: 20;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #d60000;
    color: #fff;
    font-size: 2.25rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .55);
    opacity: 1;
}

.lightbox-close {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
}

.dialog-close {
    position: absolute;
    top: 10px;
    right: 10px;
}

.lightbox-close:hover,
.dialog-close:hover,
.lightbox-close:focus-visible,
.dialog-close:focus-visible {
    background: #a90000;
    outline: 3px solid #fff;
    outline-offset: 3px;
}

@media (max-width: 620px) {
    .lightbox-close,
    .dialog-close {
        width: 58px;
        height: 58px;
        font-size: 2.5rem;
    }
}


/* Mobile lightbox close control: fixed high-contrast header area.
   Keeps the button visible regardless of the photo underneath. */
@media (max-width: 620px) {
    .lightbox::before {
        content: "";
        position: fixed;
        z-index: 19;
        top: 0;
        left: 0;
        right: 0;
        height: calc(78px + env(safe-area-inset-top));
        background: rgba(0, 0, 0, .82);
        pointer-events: none;
    }

    .lightbox-close {
        position: fixed;
        z-index: 100;
        top: calc(10px + env(safe-area-inset-top));
        right: calc(10px + env(safe-area-inset-right));
        width: 56px;
        height: 56px;
        border: 3px solid #fff;
        border-radius: 50%;
        background: #d60000;
        color: #fff;
        box-shadow: 0 3px 14px rgba(0, 0, 0, .8);
    }

    /* Keep the photograph below the close-button bar rather than behind it. */
    .lightbox-stage {
        padding-top: calc(78px + env(safe-area-inset-top));
    }

    .lightbox-stage img {
        max-height: calc(100dvh - 163px - env(safe-area-inset-top));
    }
}


/* Photo viewer close button: place directly beneath the image */
.lightbox {
    grid-template-rows: minmax(0, 1fr) auto auto;
}

.lightbox-close {
    position: static;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    align-self: center;
    width: auto;
    min-width: 150px;
    height: auto;
    margin: 12px 0 4px;
    padding: 10px 22px;
    border: 2px solid #fff;
    border-radius: 9px;
    background: #d60000;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
    box-shadow: 0 3px 12px rgba(0,0,0,.55);
}

.lightbox-close::after {
    content: " Close";
}

.lightbox-caption {
    grid-row: 3;
}

/* Undo the previous mobile top bar and top padding */
@media (max-width: 620px) {
    .lightbox::before {
        display: none;
    }

    .lightbox-close {
        position: static;
        z-index: 20;
        width: auto;
        min-width: 170px;
        height: auto;
        margin: 10px 0 4px;
        padding: 12px 24px;
        border-radius: 9px;
        font-size: 1.15rem;
    }

    .lightbox-stage {
        padding-top: 0;
    }

    .lightbox-stage img {
        max-height: calc(100dvh - 160px);
    }
}


/* Mobile/Edge lightbox layout fix:
   keep the full photo and a large Close button together inside the viewport. */
@media (max-width: 620px) {
    .lightbox {
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
        grid-template-rows: minmax(0, 1fr) auto auto;
    }

    .lightbox-stage {
        min-height: 0;
        padding: 6px 0 0;
        overflow: hidden;
    }

    .lightbox-stage img {
        display: block;
        max-width: 100%;
        max-height: calc(100dvh - 150px);
        width: auto;
        height: auto;
        object-fit: contain;
    }

    .lightbox-close {
        position: static;
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
        width: min(260px, calc(100vw - 48px));
        min-width: 0;
        min-height: 58px;
        margin: 4px 0 2px;
        padding: 13px 26px;
        border: 3px solid #fff;
        border-radius: 12px;
        background: #d60000;
        color: #fff;
        font-size: 1.35rem;
        font-weight: 900;
        line-height: 1.1;
        box-shadow: 0 3px 12px rgba(0,0,0,.65);
    }

    .lightbox-caption {
        grid-row: 3;
        min-height: 0;
        padding: 5px 10px max(7px, env(safe-area-inset-bottom));
        line-height: 1.2;
    }

    .zoom-help {
        display: none;
    }
}


/* Additional full-width Close bar directly beneath popup image */
.lightbox-close-bar {
    grid-column: 1 / -1;
    width: min(560px, calc(100% - 24px));
    justify-self: center;
    margin: 3px auto 5px;
    padding: 13px 20px;
    border: 2px solid #fff;
    border-radius: 8px;
    background: #d60000;
    color: #fff;
    font: inherit;
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,.55);
    z-index: 25;
}

.lightbox-close-bar:hover,
.lightbox-close-bar:focus-visible {
    background: #a90000;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

@media (max-width: 620px) {
    .lightbox-close-bar {
        width: calc(100% - 16px);
        min-height: 58px;
        margin: 2px 8px 4px;
        padding: 14px 18px;
        border-radius: 6px;
        font-size: 1.3rem;
    }
}
