/* plum-motion.js — the app's motion on the web: the beads, the box, the lock.
   The numbers are the app's; see the comment at the top of plum-motion.js. */

/* The beads. They show after 0.25 s, so a quick answer never flashes them. */
.pm-beads {
    display: inline-block;
    flex: none;
    vertical-align: middle;
    width: var(--pm-size, 42px);
    height: var(--pm-size, 42px);
    opacity: 0;
    animation: pm-in 0.15s linear 0.25s forwards;
}
.pm-beads.pm-now { animation-delay: 0s; }
.pm-beads > canvas { display: block; width: 100%; height: 100%; }
@keyframes pm-in { to { opacity: 1; } }
/* the loader that was just taken off, gathering into one bead */
.pm-ghost { position: fixed; z-index: 10001; pointer-events: none; }

/* A list that replaced its loader: its first rows lift a little, one after another. */
.pm-rise > * { animation: pm-rise 0.34s cubic-bezier(0.16, 1, 0.3, 1) both; }
.pm-rise > *:nth-child(2) { animation-delay: 0.04s; }
.pm-rise > *:nth-child(3) { animation-delay: 0.08s; }
.pm-rise > *:nth-child(4) { animation-delay: 0.12s; }
.pm-rise > *:nth-child(5) { animation-delay: 0.16s; }
.pm-rise > *:nth-child(6) { animation-delay: 0.2s; }
.pm-rise > *:nth-child(7) { animation-delay: 0.24s; }
.pm-rise > *:nth-child(n + 8) { animation-delay: 0.28s; }
@keyframes pm-rise { from { opacity: 0; transform: translateY(6px); } }

/* Files going from one box to the other (a job that copies or moves them). */
.pm-copy { display: block; width: 100%; max-width: 300px; aspect-ratio: 200 / 56; margin: 6px auto 10px; }
.pm-copy > canvas { display: block; width: 100%; height: 100%; }

/* The box splitting and joining over its mark. */
.pm-box-over { position: absolute; pointer-events: none; }

/* The page while the box restarts: covered, the box splitting and joining in the middle. */
.pm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 6px;
    padding: 24px;
    text-align: center;
    background: color-mix(in srgb, var(--bg) 95%, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.pm-overlay.is-on { opacity: 1; }
.pm-overlay-box { width: 132px; height: 132px; margin-bottom: 8px; }
.pm-overlay b { font-size: 18px; font-weight: var(--w-semibold, 620); color: var(--text); letter-spacing: -0.01em; }
.pm-overlay small { font-size: 13px; color: var(--text-secondary); }

/* The lock. */
svg.pm-lock { display: block; overflow: visible; }
svg.pm-lock .pm-sh { fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
svg.pm-lock .pm-bd { fill: currentColor; }

/* The upload panel: the file being sent has the beads where its ring was and a
   thin bar under its name; a finished file gets the check with a small pop. */
.upload-panel-row.is-active .upload-row-progress { display: none; }
.upload-panel-row-icon .pm-beads { position: absolute; left: 50%; top: 50%; margin: calc(var(--pm-size) / -2) 0 0 calc(var(--pm-size) / -2); }
.upload-row-line { display: none; height: 2px; margin-top: 5px; border-radius: 1px; background: var(--border-color); overflow: hidden; }
.upload-row-line-fill { display: block; height: 100%; width: 0; background: var(--text); transition: width 0.2s linear; }
.upload-panel-row.is-uploading .upload-row-line { display: block; }
.upload-panel-row.is-success .upload-row-check { color: var(--text); animation: pm-pop 0.34s cubic-bezier(0.34, 1.56, 0.64, 1) 0.18s both; }
@keyframes pm-pop { from { transform: scale(0.3); opacity: 0; } }

/* The photo flying between its cell and the viewer (the viewer is z-index 1100). */
.pm-zoom { position: fixed; z-index: 1150; object-fit: cover; pointer-events: none; }

/* Vaults (locked albums and folders): the stripes, the lock in its glass ring. */
.pm-vault-layer { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 20px; }
.pm-vault-dim { position: absolute; inset: 0; background: var(--overlay-bg); -webkit-backdrop-filter: var(--overlay-blur); backdrop-filter: var(--overlay-blur); opacity: 0; }
.pm-vault-card { position: relative; width: min(340px, 100%); display: grid; justify-items: center; gap: 4px; padding: 22px 20px 16px; border-radius: 18px; background: var(--bg-secondary); box-shadow: 0 0 0 1px var(--border-color), 0 24px 60px -24px rgba(0, 0, 0, 0.5); opacity: 0; }
.pm-vault-well { width: 52px; height: 52px; border-radius: 50%; background: var(--bg-tertiary); color: var(--text); display: grid; place-items: center; margin-bottom: 8px; }
.pm-vault-well svg { width: 26px; height: 26px; }
.pm-vault-title { font-size: 16px; font-weight: var(--w-semibold, 620); color: var(--text); text-align: center; overflow-wrap: anywhere; }
.pm-vault-sub { font-size: 12.5px; color: var(--text-secondary); text-align: center; line-height: 1.5; }
.pm-vault-input { width: 100%; margin-top: 12px; height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-tertiary); color: var(--text); font: inherit; font-size: 15px; }
.pm-vault-input:focus { outline: none; border-color: var(--border-strong); box-shadow: var(--ring-focus); }
.pm-vault-input.is-wrong { border-color: var(--error); }
.pm-vault-err { min-height: 18px; margin-top: 4px; font-size: 12px; color: var(--error); text-align: center; }
.pm-vault-acts { width: 100%; display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.pm-vault-fly { position: fixed; left: 0; top: 0; z-index: 10003; width: 36px; height: 36px; border-radius: 50%; background: var(--bg-tertiary); color: var(--text); display: grid; place-items: center; pointer-events: none; }
.pm-vault-fly svg { width: 20px; height: 20px; }
.pm-vault-fly.is-open { background: transparent; }

.pm-shut { position: fixed; z-index: 9999; pointer-events: none; overflow: hidden; transition: opacity 0.28s ease; }
.pm-shut.is-out { opacity: 0; }
.pm-shut-vault { position: absolute; inset: 0; background: var(--bg-tertiary); }
.pm-shut-vault::after, .pm-vaulting::before, .pm-vault-face::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--text) 6%, transparent) 0 1px, transparent 1px 7px); }
.pm-shut-ring { position: absolute; left: 0; top: 0; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: color-mix(in srgb, var(--bg-secondary) 78%, transparent); box-shadow: inset 0 0 0 1px var(--border-strong); }
.pm-shut-ring svg { width: 50%; height: 50%; }

