/* Polaroid — frontend styles. */

/* Single polaroid */
.b-polaroid {
    display: inline-flex;
    flex-direction: column;
    gap: 9px;
    padding: 14px 14px 18px;
    background: var(--surface, #fff);
    box-shadow: 0 8px 24px rgba(37, 33, 27, 0.15);
    position: relative;
    transition: transform 0.2s ease;
}

.b-polaroid--right { transform: rotate(1.8deg); }
.b-polaroid--left  { transform: rotate(-2.3deg); }

.b-polaroid__img {
    display: block;
    width: 100%;
    max-width: 260px;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: var(--surface2, #f5f1ea);
    transition: transform 0.22s var(--ease-out, cubic-bezier(.2,.7,.2,1));
}

/* Lightbox cursor when wired */
.b-polaroid__img[role="button"] {
    cursor: zoom-in;
}

@media (hover: hover) {
    .b-polaroid:hover .b-polaroid__img[role="button"] {
        transform: scale(1.03);
    }
    .b-polaroid:hover {
        transform: rotate(0) translateY(-3px);
    }
}

.b-polaroid__cap {
    font-family: 'Caveat', cursive;
    font-size: 1.25rem;
    color: var(--ink, #25211b);
    text-align: center;
    margin: 0;
}

/* Scrap row (multiple polaroids) */
.b-scrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px 32px;
    padding: 24px;
}

.b-scrap .b-polaroid {
    flex: 0 0 auto;
}

/* ===================================================================
   KabLightbox overlay (scoped to #kab-lb — idempotent across blocks).
   =================================================================== */

#kab-lb {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
}
#kab-lb[hidden] { display: none; }
#kab-lb .kab-lb__bd {
    position: absolute; inset: 0;
    background: var(--overlay, rgba(12, 18, 26, 0.78));
    opacity: 0; transition: opacity 0.22s ease;
}
#kab-lb.kab-lb--visible .kab-lb__bd { opacity: 1; }
#kab-lb .kab-lb__frame {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 10px;
    max-width: min(96vw, 1200px); max-height: 96dvh;
    padding: 0 6px; opacity: 0; transform: scale(0.96);
    transition: opacity 0.22s ease, transform 0.22s var(--ease-out, cubic-bezier(.2,.7,.2,1));
    pointer-events: none;
}
#kab-lb.kab-lb--visible .kab-lb__frame { opacity: 1; transform: scale(1); pointer-events: auto; }
#kab-lb .kab-lb__media {
    position: relative; display: flex; flex-direction: column;
    align-items: center; gap: 10px;
    max-width: min(88vw, 1060px); max-height: 90dvh;
}
#kab-lb .kab-lb__img {
    display: block; max-width: 100%; max-height: 82dvh;
    width: auto; height: auto; object-fit: contain;
    border-radius: var(--radius-sm, 10px);
    box-shadow: var(--shadow-pop, 0 30px 70px -20px rgba(12,18,26,.55));
}
#kab-lb .kab-lb__cap {
    margin: 0; font-size: 0.82rem; line-height: 1.4;
    color: rgba(255, 255, 255, 0.75); text-align: center; max-width: 56ch;
}
#kab-lb .kab-lb__counter {
    position: absolute; bottom: -28px; left: 50%; transform: translateX(-50%);
    font-size: 0.72rem; font-family: var(--font-mono, ui-monospace, monospace);
    color: rgba(255, 255, 255, 0.55); white-space: nowrap; pointer-events: none;
}
#kab-lb .kab-lb__close {
    position: absolute; top: -14px; right: -14px; z-index: 2;
    width: 36px; height: 36px; border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    background: rgba(20, 16, 12, 0.7); color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0;
    transition: background 0.14s ease, border-color 0.14s ease;
}
#kab-lb .kab-lb__close:hover { background: rgba(30, 24, 18, 0.9); border-color: rgba(255, 255, 255, 0.45); }
#kab-lb .kab-lb__close:focus-visible { outline: 2px solid var(--accent, #9c3a52); outline-offset: 3px; }
#kab-lb .kab-lb__nav {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    background: rgba(20, 16, 12, 0.55); color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0;
    transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}
#kab-lb .kab-lb__nav:hover { background: rgba(30, 24, 18, 0.85); border-color: rgba(255, 255, 255, 0.45); }
#kab-lb .kab-lb__nav:active { transform: scale(0.93); }
#kab-lb .kab-lb__nav:focus-visible { outline: 2px solid var(--accent, #9c3a52); outline-offset: 3px; }
@media (max-width: 600px) {
    #kab-lb .kab-lb__frame { flex-direction: column; padding: 0; gap: 14px; max-width: 100vw; }
    #kab-lb .kab-lb__nav { width: 40px; height: 40px; }
    #kab-lb .kab-lb__img { max-height: 72dvh; }
}
@media (prefers-reduced-motion: reduce) {
    #kab-lb .kab-lb__bd,
    #kab-lb .kab-lb__frame { transition: none; }
    .b-polaroid, .b-polaroid__img { transition: none; }
}
