/**
 * Ο.Σ.Α. popups (people + clubs). Native <dialog>; the box scrolls, never the page.
 * ⚠ No transform on the <dialog> itself: the photo viewer is moved INSIDE it and positions with
 *   `fixed`, which a transformed ancestor would capture. Animate the inner box only.
 */
html.osa-dialog-open { overflow: hidden; }

.osa-dialog {
    width: min(920px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 48px);
    margin: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--oms-ink);
    overflow: visible;
}
.osa-dialog::backdrop {
    background: rgba(0, 140, 142, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.osa-dialog[open] .osa-dialog__box { animation: osa-dialog-in 0.32s var(--oms-ease); }
@keyframes osa-dialog-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }

.osa-dialog__box {
    position: relative;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--oms-pale);
    border-radius: var(--oms-radius);
    box-shadow: 0 30px 80px rgba(0, 30, 32, 0.35);
}

.osa-dialog__close {
    position: sticky;
    top: 12px;
    float: right;
    z-index: 2;
    display: grid; place-items: center;
    width: 44px; height: 44px;
    margin: 12px 12px -56px 0;
    border: 0; border-radius: 50%;
    background: #fff;
    color: #111;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.osa-dialog__close svg { width: 24px; height: 24px; }
@media (hover: hover) { .osa-dialog__close:hover { background: #111; color: #fff; } }

/* Head card: photo / logo + name + role + links (the live popup's top card) */
.osa-dialog__head {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    align-items: center;
    gap: 28px;
    margin: 16px;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.osa-dialog__media { margin: 0; }
.osa-dialog__media img, .osa-dialog__media .osa-initials {
    display: block; width: 200px; height: 200px;
    border-radius: 50%; object-fit: cover;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.osa-dialog--club .osa-dialog__media img { object-fit: contain; background: #fff; border-radius: 12px; box-shadow: none; }
.osa-dialog__name { margin: 0 0 6px; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.2; padding-right: 40px; }
.osa-dialog__role { margin: 0 0 16px; color: var(--oms-cyan-ink); font-weight: 600; }
.osa-dialog__head .osa-links { justify-content: flex-start; }

.osa-dialog__body {
    margin: 0 16px 16px;
    padding: clamp(18px, 3vw, 28px);
    background: #fff;
    border-radius: 12px;
    font-size: 16.5px;
    line-height: 1.75;
}
.osa-dialog__body > :last-child { margin-bottom: 0; }
.osa-dialog__body h3, .osa-dialog__body h4 { margin: 1.2em 0 0.5em; font-size: 18px; }
.osa-dialog__body ul { padding-left: 1.2em; }
.osa-dialog__body a { text-decoration: underline; }

.osa-dialog__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin: 0 16px 16px;
    padding: 14px;
    background: #fff;
    border-radius: 12px;
    list-style: none;
}
.osa-dialog__gallery button {
    display: block; width: 100%; padding: 0; border: 0;
    aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px;
    background: #e5eeee; cursor: zoom-in;
}
.osa-dialog__gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: scale 0.4s var(--oms-ease); }
@media (hover: hover) { .osa-dialog__gallery button:hover img { scale: 1.05; } }

.osa-initials {   /* until a photo arrives: quiet, on-brand, clearly a placeholder */
    display: grid; place-items: center;
    background: linear-gradient(145deg, #f2fefe, #cdf5f5);
    color: var(--oms-cyan-ink); font-weight: 600; letter-spacing: 0.06em;
    font-size: 64px;
    box-shadow: inset 0 0 0 1px rgba(0, 114, 116, 0.12);
}

@media (max-width: 640px) {
    .osa-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
    .osa-dialog__box { max-height: calc(100dvh - 16px); border-radius: 14px; }
    .osa-dialog__head { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 14px; margin: 8px; padding: 22px 16px 18px; }
    .osa-dialog__head .osa-links { justify-content: center; }
    .osa-dialog__name { padding: 0 24px; }
    .osa-dialog__media img, .osa-dialog__media .osa-initials { width: 150px; height: 150px; }
    .osa-initials { font-size: 48px; }
    .osa-dialog__body, .osa-dialog__gallery { margin: 0 8px 8px; }
    .osa-dialog__gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; gap: 8px; }
    .osa-dialog__close { margin: 8px 8px -52px 0; top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .osa-dialog[open] .osa-dialog__box { animation: none; }
}

/* Photo viewer opened from a popup: the popup's own text must not show through. */
.osa-dialog .jm-lb__backdrop { background: rgba(8, 12, 14, 0.96); }
