/* When spotlight is active, prevent the modal from creating a new stacking
   context that offsets the fixed-position icon wrap */
body.spotlight-active #box-modal .modal-content {
    transform: none;
    overflow: visible;
}

body.spotlight-active #box-icon-companion-wrap {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 601;
}

body.spotlight-active #box-icon {
    --icon-size: var(--icon-size-spotlight-desktop) !important;
    width: var(--icon-size-spotlight-desktop) !important;
    height: var(--icon-size-spotlight-desktop) !important;
}

body.spotlight-active::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 600;
}

body.spotlight-active .modal-content {
    min-height: calc(var(--icon-size-spotlight-desktop) + 200px);
    min-width: calc(var(--icon-size-spotlight-desktop) + 200px);
}

body.spotlight-active #box-modal-controls {
    display: none;
}

/* Box-icon spotlight: hide slices so they don't show below the big icon */
body.spotlight-active:not(.spotlight-slice) #box-slices-companion {
    display: none !important;
}

/* Slice spotlight: keep box-icon at small companion size, hide non-selected slices */
body.spotlight-slice .slice-card:not(.spotlight-selected) {
    display: none !important;
}

/* Slice spotlight: restore box-icon to companion size (undo the big-icon rule above) */
body.spotlight-slice #box-icon {
    --icon-size: var(--icon-size-slices-companion-icon-shows-in-hour-view) !important;
    width: var(--icon-size-slices-companion-icon-shows-in-hour-view) !important;
    height: var(--icon-size-slices-companion-icon-shows-in-hour-view) !important;
}

/* Slice spotlight: center the selected card in the wrap */
body.spotlight-slice #slices-companion-grid {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

body.spotlight-slice .slice-card.spotlight-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    outline: none;
    border: none;
}

/* Slice spotlight: enlarge the selected slice icon */
body.spotlight-slice .slice-card.spotlight-selected .slice-card-icon {
    --icon-size: var(--icon-size-spotlight-desktop) !important;
    width: var(--icon-size-spotlight-desktop) !important;
    height: var(--icon-size-spotlight-desktop) !important;
    min-width: var(--icon-size-spotlight-desktop) !important;
    min-height: var(--icon-size-spotlight-desktop) !important;
}

/* Slice spotlight: hide time/name labels on the selected card */
body.spotlight-slice .slice-card.spotlight-selected .slice-time,
body.spotlight-slice .slice-card.spotlight-selected .slice-name {
    display: none !important;
}

@media (max-width: 600px) {
    body.spotlight-active #box-icon {
        --icon-size: var(--icon-size-spotlight-mobile) !important;
        width: var(--icon-size-spotlight-mobile) !important;
        height: var(--icon-size-spotlight-mobile) !important;
    }

    body.spotlight-active .modal-content {
        min-height: calc(var(--icon-size-spotlight-mobile) + 200px);
        min-width: calc(var(--icon-size-spotlight-mobile) + 100px);
    }

    body.spotlight-slice #box-icon {
        --icon-size: var(--icon-size-slices-companion-icon-shows-in-hour-view) !important;
        width: var(--icon-size-slices-companion-icon-shows-in-hour-view) !important;
        height: var(--icon-size-slices-companion-icon-shows-in-hour-view) !important;
    }

    body.spotlight-slice .slice-card.spotlight-selected .slice-card-icon {
        --icon-size: var(--icon-size-spotlight-mobile) !important;
        width: var(--icon-size-spotlight-mobile) !important;
        height: var(--icon-size-spotlight-mobile) !important;
        min-width: var(--icon-size-spotlight-mobile) !important;
        min-height: var(--icon-size-spotlight-mobile) !important;
    }
}
