/* Remove container bottom margin; keep footer a small breathing gap */
body > .container { margin-bottom: 0 !important; }
footer { margin-top: 1.5rem !important; }

/* 以下為首頁專用。插圖色票與 static/images/home/*.svg 一致：
   深藍 #1a3260、淺藍 #dbe8f6、暖黃 #f6c344（原本的品牌亮藍已全站改為深藍） */
.hp-band {
    --hp-yellow: #f6c344;
    --hp-cream: #fdf8ec;
    --hp-sky: #e9f0f9;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    color: var(--color-text);
}

.hp-wrap {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 var(--content-gutter);
}

/* ── 共用文字 ─────────────────────────────── */
.hp-title {
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.35rem);
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: 0.02em;
    color: var(--color-primary);
    text-align: center;
}

.hp-title--left { text-align: left; }

/* 避免中文段落最後一行只剩一兩個字 */
.hp-title, .hp-lead, .hp-step p, .hp-quote, .hp-cta-title { text-wrap: balance; }

/* 標題中的數字：黃字深藍描邊，參考 juji.tw 的「3 大特色」 */
.hp-num {
    display: inline-block;
    margin: 0 0.12em;
    font-size: 1.45em;
    line-height: 1;
    font-weight: 900;
    color: var(--hp-yellow);
    -webkit-text-stroke: 2px var(--color-primary);
    paint-order: stroke fill;
    transform: translateY(0.06em);
}

.hp-lead {
    max-width: 34em;
    margin: 0.9rem auto 0;
    color: var(--color-muted);
    font-size: 1rem;
    line-height: 1.85;
    text-align: center;
}

.hp-link {
    display: inline-flex;
    gap: 0.4rem;
    color: var(--color-accent);
    font-weight: 700;
    text-decoration: none;
}

.hp-link:hover span { transform: translateX(3px); }
.hp-link span { transition: transform 0.2s; }

/* ── HERO ─────────────────────────────────── */
.hp-hero {
    margin-top: -1.4rem; /* 抵銷 .container 上方留白，貼齊導覽列 */
    background: var(--hp-cream);
    padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 5rem);
    /* 底部一道緩弧，接下方白色數字帶 */
    clip-path: ellipse(120% 100% at 50% 0);
    position: relative;
    z-index: 1;
}

.hp-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: center;
}

.hp-hero-kicker {
    display: inline-block;
    margin-bottom: 1.1rem;
    padding: 0.3rem 0.9rem;
    border: 1.5px solid var(--color-primary);
    border-radius: 999px;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.hp-hero-title {
    font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.6rem);
    font-weight: 900;
    line-height: 1.28;
    letter-spacing: 0.03em;
    color: var(--color-primary);
}

/* 螢光筆底線，只畫在字的下半部 */
.hp-hero-title mark,
.hp-quote strong {
    background: linear-gradient(transparent 58%, var(--hp-yellow) 58%, var(--hp-yellow) 90%, transparent 90%);
    color: inherit;
    padding: 0 0.08em;
}

.hp-hero-sub {
    max-width: 26em;
    margin: 1.3rem 0 2rem;
    color: #3d4a63;
    font-size: 1.08rem;
    line-height: 1.9;
}

.hp-hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hp-hero-art {
    width: 100%;
    height: auto;
}

