/* 使用深水系配色與細節設計 */
/* ===== RESET ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    scrollbar-width: none;
    scroll-snap-type: y mandatory;
}

html::-webkit-scrollbar {
    display: none;
}

img {
    max-width: 100%;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

:root {
    --deep-blue: #0b1d2e;    /* 深邃靛藍底色 */
    --foggy-white: #e0e0e0;  /* 柔和霧白文字 */
    --faint-gold: #c5a059;   /* 淡金點綴 */
    --line-green: #06C755;   /* Line顏色 */
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--deep-blue);
    color: var(--foggy-white);
    font-family: "Serif", "細明體", serif;
    height: auto;
    overflow-x: hidden;
    overflow-y: scroll;
    max-width: 1440px;
    margin: 0 auto;
}

.about-section,
main {
    animation: pageFadeIn 2s ease forwards;
}

@keyframes pageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 全頁固定背景層，由 bg-scroll.js 控制 */
#bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: -2;
    background: var(--deep-blue);
    transition: background 0.15s linear; /* 平滑緩衝，防止跳動 */
    will-change: background;
}

/* 浮動發光粒子畫布，疊在背景色之上、內容之下 */
#bg-particles {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* --- Navbar 導覽列整體樣式 --- */
.main-nav {
    box-sizing: border-box; /* ← 加這行，讓 padding 計算在 width 內，不再溢出 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0.5rem 10%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.8s ease, background 0.5s ease;
    pointer-events: none;
}

/* 滾動觸發後的顯示狀態 */
.main-nav.visible {
    opacity: 1;
    pointer-events: auto;
    background: rgba(11, 29, 46, 0.85); /* 深水系霧面底色 */
    backdrop-filter: blur(8px); /* 輕微模糊，增加沈澱質感 */
}

.nav-links a.active {
    color: var(--faint-gold);
    opacity: 1;
    background: rgba(197, 160, 89, 0.08);
    padding: 2px 4px;
    border-radius: 2px;
    transform: scale(1.05);
    display: inline-block;
    box-shadow: 0 0 12px rgba(197, 160, 89, 0.15);
}

/* --- 手機版漢堡開關，桌面版預設隱藏 --- */
.navbar-toggle {
    display: none;
}

/* --- Logo 區域 --- */
.logo {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    color: var(--foggy-white);
    cursor: pointer;
}

/* --- 四個項目並排的連結區域 --- */
.nav-links {
    display: flex;
    gap: 4rem; /* 保持項目間距的優雅 */
    justify-content: flex-end; /* 確保四個項目整體靠右對齊 */
}

.nav-links a {
    color: var(--foggy-white);
    text-decoration: none;
    font-size: 1rem;
    letter-spacing: 0.25em; /* 寬字距營造空靈感 */
    text-transform: uppercase; /* 可選，若想更現代可保留 */
    transition: color 0.4s ease, opacity 0.4s ease;
    opacity: 0.8; /* 連結稍微低調，不搶奪視覺重心 */
}

.nav-links a:hover {
    color: var(--faint-gold); /* 懸停時溫柔呈現金色微光 */
    opacity: 1;
}

.hero {
    height: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    letter-spacing: 0.2em;
    scroll-snap-align: start;
}

.title {
    font-size: 3rem;
    font-weight: 200;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    animation: heroFadeIn 1.5s ease-out forwards;
}

.cta-button {
    display: inline-block;
    margin-top: 2rem;
    padding: 10px 30px;
    border: 1px solid var(--faint-gold);
    color: var(--faint-gold);
    text-decoration: none;
    transition: 0.5s;
}

.cta-button:hover {
    background-color: var(--faint-gold);
    color: var(--deep-blue);
}

.narrative-section {
    height: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    line-height: 2;
    font-size: 1.2rem;
    padding: 60px 10%;
    scroll-snap-align: start;
}

.narrative-section p {
    margin-bottom: 3rem; /* 段落間的距離，創造慢節奏 */
}

/* 文字浮現動畫：初始隱藏，進入視窗後淡入並上浮 */
.reveal-text {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 7s ease, transform 1.2s ease;
}

.reveal-text.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.teacher-preview {
    height: 100dvh;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5rem;
    padding: 60px 10%;
    color: var(--foggy-white);
    scroll-snap-align: start;
}

.teacher-image-placeholder {
    width: 300px;
    height: 400px;
    background-color: #1a2e42; /* 比底色稍微亮一點的深藍 */
    border: 1px solid var(--faint-gold); /* 淡金邊框，增加精緻感 */
}

.teacher-image {
    width: 350px;
}

.teacher-intro h2 {
    font-size: 2rem;
    font-weight: 200;
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
}

.teacher-intro p {
    line-height: 1.8;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    opacity: 0.8;
}

/* 逐字從右側飄入的打字機效果 */
.char-reveal .char-unit {
    display: inline-block;
    opacity: 0;
    transform: translateX(14px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    white-space: pre; /* 保留空白字元的寬度 */
}

.char-reveal .char-unit.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* 空白字元（縮排、換行用）：保留排版寬度，不參與飄入動畫，立即可見 */
.char-reveal .char-space {
    display: inline-block;
    white-space: pre;
}

/* h2 套用 char-reveal 時沿用原本的 opacity，避免文字本身過於透明前後不一致 */
.teacher-intro h2.char-reveal .char-unit.is-visible {
    opacity: 1;
}

.more-link {
    color: var(--faint-gold);
    text-decoration: none;
    border-bottom: 1px solid var(--faint-gold);
    padding-bottom: 2px;
    transition: 0.3s;
}

.more-link:hover {
    opacity: 0.6;
}

.services-section {
    height: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 10%;
    text-align: center;
    scroll-snap-align: start;
}

.section-title {
    font-weight: 200;
    margin-bottom: 4rem;
    letter-spacing: 0.2em;
    opacity: 0.9;
}

.services-container {
    display: flex;
    justify-content: center;
    gap: 2rem; /* 保持大留白 */
}

.service-card {
    padding: 4rem 2rem;
    flex: 1;
    transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1); /* 更細膩的緩動 */
    background: rgba(255, 255, 255, 0.02); /* 極輕微的背景質感 */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    letter-spacing: 0.3em;
    color: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid var(--faint-gold);
    border-left: none;
    border-right: none;
    transition: transform 0.9s ease, box-shadow 0.8s ease;
}

.service-card:hover {
    box-shadow: 0 0 30px rgba(197, 160, 89, 0.15); /* 輕柔擴散的光暈 */
    background: rgba(197, 160, 89, 0.05); /* 更低調的 hover 背景 */
    transform: translateY(-10px);
    transition: transform 0.8s ease, box-shadow 0.8s ease;
}

.service-card h3 {
    font-weight: 200;
    margin-bottom: 1.5rem;
    letter-spacing: 0.1em;
}

.service-card p {
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    opacity: 0.8;
}

.service-link {
    color: var(--faint-gold);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--faint-gold);
}

