/* The lock screen. `app-locked` is set by an inline script in the document head
   before anything renders, so a locked app never flashes a frame of its contents. */

.applock {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background-color: var(--bg);
}

html.app-locked .applock {
    display: flex;
}

/* Everything that is not the lock screen. Hidden rather than blurred: a blur
   still leaks the shape of your day to someone glancing over. */
html.app-locked body > *:not(.applock) {
    visibility: hidden;
}

html.app-locked body {
    overflow: hidden;
}

.applock-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    max-width: 22rem;
    text-align: center;
    animation: applock-in 0.35s ease;
}

.applock-icon {
    width: 3rem;
    height: 3.5rem;
    color: var(--text-main);
    overflow: visible;
}

.applock-shackle,
.applock-body-shape {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.applock-shackle {
    transform-box: view-box;
    transform-origin: 7.5px 12px;
}

/* Face ID succeeded: the shackle lifts out of the body, then the card eases
   off so the memories are not waiting behind a slammed door. */
.applock.is-unlocking .applock-shackle {
    animation: applock-open 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.applock.is-unlocking .applock-card {
    animation: applock-out 0.28s ease 0.22s forwards;
}

.applock.is-unlocking .applock-btn {
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.applock-title {
    margin: 0.35rem 0 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
}

.applock-body {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.applock-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    margin-top: 0.85rem;
    padding: 0.82rem 1.35rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--border));
    background-color: var(--accent-soft);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease, opacity 0.2s ease;
}

.applock-btn:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--accent) 22%, var(--accent-soft));
    border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
}

.applock-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.applock-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.applock-btn:disabled {
    cursor: default;
    opacity: 1;
}

.applock.is-verifying .applock-btn {
    opacity: 0.72;
}

.applock.is-verifying .applock-btn-mark {
    animation: applock-scan 1.1s ease-in-out infinite;
}

.applock-btn-mark {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    overflow: visible;
}

.applock-btn-mark path,
.applock-btn-mark circle {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.applock-btn-mark circle {
    fill: currentColor;
    stroke: none;
}

@keyframes applock-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@keyframes applock-open {
    from { transform: rotate(0deg); }
    to { transform: rotate(-42deg); }
}

@keyframes applock-out {
    to { opacity: 0; transform: translateY(-4px); }
}

@keyframes applock-scan {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .applock-card,
    .applock.is-unlocking .applock-shackle,
    .applock.is-unlocking .applock-card,
    .applock.is-verifying .applock-btn-mark {
        animation: none;
    }

    .applock.is-unlocking .applock-shackle {
        transform: rotate(-42deg);
    }
}
