@charset "UTF-8";

/* ============================================================================
 * Private Sun Yat-sen Memorial Hall — Apple Desktop Shell (desktop-shell.css)
 * ============================================================================
 * COMMENTING STANDARDS
 * 1. Block comments only. Inline comments are strictly prohibited.
 * 2. Section dividers use the === banner format.
 * 3. All prose is written in English.
 * ============================================================================ */

@layer shell {
    /* ========================================================================
     * Section 2: Desktop Layout & Authentic Apple Sidebar (> 768px)
     * ======================================================================== */
    @media (min-width: 769px) {
        /* Fixed Apple Translucent Left Sidebar */
        .desktop-sidebar {
            position: fixed;
            top: 0;
            left: 0;
            bottom: 0;
            width: 240px;
            height: 100vh;
            height: 100dvh;
            background: rgba(18, 18, 20, 0.94);
            backdrop-filter: blur(35px) saturate(190%);
            -webkit-backdrop-filter: blur(35px) saturate(190%);
            border-right: 0.5px solid rgba(255, 255, 255, 0.10);
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 20px 12px 18px 12px;
            box-sizing: border-box;
            z-index: 30000;
            user-select: none;
            -webkit-user-select: none;
            overflow: visible;
        }

        .desktop-sidebar,
        .desktop-sidebar *,
        .desktop-sidebar *::before,
        .desktop-sidebar *::after {
            box-sizing: border-box;
        }

        @media (prefers-color-scheme: light) {
            .desktop-sidebar {
                background: rgba(245, 245, 247, 0.94);
                border-right: 0.5px solid rgba(0, 0, 0, 0.08);
            }
        }

        /* Sidebar Top Container */
        .desktop-sidebar-top {
            position: relative;
            display: flex;
            flex-direction: column;
            gap: 14px;
            flex: 1;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
        }

        .desktop-sidebar-top::-webkit-scrollbar {
            width: 3px;
        }

        .desktop-sidebar-top::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.15);
            border-radius: 3px;
        }

        @media (prefers-color-scheme: light) {
            .desktop-sidebar-top::-webkit-scrollbar-thumb {
                background: rgba(0, 0, 0, 0.15);
            }
        }

        /* Apple-Style Brand Header */
        .desktop-sidebar-brand {
            display: flex;
            align-items: center;
            gap: 8px;
            text-decoration: none;
            color: #ffffff;
            padding: 4px 8px 10px 8px;
            border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
        }

        @media (prefers-color-scheme: light) {
            .desktop-sidebar-brand {
                color: #1d1d1f;
                border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
            }
        }

        .desktop-sidebar-brand-icon {
            width: 26px;
            height: 26px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
        }

        .desktop-sidebar-brand-text {
            font-family: var(--sys-font-family);
            font-size: 15px;
            font-weight: 700;
            letter-spacing: -0.2px;
        }

        /* Apple-Style Search Box */
        .desktop-search-box {
            position: relative;
            width: 100%;
            padding: 0 4px;
            box-sizing: border-box;
        }

        .desktop-search-input-wrapper {
            position: relative;
            display: flex;
            align-items: center;
            width: 100%;
        }

        .desktop-search-input-wrapper svg {
            position: absolute;
            left: 10px;
            width: 14px;
            height: 14px;
            stroke: rgba(255, 255, 255, 0.4);
            fill: none;
            pointer-events: none;
        }

        @media (prefers-color-scheme: light) {
            .desktop-search-input-wrapper svg {
                stroke: rgba(0, 0, 0, 0.4);
            }
        }

        .desktop-search-input {
            width: 100%;
            height: 30px;
            padding: 0 10px 0 30px;
            font-size: 12.5px;
            font-family: var(--sys-font-family);
            color: #f5f5f7;
            background: rgba(255, 255, 255, 0.08);
            border: none;
            border-radius: 7px;
            outline: none;
            box-sizing: border-box;
            transition: all 0.2s ease;
        }

        @media (prefers-color-scheme: light) {
            .desktop-search-input {
                color: #1d1d1f;
                background: rgba(0, 0, 0, 0.06);
            }
        }

        .desktop-search-input:focus {
            background: rgba(255, 255, 255, 0.14);
            box-shadow: 0 0 0 2px #fa586a;
        }

        @media (prefers-color-scheme: light) {
            .desktop-search-input:focus {
                background: #ffffff;
                box-shadow: 0 0 0 2px #fa586a;
            }
        }

        .desktop-search-input::placeholder {
            color: rgba(255, 255, 255, 0.35);
        }

        @media (prefers-color-scheme: light) {
            .desktop-search-input::placeholder {
                color: rgba(0, 0, 0, 0.38);
            }
        }

        /* Floating Search Dropdown */
        .desktop-search-dropdown {
            position: absolute;
            top: 36px;
            left: 4px;
            right: 4px;
            max-height: 320px;
            overflow-y: auto;
            background: rgba(28, 28, 30, 0.98);
            backdrop-filter: blur(30px);
            -webkit-backdrop-filter: blur(30px);
            border: 0.5px solid rgba(255, 255, 255, 0.14);
            border-radius: 10px;
            box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
            z-index: 10001;
            display: none;
            padding: 6px;
            box-sizing: border-box;
        }

        @media (prefers-color-scheme: light) {
            .desktop-search-dropdown {
                background: rgba(255, 255, 255, 0.98);
                border: 0.5px solid rgba(0, 0, 0, 0.12);
                box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
            }
        }

        .desktop-search-dropdown.active {
            display: block;
        }

        .desktop-search-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 7px 10px;
            border-radius: 6px;
            text-decoration: none;
            color: #f5f5f7;
            font-size: 13px;
            transition: background 0.15s ease;
        }

        @media (prefers-color-scheme: light) {
            .desktop-search-item {
                color: #1d1d1f;
            }
        }

        .desktop-search-item:hover,
        .desktop-search-item.highlighted {
            background: rgba(250, 88, 106, 0.18);
        }

        .desktop-search-item-badge {
            font-size: 10px;
            padding: 2px 6px;
            border-radius: 4px;
            background: rgba(255, 255, 255, 0.1);
            color: #8e8e93;
            margin-left: auto;
        }

        @media (prefers-color-scheme: light) {
            .desktop-search-item-badge {
                background: rgba(0, 0, 0, 0.06);
                color: #6e6e73;
            }
        }

        .desktop-search-empty {
            padding: 12px;
            text-align: center;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.4);
        }

        @media (prefers-color-scheme: light) {
            .desktop-search-empty {
                color: rgba(0, 0, 0, 0.45);
            }
        }

        /* Sidebar Navigation Sections */
        .desktop-nav-section {
            display: flex;
            flex-direction: column;
            gap: 1px;
        }

        .desktop-nav-header {
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.6px;
            text-transform: uppercase;
            color: rgba(255, 255, 255, 0.35);
            padding: 10px 10px 4px 10px;
        }

        @media (prefers-color-scheme: light) {
            .desktop-nav-header {
                color: rgba(0, 0, 0, 0.40);
            }
        }

        /* Authentic Apple Music Capsule Nav Items */
        .desktop-nav-item {
            position: relative;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 7px 10px 7px 14px;
            border-radius: 7px;
            text-decoration: none;
            color: rgba(245, 245, 247, 0.8);
            font-size: 13.5px;
            font-weight: 500;
            transition: background 0.15s ease, color 0.15s ease;
        }

        @media (prefers-color-scheme: light) {
            .desktop-nav-item {
                color: rgba(29, 29, 31, 0.8);
            }
        }

        .desktop-nav-item svg {
            width: 17px;
            height: 17px;
            fill: currentColor;
            flex-shrink: 0;
        }

        .desktop-nav-item:hover {
            background: rgba(255, 255, 255, 0.06);
            color: #ffffff;
        }

        @media (prefers-color-scheme: light) {
            .desktop-nav-item:hover {
                background: rgba(0, 0, 0, 0.05);
                color: #000000;
            }
        }

        /* Apple Music Selected State */
        .desktop-nav-item.active {
            background: rgba(255, 255, 255, 0.10);
            color: #ffffff;
            font-weight: 600;
        }

        .desktop-nav-item.active svg {
            fill: currentColor;
        }

        .desktop-nav-item.active::before {
            content: "";
            position: absolute;
            left: 2px;
            top: 50%;
            transform: translateY(-50%);
            width: 3.5px;
            height: 16px;
            border-radius: 2px;
            background-color: #fa586a;
        }

        @media (prefers-color-scheme: light) {
            .desktop-nav-item.active {
                background: rgba(0, 0, 0, 0.07);
                color: #1d1d1f;
            }
        }

        /* Apple Fluid Dynamic Sliding Indicator */
        .desktop-nav-indicator {
            position: absolute;
            left: 2px;
            width: 3.5px;
            height: 16px;
            border-radius: 2px;
            background-color: #fa586a;
            pointer-events: none;
            z-index: 100;
            opacity: 0;
            will-change: top, height, opacity;
        }

        /* When JS indicator is active, hide the static pseudo-element to avoid duplication */
        .has-desktop-indicator .desktop-nav-item.active::before {
            display: none;
        }

        /* Sidebar Footer */
        .desktop-sidebar-bottom {
            display: flex;
            flex-direction: column;
            padding-top: 10px;
            margin: 8px -12px 0 -12px;
            padding-left: 12px;
            padding-right: 12px;
            border-top: 0.5px solid rgba(255, 255, 255, 0.08);
            overflow: hidden;
            min-width: 0;
            flex-shrink: 0;
        }

        @media (prefers-color-scheme: light) {
            .desktop-sidebar-bottom {
                border-top: 0.5px solid rgba(0, 0, 0, 0.08);
            }
        }

        /* Sidebar Footer Profile */
        .desktop-profile-card {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            height: 24px;
            padding: 0 6px;
            border-radius: 5px;
            text-decoration: none;
            color: #ffffff;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
            transition: background-color 0.15s ease, transform 0.15s ease;
            min-width: 0;
            overflow: hidden;
            box-sizing: border-box;
        }

        .desktop-profile-card:hover {
            background: rgba(255, 255, 255, 0.08);
        }

        .desktop-profile-card:active {
            transform: scale(0.98);
            background: rgba(255, 255, 255, 0.12);
        }

        @media (prefers-color-scheme: light) {
            .desktop-profile-card {
                color: #1d1d1f;
            }

            .desktop-profile-card:hover {
                background: rgba(0, 0, 0, 0.05);
            }

            .desktop-profile-card:active {
                background: rgba(0, 0, 0, 0.09);
            }
        }

        .desktop-profile-avatar {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
            border: 0.5px solid rgba(255, 255, 255, 0.15);
            background: rgba(255, 255, 255, 0.05);
        }

        @media (prefers-color-scheme: light) {
            .desktop-profile-avatar {
                border: 0.5px solid rgba(0, 0, 0, 0.1);
                box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
                background: rgba(0, 0, 0, 0.03);
            }
        }

        .desktop-profile-avatar svg {
            width: 100%;
            height: 100%;
            display: block;
        }

        .desktop-profile-uuid {
            font-size: 11px;
            font-weight: 500;
            font-family: var(--sys-font-mono);
            letter-spacing: -0.2px;
            line-height: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
            flex: 1;
            display: block;
            color: rgba(245, 245, 247, 0.85);
            transition: color 0.15s ease;
        }

        .desktop-profile-uuid.copied {
            color: #34c759;
            font-family: var(--sys-font-family);
            font-weight: 600;
        }

        @media (prefers-color-scheme: light) {
            .desktop-profile-uuid {
                color: rgba(29, 29, 31, 0.82);
            }
        }

        /* ====================================================================
         * Section 3: Desktop Home Ceremonial Hall Integration (> 768px)
         * ==================================================================== */
        html:not(.device-mobile) .top-hover-trigger {
            position: fixed;
            top: 0;
            left: 240px;
            width: calc(100% - 240px);
            height: 15px;
            display: block;
            z-index: 20000;
        }

        html:not(.device-mobile) .dropdown-nav-bar {
            left: 0;
            width: 100%;
        }

        html:not(.device-mobile) body:not(.banner-active) .top-hover-trigger:hover .dropdown-nav-bar,
        html:not(.device-mobile) body:not(.banner-active) .dropdown-nav-bar:hover {
            transform: translateY(0);
        }

        html:not(.device-mobile) .memorial-banner,
        html:not(.device-mobile) .status-banner {
            left: 240px;
            width: calc(100% - 240px);
        }

        /* Strict vertical & horizontal centering for desktop ceremonial hall */
        html:not(.device-mobile) body.is-desktop-home,
        html:not(.device-mobile) body.has-desktop-sidebar.is-desktop-home {
            padding: 0 0 0 240px;
            width: 100%;
            height: 100vh;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            box-sizing: border-box;
        }

        html:not(.device-mobile) body.is-desktop-home .desktop-stage,
        html:not(.device-mobile) body.has-desktop-sidebar.is-desktop-home .desktop-stage {
            width: 100%;
            height: 100vh;
            min-height: 100vh;
            padding: 0 24px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            box-sizing: border-box;
        }

        html:not(.device-mobile) body.is-desktop-home .container,
        html:not(.device-mobile) body.has-desktop-sidebar.is-desktop-home .container {
            max-width: 500px;
            width: 100%;
            margin: auto auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        @media (max-height: 720px) {
            body.is-desktop-home .portrait-img,
            body.has-desktop-sidebar.is-desktop-home .portrait-img {
                height: min(280px, 30vh);
            }
            body.is-desktop-home .attendance-box,
            body.has-desktop-sidebar.is-desktop-home .attendance-box {
                margin: 0 auto 10px auto;
                padding: 3px 14px;
            }
            body.is-desktop-home .testament-box,
            body.has-desktop-sidebar.is-desktop-home .testament-box {
                margin-top: 6px;
            }
            body.is-desktop-home .testament-text,
            body.has-desktop-sidebar.is-desktop-home .testament-text {
                height: min(200px, 26vh);
                font-size: clamp(0.75rem, 1.7vh, 0.92rem);
                letter-spacing: 2px;
                line-height: 1.5;
            }
        }

        /* ====================================================================
         * Section 4: Subpages Desktop Layout (> 768px)
         * ==================================================================== */
        html:not(.device-mobile) body {
            padding: 0 0 0 240px;
            margin: 0;
            width: 100%;
            box-sizing: border-box;
        }

        /* Desktop Split View Dynamic Content Stage */
        .desktop-stage {
            width: 100%;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            box-sizing: border-box;
            padding: 40px 24px 60px 24px;
            position: relative;
            transition: opacity 0.18s cubic-bezier(0.25, 1, 0.5, 1);
            will-change: opacity;
        }

        .desktop-stage > * {
            flex-shrink: 0;
        }

        /* Desktop Subpage Background (Apple Black & White) */
        body.has-desktop-sidebar.is-desktop-subpage,
        body.has-desktop-sidebar.is-desktop-subpage .desktop-stage {
            background-color: var(--sys-bg, #000000);
        }

        @media (prefers-color-scheme: light) {
            body.has-desktop-sidebar.is-desktop-subpage,
            body.has-desktop-sidebar.is-desktop-subpage .desktop-stage {
                background-color: var(--sys-bg, #f2f2f7);
            }
        }

        /* Desktop Home Ceremonial Hall Background */
        html:not(.device-mobile) body.is-desktop-home,
        html:not(.device-mobile) body.has-desktop-sidebar.is-desktop-home,
        html:not(.device-mobile) body.is-desktop-home .desktop-stage,
        html:not(.device-mobile) body.has-desktop-sidebar.is-desktop-home .desktop-stage {
            background-color: var(--sys-bg-home, #000000);
        }

        @media (prefers-color-scheme: light) {
            html:not(.device-mobile) body.is-desktop-home,
            html:not(.device-mobile) body.has-desktop-sidebar.is-desktop-home,
            html:not(.device-mobile) body.is-desktop-home .desktop-stage,
            html:not(.device-mobile) body.has-desktop-sidebar.is-desktop-home .desktop-stage {
                background-color: var(--sys-bg-home, #ffffff);
            }
        }

        /* When top-back-btn is visible (nav-from-content), clear the 16px-top + 28px-height button */
        body.is-desktop-subpage.nav-from-content .desktop-stage {
            padding-top: 60px;
        }

        .ios-group-container {
            width: 100%;
            max-width: 680px;
            margin: 20px auto 40px auto;
            box-sizing: border-box;
        }

        .ios-section-header {
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: rgba(245, 245, 247, 0.45);
            margin: 22px 0 6px 12px;
        }

        @media (prefers-color-scheme: light) {
            .ios-section-header {
                color: #6e6e73;
            }
        }

        /* macOS Inset Grouped Card */
        .ios-card {
            display: flex;
            flex-direction: column;
            background: var(--sys-surface, #1c1c1e);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 0.5px solid var(--sys-border, rgba(255, 255, 255, 0.12));
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
            margin-bottom: 16px;
        }

        @media (prefers-color-scheme: light) {
            .ios-card {
                background: #ffffff;
                border: 0.5px solid rgba(0, 0, 0, 0.08);
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
            }
        }

        .ios-card .ios-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            min-height: 44px;
            padding: 0 14px;
            position: relative;
            background: transparent;
            border: none;
            border-radius: 0;
            text-decoration: none;
            color: #f5f5f7;
            transition: background-color 0.15s ease;
        }

        @media (prefers-color-scheme: light) {
            .ios-card .ios-row {
                color: #1d1d1f;
            }
        }

        .ios-card .ios-row:hover {
            background: rgba(255, 255, 255, 0.05);
            transform: none;
            box-shadow: none;
        }

        @media (prefers-color-scheme: light) {
            .ios-card .ios-row:hover {
                background: rgba(0, 0, 0, 0.03);
            }
        }

        .ios-card .ios-row:not(:last-child)::after {
            display: block;
            content: "";
            position: absolute;
            left: 54px;
            right: 0;
            bottom: 0;
            height: 0.5px;
            background: rgba(255, 255, 255, 0.08);
        }

        @media (prefers-color-scheme: light) {
            .ios-card .ios-row:not(:last-child)::after {
                background: rgba(0, 0, 0, 0.06);
            }
        }

        .festival-hero {
            width: 100%;
            max-width: 800px;
            margin: 0 auto 20px auto;
            box-sizing: border-box;
        }

        .markdown-container,
        .charts-container {
            width: 100%;
            max-width: 800px;
            margin: 0 auto 40px auto;
            box-sizing: border-box;
            flex-shrink: 0;
            height: auto;
        }

        /* ====================================================================
         * Desktop macOS Ghost Toolbar Navigation Back Button (> 768px)
         * ==================================================================== */
        .top-back-btn {
            position: fixed;
            top: 16px;
            left: calc(240px + 32px);
            display: inline-flex;
            align-items: center;
            gap: 5px;
            height: 28px;
            padding: 0 8px 0 6px;
            margin: 0;
            background: transparent;
            border: none;
            border-radius: 6px;
            color: rgba(245, 245, 247, 0.85);
            font-size: 13px;
            font-weight: 500;
            font-family: var(--sys-font-family);
            text-decoration: none;
            box-shadow: none;
            z-index: 1000;
            transition: background-color 0.15s ease,
                        color 0.15s ease,
                        transform 0.15s ease;
            user-select: none;
            -webkit-user-select: none;
            cursor: pointer;
        }

        @media (prefers-color-scheme: light) {
            .top-back-btn {
                background: transparent;
                border: none;
                color: #1d1d1f;
                box-shadow: none;
            }
        }

        .top-back-btn:hover {
            background: rgba(255, 255, 255, 0.08);
            color: #fa586a;
            border: none;
            box-shadow: none;
            transform: none;
        }

        @media (prefers-color-scheme: light) {
            .top-back-btn:hover {
                background: rgba(0, 0, 0, 0.06);
                color: #fa586a;
                border: none;
                box-shadow: none;
            }
        }

        .top-back-btn:active {
            transform: scale(0.97);
            background: rgba(255, 255, 255, 0.14);
        }

        @media (prefers-color-scheme: light) {
            .top-back-btn:active {
                background: rgba(0, 0, 0, 0.10);
            }
        }

        .top-back-btn svg {
            width: 13px;
            height: 13px;
            stroke: currentColor;
            stroke-width: 2px;
            fill: none;
            margin: 0;
            transition: transform 0.15s ease;
        }

        .top-back-btn:hover svg {
            transform: translateX(-2px);
        }
    }
}

/* ============================================================================
 * Mobile Isolation & Explicit Desktop Shell Visibility Overrides
 * ============================================================================ */
@layer overrides {
    @media (max-width: 768px) {
        .desktop-sidebar,
        .desktop-search-dropdown {
            display: none;
        }

        .desktop-stage {
            display: contents;
        }
    }

    html.device-mobile .desktop-sidebar,
    html.device-mobile .desktop-search-dropdown,
    body.device-mobile .desktop-sidebar,
    body.device-mobile .desktop-search-dropdown {
        display: none;
    }

    html.device-mobile .desktop-stage,
    body.device-mobile .desktop-stage {
        display: contents;
    }

    @media (min-width: 769px) {
        html.device-mobile,
        html.device-mobile body,
        body.device-mobile {
            padding-left: 0;
        }

        body.nav-from-sidebar .top-back-btn {
            display: none;
        }

        .desktop-stage.stage-fading {
            opacity: 0;
        }
    }
}