/* A form becoming a vault (creating a locked album or folder). */
/* (it keeps its own position — the album card is fixed in the middle; the shared dialog is positioned too) */
.pm-vaulting { background: var(--bg-tertiary) !important; transition: background-color 0.3s ease; }
.modal-content.pm-vaulting { position: relative; }
.pm-vaulting::before { border-radius: inherit; z-index: 0; }
.pm-vaulting > *:not(.pm-vring) { position: relative; z-index: 1; }
.pm-vring { position: absolute !important; right: 10px; top: 10px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: color-mix(in srgb, var(--bg-secondary) 78%, transparent); box-shadow: inset 0 0 0 1px var(--border-strong); animation: pm-pop 0.36s cubic-bezier(0.34, 1.56, 0.64, 1) both; z-index: 2; }
.pm-vring svg { width: 16px; height: 16px; }
.pm-shrink { z-index: 10002; pointer-events: none; }

/* the album card: its vault lock at the top right, clear of the title */
.photos-album-composer > .pm-vring { right: 16px; top: 16px; width: 34px; height: 34px; }
.photos-album-composer > .pm-vring svg { width: 17px; height: 17px; }

/* a switch in the app's manner (a checkbox drawn as a track and a knob) */
/* (also inside the shared dialog, which sizes every checkbox to 16px) */
input.pm-switch, .modal-content input.pm-switch[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: none; width: 36px; height: 22px; margin: 0; border-radius: 11px; cursor: pointer;
    background: radial-gradient(circle, #FFFFFF 0 7.5px, transparent 8px) no-repeat 0 50% / 22px 22px, var(--border-strong);
    transition: background-position 0.22s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.22s ease; }
input.pm-switch:checked, .modal-content input.pm-switch[type="checkbox"]:checked { background: radial-gradient(circle, var(--bg-secondary) 0 7.5px, transparent 8px) no-repeat 14px 50% / 22px 22px, var(--text); }
input.pm-switch:focus-visible { outline: none; box-shadow: var(--ring-focus); }

/* the shared dialog keeps its close button: the vault's lock sits left of it */
.modal-content > .pm-vring { right: 52px; top: 14px; }
/* the open lock beside an opened secret folder's name in the path */
.crumb-lock { display: inline-block; width: 12px; height: 12px; margin: 0 4px 0 2px; vertical-align: -1px; color: var(--text-secondary); }
.crumb-lock svg { width: 100%; height: 100%; }
/* the open lock is a button: it locks the folder again (lockSecretFolder) */
button.crumb-lock { position: relative; padding: 0; border: 0; background: none; cursor: pointer; transition: color 0.15s ease, transform 0.15s ease; }
button.crumb-lock::before { content: ""; position: absolute; inset: -7px; border-radius: 8px; }
button.crumb-lock:hover { color: var(--text-primary); transform: scale(1.12); }
button.crumb-lock:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 3px; border-radius: 3px; }
.crumb-lock[hidden] { display: none !important; }
.mobile-folder-lock { flex: none; width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-primary); cursor: pointer; }
.mobile-folder-lock svg { width: 17px; height: 17px; }
.mobile-folder-lock[hidden] { display: none; }

/* A locked album's small picture in the list: the vault face with the app's lock. */
.album-preview-box.pm-vault-face { position: relative; background: var(--bg-tertiary); color: var(--text); }
.album-preview-box.pm-vault-face svg { position: relative; z-index: 1; width: 14px; height: 14px; }

@media (prefers-reduced-motion: reduce) {
    .pm-vring { animation: none; }
    .upload-panel-row.is-success .upload-row-check { animation: none; }
    .pm-beads { animation: none; opacity: 1; }
    .pm-rise > * { animation: none; }
    .pm-overlay { transition: none; }
}
