@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #e9e9e9; /* 看得清楚粒子 */
    scroll-behavior: smooth;
}

/*背景粒子*/
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}
canvas {
    display: block !important;
    opacity: 1 !important;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: auto;
    width: 45px;
    display: flex;
    overflow-x: hidden;
    flex-direction: column;
    background: #e0e0e0;
    padding: 25px 20px;
    transition: all 0.4s ease;
    transform: translateY(50%);
    z-index: 2;
}
.sidebar:hover {
    width: 150px;
}
.sidebar-links h4 {
    color: #000000;
    font-weight: 500;
    white-space: nowrap;
    margin: 10px 0;
    position: relative;
}
.sidebar-link.active {
    background: rgba(0, 255, 255, 0.15);
    color: #00ffff;
    border-left: 4px solid #00ffff;
}
.sidebar-link.active span {
    color: #00ffff;
}
ul {
    padding-inline-start: 0;
}
.sidebar-links h4 span {
    opacity: 0;
}
.sidebar:hover .sidebar-links h4 span {
    opacity: 1;
}
.sidebar-links .menu-separator {
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    transform: scaleX(1);
    transform: translateY(-50%);
    background: #4f52ba;
    transform-origin: right;
    transition-delay: 0.2s;
}
.sidebar:hover .sidebar-links .menu-separator {
    transition-delay: 0s;
    transform: scaleX(0);
    width: 100px;
}
.sidebar-links {
    list-style: none;
    margin-top: 20px;
    height: 80%;
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar-links::-webkit-scrollbar {
    display: none;
}
.sidebar-links li a {
    display: flex;
    align-items: center;
    gap: 0 20px;
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
    padding: 15px 10px;
    text-decoration: none;
    transition: 0.2s ease;
}
.sidebar-links li a:hover {
    color: #161a2d;
    background: #fff;
    border-radius: 4px;
}
.container{
    width: 75%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background:color-mix(in srgb, var(--clb-color-black) 20%, transparent);
    padding: 0 25px;
}
/*標頭*/
header {
    width: 100%;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.container-up {
    width: 100%;
    height: 100%;
    display: block;
    justify-content: space-between;
    background:color-mix(in srgb, var(--clb-color-black) 20%, transparent);
    align-items: center;
}
.container-head {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    background:color-mix(in srgb, var(--clb-color-black) 20%, transparent);
    align-items: center;
}
.stage {
    height:auto;
    display: flex;
    flex-direction: column; /* 垂直排列 */
    align-items: center;     /* 水平置中 */
    text-align: center;
}
.stage time {
    font-size: 3.5rem;
    font-weight: 500;
    color: #ff6435;
    font-family: 'DM Serif Text', serif;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}
.Cyber {
    width: 100%;           /* 父容器寬度固定 */
    position: relative;
    display: inline-block;
    white-space: nowrap;
    text-align: center;    /* 文字水平置中 */
    font-size: 30px;
    animation: marquee 10s linear infinite;
}
.Cyber h2{
    display: flex;
    color:transparent ;
    justify-content: center;
    align-self: center;
    height: 25px;
    font-size: 40px;
    margin: 0%;
}
.Cyber h2 span {
    font-weight: bold;
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    animation: LetterAppear 3s linear infinite, LetterColor 3s linear infinite;
    animation-delay: calc(0.1s * var(--o));
}
@keyframes LetterColor {
    0%, 20% { color: black; }
    50% { color: #ff6435; }
    100% { color: black; }
}
/* 逐字彈跳 + 淡入 */
@keyframes LetterAppear {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(5px);
    }
    70% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(20px);
    }
}
@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.logo{
    align-self: flex-end;
    font-weight: bold;
    font-size: 30px;
    align-items: center;
}
.logo img{
    height:45px;
    width: auto;
    justify-content: center;
}
.container-title{
    font-family: Roboto, sans-serif;
    display:block ;
    z-index: 3;
    margin-top: 5%;
}
.webname{
    font-size: 20px;
    font-weight: 500;
    font-style: normal;
    text-align: center;
    color:#ff6435;
}
.slogan{
    font-size: 40px;
    font-weight: 650;
    font-style: normal;
    text-align: center;
    margin-top:0.5%;
    color:rgb(68, 68, 68);
}
.title-gif {
    width: 18px;/* 根據需求調整大小 */
    height: auto;
    vertical-align: middle;
    margin-bottom: 5px;
}
nav{
    font-family: "DM Serif Text", serif;
    display: flex;
    gap: 15px;
    z-index: 3;
}
.navitem{
    display: flex;
    align-items: center;
    font-weight: bold;
}
.navitem a{
    display: flex;
    flex-direction: column;
    align-items: center;
}
.navitem__text {
    font-size: 18px;
    text-decoration: none;
    color: rgb(91, 91, 91);
    font-weight: 100;
    transition: color 0.3s ease; /* 平滑變色動畫 */
}
.navitem__text:hover {
    color: #000000f0; /* 滑過時變藍色，可改其他顏色 */
}
.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 100%;
    min-width: 150px;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    text-align: center;/* 文字也置中 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 1); /* 半透明白色 */
    z-index: 3;
}
.submenu a {
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}
.submenu.show{
    display: flex;
}
.submenu a:first-child {
    border-left: none;
}
.submenu a:hover {
    background: rgba(255, 255, 255, 0.75); /* 半透明白色 */
}
.submenu--right {
    min-width: 100%;
    left: 0;       /* 從最左邊展開 */
    top: 45px;     /* 跟 header 高度對齊 */
}
.submenu .back-button {
    display: none !important;
}
/* 漢堡選單按鈕 - 手機版用 */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    width: 25px;
    justify-content: space-between;
    right: 20px;
}
.hamburger div {
    height: 3px;
    border-radius: 2px;
    margin: 4px 0; /* 通常會有間距讓三條線分開 */
    background-color: #ffffff;  /* 一定要有背景色，才看得到 */
    transition: all 0.3s ease;
}
/* 淡出動畫 */
#figma-preview {
    transition: opacity 1s ease;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: white;
    z-index: 9999;
}
#figma-preview.fade-out {
    opacity: 0;
    pointer-events: none;
}

