* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

body.page-loading {
    overflow: hidden;
    height: 100vh;
    overscroll-behavior: none;
}

a {
    text-decoration: none;
}

a:hover {
    opacity: .8;
    transition: .5s;
}

a:hover .fa-angles-right {
    transform: translateX(50%);
    transition: .5s;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

ul li {
    display: inline-block;
    position: relative;
}

ul li a {
    display: block;
    padding: 20px;
    color: #fff;
    text-decoration: none;
    text-align: center;
    font-size: 20px;
    position: relative;
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* Elegant growing underline for parent menu */
.nav_menu>li>a::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: #ffcc00;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.6);
}

.nav_menu>li>a:hover::after,
.nav_menu>li>a.active::after {
    width: 60%;
}

ul li ul.dropdown li {
    display: block;
}

ul li ul.dropdown {
    width: 100%;
    background: #283046;
    /* Better dark blue matches top header */
    position: absolute;
    z-index: 999;
    display: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

ul li a:hover,
ul li a.active {
    color: #ffcc00;
}

ul li:hover ul.dropdown {
    display: block;
}

ul li:hover ul.dropdown li a:hover,
ul li ul.dropdown li a.active {
    color: #ffcc00;
    background-color: rgba(255, 204, 0, 0.1);
    padding-left: 25px;
    /* slight indent effect on hover */
    transition: all 0.3s ease;
}

ul li:hover .fa-caret-down {
    transform: rotate(180deg);
    transition: .4s;
}

.header,
.copyright {
    background-color: rgb(230, 230, 230);
}

/* Keep CKEditor HTML content visually stable on frontend pages. */
.article-content img {
    max-width: 100%;
    height: auto !important;
}

.article-content .image,
.article-content .image_resized,
.article-content figure {
    max-width: 100%;
}

.article-content p {
    overflow-wrap: anywhere;
}

.loading-shell {
    position: relative;
    min-height: calc(100vh - 168px);
}

.loading-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 14% 16%, rgba(255, 250, 243, 0.9), transparent 22%),
        radial-gradient(circle at 86% 24%, rgba(230, 235, 244, 0.74), transparent 26%),
        linear-gradient(180deg, rgba(248, 249, 251, 0.98), rgba(239, 241, 245, 0.98));
}

.loading-page-body {
    position: relative;
}

.loading-header-shell-top {
    z-index: 3;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.loading-header-shell-top-inner {
    gap: 1rem;
}

.loading-header-shell-menu,
.loading-header-shell-social {
    display: flex;
    align-items: center;
}

.loading-header-shell-menu {
    gap: 0.7rem;
}

.loading-header-shell-link {
    pointer-events: none;
}

.loading-header-shell-toggle {
    position: relative;
    width: 32px;
    height: 32px;
}

.loading-header-shell-toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    margin: 6px auto;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.38));
    background-size: 180% 100%;
    animation: loadingShellShimmer 1.6s ease-in-out infinite;
}

.loading-header-shell-social {
    gap: 0.55rem;
}

.loading-header-shell-link-bar,
.loading-header-shell-dot,
.loading-header-shell-title-bar,
.loading-header-shell-subtitle-bar {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.32));
    background-size: 180% 100%;
    animation: loadingShellShimmer 1.6s ease-in-out infinite;
}

.loading-header-shell-link-bar {
    display: block;
    width: 72px;
    height: 30px;
    margin: 0 auto;
    border-radius: 999px;
}

.loading-header-shell-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
}

.loading-header-shell-social-link {
    pointer-events: none;
}

