html {
    box-sizing: border-box;
    margin: 0; /* Reset default body margin */
    padding: 0; /* Reset default body padding */
  }
  
  *,
  *::before,
  *::after {
    box-sizing: inherit;
  }
  body {
    width: 100%;
    font-family: Arial, Helvetica, "STHeiti Medium", "Heiti TC Medium", "LiHei Pro", "Microsoft JhengHei Medium", "Microsoft Yahei", '微軟正黑體', '微软雅黑', 'Open Sans', sans-serif;
    font-size: clamp(1rem, 4vw, 1.125rem);
    line-height: 1.5; 
    color: #333; 
    margin: 0; 
    padding: 0; 
    background-color: #fff; 
    min-height: 100vh;
    margin-inline: 0; 
    padding-block-start: 0; 
    padding-block-end: 0; 
    display: flex;
    flex-direction: column;
  }
    body.locked {
        overflow-y: hidden;
    }

    img {
        max-width: 100%;
        height: auto;
        display: inline-block;
        vertical-align: middle;
        object-fit: cover; 
        object-position: center center;
        transition: opacity 0.3s ease-in-out;
        opacity: 1;
      }

header {
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 10;
    transition:0.3s;
}
header.sticky{

}

.header-wrapper{
    display:flex;
    align-items: center;
    justify-content: space-between;
    gap:2rem;
}

main{
    flex-grow:1;
}

  .main-nav{
    flex:1;
  }

.main-nav ul{
    list-style:none;
    padding:0;
}
.main-nav li{
    position:relative;
}
.main-nav a,
.main-nav a:hover{
    text-decoration: none;
}
.main-nav ul.lv0 {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}


.main-nav ul.lv0 ul {
    display:none;
    position: absolute;
    animation-duration: 0.3s;
    transition: 0.3s;
}

.main-nav ul.lv0 > li:hover > ul {
    display: block;
    animation-name: menuSlideDown;
    transition: none;
}

.main-nav ul.lv1 {
    top: 100%;
    left: 0;
}
.main-nav ul.lv1 ul {
    top: 0;
    left: 100%;
}

    .main-nav ul.lv1 li:hover > ul {
        display: block;
        animation-name: menuSlideRight;
        transition: none;
    }

@keyframes menuSlideDown {
    0% {
        opacity: 0.5;
        transform: translateY(-10%);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes menuSlideRight {
    0% {
        opacity: 0.5;
        transform: translateX(-10%);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}


/* Mobile Main Menu */
.header-wrapper-mobile {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-btn {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
}

#overlay {
    background: rgba(0,0,0,0.7);
    position: fixed;
    display: none;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 998;
}

    #overlay.show {
        display: block;
    }

#mobile-menu-wrapper {
    position: fixed;
    display: block;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 360px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.2);
    z-index: 999;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

    #mobile-menu-wrapper.open {
        transform: translateX(0%);
    }


.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: end;
    height: 60px;
}

    .mobile-menu-header > .close-btn {
        font-size: 2rem;
        padding: 4px 1rem;
        cursor: pointer;
    }

.mobile-menu {
    display: block;
    width: 100%;
    background: #fff;
    overflow-y: auto;
}

    .mobile-menu ul {
        list-style: none;
    }

    .mobile-menu,
    .mobile-menu a {
        display: block;
        color: #222;
        font-size: 1rem;
        text-decoration: none;
    }

        .mobile-menu a:hover {
            text-decoration: none;
        }

        .mobile-menu ul.lv0 {
            padding-left: 0;
        }

            .mobile-menu ul.lv0 > li > a {
                padding: 1.5rem 2rem;
                font-size: 16px;
                line-height: 1;
            }
            .mobile-menu ul:not(.lv0) {
                display:none
            }
            .mobile-menu li.open > ul{
                display:block
            }
        .mobile-menu ul.lv1 {
            padding: 12px 0;
        }

            .mobile-menu ul.lv1 > li > a {
                padding: 11px 40px;
            }

            .mobile-menu ul.lv1 ul {
                padding-left: 40px;
            }

                .mobile-menu ul.lv1 ul a {
                    font-size: 14px;
                    padding: 8px 16px;
                }


.post-list-pagination {
    display: flex;
    gap: 1rem;
}

.back-to-top {
    position: fixed;
    bottom: 6vh;
    right: 6vw;
    z-index: 10000;
    width: 42px;
    height: 42px;
    background-color: var(--primary-color);
    border-radius: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: 0.2s;
    opacity: 0;
    visibility: hidden;
}

    .back-to-top.show {
        opacity: 1;
        visibility: visible;
    }
    .back-to-top:hover {
        background-color: var(--primary-color-darker);
    }