/*
 * 全站頁首、頁尾、回到頂端、洽詢視窗（新版設計稿 2026-11-17：newfrontend/site-chrome.css）。
 * 每一頁都會載入，包含仍使用 Tailwind 的舊版內頁；Tailwind 的 preflight 會重設標題字重、清單樣式與連結顏色，
 * 所以這裡的規則都寫明確的值，不依賴瀏覽器預設。
 * 與設計稿的差異：標誌路徑改為 ../img/、頁尾標題補 font-weight、會員登入改為連結、加上跳至主要內容與洽詢視窗。
 */

/* 頁首與頁尾使用同一內容寬度，窄畫面讓導覽自然換列。 */
.shared-header,.shared-footer{box-sizing:border-box;font-family:"Noto Sans TC","Microsoft JhengHei",sans-serif}
/* 頁首保留在正常版面中，捲動時貼齊視窗頂端；較高層級讓下拉選單蓋在內容上方。 */
.shared-header{position:sticky;top:0;z-index:100;background:#fffdf8;color:#171512;border-bottom:1px solid #e8dcc6}
/* 頁內連結捲動時避開固定可見的頁首，避免目標標題被遮住。 */
html{scroll-padding-top:80px}
.shared-chrome-inner{width:min(1200px,calc(100% - 48px));margin-inline:auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 24px;padding-block:12px}
.shared-chrome-inner .shared-brand{font-family:"Noto Serif TC","Microsoft JhengHei",serif;font-size:24px;font-weight:700;line-height:1.3;text-decoration:none;color:inherit}
/* 設計稿的首頁、CDA、CFY 頁首品牌名稱改用內文字型（頁面設 $page['brandsans']）。 */
.shared-chrome-inner .shared-brand.is-sans{font-family:"Noto Sans TC","Microsoft JhengHei",sans-serif}
/* 全站頁首共用擺渡原始標誌；以裝飾圖呈現，保留品牌文字作為連結名稱。 */
.shared-header .shared-brand{display:inline-flex;align-items:center;gap:9px;white-space:nowrap}
.shared-header .shared-brand::before{content:"";display:block;flex:none;width:52px;height:36px;background:center/contain no-repeat url("../img/tsquare-logo.png")}
.shared-nav,.shared-footer-meta{display:flex;flex-wrap:wrap;align-items:center;gap:0 16px}
.shared-nav a{display:inline-flex;min-height:44px;align-items:center;color:inherit;text-decoration:none;font-size:14px}
.shared-nav a:hover,.shared-nav a[aria-current]{text-decoration:underline;text-underline-offset:6px}
.shared-nav a[aria-current]{color:#8a5f14;font-weight:700}
/* 桌面選單浮在內容上方，窄螢幕則使用整列導覽寬度。 */
.shared-nav-group{position:relative}
.shared-nav-group summary{
  display:flex;align-items:center;gap:6px;min-height:44px;
  font-size:14px;list-style:none;cursor:pointer;
}
.shared-nav-group summary::-webkit-details-marker{display:none}
.shared-nav-group summary::after{
  content:"";width:6px;height:6px;border:solid currentColor;border-width:0 1px 1px 0;
  transform:translateY(-2px) rotate(45deg);
}
.shared-nav-group[open] summary::after{transform:translateY(2px) rotate(225deg)}
.shared-nav-group summary.is-current{color:#8a5f14;font-weight:700;text-decoration:underline;text-underline-offset:6px}
.shared-nav-group summary:focus-visible{outline:2px solid #b68420;outline-offset:3px}
.shared-nav-dropdown{
  position:absolute;z-index:30;inset-inline-end:0;top:100%;
  width:280px;box-sizing:border-box;margin:0;padding:6px;list-style:none;
  background:#fffdf8;border:1px solid #e8dcc6;border-radius:10px;
  box-shadow:0 8px 20px rgb(23 21 18 / 12%);
}
.shared-nav-dropdown a{display:flex;padding:6px 12px;line-height:1.5;border-radius:6px;box-sizing:border-box}
.shared-nav-dropdown a:hover,.shared-nav-dropdown a:focus-visible{background:#f7f2e8}
.shared-header a:focus-visible,.shared-footer a:focus-visible{outline:2px solid #b68420;outline-offset:3px}
.shared-footer{margin-top:auto;background:#171512;color:#d9d3c7;font-size:14px}
.shared-footer .shared-chrome-inner{padding-block:28px}
.shared-footer .shared-brand{color:#fffdf8;font-size:18px}
.shared-footer a{color:inherit}
@media(max-width:760px){
  html{scroll-padding-top:140px}
  .shared-chrome-inner{width:calc(100% - 32px)}
  .shared-header .shared-brand{gap:7px}
  .shared-header .shared-brand::before{width:43px;height:30px}
  .shared-nav{width:100%;gap:0 12px}
  .shared-nav{position:relative}
  .shared-nav-group{position:static}
  .shared-nav-dropdown{inset-inline:0;top:100%;width:100%}
}

/* 跳至主要內容：平時移出畫面，以鍵盤取得焦點時出現在左上角。 */
.skip-link{position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden}
.skip-link:focus{position:fixed;left:16px;top:16px;z-index:200;width:auto;height:auto;padding:12px 16px;border-radius:8px;background:#fffdf8;color:#171512;box-shadow:0 8px 20px rgb(23 21 18 / 18%)}

/* 固定在視窗右下角，為觸控與鍵盤操作保留足夠空間。 */
a.site-back-to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #a86b08;
  color: #fff;
  text-decoration: none;
}
a.site-back-to-top[hidden] { display: none; }
a.site-back-to-top:hover { background: #8a5f14; }
/* 以粗線與圓角呈現參考圖的上箭頭。 */
a.site-back-to-top span { display: none; }
a.site-back-to-top::before {
  content: "";
  width: 24px;
  height: 24px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20V5m-7 7 7-7 7 7'/%3E%3C/svg%3E");
}
@media (forced-colors: active) {
  a.site-back-to-top span { display: inline; }
  a.site-back-to-top::before { display: none; }
}
a.site-back-to-top:focus-visible { outline: 2px solid #171512; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  html:has(#site-top:target) { scroll-behavior: auto; }
}

/* 全站頁尾共用版型；清除各頁舊頁尾的外層留白與邊框。 */
.home-footer {
  padding: 0;
  border: 0;
  background: #171512;
  color: #d9d3c7;
  font-size: 1rem;
  line-height: 1.7;
}
.home-footer-grid, .home-footer-copyright p {
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
}
.home-footer-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 28px;
  padding-block: 44px 36px;
}
.home-footer a { text-underline-offset: .2em; }
.home-footer a.home-footer-brand {
  display: inline-block;
  margin-bottom: 12px;
  color: #fffdf8;
  font: 700 2rem/1.3 "Noto Serif TC", serif;
  text-decoration: none;
}
.home-footer h2 {
  margin: 0 0 12px;
  color: #d5a53b;
  font-family: var(--font-body, "Noto Sans TC", "Microsoft JhengHei", sans-serif);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}
.home-footer p { margin-block: 0 4px; }
.home-footer address { display: grid; gap: 4px; font-style: normal; }
.home-footer ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.home-footer-copyright {
  border-top: 1px solid #ffffff24;
  padding-block: 20px;
  padding-right: 64px;
  font-size: .875rem;
}
.home-footer-copyright p { margin-block: 0; }
@media (max-width: 760px) {
  .home-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .home-footer-grid { grid-template-columns: 1fr; }
}

.home-footer nav a, .home-footer address a, .home-footer ul a { text-decoration: none; }
.home-footer nav a:hover, .home-footer address a:hover, .home-footer ul a:hover { color: #d5a53b; }
.home-footer ul.home-footer-social { display: flex; flex-wrap: wrap; gap: 12px; }
.home-footer-social span, .home-footer-social a { display: grid; place-items: center; width: 34px; height: 34px; color: #d5a53b; }
.home-footer-social svg { display: block; width: 24px; height: 24px; }

/* 外部流程尚未接通時，保留按鈕版位並顯示可用的洽詢入口。 */
.journey-note {
  margin: 0 0 12px;
  color: #514a3e;
  font-size: .9375rem;
  line-height: 1.65;
}
.journey-note a { color: #704b0e; text-underline-offset: .2em; }
/* 尚未啟用的導覽和交易按鈕，以一致的停用外觀呈現。 */
.shared-nav a[aria-disabled="true"] { color: #6f6a62; cursor: default; text-decoration: none; }
.journey-note + button:disabled,
button[aria-describedby="card-order-status"]:disabled,
#needs-form button[type="submit"]:disabled {
  background: #f1ece3;
  border: 1px solid #d7cbb6;
  color: #62584a;
  opacity: 1;
  cursor: not-allowed;
}

.journey-table-hint { display: none; }
.journey-table-scroll:focus-visible { outline: 2px solid #8a5f14; outline-offset: -3px; }

/* 窄螢幕橫滑時固定首欄，保留比較項目或課程名稱。 */
@media (max-width: 1024px) {
  .journey-table-hint { display: block; margin: 0 0 8px; font-size: .875rem; }
  .journey-table-scroll tr > :first-child {
    position: sticky;
    inset-inline-start: 0;
    z-index: 1;
    box-shadow: 1px 0 #e8dcc6;
  }
  .journey-table-scroll thead th:first-child { background: #f4ebda; }
  .journey-table-scroll tbody tr > :first-child { background: #fffdf8; }
  .journey-schedule-scroll thead th:first-child { background: #171512; }
  .journey-schedule-scroll tr > :first-child {
    min-width: 9rem;
    width: 9rem !important;
    max-width: 11rem;
  }
}

/* 共用會員入口：未登入為登入按鈕，已登入顯示姓名（連到會員中心）與登出。 */
.shared-nav .shared-member-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #C95018;
  color: #fff;
  font: 700 14px/1.3 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  white-space: nowrap;
  text-decoration: none;
}
.shared-nav a.shared-member-login:hover { background: #a9420f; text-decoration: none; }
.shared-nav .shared-member-login:disabled { opacity: 1; }
.shared-member { display: inline-flex; align-items: center; gap: 8px; }
.shared-member form { margin: 0; }
.shared-member .shared-logout {
  min-height: 44px; padding: 0 4px; border: 0; background: none; cursor: pointer;
  color: inherit; font: 14px/1.3 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}
.shared-member .shared-logout:hover { text-decoration: underline; text-underline-offset: 6px; }

/* ---------------------------------------------------------------------
 * 洽詢視窗（頁尾共用 <dialog>）：新版與舊版內頁共用，所以不使用 Tailwind class。
 * --------------------------------------------------------------------- */
.inquiry-dialog {
  box-sizing: border-box;
  width: min(92vw, 600px);
  max-height: 90vh;
  overflow: hidden;
  padding: 0;
  border: 1px solid #e8dcc6;
  border-radius: 24px;
  background: #fffdf8;
  color: #171512;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  box-shadow: 0 24px 60px rgb(23 21 18 / 25%);
}
.inquiry-dialog::backdrop { background: rgb(23 21 18 / 58%); backdrop-filter: blur(4px); }
.inquiry-dialog-body { max-height: 90vh; box-sizing: border-box; overflow-y: auto; padding: clamp(24px, 4vw, 32px); }
.inquiry-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.inquiry-dialog-eyebrow { color: #8a5f14; font-size: 12px; font-weight: 700; letter-spacing: .18em; }
.inquiry-dialog h2 { margin: 8px 0 0; font: 700 1.5rem/1.4 "Noto Serif TC", "PMingLiU", serif; color: #171512; }
.inquiry-dialog-close {
  flex: none; width: 40px; height: 40px; border: 1px solid #e8dcc6; border-radius: 999px;
  background: #fff; color: #171512; font-size: 20px; line-height: 1; cursor: pointer;
}
.inquiry-dialog-lead { margin: 16px 0 0; color: #6f6a62; font-size: .9375rem; line-height: 1.8; }
.inquiry-form { display: grid; gap: 16px; margin-top: 24px; }
.inquiry-form[hidden] { display: none; }
@media (min-width: 640px) { .inquiry-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .inquiry-form .is-wide { grid-column: 1 / -1; } }
.inquiry-form label { display: block; font-size: .875rem; }
.inquiry-form label > span:first-child { font-weight: 600; }
.inquiry-form .req { color: #8a5f14; }
.inquiry-form input[type=text], .inquiry-form input[type=email], .inquiry-form input[type=tel], .inquiry-form select, .inquiry-form textarea {
  display: block; box-sizing: border-box; width: 100%; margin-top: 6px; padding: 10px 16px;
  border: 1px solid rgb(23 21 18 / 15%); border-radius: 12px; background: #fff; color: #171512;
  font: 1rem/1.6 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}
.inquiry-form :is(input, select, textarea):focus { border-color: #d5a53b; outline: 2px solid rgb(213 165 59 / 35%); outline-offset: 0; }
.inquiry-form .inquiry-agree { display: flex; align-items: flex-start; gap: 12px; color: #6f6a62; font-size: .8125rem; line-height: 1.8; }
.inquiry-form .inquiry-agree input { flex: none; width: 16px; height: 16px; margin-top: 5px; }
.inquiry-form .inquiry-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.inquiry-submit {
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 26px; border: 0; border-radius: 999px;
  background: #d5a53b; color: #171512; font: 700 1rem/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif; cursor: pointer;
}
.inquiry-submit:disabled { opacity: .6; cursor: wait; }
.inquiry-msg { color: #8a5f14; font-size: .875rem; }
.inquiry-done { margin-top: 24px; padding: 20px; border-radius: 16px; background: #f7f2e8; font-size: .9375rem; line-height: 1.8; }
.inquiry-done[hidden] { display: none; }
.inquiry-contact { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid #e8dcc6; color: #6f6a62; font-size: .8125rem; line-height: 1.8; }
.inquiry-contact a { color: inherit; text-decoration: underline; text-underline-offset: 4px; }
/* 誘餌欄位移出畫面（不用 display:none，機器人才會填） */
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

@media print {
  .shared-header, .site-back-to-top, .js-dialog-btn { display: none !important; }
}
