/* Explain: Styles for the interactive hanging lantern navigation animation. */
/* ===================================================================
   Interactive hanging lantern for the sidebar navigation
   =================================================================== */

.lantern-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: 34px;
    height: 0;
    z-index: 56;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 520ms ease;
}

.lantern-rail.is-on {
    opacity: 1;
    visibility: visible;
}

/* Soft warm wash that lights the selected menu item */
.lantern-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 150px;
    margin-left: -140px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: radial-gradient(ellipse at 50% 50%, rgba(255, 205, 100, 0.30) 0%, rgba(255, 176, 56, 0.13) 44%, rgba(255, 160, 40, 0) 74%);
    mix-blend-mode: screen;
    transition: top 760ms cubic-bezier(0.34, 1.12, 0.4, 1), left 760ms cubic-bezier(0.34, 1.12, 0.4, 1);
}

/* Hanging chain */
.lantern-cord {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 40px;
    margin-left: -1px;
    border-radius: 2px;
    background-image: repeating-linear-gradient(180deg, rgba(226, 190, 96, 0.95) 0 3px, rgba(226, 190, 96, 0.28) 3px 6px);
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.35);
    transition: height 760ms cubic-bezier(0.34, 1.12, 0.4, 1);
}

/* Swinging pivot */
.lantern-pendulum {
    position: absolute;
    top: 40px;
    left: 50%;
    width: 34px;
    margin-left: -17px;
    transform-origin: top center;
    transition: top 760ms cubic-bezier(0.34, 1.12, 0.4, 1);
    will-change: top, transform;
}

.lantern-pendulum.is-swinging {
    animation: lanternSwing 1150ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Warm light beam toward the menu labels */
.lantern-beam {
    position: absolute;
    top: 28px;
    left: 50%;
    width: 185px;
    height: 100px;
    margin-top: -50px;
    transform-origin: 0 50%;
    background: radial-gradient(ellipse at 0% 50%, rgba(255, 202, 96, 0.34) 0%, rgba(255, 176, 56, 0.15) 40%, rgba(255, 160, 40, 0) 74%);
    filter: blur(1.5px);
    pointer-events: none;
}

.lantern-rail.is-flipped .lantern-beam {
    transform: scaleX(-1);
}

/* Round halo around the lantern */
.lantern-halo {
    position: absolute;
    top: 28px;
    left: 50%;
    width: 150px;
    height: 150px;
    margin: -75px 0 0 -75px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 199, 92, 0.30) 0%, rgba(255, 172, 52, 0.11) 44%, rgba(255, 150, 30, 0) 72%);
    mix-blend-mode: screen;
    pointer-events: none;
}

/* ---------------- Lantern body ---------------- */

.lantern-body {
    position: relative;
    display: block;
    width: 34px;
    height: 56px;
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 14px rgba(255, 196, 84, 0.4));
}

/* hanging loop */
.lantern-body::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 50%;
    width: 9px;
    height: 9px;
    margin-left: -4.5px;
    border: 1.5px solid rgba(226, 190, 96, 0.9);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 214, 120, 0.6);
}

/* bottom finial */
.lantern-body::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 8px;
    height: 8px;
    margin-left: -4px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #fdf6cf 0%, #dcb843 60%, #8f6f15 100%);
    box-shadow: 0 0 8px rgba(255, 214, 120, 0.5);
}

.lantern-cap {
    position: absolute;
    top: 0;
    left: 50%;
    width: 17px;
    height: 6px;
    margin-left: -8.5px;
    border-radius: 3px 3px 2px 2px;
    background: linear-gradient(180deg, #fdf6cf 0%, #dcb843 52%, #8f6f15 100%);
    box-shadow: 0 0 7px rgba(255, 214, 120, 0.55);
}

.lantern-glass {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 28px;
    height: 36px;
    margin-left: -14px;
    border-radius: 10px 10px 12px 12px / 13px 13px 15px 15px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 44%, rgba(255, 252, 224, 0.98) 0%, rgba(255, 214, 110, 0.96) 24%, rgba(255, 168, 58, 0.94) 58%, rgba(158, 90, 16, 0.96) 100%);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.5), inset 0 -7px 12px rgba(120, 60, 8, 0.45), 0 0 22px rgba(255, 186, 70, 0.55);
    animation: lanternGlassPulse 3.8s ease-in-out infinite;
}

.lantern-glass::after {
    content: "";
    position: absolute;
    inset: 2px 4px auto 4px;
    height: 44%;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
    opacity: 0.7;
}

.lantern-flame {
    position: absolute;
    bottom: 5px;
    left: 50%;
    width: 8px;
    height: 15px;
    margin-left: -4px;
    border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
    background: radial-gradient(circle at 50% 72%, #fffdf0 0%, #ffe9a8 38%, #ffb648 72%, rgba(255, 150, 40, 0) 100%);
    filter: blur(0.4px);
    animation: lanternFlicker 2.6s ease-in-out infinite;
}

.lantern-base {
    position: absolute;
    top: 42px;
    left: 50%;
    width: 17px;
    height: 6px;
    margin-left: -8.5px;
    border-radius: 2px 2px 4px 4px;
    background: linear-gradient(180deg, #dcb843 0%, #8f6f15 100%);
    box-shadow: 0 0 8px rgba(255, 200, 90, 0.4);
}

/* ---------------- Menu lighting states ---------------- */

.dashboard-nav.is-lantern .dashboard-nav__link {
    transition: opacity 340ms ease, color 340ms ease, text-shadow 340ms ease, background 260ms ease;
}

.dashboard-nav.is-lantern .dashboard-nav__link:not(.is-active) {
    opacity: 0.72;
}

.dashboard-nav.is-lantern .dashboard-nav__link:not(.is-active):hover,
.dashboard-nav.is-lantern .dashboard-nav__link:not(.is-active):focus-visible {
    opacity: 1;
}

.dashboard-nav.is-lantern .dashboard-nav__link.is-active {
    color: #ffd98a;
    text-shadow: 0 0 10px rgba(255, 196, 84, 0.55), 0 0 24px rgba(255, 168, 48, 0.35);
}

/* ---------------- Keyframes ---------------- */

@keyframes lanternSwing {
    0% { transform: rotate(0deg); }
    16% { transform: rotate(7.5deg); }
    38% { transform: rotate(-5.5deg); }
    60% { transform: rotate(3.2deg); }
    80% { transform: rotate(-1.4deg); }
    100% { transform: rotate(0deg); }
}

@keyframes lanternFlicker {
    0%, 100% { opacity: 0.82; transform: scale(1); }
    45% { opacity: 1; transform: scale(1.09); }
    70% { opacity: 0.9; transform: scale(0.97); }
}

@keyframes lanternGlassPulse {
    0%, 100% { box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.5), inset 0 -7px 12px rgba(120, 60, 8, 0.45), 0 0 20px rgba(255, 186, 70, 0.5); }
    50% { box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.6), inset 0 -7px 12px rgba(120, 60, 8, 0.45), 0 0 28px rgba(255, 196, 84, 0.7); }
}

/* ---------------- Accessibility ---------------- */

@media (prefers-reduced-motion: reduce) {
    .lantern-rail,
    .lantern-cord,
    .lantern-pendulum,
    .lantern-glow {
        transition: none !important;
    }

    .lantern-pendulum.is-swinging {
        animation: none !important;
    }

    .lantern-glass,
    .lantern-flame {
        animation: none !important;
    }
}