/* ── STATS ────────────────────────────────── */
/* 首頁內容區一律白底，蓋過 body 的淺灰 */
.hp-stats-band, .hp-steps, .hp-intro, .hp-news, .hp-depts { background: #fff; }

/* 白色數字帶墊在 hero 弧線底下，弧線兩側才不會露出灰底 */
.hp-stats-band {
    margin-top: -80px;
    padding: calc(80px + 1.5rem) 0 1rem;
}

.hp-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.hp-stat {
    padding: 1.4rem 1rem;
    background: #fff;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.hp-stat--hl { background: var(--hp-yellow); border-color: var(--hp-yellow); }

.hp-stat dt {
    color: var(--color-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.hp-stat--hl dt,
.hp-stat--hl p { color: var(--color-primary); }

.hp-stat dd {
    margin: 0.2rem 0 0;
    color: var(--color-primary);
    font-size: clamp(2.2rem, 1.6rem + 2vw, 3rem);
    font-weight: 900;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.hp-stat dd small {
    margin-left: 0.15em;
    font-size: 0.4em;
    font-weight: 700;
}

.hp-stat p {
    margin-top: 0.2rem;
    font-size: 0.78rem;
}

/* ── STEPS ────────────────────────────────── */
.hp-steps { padding: clamp(3.5rem, 8vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4rem); }

.hp-step-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    padding: 0;
    list-style: none;
    position: relative;
}

/* 三步驟之間的虛線 */
.hp-step-list::before {
    content: "";
    position: absolute;
    top: 60px;
    left: 16%;
    right: 16%;
    border-top: 2.5px dashed #c5d3e6;
}

.hp-step {
    position: relative;
    text-align: center;
}

.hp-step img {
    position: relative;
    width: 160px;
    height: auto;
    background: #fff;
}

/* 插圖左上角的步驟編號 */
.hp-step-no {
    position: absolute;
    top: -0.5rem;
    left: calc(50% - 88px);
    width: 2.2rem;
    height: 2.2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--hp-yellow);
    font-size: 1.05rem;
    font-weight: 900;
    z-index: 1;
}

.hp-step h3 {
    margin-top: 1rem;
    color: var(--color-primary);
    font-size: 1.25rem;
    font-weight: 700;
}

.hp-step p {
    max-width: 17em;
    margin: 0.5rem auto 0;
    color: var(--color-muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

/* ── INTRO ────────────────────────────────── */
.hp-intro { padding: clamp(2.5rem, 6vw, 4rem) 0; }

.hp-intro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}

.hp-intro-photo {
    margin: 0;
    position: relative;
}

.hp-intro-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: 40% 50%;
    border-radius: 24px;
}

/* 照片後方錯位的黃色色塊 */
.hp-intro-photo::before {
    content: "";
    position: absolute;
    inset: 18px -18px -18px 18px;
    background: var(--hp-yellow);
    border-radius: 24px;
    z-index: -1;
}

.hp-intro-body p {
    margin-top: 1rem;
    color: #3d4a63;
    line-height: 1.95;
}

.hp-intro-body .hp-title { margin-bottom: 0.4rem; }
.hp-intro-body .hp-link { margin-top: 1.4rem; }

/* ── NEWS ─────────────────────────────────── */
.hp-news { padding: 1rem 0 clamp(2rem, 5vw, 3rem); }

.hp-news-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.hp-news-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0.25rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
}

.hp-news-item:hover .hp-news-title { color: var(--color-hover); }

.hp-news-date {
    color: var(--color-muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.hp-news-cat {
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background: var(--hp-sky);
    color: var(--color-accent);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.hp-news-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── WHY ──────────────────────────────────── */
.hp-why {
    background: var(--hp-sky);
    padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}

.hp-why-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 2.75rem;
}

.hp-why-card {
    padding: 1.5rem 1.4rem 1.75rem;
    background: #fff;
    border-radius: 20px;
}

.hp-why-card img {
    display: block;
    width: 120px;
    height: auto;
    margin: 0 auto 0.75rem;
}

.hp-why-card h3 {
    color: var(--color-primary);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

.hp-why-card p {
    margin-top: 0.6rem;
    color: var(--color-muted);
    font-size: 0.92rem;
    line-height: 1.8;
}

/* 外框圓角盒，參考 juji.tw 的提示框 */
.hp-quote {
    margin: 2.5rem 0 0;
    padding: 1.5rem 2rem;
    border: 2px solid var(--color-primary);
    border-radius: 20px;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem 1.5rem;
    text-align: center;
}

.hp-quote p {
    color: var(--color-primary);
    font-size: clamp(1.1rem, 0.9rem + 0.8vw, 1.4rem);
    font-weight: 900;
    letter-spacing: 0.02em;
}

.hp-quote span {
    padding-left: 1.5rem;
    border-left: 2px solid var(--color-primary);
    color: #3d4a63;
}

/* ── DEPARTMENTS ──────────────────────────── */
.hp-depts { padding: clamp(3.5rem, 8vw, 5.5rem) 0 clamp(2rem, 5vw, 3rem); }

.hp-dept-list {
    margin: 2.75rem 0 0;
    padding: 0;
    list-style: none;
    border-top: 2px solid var(--color-primary);
}

/* 每個系所是一個 <details>：桌機恆展開、左欄名稱右欄內容；手機版收合成手風琴 */
.hp-dept {
    display: flow-root;
    padding: 1.5rem 0.25rem;
    border-bottom: 1px solid var(--color-border);
}

.hp-dept > summary {
    float: left;
    width: 13rem;
    list-style: none;
    pointer-events: none; /* 桌機不給收合 */
}

.hp-dept > summary::-webkit-details-marker { display: none; }

.hp-dept-body { margin-left: 15rem; }

.hp-dept h3 {
    color: var(--color-primary);
    font-size: 1.15rem;
    font-weight: 900;
}

.hp-dept dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 2rem;
    margin: 0;
}

.hp-dept dt {
    font-weight: 700;
    color: var(--color-text);
}

.hp-dept dt::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 0.5rem;
    border-radius: 50%;
    background: var(--hp-yellow);
    vertical-align: 0.15em;
}

.hp-dept dd {
    margin: 0.25rem 0 0;
    color: var(--color-muted);
    font-size: 0.92rem;
    line-height: 1.7;
}

/* ── CTA ──────────────────────────────────── */
.hp-cta {
    background: var(--color-primary);
    color: #fff;
    padding: clamp(3rem, 7vw, 4.5rem) 0;
    margin-bottom: -2rem; /* 貼齊頁尾 */
}

.hp-cta-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2rem;
    align-items: center;
}

.hp-cta-title {
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.35rem);
    font-weight: 900;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.hp-cta-sub {
    margin: 0.8rem 0 1.75rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.8;
}

.hp-cta-art {
    width: 240px;
    height: auto;
}

/* ── RWD ──────────────────────────────────── */
@media (max-width: 960px) {
    .hp-why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .hp-hero { padding-bottom: 2.5rem; clip-path: ellipse(160% 100% at 50% 0); }
    .hp-hero-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .hp-hero-art { max-width: 300px; margin: 0 auto; }
    .hp-hero-sub { margin: 1rem 0 1.5rem; font-size: 1rem; }
    .hp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
    .hp-stat { padding: 1rem 0.4rem; }
    .hp-stat dt { font-size: 0.8rem; }
    .hp-stat--hl { grid-column: 1 / -1; order: -1; }

    /* 步驟改成左側時間軸：小插圖＋虛線串接，文字靠左 */
    .hp-step-list { grid-template-columns: 1fr; gap: 0; margin-top: 2rem; }
    .hp-step-list::before { display: none; }
    .hp-step {
        display: grid;
        grid-template-columns: 76px minmax(0, 1fr);
        column-gap: 1rem;
        align-content: start;
        padding-bottom: 1.75rem;
        text-align: left;
    }
    .hp-step img { grid-row: 1 / 3; width: 76px; background: none; }
    .hp-step:not(:last-child)::after {
        content: "";
        position: absolute;
        left: 37px;
        top: 66px;
        bottom: 0.5rem;
        border-left: 2.5px dashed #c5d3e6;
    }
    .hp-step-no { top: -0.35rem; left: -0.35rem; width: 1.75rem; height: 1.75rem; font-size: 0.85rem; }
    .hp-step h3 { margin-top: 0.4rem; font-size: 1.1rem; }
    .hp-step p { max-width: none; margin: 0.3rem 0 0; text-wrap: wrap; }

    .hp-intro-grid { grid-template-columns: 1fr; }
    .hp-intro-photo { margin-right: 18px; }

    /* 理由卡改成橫列：插圖在左、文字在右 */
    .hp-why-grid { grid-template-columns: 1fr; gap: 0.75rem; margin-top: 2rem; }
    .hp-why-card {
        display: grid;
        grid-template-columns: 64px minmax(0, 1fr);
        column-gap: 1rem;
        padding: 1.1rem 1.2rem;
        border-radius: 16px;
    }
    .hp-why-card img { grid-row: 1 / 3; width: 64px; margin: 0; }
    .hp-why-card h3 { text-align: left; }
    .hp-why-card p { margin-top: 0.3rem; font-size: 0.9rem; line-height: 1.75; }

    .hp-quote { flex-direction: column; margin-top: 1.5rem; padding: 1.25rem; }
    .hp-quote span { padding-left: 0; border-left: 0; }

    /* 系所清單：手風琴 */
    .hp-dept-list { margin-top: 2rem; }
    .hp-dept { padding: 0; }
    .hp-dept > summary {
        float: none;
        width: auto;
        pointer-events: auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 1.1rem 0.25rem;
        cursor: pointer;
    }
    .hp-dept > summary::after {
        content: "";
        flex: none;
        width: 0.6rem;
        height: 0.6rem;
        border-right: 2.5px solid var(--color-primary);
        border-bottom: 2.5px solid var(--color-primary);
        transform: translateY(-25%) rotate(45deg);
        transition: transform 0.2s;
    }
    .hp-dept[open] > summary::after { transform: translateY(25%) rotate(-135deg); }
    .hp-dept h3 { font-size: 1.08rem; }
    .hp-dept-body { margin: 0; padding: 0 0.25rem 1.25rem; }
    .hp-dept dl { grid-template-columns: 1fr; gap: 0.9rem; }

    .hp-cta-grid { grid-template-columns: 1fr; }
    .hp-cta-art { display: none; }
}

@media (max-width: 520px) {
    .hp-btn { flex: 1 1 auto; justify-content: center; }
}