.loading-header-shell-main {
    background: rgba(230, 230, 230, 0.92);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.loading-header-shell-title {
    margin-bottom: 0.5rem;
}

.loading-header-shell-title-link {
    pointer-events: none;
}

.loading-header-shell-title-bar {
    display: block;
    width: min(400px, 72vw);
    max-width: 100%;
    height: 30px;
    margin: 0 auto;
    border-radius: 999px;
}

.loading-header-shell-subtitle {
    margin-bottom: 1rem;
}

.loading-header-shell-subtitle-bar {
    display: block;
    width: min(360px, 72vw);
    height: 12px;
    margin: 0 auto;
    border-radius: 999px;
}

.loading-header-shell-subtitle.short,
.loading-header-shell-subtitle:last-child {
    margin-bottom: 0;
}

.loading-header-shell-subtitle-bar.short {
    width: min(240px, 46vw);
}

.loading-overlay,
.loading-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2.25rem 1.5rem 3rem;
    background:
        linear-gradient(180deg, rgba(246, 247, 249, 0.84), rgba(242, 244, 247, 0.94)),
        radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.5), transparent 22%);
}

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    align-items: center;
    backdrop-filter: blur(10px);
}

.loading-fallback {
    min-height: calc(100vh - 168px);
}

.loading-fallback-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: min(1100px, 100%);
    margin: 0 auto;
}

.loading-stage-intro {
    width: min(1100px, 100%);
    min-height: clamp(260px, 34vh, 360px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.loading-badge-wrap {
    position: relative;
    width: min(360px, calc(100vw - 2rem));
    padding: 0.35rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.loading-badge-aura {
    position: absolute;
    inset: 8% 10%;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 247, 236, 0.72) 0%, rgba(233, 238, 248, 0.34) 54%, rgba(255, 255, 255, 0) 76%);
    filter: blur(24px);
    animation: loadingBadgeAura 2.8s ease-in-out infinite;
}

.loading-badge {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.95rem;
    padding: 1rem 1.05rem;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(241, 243, 247, 0.58)),
        linear-gradient(135deg, rgba(216, 207, 194, 0.12), rgba(255, 255, 255, 0.08));
    box-shadow:
        0 20px 46px rgba(145, 151, 167, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
}

.loading-stage-skeleton {
    width: min(1100px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 0.9fr);
    gap: 1.5rem;
}

.loading-stage-skeleton-main,
.loading-stage-skeleton-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.loading-stage-card {
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(242, 244, 247, 0.72)),
        linear-gradient(135deg, rgba(217, 209, 198, 0.08), rgba(255, 255, 255, 0.05));
    box-shadow: 0 18px 40px rgba(163, 168, 179, 0.08);
    overflow: hidden;
}

.loading-stage-card.hero {
    min-height: 240px;
}

.loading-stage-card.compact {
    min-height: 128px;
}

.loading-stage-card.side {
    min-height: 168px;
}

.loading-stage-shimmer {
    width: 100%;
    height: 100%;
    min-height: inherit;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.16));
    background-size: 180% 100%;
    animation: loadingShellShimmer 1.7s ease-in-out infinite;
}

.loading-badge-spinner {
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
}

.loading-badge-ring {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 2px solid rgba(166, 174, 189, 0.18);
    border-top-color: rgba(124, 111, 96, 0.78);
    border-right-color: rgba(124, 111, 96, 0.52);
    animation: loadingBadgeSpin 0.9s linear infinite;
}

.loading-badge-core {
    position: relative;
    z-index: 1;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: rgba(118, 104, 88, 0.72);
}

.loading-badge-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.loading-badge-title {
    display: inline-flex;
    align-items: baseline;
    gap: 0.24rem;
    color: rgba(66, 60, 54, 0.92);
    line-height: 1;
    position: relative;
}

.loading-badge-title-amanda {
    font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
    font-size: 1.08rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.15;
    color: rgba(82, 73, 65, 0.9);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

.loading-badge-title-separator {
    width: 4px;
    height: 4px;
    margin: 0 0.02rem 0.22rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(182, 160, 132, 0.76) 0%, rgba(182, 160, 132, 0.34) 58%, rgba(182, 160, 132, 0) 100%);
    box-shadow: 0 0 0 3px rgba(182, 160, 132, 0.05);
}

.loading-badge-title-blog {
    font-family: "Brush Script MT", "Snell Roundhand", "Apple Chancery", "Segoe Script", cursive;
    color: rgba(129, 114, 96, 0.68);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.015em;
    text-transform: none;
    transform: translateY(-0.01rem);
}

