/* Non-critical global rules — nothing here is needed for first paint (page
   transitions and the nav progress bar only matter once the user navigates;
   prose-note only applies on novel/note content; offline overrides only
   matter once navigator.onLine goes false). Loaded non-blocking via
   <link media="print" onload="this.media='all'"> in index.php — see
   assets/styles/global.css for the render-blocking-on-purpose subset. */

/* Deep-linked review (#review-<id>) — flash the card on arrival */
.review-focus {
    border-color: rgba(167, 139, 250, 0.55) !important;
    animation: review-focus-pulse 2.4s ease-out 1;
}

@keyframes review-focus-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.5);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(167, 139, 250, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(167, 139, 250, 0);
    }
}

/* Page transition */
::view-transition-old(root) {
    animation: 120ms ease-in both _page-fade-out;
}

::view-transition-new(root) {
    animation: 200ms ease-out both _page-fade-in;
}

@keyframes _page-fade-out {
    to {
        opacity: 0;
    }
}

@keyframes _page-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes _menu-punch-in {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #a78bfa;
    z-index: 9999;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease, opacity 0.2s ease;
    pointer-events: none;
    opacity: 0;
}

/* Novel / note page styles */
.prose-note h1,
.prose-note h2,
.prose-note h3,
.prose-note h4,
.prose-note h5,
.prose-note h6 {
    color: #fff;
    font-family: 'Bree Serif', Georgia, serif;
    font-weight: 700;
    margin: 0 0 0.6em;
    line-height: 1.3;
}

.prose-note h2 {
    font-size: 1.35rem;
}

.prose-note h6 {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
    letter-spacing: .04em;
}

.prose-note p {
    margin: 0 0 0.1em;
}

.prose-note p:has(> br:only-child),
.prose-note p:empty {
    margin: 0;
    min-height: 0.6em;
}

.prose-note a {
    color: #c4b5fd;
    text-decoration: underline;
    word-break: break-all;
}

.prose-note strong {
    font-weight: 700;
}

.reader-note+img {
    margin-top: 0;
}

/* Offline: search / notifications / profile links don't work, so drop
   the site nav and the mobile tab bar entirely. (index.php toggles
   html.is-offline from navigator.onLine.) */
html.is-offline #site-nav,
html.is-offline #mobile-tabbar {
    display: none !important;
}

html.is-offline {
    --mobile-tabbar-h: 0px;
}

/* No nav bar to clear — reclaim the top gap on the main offline page. */
html.is-offline #downloads-view {
    padding-top: 1.75rem;
}

/* Themed scrollbar for dark scrollable panels (edit-profile modal, its
   avatar-decoration grid, etc.) — matches the site's rgba(255,255,255,*)
   border/surface scale instead of the OS default scrollbar. */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.32);
}
