/* app.css — 全域基底（元件造型於後續任務逐段追加） */

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.25;
  font-weight: 800;
}
h1 { font-size: clamp(28px, 4vw, 44px); }
h2 { font-size: clamp(22px, 3vw, 32px); }
h3 { font-size: clamp(18px, 2.4vw, 24px); }

a { color: var(--brand); transition: color .2s var(--ease); }
a:hover { color: var(--brand-strong); }

.container { max-width: var(--container-max); }

/* 區塊節奏 */
.section { padding: var(--space-9) 0; }
.section-tight { padding: var(--space-7) 0; }
.eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 13px;
  color: var(--brand);
  font-weight: 700;
}

/* 按鈕 */
.btn-brand, .btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; border-radius: var(--radius-pill);
  padding: 12px 22px; border: 1.5px solid transparent;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease),
              background .2s var(--ease), color .2s var(--ease);
  cursor: pointer; text-decoration: none;
}
.btn-brand { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm); }
.btn-brand:hover { background: var(--brand-strong); color: var(--on-brand);
  transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--brand); background: var(--brand-weak); transform: translateY(-2px); }

/* 捲動進場 */
.reveal { opacity: 0; transform: translateY(18px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); will-change: opacity, transform; }
.reveal.in-view { opacity: 1; transform: none; }
[data-reveal-stagger] > * { transition-delay: calc(var(--i, 0) * 80ms); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  * { scroll-behavior: auto !important; }
}

/* ── Navbar ───────────────────────────── */
.sticky { background: transparent; }
.nav-wide { max-width: 1320px; }
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 0 0 var(--radius) var(--radius);
  transition: box-shadow .25s var(--ease);
}
.site-nav.is-scrolled { box-shadow: var(--shadow-md); border-bottom-color: transparent; }
.site-brand {
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  color: var(--text) !important; letter-spacing: -0.01em;
}
.site-brand::before {
  content: ""; display: inline-block; width: 10px; height: 22px; margin-right: 10px;
  vertical-align: -3px; border-radius: 3px;
  background: linear-gradient(var(--brand), var(--brand-strong));
}
.site-nav .nav-link {
  color: var(--text) !important; font-weight: 500; border-radius: var(--radius-sm);
  padding: 8px 9px !important; font-size: 15px; white-space: nowrap;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.site-nav .nav-link:hover { color: var(--brand) !important; background: var(--brand-weak); }
.site-nav .dropdown-menu {
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 8px;
}
.site-nav .dropdown-item { border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text); }
.site-nav .dropdown-item:hover { background: var(--brand-weak); color: var(--brand); }

/* 主題切換鈕 */
.theme-toggle {
  display: inline-flex; gap: 2px; padding: 3px; margin-left: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill);
}
.theme-toggle button {
  border: 0; background: transparent; color: var(--muted);
  width: 34px; height: 28px; border-radius: var(--radius-pill); cursor: pointer;
  font-weight: 700; font-size: 13px; transition: background .2s var(--ease), color .2s var(--ease);
}
[data-theme="blue"]  .theme-toggle [data-theme-value="blue"],
[data-theme="green"] .theme-toggle [data-theme-value="green"] {
  background: var(--brand); color: var(--on-brand);
}

/* 通告條 */
.site-notice {
  background: var(--brand-weak); color: var(--brand-strong);
  border-radius: var(--radius); padding: 10px 16px; margin-top: 12px;
  font-weight: 500; text-align: center;
}

