/* ============================================================
   layout-branch.css — 分會子站 Layout
   調性：社團 / 品牌、敘事感、活動影像主導
   特色：full-width hero、單欄敘事流、結盟會 logo 牆、活動相簿
   ============================================================ */

/* ─── Sticky Header（與協調長對比：分會走 transparent on scroll）── */
.branch-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--c-surface);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--c-line);
    padding: 16px 0;
}
.branch-header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}
.branch-header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.branch-header__logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
    border-radius: var(--r-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-on-primary);
    font-family: var(--f-accent);
    font-weight: 700;
    font-size: 20px;
}
.branch-header__names { min-width: 0; }
.branch-header__name {
    font-family: var(--f-display);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
    color: var(--c-text);
}
/* 英文會名：第二排、字較小、與中文會名同色（僅以大小分主次） */
.branch-header__enname {
    font-family: var(--f-accent);
    font-size: 13px;
    font-weight: 400;
    color: var(--c-text);
    letter-spacing: 0.02em;
    line-height: 1.2;
    margin-top: 2px;
}
.branch-header__nav { display: flex; gap: 4px; }
.branch-header__nav a {
    padding: 10px 16px;
    border-radius: var(--r-pill);
    color: var(--c-text);
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
}
.branch-header__nav a:hover { background: var(--c-surface-alt); color: var(--c-primary); }
/* active 底色橢圓維持 --c-primary；字色改用 footer 的白字系（不用 --c-on-primary 深墨字）*/
.branch-header__nav a.active { background: var(--c-primary); color: #fff; }
.branch-header__social {
    display: flex;
    gap: 8px;
}
.branch-header__social a {
    width: 36px;
    height: 36px;
    background: var(--c-surface-alt);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-primary);
    transition: all .2s;
}
.branch-header__social a:hover { background: var(--c-primary); color: var(--c-on-primary); transform: translateY(-2px); }

/* 漢堡按鈕：桌機隱藏，手機（@media ≤768）才顯示 */
.branch-header__burger { display: none; }

/* ─── Full-width Hero ─────────────────────────────────── */
.branch-hero {
    position: relative;
    min-height: 600px;
    color: #fff;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    isolation: isolate;
}
.branch-hero__bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
    z-index: -2;
}
.branch-hero__bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, var(--c-accent) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, var(--c-primary-light) 0%, transparent 50%);
    opacity: 0.4;
    mix-blend-mode: screen;
}
.branch-hero__overlay {
    position: absolute;
    inset: 0;
    background: var(--hero-overlay);
    z-index: -1;
}
.branch-hero__container {
    padding: 120px 24px 80px;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 48px;
    align-items: end;
}
.branch-hero__eyebrow {
    font-family: var(--f-accent);
    letter-spacing: 0.3em;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--c-accent);
    margin-bottom: 16px;
}
.branch-hero__title {
    font-family: var(--f-display);
    font-size: clamp(48px, 7vw, 84px);
    line-height: 1;
    margin: 0 0 16px;
    color: #fff;
    letter-spacing: -0.02em;
}
.branch-hero__title .accent {
    font-family: var(--f-accent);
    font-style: italic;
    color: var(--c-accent);
}
.branch-hero__lead {
    font-size: 18px;
    line-height: 1.6;
    color: rgba(255,255,255,0.9);
    max-width: 560px;
    margin: 0 0 24px;
}
.branch-hero__cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.branch-hero__cta .btn {
    background: var(--c-accent);
    color: var(--c-primary-dark);
}
.branch-hero__cta .btn:hover { background: #fff; color: var(--c-primary-dark); }
.branch-hero__cta .btn-outline {
    border-color: rgba(255,255,255,0.8);
    color: #fff;
    background: transparent;
}
.branch-hero__cta .btn-outline:hover { background: #fff; color: var(--c-primary-dark); border-color: #fff; }

.branch-hero__meta {
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 24px;
    border-radius: var(--r-card);
}
.branch-hero__meta dt {
    font-family: var(--f-accent);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-accent);
    margin: 12px 0 4px;
}
.branch-hero__meta dt:first-child { margin-top: 0; }
.branch-hero__meta dd {
    margin: 0;
    font-size: 15px;
    color: #fff;
    line-height: 1.5;
}

/* ─── Story narrative section ─────────────────────────── */
.branch-story {
    padding: 96px 0;
    background: var(--c-surface);
}
.branch-story__container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: 64px;
    align-items: center;
}
.branch-story__image {
    aspect-ratio: 4/5;
    background: linear-gradient(135deg, var(--c-accent), var(--c-primary-light));
    border-radius: var(--r-card);
    position: relative;
    box-shadow: var(--sh-deep);
}
.branch-story__image::after {
    content: "故事照";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    font-family: var(--f-accent);
    font-size: 14px;
    letter-spacing: 0.3em;
}
.branch-story__title {
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.15;
    margin: 0 0 24px;
}
.branch-story__title .accent { color: var(--c-primary); }
.branch-story__lead {
    font-size: 18px;
    color: var(--c-text-soft);
    line-height: 1.8;
    margin: 0 0 24px;
}
.branch-story__stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--c-line);
}
.branch-story__stat strong {
    display: block;
    font-family: var(--f-accent);
    font-size: 36px;
    font-weight: 700;
    color: var(--c-primary);
    line-height: 1;
    margin-bottom: 4px;
}
.branch-story__stat span {
    font-size: 12px;
    color: var(--c-text-mute);
    letter-spacing: 0.1em;
}

