.gallery-modal,
.cv-modal,
.qr-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.gallery-modal { z-index: 1000; }
.cv-modal,
.qr-modal { z-index: 1002; }

.gallery-modal.is-open,
.cv-modal.is-open,
.qr-modal.is-open {
    display: flex;
}

.gallery-content {
    position: relative;
    width: 100%;
    max-width: min(800px, calc(100vw - 32px));
    height: min(80%, calc(100dvh - 32px));
    overflow: hidden;
    border-radius: 6px;
}

.gallery-content .slider {
    display: flex;
    height: 100%;
    position: relative;
}

.gallery-modal .slider img {
    object-fit: contain;
    pointer-events: none;
    cursor: default;
}

.close-button {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 3rem;
    background: none;
    border: none;
    color: var(--fg);
    cursor: pointer;
    z-index: 1003;
    transition: transform 0.25s ease;
}

.close-button:hover {
    transform: scale(1.2);
    color: var(--accent);
}

.gallery-content .prev,
.gallery-content .next {
    font-size: 4rem;
    position: fixed;
}

.gallery-content .prev { left: 2rem; }
.gallery-content .next { right: 2rem; }

.gallery-content .dots {
    bottom: 1rem;
    gap: 0.6rem;
}

body.gallery-open .slider-container .prev,
body.gallery-open .slider-container .next,
body.gallery-open .slider-container .dots {
    display: none;
}

.cv-content {
    position: relative;
    width: min(90%, calc(100vw - 24px));
    max-width: 800px;
    height: min(80%, calc(100dvh - 24px));
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 6px;
    overflow: hidden;
}

.cv-frame {
    width: 100%;
    height: 100%;
    border: none;
    transition: filter 250ms ease;
}

.cv-frame.is-locked {
    filter: blur(10px) saturate(0.85);
    pointer-events: none;
    user-select: none;
}

.cv-gate {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    padding: var(--space-4);
}

.cv-gate.is-hidden { display: none; }

.cv-gate__form {
    width: 100%;
    max-width: 360px;
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    font-family: var(--font-mono);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.cv-gate__title {
    margin: 0;
    font-size: var(--text-lg);
    color: var(--fg);
}

.cv-gate__lead {
    margin: 0 0 var(--space-2);
    font-size: var(--text-sm);
    color: var(--fg-muted);
}

.cv-gate__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--fg-mute2);
}

.cv-gate__field input {
    font: inherit;
    font-size: var(--text-sm);
    color: var(--fg);
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 0.5rem 0.6rem;
}

.cv-gate__field input:focus {
    outline: none;
    border-color: var(--accent);
}

.cv-gate__req { color: var(--accent); }
.cv-gate__opt { color: var(--fg-mute3); }

.cv-gate__submit {
    margin-top: var(--space-2);
    cursor: pointer;
}

.cv-gate__submit[disabled] {
    opacity: 0.6;
    cursor: progress;
}

.cv-gate__status {
    margin: 0;
    min-height: 1.2em;
    font-size: var(--text-xs);
}

.cv-gate__status.is-error { color: var(--accent); }
.cv-gate__status.is-ok { color: var(--ok); }

.cv-gate--thanks .cv-gate__form > :not(.cv-gate__title):not(.cv-gate__status) {
    display: none;
}

.qr-modal__image {
    max-width: min(300px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    border-radius: 6px;
    box-shadow: 0 0 20px rgba(215, 38, 56, 0.5);
}

@media (max-width: 640px) {
    .close-button,
    .cv-modal__close,
    .qr-modal__close { top: 0.8rem; right: 0.8rem; font-size: 2.4rem; }
    .gallery-content .prev,
    .gallery-content .next { font-size: 2.6rem; }
    .gallery-content .prev { left: 0.4rem; }
    .gallery-content .next { right: 0.4rem; }
    .cv-gate__form { padding: var(--space-4); }
}

.cv-modal__close,
.qr-modal__close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 4rem;
    color: var(--fg);
    cursor: pointer;
    transition: 0.2s;
}

.cv-modal__close:hover,
.qr-modal__close:hover {
    color: var(--accent);
}