/* ── Hero ─────────────────────────────── */
.hero { position: relative; overflow: hidden; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.hero__media {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,18,30,.30), rgba(10,18,30,.62)),
              url('/image/z1-fsr.jpg') center/cover no-repeat;
}
.hero__inner { position: relative; padding: clamp(56px, 9vw, 120px) 15px; color: #fff; }
.hero .eyebrow { color: #fff; opacity: .9; }
.hero__title { color: #fff; margin: 12px 0 16px; }
.hero__sub { color: rgba(255,255,255,.92); font-size: clamp(15px, 1.6vw, 18px); max-width: 560px; }
.hero__cta { display: flex; gap: 12px; margin-top: var(--space-6); flex-wrap: wrap; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.6); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.14); border-color: #fff; }
@media (max-width: 576px) {
  .hero__inner { padding-left: 24px; padding-right: 24px; }
}

/* ── 特色卡 ───────────────────────────── */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-5); box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature__icon {
  width: 52px; height: 52px; display: grid; place-items: center; font-size: 26px;
  background: var(--brand-weak); border-radius: var(--radius); margin-bottom: var(--space-3);
}
.feature__title { font-size: 18px; margin-bottom: 6px; }
.feature__desc { color: var(--muted); font-size: 15px; margin: 0; }
@media (max-width: 768px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .features { grid-template-columns: 1fr; } }

/* ── 最新消息 ─────────────────────────── */
.news-list { display: flex; flex-direction: column; gap: var(--space-3); }
.news-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease);
}
.news-item.is-extra { display: none; }
.news-item:hover, .news-item.is-open { box-shadow: var(--shadow-md); }
.news-item__head {
  width: 100%; display: flex; align-items: center; gap: var(--space-4);
  padding: 16px 20px; background: transparent; border: 0; cursor: pointer; text-align: left;
  border-radius: var(--radius);
}
.news-item__head:focus { outline: none; }
.news-item__head:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.news-date {
  font-family: var(--font-display); font-weight: 700; color: var(--brand);
  background: var(--brand-weak); padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 13px; white-space: nowrap;
}
.news-subject { flex: 1; font-weight: 500; color: var(--text); }
.news-caret { color: var(--brand); font-weight: 700; font-size: 18px; line-height: 1; }
.news-item__body {
  max-height: 0; overflow: hidden; transition: max-height .3s var(--ease);
  padding: 0 20px; color: var(--muted); line-height: 1.9;
}
.news-item.is-open .news-item__body { max-height: 1500px; padding: 16px 20px 20px; border-top: 1px solid var(--border); }
.news-more {
  align-self: center; margin-top: var(--space-4);
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1.5px solid var(--border); color: var(--brand);
  border-radius: var(--radius-pill); padding: 10px 20px; font-weight: 700; cursor: pointer;
  font-family: var(--font-sans); transition: border-color .2s var(--ease), background .2s var(--ease);
}
.news-more:hover { border-color: var(--brand); background: var(--brand-weak); }

/* ── 快速入口 ─────────────────────────── */
.quicklinks { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.quicklink {
  display: flex; align-items: center; justify-content: center; min-height: 84px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--text);
  text-decoration: none; transition: transform .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.quicklink:hover { transform: translateY(-3px); border-color: var(--brand); color: var(--brand); }
@media (max-width: 768px) { .quicklinks { grid-template-columns: repeat(2, 1fr); } }

/* ── Footer ───────────────────────────── */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: var(--space-8); padding: var(--space-8) 0 var(--space-5); }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: var(--space-6); }
.footer-brand { font-family: var(--font-display); font-weight: 800; font-size: 20px; margin-bottom: var(--space-4); color: var(--text); }
.footer-h { font-size: 16px; margin-bottom: var(--space-3); }
.site-footer p { color: var(--muted); margin: 0 0 8px; }
.site-footer a { color: var(--text); }
.site-footer a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: var(--space-6); padding-top: var(--space-4); text-align: center; color: var(--muted); }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr; gap: var(--space-5); } }

/* ── 內頁：頁首橫幅 ─────────────────────── */
.page-header {
  background: linear-gradient(180deg, var(--brand-weak), var(--surface));
  border-bottom: 1px solid var(--border);
  padding: var(--space-7) 0 var(--space-6);
  margin-bottom: var(--space-6);
}
.page-header__title { margin: 0; font-size: clamp(26px, 4vw, 40px); }
.page-header .eyebrow { margin-bottom: 6px; }

/* ── 內頁：內容元件 ─────────────────────── */
#content h3 { margin-bottom: var(--space-3); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-4) 0; }

/* 表格 */
.table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { border-color: var(--border); vertical-align: middle; padding: 12px 14px; }
.table thead th { background: var(--surface-2); color: var(--text); font-family: var(--font-display); font-weight: 700; border-bottom: 2px solid var(--border); }
.table-striped tbody tr:nth-of-type(odd) { background: var(--surface-2); }
.table-hover tbody tr:hover { background: var(--brand-weak); }

/* 卡片 */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-deck .card { margin-bottom: var(--space-4); }
.card-title { font-family: var(--font-display); }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); }
/* 修正評分標準頁路線圖：覆蓋 w-50/h-50 造成的壓扁與空白，圖片置中自適應 */
.card .card-img-top.w-50 { width: auto !important; height: auto !important; max-width: min(480px, 90%); display: block; margin: 16px auto; }

/* 線上補課（BS5 手風琴）：套用品牌色，箭頭以 currentColor 隨主題切換 */
.accordion-button:not(.collapsed) { color: var(--brand-strong); background-color: var(--brand-weak); box-shadow: inset 0 -1px 0 var(--border); }
.accordion-button:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem var(--brand-weak); }
.accordion-button::after {
  background-image: none; background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E") no-repeat center / 1.25rem;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E") no-repeat center / 1.25rem;
}

/* 表單 */
.form-control { border-radius: var(--radius-sm); border-color: var(--border); }
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-strong); border-color: var(--brand-strong); box-shadow: none; }