/* ─── Services cards ──────────────────────────────────── */
.branch-services {
    padding: 96px 0;
    background: var(--c-surface-alt);
}
.branch-services__head {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 64px;
}
.branch-services__grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}
.branch-service {
    background: var(--c-surface);
    padding: 32px;
    border-radius: var(--r-card);
    transition: all .25s;
    border: 1px solid var(--c-line);
    position: relative;
    overflow: hidden;
}
.branch-service::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--c-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s;
}
.branch-service:hover { transform: translateY(-6px); box-shadow: var(--sh-deep); }
.branch-service:hover::before { transform: scaleX(1); }
.branch-service__num {
    font-family: var(--f-accent);
    font-size: 48px;
    color: var(--c-accent);
    line-height: 1;
    margin-bottom: 16px;
    font-weight: 700;
}
.branch-service__title {
    font-size: 20px;
    margin: 0 0 12px;
}
.branch-service__desc {
    font-size: 14px;
    color: var(--c-text-soft);
    margin: 0 0 16px;
}
.branch-service__date {
    font-size: 12px;
    color: var(--c-text-mute);
    font-family: var(--f-accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ─── Allied clubs logo wall ──────────────────────────── */
.branch-allies {
    padding: 80px 0;
    background: var(--c-surface);
    text-align: center;
    border-top: 1px solid var(--c-line);
    border-bottom: 1px solid var(--c-line);
}
.branch-allies__title {
    font-family: var(--f-accent);
    font-size: 13px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--c-text-mute);
    margin-bottom: 8px;
}
.branch-allies__head {
    font-size: 28px;
    margin-bottom: 40px;
}
.branch-allies__wall {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}
.branch-allies__logo {
    aspect-ratio: 1;
    background: var(--c-surface-alt);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 20px;
    color: var(--c-primary);
    border: 1px solid var(--c-line);
    transition: all .2s;
}
.branch-allies__logo:hover { background: var(--c-primary); color: var(--c-on-primary); transform: scale(1.08); }

/* ─── Team group photo ────────────────────────────────── */
.branch-team {
    padding: 96px 0;
    background: var(--c-bg);
}
.branch-team__head {
    text-align: center;
    margin-bottom: 48px;
}
.branch-team__photo {
    aspect-ratio: 21/9;
    background: linear-gradient(135deg, var(--c-primary-dark), var(--c-primary), var(--c-accent));
    border-radius: var(--r-card);
    margin-bottom: 32px;
    position: relative;
}
.branch-team__photo::after {
    content: "團體合照";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    font-family: var(--f-accent);
    font-size: 16px;
    letter-spacing: 0.3em;
}
.branch-team__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}
.branch-team__person {
    text-align: center;
    padding: 16px;
}
.branch-team__avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-on-primary);
    font-family: var(--f-accent);
    font-weight: 700;
    font-size: 24px;
}
.branch-team__role {
    font-family: var(--f-accent);
    font-size: 12px;
    color: var(--c-accent-dark);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.branch-team__name {
    font-size: 18px;
    font-weight: 600;
    margin: 4px 0;
}

/* ─── Footer ──────────────────────────────────────────── */
.branch-footer {
    background: var(--c-primary-dark);
    color: rgba(255,255,255,0.85);
    padding: 64px 0 32px;
}
.branch-footer__grid {
    display: grid;
    /* 品牌欄固定較寬，其餘連結欄用 auto-fit：社群欄若隱藏，欄數自動收合不留空欄。
       注意：track list 含 auto-fit 時其他 track 必須是 fixed-size，裸 2fr 會讓整條宣告無效（掉回單欄）→ 用 minmax 給固定下限 */
    grid-template-columns: minmax(280px, 2fr) repeat(auto-fit, minmax(150px, 1fr));
    gap: 48px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px 48px;
}
/* footer 文字：底色恆為 --c-primary-dark（各主題的深品牌色），文字一律走亮色系。
   前綴 body.subsite 提高 specificity，壓過 base.css 的 body.subsite h5 / a 全域深色規則。 */
body.subsite .branch-footer__brand h3 {
    color: #fff;
    font-size: 22px;
    margin-bottom: 8px;
}
body.subsite .branch-footer__brand p {
    color: rgba(255,255,255,0.72);
    font-size: 14px;
    line-height: 1.7;
}
body.subsite .branch-footer h5 {
    color: #fff;
    font-family: var(--f-accent);
    font-size: 13px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin: 0 0 16px;
    opacity: 0.95;
}
body.subsite .branch-footer a { color: rgba(255,255,255,0.82); display: block; padding: 4px 0; font-size: 14px; word-break: keep-all; }
body.subsite .branch-footer a:hover { color: #fff; }
.branch-footer__social {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
/* 前綴 body.subsite 提高 specificity，壓過上方 body.subsite .branch-footer a 的 display:block/padding，
   否則圓形社群圖示會變成 block、圖示不置中、位置跑掉 */
body.subsite .branch-footer__social a {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.12);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 18px;
    color: #fff;
    line-height: 1;
}
body.subsite .branch-footer__social a:hover { background: var(--c-accent); color: var(--c-primary-dark); }
.branch-footer__bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 24px;
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* ─── 手機版（≤768px）─────────────────────────────────────
   桌機為橫排 flex / 多欄 grid，手機需收斂：
   1) header 三塊（品牌 / 導覽 / social）改為換行，導覽自成一列可橫向捲動，
      CJK 導覽字加 keep-all 避免逐字直斷。
   2) footer 4 欄 grid 收成 2 欄、品牌區跨整列；連結 keep-all 不斷字。 */
