@font-face {
    font-family: 'ChiayiFont';
    src: url('../fonts/ChiayiCity.woff2') format('woff2'),
          url('../fonts/ChiayiCity.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

h1::selection {
    background-color: #727272;
    color: #fff;
}
p::selection {
    background-color: #acacac;
    color: #fff;
}
h6::selection {
    background-color: #acacac;
    color: #fff;
}
.nav-links a::selection {
    background-color: #555555;
    color: #fff;
}

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

html.loading {
    overflow: hidden;
}

html::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    z-index: 9999;
    display: flex;    
    justify-content: center;  
    align-items: center;   
    flex-direction: column;  
    pointer-events: all;
    opacity: 1;
    transition: opacity 0.8s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

body {
    font-family: 'ChiayiFont', sans-serif;
    margin: 0;
    padding: 0;
    padding-top: 60px;
    display: flex;
    flex-direction: column;
    background-color: #FAF4DB;
    transition: background 0.3s ease;
}

/******************************************************************************************/

@keyframes frostBreak {
    0% {
        transform: scale(0.8) rotate(0deg);
        opacity: 0;
        filter: grayscale(1) blur(10px) brightness(200%) contrast(300%);
    }
    30% {
        transform: scale(1.3) rotate(10deg);
        filter: hue-rotate(180deg) brightness(150%);
    }
    60% {
        transform: scale(0.9) rotate(-5deg);
        filter: none;
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

@keyframes lavaBurst {
    0% {
        transform: scale(0.4) rotate(-180deg);
        filter: blur(20px) sepia(1) brightness(250%);
        opacity: 0;
    }
    30% {
        transform: scale(1.5) rotate(30deg);
        filter: hue-rotate(50deg) brightness(180%);
        opacity: 1;
    }
    60% {
        nsform: scale(0.95) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: none;
    }
}

@keyframes electricZap {
    0% {
        transform: scale(0.8);
        opacity: 0;
        filter: brightness(200%) saturate(4);
    }
    20%, 40%, 60%, 80% {
        transform: scale(1.05) rotate(2deg);
        filter: drop-shadow(0 0 20px #0ff);
    }
    30%, 50%, 70% {
        transform: scale(0.95) rotate(-2deg);
        filter: drop-shadow(0 0 30px #f0f);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        filter: none;
    }
}

@keyframes rainbowPulse {
    0% {
        transform: scale(0.6);
        filter: hue-rotate(0deg) drop-shadow(0 0 10px #f0f);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
        filter: hue-rotate(180deg) drop-shadow(0 0 30px #0ff);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        filter: hue-rotate(360deg) drop-shadow(0 0 20px #ff0);
        opacity: 1;
    }
}

@keyframes wormhole {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
        filter: blur(50px) contrast(500%) brightness(200%);
    }
    50% {
        transform: scale(1.5) rotate(360deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(720deg);
        filter: none;
        opacity: 1;
    }
}

@keyframes hyperEntrance {
    0% {
        opacity: 0;
        transform: scale(0.2) rotate(0deg);
        filter: blur(20px) hue-rotate(0deg) brightness(200%) drop-shadow(0 0 50px #00ffff);;
    }
    30% {
        transform: scale(1.4) rotate(180deg);
        filter: blur(5px) hue-rotate(180deg) brightness(150%) drop-shadow(0 0 15px #ff00fb);;
    }
    60% {
        transform: scale(0.9) rotate(270deg);
        filter: blur(2px) hue-rotate(270deg) brightness(120%) drop-shadow(0 0 50px #f2ff00);;
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(360deg);
        filter: blur(0px) hue-rotate(360deg) brightness(100%) drop-shadow(0 0 15px #ff2f00);;
    }
}

@keyframes cosmicPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px #00ffff);
    }
    50% {
        transform: scale(1.2);
        filter: drop-shadow(0 0 40px #ff00ff) hue-rotate(45deg);
    }
}

.loading-logo {
    width: 400px;
    height: auto;
    opacity: 0;
    animation:
        hyperEntrance 1.5s ease-out forwards,
        cosmicPulse 2.5s ease-in-out infinite 1.5s;
    animation-fill-mode: forwards;
    z-index: 10000;
    transition: all 0.3s ease-in-out;
    position: relative;
}

/******************************************************************************************/

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    backdrop-filter: blur(8px);
    background: #faf4dba3;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
    padding: 1rem 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 3.5rem;
    flex-wrap: wrap;
}

.nav-links a {
    position: relative;
    text-decoration: none;
    color: #858585;
    font-weight: 550;
    letter-spacing: 6.5px;
    font-size: 0.8rem;
    padding: 0.3rem;
    transition: color 0.3s ease;
}

body.change-mode .nav-links a {
    color: #858585;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background-color: #007bff;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

.nav-links a:hover {
    color: #007bff;
}

body.change-mode .navbar {
    background: #ffffffa7;
    box-shadow: 0 2px 10px rgba(67, 67, 67, 0.1);
}

.hamburger {
    display: none;
    color:black;
    font-size: 1.8rem;
    cursor: pointer;
    padding-left: 1rem;
}

body.change-mode .navbar .hamburger {
    color: rgb(30, 30, 30);
}

header {
    background-color: #FAF4DB;
    color:black;
    transition: background 0.3s ease;
    text-align: center;
}

header.change-mode {
    background-color: #e9eced;
    transition: background 1s ease;
}

body.change-mode {
    background-color: #e9eced;
    transition: background 1s ease;
}

#banner {
    position: relative;
    width: 100%;
}

#banner img {
    display: block;
    width: 100%;
    height: auto;
}

.overlap-container {
    position: relative;
    margin-top: -40px;
    text-align: center;
    z-index: 1;
}

.overlap-image {
    width: 500px;
    max-width: 90%;
    animation: sway 3s ease-in-out infinite;
}

.overlap-text {
    margin-top: 10px;
    font-size: 1rem;
    color: #333;
}

@keyframes sway {
    0% { transform: rotate(-3.5deg); }
    50% { transform: rotate(3.5deg);}
    100% { transform: rotate(-3.5deg); }
}

main {
    padding: 3%;
}

main h1 {
    margin-top: 220px;
    margin-bottom: 66px;
}

main p {
    margin-top: 50px;
    margin-bottom: 100px;
}

h1, p {
    opacity: 0;
    transform: translateY(110px);
}
h1 {
    color: #000000;
    letter-spacing: 15px;
    font-size: 3.5em;
    font-weight: 700;
    transition: background 0.8s ease, opacity 1.1s ease, transform 1.1s ease, color 1.1s ease;
}
p {
    color: #6f6f6f;
    letter-spacing: 9px;
    line-height: 35px;
    font-weight: 700;
    transition: background 1.2s ease, opacity 1.7s ease, transform 1.7s ease, color 1.7s ease;
}
h1.visible, p.visible {
    opacity: 1;
    transform: translateY(30px);
    display: block;
}

.big-title-blue {
    color: rgb(0, 110, 169);
    font-size: 1.35em;
}
.big-title-red {
    color: rgb(188, 14, 14);
    font-size: 1.35em;
}

.title-gradient {
    background: linear-gradient(to right, rgb(166, 120, 200), rgb(134, 131, 199), rgb(110, 140, 196), rgb(105, 146, 142), rgb(99, 153, 74));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.typewriter {
    min-height: 12em;
}

body.change-mode h1{
    color: #3d3d3d;
}

body.change-mode p{
    color: #878787;
}

section {
    margin-top: 50px;
    margin-bottom: 50px;
    text-align: justify;
    background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 70%);
    padding: 50px;
    padding-top: 0;
    border-radius: 25px;
}

section h1::after {
    content: "";
    position: absolute;
    bottom: -20px;
    left: -5px;
    width: 0px;
    height: 4px;
    background-color: #999;
    border-radius: 2px;
    transition: width 0.6s ease;
    transition-delay: 0.6s;
}

section h1.visible::after {
    width: 500px;
}

.floating-image-container {
    position: relative;
    overflow: visible;
}

.floating-image-right {
    position: absolute;
    right: 0px;
    top: 0;
    opacity: 0;
    transform: scale(0.2) rotate(360deg) translateX(0);
    transition: 0;
    max-width: 300px;
    z-index: 0;
}

.floating-image-right.visible {
    animation: JumpInLeft 2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    opacity: 1;
}

@keyframes JumpInLeft {
    0% {
        transform: scale(0.2) rotate(360deg) translateX(100%);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) rotate(-20deg) translateX(-10%);
    }
    70% {
        transform: scale(0.95) rotate(10deg) translateX(-30%);
        opacity: 1;
    }
    85% {
        transform: scale(1.02) rotate(-5deg) translateX(-45%);
    }
    100% {
        transform: scale(1) rotate(0deg) translateX(-50%);
    }
}

.floating-image-left {
    position: absolute;
    left: 0px;
    top: 0;
    opacity: 0;
    transform: scale(0.2) rotate(-360deg) translateX(100%);
    transition: 0;
    max-width: 300px;
    z-index: 0;
}

.floating-image-left.visible {
    animation: JumpInRight 2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    opacity: 1;
}

@keyframes JumpInRight {
    0% {
        transform: scale(0.2) rotate(-360deg) translateX(-100%);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) rotate(20deg) translateX(10%);
    }
    70% {
        transform: scale(0.95) rotate(-10deg) translateX(30%);
        opacity: 1;
    }
    85% {
        transform: scale(1.02) rotate(5deg) translateX(45%);
    }
    100% {
        transform: scale(1) rotate(0deg) translateX(50%);
    }
}

.screen-blackout {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0);
    opacity: 0;
    z-index: -9998;
    pointer-events: all;
    transition: opacity 500ms ease;
}

.screen-blackout.show {
    opacity: 1;
}

.particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
}

footer {
    background-color:rgb(32, 32, 32);
    color: white;
    text-align: center;
    padding-bottom: 15px;
}

footer h6 {
    font-size: 12px;
    letter-spacing: 8px;
}

footer a {
    margin: 10px;
    margin-bottom: 50px;
    color: white;
}

.carousel-container {
    position: relative;
    width: 100%;
    margin: auto;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    will-change: transform;
    width: max-content;
    touch-action: pan-y; /* 允許水平滑動 */
}

[data-carousel] {
    overflow: hidden;
    position: relative;
}

.carousel-track img {
    width: 500px;
    height: auto;
    object-fit: cover;
    margin-right: 10px;
    flex-shrink: 0;
    border-radius: 15px;
}

.arrow {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    color: #333;
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease, transform 0.3s ease;
}

.arrow:hover {
    background: #007BFF;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.arrow.left {
    left: 10px;
}

.arrow.right {
    right: 10px;
}

.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    padding: 16px;
}

.gallery-item {
    width: calc(33.333% - 10.66px);
    text-align: center;
}

.gallery-item img {
    width: 100%;
    height: auto;
    border: 5.2px solid #dbdbdb;
    border-radius: 15px;
    transition: transform 0.3s ease, color 0.55s ease;
    box-sizing: border-box;
}

.gallery-item img:hover {
    transform: scale(1.1);
    border: 5.2px solid #b4b4b4;
}

.gallery-item h6 {
    margin-top: 8px;
    font-size: 13px;
    letter-spacing: 7px;
    color: #757575;
}

@media (max-width: 768px) {
    .loading-logo {
        width: 300px;
    }

    .hamburger {
        display: block;
    }

    .navbar {
        justify-content: space-between;
    }

    .nav-links {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        background: #f8f6ef;
        backdrop-filter: blur(10px);
        gap: 1rem;
        display: none;
        flex-direction: column;
        align-items: center;
        padding: 1rem 0;
    }

    .nav-links a {
        font-size: 1rem;
    }

    .overlap-container {
        position: relative;
        margin-top: -25px;
        text-align: center;
        z-index: 1;
    }

    .overlap-image {
        width: 250px;
        max-width: 90%;
        animation: sway 2.1s ease-in-out infinite;
    }

    @keyframes sway {
        0% { transform: rotate(-4.2deg); }
        50% { transform: rotate(4.2deg); }
        100% { transform: rotate(-4.2deg); }
    }


    body.change-mode .nav-links {
        background: #ffffff;
    }

    .nav-links.active {
        display: flex;
    }

    body {
        padding-top: 75px;
    }

    h1 {
        color: #000000;
        letter-spacing: 9px;
        font-size: 2.3em;
        font-weight: 1000;
    }
    p {
        color: #6f6f6f;
        font-weight: 700;
        line-height: 30px;
    }

    .big-title-blue {
        color: rgb(0, 110, 169);
        font-size: 1.3em;
    }
    .big-title-red {
        color: rgb(188, 14, 14);
        font-size: 1.3em;
    }

    .typewriter {
        min-height: 20em;
    }

    .floating-image-container {
        position: relative;
        overflow: none;
        height: 130px;
    }

    .floating-image-left {
        max-width: 200px;
    }
    .floating-image-left.visible {
        animation: JumpInRight 2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
        opacity: 1;
    }

    @keyframes JumpInRight {
        0% {
            transform: scale(0.2) rotate(360deg) translateX(-100%);
            opacity: 0;
        }
        50% {
            transform: scale(1.05) rotate(-20deg) translateX(-15%);
        }
        70% {
            transform: scale(0.95) rotate(10deg) translateX(5%);
            opacity: 1;
        }
        85% {
            transform: scale(1.02) rotate(-5deg) translateX(15%);
        }
        100% {
            transform: scale(1) rotate(0deg) translateX(20%);
        }
    }

    .floating-image-right {
        max-width: 200px;
    }
    .floating-image-right.visible {
        animation: JumpInLeft 2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
        opacity: 1;
    }

    @keyframes JumpInLeft {
        0% {
            transform: scale(0.2) rotate(360deg) translateX(100%);
            opacity: 0;
        }
        50% {
            transform: scale(1.05) rotate(-20deg) translateX(15%);
        }
        70% {
            transform: scale(0.95) rotate(10deg) translateX(-5%);
            opacity: 1;
        }
        85% {
            transform: scale(1.02) rotate(-5deg) translateX(-15%);
        }
        100% {
            transform: scale(1) rotate(0deg) translateX(-20%);
        }
    }

    section {
        padding: 15px;
        padding-top: 0;
    }

    section h1.visible::after {
        width: 300px;
    }

    .carousel-track img {
        width: 250px;
    }

    .gallery {
        padding: 0px;
    }

    .gallery-item {
        width: 100%;
    }

    .gallery-item img {
        border: 5px solid #dbdbdb;
    }

    .gallery-item h6 {
        margin-top: 8px;
        font-size: 14px;
        color: #757575;
    }

    footer h6 {
        font-size: 11px;
        letter-spacing: 3px;
    }
}