.service-link::after {
    content: " ↗"; /* 增加指向性符號 */
    font-size: 0.8rem;
}

/* 服務卡片滑動提示點點：桌機版不需要，預設隱藏 */
.services-dots {
    display: none;
}

.testimonials-section {
    height: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 10%;
    text-align: center;
    color: var(--foggy-white);
    scroll-snap-align: start;
}

.carousel-container {
    position: relative;
    height: 300px; /* 固定高度以維持穩定感 */
    max-width: 800px;
    margin: 0 auto;
    width: 100%; 
    margin-top: 30px;
}

.testimonial-slide {
    position: absolute;
    width: 100%;
    opacity: 0;
    transition: opacity 1.5s ease; /* 慢節奏的淡入淡出 */
}

.testimonial-slide.active {
    opacity: 1;
}

.testimonial-slide p {
    font-size: 1.4rem;
    line-height: 2.4; /* 極高的行距，增加閱讀的沈澱感 */
    letter-spacing: 0.15em;
    font-weight: 200;
}

.testimonial-slide cite {
    display: block;
    margin-top: 3rem;
    font-size: 0.9rem;
    opacity: 0.5;
    letter-spacing: 0.25em;
}

.carousel-dots {
    margin-top: 2rem;
}

.dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--foggy-white);
    border-radius: 50%;
    margin: 0 10px;
    opacity: 0.2;
    cursor: pointer;
    transition: 0.3s;
}

.dot.active {
    opacity: 0.8;
    background: var(--faint-gold);
}

.cta-section {
    height: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 50px 10%;
    text-align: center;
    color: var(--foggy-white);
    scroll-snap-align: start;
    position: relative; /* 讓 footer-section 相對它定位 */
}

.cta-section h2 {
    font-weight: 200;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
}

.cta-section p {
    font-size: 1.1rem;
    margin-bottom: 4rem;
    opacity: 0.7;
}

.cta-button {
    display: inline-block;
    padding: 1rem 3rem;
    border: 1px solid var(--faint-gold);
    color: var(--faint-gold);
    text-decoration: none;
    letter-spacing: 0.2em;
    transition: all 0.5s ease;
    align-self: center;
}

.cta-button:hover {
    background: var(--faint-gold);
    color: #0b1d2e; /* 恢復背景色 */
    transform: scale(1.05);
}

.hero {
    position: relative;
}

#heroCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.title, .subtitle {
    position: relative;
    z-index: 1;
}

/* =========================================
   手機版 RWD（斷點 768px，每個 section 佔滿一頁、字體同比例放大）
   ========================================= */
