/* Full-screen photo viewer */

.viewer {
    --viewer-bar-bg: rgba(10, 10, 10, 0.9);
}

.viewer[open] {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: var(--bg-primary);
    color: var(--text-primary);

    &::backdrop {
        background: var(--bg-primary);
    }
}

/* ── EXIF info overlay ── */

.viewer__info {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: var(--space-4);
    padding-top: max(var(--space-4), env(safe-area-inset-top));
    background: var(--viewer-bar-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.viewer__info[hidden] {
    display: none;
}

.viewer__exif {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-1) var(--space-3);
    font-size: 0.8125rem;
    line-height: 1.6;
}

.viewer__exif dt {
    color: var(--text-muted);
}

.viewer__exif dd {
    color: var(--text-primary);
    margin: 0;
    font-variant-numeric: tabular-nums;
}

/* ── Stage ── */

.viewer__stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.viewer__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    transition:
        opacity var(--duration-fast) ease,
        transform var(--duration-normal) ease;
}

.viewer__image[src=""] {
    display: none;
}

.viewer__loading {
    position: absolute;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.viewer__loading[hidden] {
    display: none;
}

/* ── Bottom bar ── */

.viewer__bar {
    padding: var(--space-2) var(--space-3);
    padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
    background: var(--viewer-bar-bg);
    flex-shrink: 0;
}

.viewer__ratings {
    display: flex;
    gap: var(--space-1);
    justify-content: center;
}

.viewer__rating {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 2.75rem;
    border: none;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    transition:
        background var(--duration-fast) ease,
        color var(--duration-fast) ease;

    &:hover {
        background: var(--bg-elevated);
    }
}

/* Rotate and share: fixed square */
.viewer__rating--rotate,
.viewer__rating--share {
    flex: 0 0 2.75rem;
    width: 2.75rem;
}

.viewer__rating--no {
    &[aria-pressed="true"] {
        background: rgba(239, 68, 68, 0.15);
        color: var(--danger);
        font-weight: bold;
    }
}

.viewer__rating--maybe {
    &[aria-pressed="true"] {
        background: rgba(251, 191, 36, 0.15);
        color: var(--rating-active);
        font-weight: bold;
    }
}

.viewer__rating--yes {
    &[aria-pressed="true"] {
        background: rgba(34, 197, 94, 0.15);
        color: var(--success);
        font-weight: bold;
    }
}

.viewer__rating--share,
.viewer__rating--rotate {
    &[aria-pressed="true"] {
        background: var(--bg-tertiary);
        color: var(--text-primary);
        font-weight: 500;
    }
}

/* ── Drag state ── */

.viewer__stage--dragging .viewer__image {
    transition: none;
}