.container-mid{
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    width: 100%;
    background: rgba(255, 255, 255, 0.75); /* 半透明白色 */
}
/* 卡片主體 */
.card {
    position: relative;
    width: 100%;
    max-width: 390px;
    height: 10rem;
    overflow: hidden;
    border-radius: 0.5rem;
    margin-top: 15px;
    margin-bottom: 5px;
    margin-right: 15px;
    margin-left: 15px;
    box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease-in-out;
}
/* 背景漸層遮罩 */
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.7) 90%);
    z-index: 0;
    pointer-events: none;
}
/* 點擊整個卡片 */
.card .link {
    position: absolute;
    inset: 0;
    z-index: 1;
}
/* 通用圖片樣式 */
.card .img {
    position: absolute;     /* 確保疊在一起 */
    inset: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 1s ease;
}
/* 預設圖 */
.card .img-default {
    opacity: 1;
    z-index: 1;
}
/* 滑過才顯示的圖 */
.card .img-hover {
    opacity: 0;
    z-index: 2;
}
/* 滑過效果 */
.card:hover .img-default {
    opacity: 0;
    }
.card:hover .img-hover {
    opacity: 1;
}
/* 卡片資訊 */
.card .info {
    position: absolute;
    bottom: 0;
    padding: 1rem;
    color: white;
    z-index: 2;
    background-color: transparent;
    transition: background-color 1s ease;
}

.card .title {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    transition: color 0.8s ease;
}
.card .date {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    color: white;
}
.card .detail {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 1.5s ease, opacity 1s ease;
}
/* hover 效果僅在大螢幕啟用 */
@media screen and (min-width: 900px) {
    .card {
        height: 20rem;
    }
    .card:hover .img {
        transform: scale(1.2);
        z-index: -1;
    }
    .card:hover .info {
        background-color: rgba(0, 0, 0, 0.6);
    }
    .card:hover .title {
        color: yellow;
    }

    .card:hover .detail {
        max-height: 20rem;
        opacity: 1;
    }
}
/* 手機版樣式 */
@media (max-width: 768px) {
    #particles-js { pointer-events: none; }
    header {
        justify-content: space-between; /* 左右分散 */
    }
    .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    .logo img {
        height: 35px; /* logo 縮小 */
    }
    .container {
        width: 100%;
        justify-content: space-between;
    }
    nav {
        position: fixed;
        top: 45px;
        left: 0;
        width: 100%;
        flex-direction: column;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        background-color: rgba(255, 255, 255);
        text-align: center;
        justify-content: center;
        align-items: center;
    }
    nav.open {
        transform: translateX(0);
    }
    .hamburger {
        display: flex;
        position: relative;
        z-index: 9999; /* 確保高於 nav */
    }
    .submenu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.95);
        transform: translateX(100vw);
        transition: transform 0.3s ease;
    }
    .submenu.show {
        transform: translateX(0);
    }
    .submenu .back-button {
        display: block !important;
        font-weight: bold;
        color: #555;
        align-self: flex-start; /* 靠左放（可改 center） */
    }
    .webname{
        font-size: 15px;
        font-weight: 500;
        font-style: normal;
        text-align: center;
        color:#ff6435;
    }
    .slogan{
        font-size: 30px;
        font-weight: 650;
        font-style: normal;
        text-align: center;
        margin-top:0.5%;
        color:rgb(68, 68, 68);
    }
    .sidebar {
        display: none;
    }
    .stage {
        transform: scale(0.8);
    }

    .card {
        height: auto;
        max-height: none;
        overflow: hidden;
        margin: 10px 15px;
    }
    .card .img-default {
        transform: scale(1);
    }
    .card .info {
        position: relative;
        background-color: rgba(0,0,0,0.6);
        padding: 0.8rem;
        color: #fff;
    }
    .card .title,
    .card .date,
    .card .detail {
        white-space: normal;
    }
    .card .detail {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.5s ease;
    }
    .card .detail.show {
        max-height: 500px; /* 展開後可看到所有文字 */
    }
    .card .toggle-detail {
        display: block;
        margin-top: 5px;
        padding: 5px 10px;
        background: #ff6435;
        color: #fff;
        border: none;
        border-radius: 4px;
        font-size: 0.9rem;
        cursor: pointer;
    }
    .Cyber {
        display: none; /* 手機完全不顯示 */
    }
}
@media (max-width: 1024px) {
    .Researcher-infocard1,
    .Researcher-infocard2,
    .Researcher-infocard3,
    .Researcher-infocard4 {
        flex: 0 0 50%; /* 平板變成兩欄 */
    }
}
@media (max-width: 600px) {
    .Researcher-infocard1,
    .Researcher-infocard2,
    .Researcher-infocard3,
    .Researcher-infocard4 {
        flex: 0 0 100%; /* 手機變成單欄 */
    }
}
@media (min-width: 1920px) {
    .card{
        max-width: 445px;
        justify-content: space-around;
  }
}