@media (max-width: 768px) {
    /* 保險：裁掉任何殘餘水平溢出，杜絕整頁左右捲動（clip 不建立捲動容器、不影響 sticky header） */
    body.subsite { overflow-x: clip; }

    /* ── Header：品牌 + 右側（social + 漢堡）同一列，nav 收進漢堡下拉 ── */
    .branch-header { padding: 12px 0; }
    .branch-header__container { position: relative; flex-wrap: nowrap; gap: 10px; }
    .branch-header__brand { flex: 1 1 auto; min-width: 0; gap: 10px; }
    .branch-header__name { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .branch-header__enname { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .branch-header__social { flex: 0 0 auto; gap: 6px; }

    /* 漢堡按鈕（三條線） */
    .branch-header__burger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 40px;
        height: 40px;
        flex: 0 0 auto;
        border-radius: 10px;
        background: var(--c-surface-alt);
        cursor: pointer;
    }
    .branch-header__burger span {
        display: block;
        width: 20px;
        height: 2px;
        margin: 0 auto;
        background: var(--c-primary);
        border-radius: 2px;
        transition: transform .25s, opacity .2s;
    }
    /* 打開時三條線變 X */
    .branch-nav-toggle:checked ~ .branch-header__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .branch-nav-toggle:checked ~ .branch-header__burger span:nth-child(2) { opacity: 0; }
    .branch-nav-toggle:checked ~ .branch-header__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* nav 收成下拉面板：預設隱藏，勾選漢堡才展開 */
    .branch-header__nav {
        display: none;
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 2px;
        background: var(--c-surface);
        border: 1px solid var(--c-line);
        border-radius: var(--r-card);
        box-shadow: var(--sh-deep);
        padding: 8px;
        z-index: 200;
    }
    .branch-nav-toggle:checked ~ .branch-header__nav { display: flex; }
    .branch-header__nav a { width: 100%; padding: 12px 16px; border-radius: 10px; font-size: 15px; }

    .branch-hero__container { grid-template-columns: 1fr; padding: 80px 20px 48px; gap: 28px; }

    /* ── Footer：單欄堆疊，不並排 ── */
    .branch-footer { padding: 44px 0 24px; }
    .branch-footer__grid {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 0 24px 32px;
    }
    body.subsite .branch-footer a { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
}

/* ============================================================
   關於分會 · 插入範本區塊（About 編輯器 template + 前台共用）
   全走主題 token（.theme-xxx 提供 --c-*），套哪個分會主題就變哪個色。
   不加 body.subsite scope：同一份規則也要在 TinyMCE iframe（body 掛 theme class）內生效。
   標籤限 sanitizer 白名單：div / section / span / p / h2-h6 / blockquote。
   ============================================================ */

/* 1. 章節標題：主題色底線小標 */
.branch-heading { margin: 1.6em 0 1em; }
.branch-heading h2,
.branch-heading h3 {
    display: inline-block;
    margin: 0;
    padding-bottom: .3em;
    font-family: var(--f-display, "Noto Serif TC", serif);
    color: var(--c-text, #2A2520);
    border-bottom: 3px solid var(--c-primary, #ECB22F);
}

/* 2. 重點框 / Callout：主題淡底 + 左側主題強調條 */
.branch-callout {
    margin: 1.4em 0;
    padding: 1em 1.25em;
    background: var(--c-surface-alt, #FBF4E2);
    border-left: 4px solid var(--c-primary, #ECB22F);
    border-radius: var(--r-card, 12px);
    color: var(--c-text, #2A2520);
}
.branch-callout > :first-child { margin-top: 0; }
.branch-callout > :last-child { margin-bottom: 0; }

/* 3. 引言：襯線居中引述 + 署名 */
.branch-quote {
    margin: 1.6em auto;
    max-width: 46em;
    padding: .5em 1em;
    text-align: center;
    border: 0;
}
.branch-quote p {
    margin: 0 0 .5em;
    font-family: var(--f-accent, var(--f-display, "Noto Serif TC", serif));
    font-size: 1.35em;
    line-height: 1.6;
    color: var(--c-primary-dark, #7A5408);
}
.branch-quote .branch-quote-sign {
    display: block;
    font-size: .95em;
    color: var(--c-text-soft, #5A5249);
}

/* 4. 數字亮點：一列數據 */
.branch-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
    justify-content: center;
    margin: 1.6em 0;
    padding: 1.2em 1em;
    background: var(--c-surface-alt, #FBF4E2);
    border-radius: var(--r-card, 12px);
}
.branch-stat { text-align: center; min-width: 90px; }
.branch-stat-num {
    display: block;
    font-family: var(--f-display, "Noto Serif TC", serif);
    font-size: 2.2em;
    font-weight: 700;
    line-height: 1.1;
    color: var(--c-primary, #ECB22F);
}
.branch-stat-label {
    display: block;
    margin-top: .2em;
    font-size: .9em;
    color: var(--c-text-soft, #5A5249);
}

/* ============================================================
   關於分會 · 內容排版（.branch-about）
   原寫在 Views/Page/SubSiteBranchAbout.cshtml inline style，移來此處成單一來源，
   讓前台子站與 Admin「關於分會」編輯器（content_css 載本檔 + body class 加 branch-about）
   共用同一份排版 → 所見即所得。全走主題 token（.theme-xxx）。
   ============================================================ */
.branch-about { color: var(--c-text-soft); font-size: 1.08rem; line-height: 2.0; }
.branch-about > :first-child { margin-top: 0; }
.branch-about p { margin: 0 0 1.4em; }
.branch-about h2, .branch-about h3, .branch-about h4 { font-family: "Noto Serif TC", serif; color: var(--c-text); line-height: 1.5; margin: 1.8em 0 0.7em; }
.branch-about h2 { font-size: 1.5rem; padding-left: 14px; border-left: 4px solid var(--c-primary); }
.branch-about h3 { font-size: 1.25rem; color: var(--c-primary-dark); }
.branch-about a { color: var(--c-primary-dark); text-decoration: underline; text-underline-offset: 3px; }
.branch-about ul, .branch-about ol { margin: 0 0 1.4em; padding-left: 1.5em; }
.branch-about li { margin-bottom: 0.5em; }
.branch-about blockquote { margin: 1.6em 0; padding: 14px 22px; border-left: 4px solid var(--c-accent); background: var(--c-surface-alt); border-radius: 0 var(--r-card) var(--r-card) 0; color: var(--c-text); }
.branch-about img { max-width: 100%; height: auto; border-radius: var(--r-card); margin: 1em 0; box-shadow: var(--sh-card); }
.branch-about hr { border: none; border-top: 1px solid var(--c-line); margin: 2em 0; }

/* 關於分會 · 頁面外框（置中窄欄 + 自動大標題）
   原寫在 Views/Page/SubSiteBranchAbout.cshtml inline style，移來此處成單一來源，
   讓 Admin 編輯器（content_css 載本檔）也能呈現與前台一致的容器與大標題預覽。 */
.branch-about-wrap { max-width: 860px; margin: 0 auto; padding: clamp(40px, 6vw, 84px) clamp(20px, 5vw, 40px); }
.branch-about-head { text-align: center; margin-bottom: 48px; }
.branch-about-head__eyebrow { font-family: "Cormorant Garamond", serif; font-style: italic; color: var(--c-accent-dark); font-size: 1.1rem; letter-spacing: 0.04em; }
.branch-about-head__title { font-family: "Noto Serif TC", serif; font-weight: 900; font-size: clamp(1.9rem, 4vw, 2.8rem); color: var(--c-text); margin: 6px 0 14px; }
.branch-about-head__rule { width: 72px; height: 3px; margin: 0 auto; background: var(--c-primary); border-radius: 3px; }
.branch-about-head__meta { margin-top: 16px; color: var(--c-text-mute); font-size: 0.95rem; }