.loading-badge-text {
    margin-top: 0.18rem;
    color: rgba(117, 120, 128, 0.58);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

@keyframes loadingBadgeSpin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes loadingBadgeAura {
    0%,
    100% {
        opacity: 0.72;
        transform: scale(0.98);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

@keyframes loadingShellShimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

@media screen and (max-width: 767px) {

    .loading-overlay,
    .loading-fallback {
        padding: 1.25rem 1rem 2rem;
    }

    .loading-header-shell-top-inner {
        min-height: auto;
    }

    .loading-header-shell-link-bar {
        width: 52px;
        height: 21px;
    }

    .loading-header-shell-title-bar {
        height: 24px;
    }

    .loading-header-shell-subtitle-bar {
        height: 10px;
    }

    .loading-badge-wrap {
        width: min(320px, calc(100vw - 1rem));
        padding: 0.75rem;
    }

    .loading-stage-intro {
        min-height: clamp(220px, 30vh, 300px);
    }

    .loading-badge {
        width: 100%;
        gap: 0.82rem;
        padding: 0.9rem 0.92rem;
        border-radius: 16px;
    }

    .loading-badge-spinner {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .loading-badge-core {
        font-size: 0.62rem;
    }

    .loading-badge-title {
        font-size: 0.95rem;
    }

    .loading-badge-title-amanda {
        font-size: 1rem;
    }

    .loading-badge-title-separator {
        width: 3px;
        height: 3px;
        margin-bottom: 0.16rem;
    }

    .loading-badge-title-blog {
        font-size: 0.72rem;
        letter-spacing: 0.01em;
    }

    .loading-badge-text {
        font-size: 0.58rem;
        letter-spacing: 0.14em;
    }

    .loading-stage-skeleton {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1rem;
    }

    .loading-stage-card.hero {
        min-height: 180px;
    }

    .loading-stage-card.compact,
    .loading-stage-card.side {
        min-height: 108px;
    }

    .more,
    .tag a,
    .time,
    p {
        font-size: .8em;
    }

    h2 {
        font-size: 1.4em;
    }

    h4 {
        font-size: 1.2em;
    }

    h5 {
        font-size: 1em;
    }

    ul li {
        display: block;
        position: relative;
        background: rgba(33, 37, 41, 0.95);
        /* Match bg-dark */
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    ul li a {
        display: block;
        padding: 16px;
        color: #fff;
        text-decoration: none;
        text-align: center;
        font-size: 14px;
        transition: all 0.3s ease;
    }

    /* Disable underline on mobile for cleaner look */
    .nav_menu>li>a::after {
        display: none;
    }

    ul li ul.dropdown li {
        display: block;
    }

    ul li ul.dropdown {
        width: 100%;
        background: rgba(26, 30, 33, 0.95);
        position: static;
        z-index: 999;
        display: none;
        box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
    }

    ul li a:hover,
    ul li a.active {
        color: #ffcc00;
        background-color: rgba(255, 204, 0, 0.1);
    }

    ul li:hover ul.dropdown {
        display: block;
    }

    .more a span {
        width: 100%;
        text-align: center;
    }

    .nav_toggle {
        position: relative;
        width: 32px;
        height: 32px;
    }

    .nav_burger,
    .nav_close {
        position: absolute;
        line-height: 32px;
        font-size: 1.25rem;
        cursor: pointer;
    }

    .nav_close {
        opacity: 0;
    }

    .nav_menu {
        position: absolute;
        left: 0;
        top: 2rem;
        width: 100%;
        height: auto;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        transition: max-height 0.3s ease, opacity 0.3s ease;
    }

    .show_menu {
        max-height: 100vh;
        opacity: 1;
        overflow-y: auto;
        pointer-events: auto;
    }

    .show_icon .nav_burger {
        opacity: 0;
    }

    .show_icon .nav_close {
        opacity: 1;
    }
}