@media (max-width: 768px) {

    html {
        scroll-snap-type: y proximity;
        /* 或直接 scroll-snap-type: none; */
    }

    /* --- Nav 導覽列 --- */
    .main-nav {
        padding: 0.6rem 6%;
    }

    .logo {
        font-size: 1.6rem;
        letter-spacing: 0.2em;
    }

    /* --- 漢堡開關按鈕 --- */
    .navbar-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 24px;
        height: 18px;
        cursor: pointer;
        z-index: 1001;
    }

    .navbar-toggle span {
        display: block;
        width: 100%;
        height: 1px;
        background: var(--faint-gold);
        opacity: 0.85;
        transition: transform 0.35s ease, opacity 0.35s ease;
    }

    .navbar-toggle.open span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    .navbar-toggle.open span:nth-child(2) {
        opacity: 0;
    }
    .navbar-toggle.open span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    /* --- nav-links 從橫排改成右側滑出面板 --- */
    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        height: 50vh;
        width: 100%;
        max-width: 100%;
        flex-direction: column;
        justify-content: center;
        align-items: flex-end;
        gap: 2.2rem;
        padding: 2rem 2rem 2rem;
        background: rgba(11, 29, 46, 0.95);
        backdrop-filter: blur(10px);
        border-left: 1px solid rgba(197, 160, 89, 0.15);
        transform: translateX(100%);
        transition: transform 0.45s ease;
        z-index: 1000;
    }

    .nav-links.open {
        transform: translateX(0);
        align-items: center;
    }

    .nav-links a {
        font-size: 0.95rem;
        letter-spacing: 0.15em;
    }

    /* --- Hero 區（本來就是 100vh，維持一頁） --- */
    .title {
        font-size: 2rem;
    }

    .hero .subtitle {
        font-size: 1rem;
        letter-spacing: 0.15em;
    }

    .spacer {
        height: 10vh;
    }

    /* --- Narrative 文字區 --- */
    .narrative-section {
        max-width: 100%;
        padding: 60px 8%;
        font-size: 1.2rem;
    }

    .narrative-section p {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        margin-bottom: 2.5rem;
    }

    /* --- Teacher Preview 區 --- */
    .teacher-preview {
        flex-direction: column;
        gap: 1.3rem;
        padding: 60px 8%;
    }

    .teacher-image-placeholder {
        width: 40%;
        max-width: 320px;
        height: 220px;
    }

    .teacher-image {
        width: 270px;
    }

    .teacher-intro {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        text-align: center;
    }

    .teacher-intro h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .teacher-intro p {
        font-size: 1rem;
        line-height: 1.9;
        margin-bottom: 1.5rem;
    }

    /* --- Services 服務卡片區 --- */
    .services-section {
        padding: 60px 6%;
    }

    .section-title {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
    }

    .services-container {
        width: 100%;
        min-width: 0;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-left: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox 隱藏捲軸 */
        justify-content: flex-start;
    }

    .services-container::-webkit-scrollbar {
        display: none; /* Chrome/Safari 隱藏捲軸 */
    }

    .service-card {
        flex: 0 0 100%;
        width: 100%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        box-sizing: border-box;
        padding: 1rem 8%;
        background: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        box-shadow: none;
        transform: none;
        text-align: center;
    }

    .service-card:hover {
        background: none;
        box-shadow: none;
        transform: none;
    }

    .service-card h3 {
        font-size: 1.2rem;
    }

    .service-card p {
        font-size: 1rem;
        line-height: 1.8;
    }

    .service-link {
        font-size: 1.1rem;
    }

    /* 服務卡片橫滑提示點點：手機版顯示，沿用既有 .dot 樣式 */
    .services-dots {
        display: block;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        margin-top: 2rem;
        text-align: center;
    }

    /* --- Testimonials 迴響輪播區 --- */
    .testimonials-section {
        padding: 60px 6%;
    }

    .carousel-container {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        height: 250px; /* 字級放大後行數變多，加高避免裁切 */
    }

    .testimonial-slide p {
        font-size: 1.3rem;
        line-height: 2;
        letter-spacing: 0.05em;
    }

    .testimonial-slide cite {
        margin-top: 2rem;
        font-size: 1.1rem;
    }

    /* --- CTA 結尾區 --- */
    .cta-section {
        padding: 60px 8%;
        
    }

    .cta-section h2 {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        font-size: 1.4rem;
        margin-bottom: 1.8rem;
    }

    .cta-section p {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        font-size: 1.2rem;
        margin-bottom: 3rem;
        letter-spacing: 2px;
    }

    .cta-button {
        padding: 1rem 1rem;
        font-size: 1rem;
    }
}

/* about.html 的專屬微調，放在 main.css 最下方 */
.about-page-container {
    padding-top: 150px; /* 避開導覽列的距離 */
    max-width: 800px;   /* 讓閱讀體驗更舒適 */
    margin: 0 auto;
    padding-left: 5%;
    padding-right: 5%;
}

.about-page-container h2 {
    color: var(--faint-gold);
    font-weight: 200;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

.about-page-container p {
    font-size: 1.1rem;
    line-height: 2;
    opacity: 0.8;
    margin-bottom: 2rem;
}

.footer-section {
    position: absolute;
    bottom: 24px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    text-align: center;
    margin-bottom: 0;
}

.footer-section p {
    margin:0.5rem 0;
    color: var(--foggy-white)
}

.mobile-break {
    display: none;
}

@media (max-width: 767px) {
    .footer-section p {
        font-size: 1rem;;
    }

    .mobile-break {
        display: none;
    }
}