/* ============================================================
   forge.css — WebForge UI 系統（零外部依賴，純 CSS 變數）
   版面：.container / grid helpers / section spacing / 元件
   色彩與字型變數由 themes.css 依 [data-theme] 提供。
   ============================================================ */

/* ---------- 基本 ---------- */
*, *::before, *::after { box-sizing: border-box; }

:root {
  /* 預設（minimal 風格）；任何 [data-theme] 定義都會覆蓋以下值 */
  --bg: #f4f4f5;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #71717a;
  --primary: #18181b;
  --accent: #1f5fd6;
  --border: #e2e2e8;
  --radius: 10px;
  --hero-bg: #23232a;
  --hero-text: #fafafa;
  --on-accent: #ffffff;                 /* accent 底上嘅文字色（可按主題覆蓋） */
  --font: "Noto Sans HK", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Segoe UI", sans-serif;
  --font-display: "Playfair Display", "Noto Serif TC", Georgia, serif;
  --footer-bg: var(--surface);
  --footer-brand: var(--accent);
  --footer-muted: var(--muted);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; font-weight: 700; }
p { margin: 0 0 1em; }
ul { padding: 0; margin: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

/* 襯線展示字（--font-display；沿用舊站 Playfair Display 風格） */
.hero-title,
.section-title,
.cta-heading,
.gate-title { font-family: var(--font-display); }

/* ---------- 版面 helper ---------- */
.container { max-width: 1140px; margin-inline: auto; padding-inline: 24px; }
.grid { display: grid; gap: 24px; }

.section { padding: 84px 0; }
.section-head { max-width: 720px; margin: 0 auto 48px; text-align: center; }
.section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--text); }
.section-sub { color: var(--muted); font-size: 1.05rem; margin-bottom: 0; }

.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-block;
  padding: 13px 30px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  transition: filter .18s ease, transform .12s ease, background .18s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--primary); color: var(--surface); }
.btn-primary:hover { filter: brightness(1.25); }

.btn-accent { background: var(--accent); color: var(--on-accent, var(--surface)); }
.btn-accent:hover { filter: brightness(1.18); }

.btn-ghost {
  background: transparent;
  color: inherit;
  border-color: currentColor;
}
.btn-ghost:hover { opacity: .8; }

/* 特色卡片底部連結（可選：設定項加 "link" 先會出現） */
.card-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .05em;
  transition: color .15s ease;
}
.card-link::after { content: " →"; }
.card-link:hover { color: var(--primary); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}
.card-title { font-size: 1.12rem; margin-bottom: .4em; }
.card-text { color: var(--muted); margin-bottom: 0; font-size: .97rem; }

/* 特色卡片網格（自動適應 2/3/4 欄） */
.features-grid { grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); }
.feature-card { text-align: left; transition: transform .18s ease, box-shadow .18s ease; }
.feature-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(0, 0, 0, .08); }

.feature-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  font-size: 26px;
  line-height: 1;
  color: var(--primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
}

/* ---------- 圖輯 ---------- */
/* 圖輯（自動適應；2 張時自動變兩欄寬幅） */
.gallery-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.gallery-item {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: zoom-in;
}
.gallery-item img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  transition: transform .3s ease;
}
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 34px 16px 12px;
  font-size: .9rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
}

/* Lightbox（forge.js 動態加入） */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  place-items: center;
  padding: 5vh 4vw;
  background: rgba(0, 0, 0, .88);
}
.lightbox.open { display: grid; }
.lightbox img {
  max-width: 100%;
  max-height: 86vh;
  border-radius: 6px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, .6);
}
.lightbox-caption { color: #ddd; margin: 14px 0 0; text-align: center; }
.lightbox-close {
  position: absolute;
  top: 18px; right: 22px;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .28); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: .97rem; min-width: 560px; }
.data-table th, .data-table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table thead th {
  background: var(--bg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: .04em;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:nth-child(even) { background: var(--bg); }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* ---------- 文件清單 ---------- */
.doc-list {
  max-width: 860px;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.doc-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  transition: background .15s ease;
}
.doc-item:last-child { border-bottom: 0; }
.doc-item:hover { background: var(--bg); }
.doc-date {
  flex: none;
  min-width: 106px;
  padding: 3px 10px;
  text-align: center;
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-radius: 999px;
}
.doc-link {
  color: var(--text);
  font-weight: 600;
  transition: color .15s ease;
}
.doc-link::after { content: " ↗"; color: var(--accent); }
.doc-link:hover { color: var(--accent); }

/* ---------- 長文內容（text section） ---------- */
.text-body { max-width: 860px; margin-inline: auto; }
.text-body p {
  color: var(--text);
  font-size: 1.06rem;
  line-height: 2.05;
  margin-bottom: 1.2em;
}
.text-body strong { color: var(--primary); }
.text-body .text-lead {
  font-size: 1.14rem;
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 子頁 Hero（較矮版本：class="hero sub"） ---------- */
.hero.sub { padding: 116px 0 100px; }

/* ---------- 聯絡電話（WhatsApp 連結） ---------- */
.contact-wa-link {
  color: var(--text);
  border-bottom: 2px dotted var(--accent);
}
.contact-wa-link:hover { color: var(--accent); }

/* ---------- 預約表格（booking section） ---------- */
.booking-card {
  max-width: 780px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 44px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
}
.form-row + .form-row { margin-top: 2px; }
.form-field { margin-bottom: 18px; }
.req { color: #c0392b; }
.field-status { font-size: .82rem; color: var(--muted); margin: 5px 0 0; min-height: 1em; }
.field-status.err { color: #c0392b; }
.btn-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.booking-submit { min-width: 190px; }
.booking-note {
  max-width: 560px;
  margin: 22px auto 0;
  text-align: center;
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.8;
}
.booking-success {
  text-align: center;
  padding: 30px 10px;
}
.booking-success-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent, var(--surface));
  font-size: 34px;
  font-weight: 800;
}
.booking-success h3 { font-size: 1.4rem; margin-bottom: .4em; }
.booking-success p { color: var(--muted); max-width: 520px; margin-inline: auto; }

/* ---------- 聯絡 ---------- */
.contact-grid { grid-template-columns: repeat(3, 1fr); }
.contact-card { text-align: center; }
.contact-card .feature-icon { margin-inline: auto; }
.contact-main { font-size: 1.04rem; color: var(--text); font-weight: 600; word-break: break-word; }
.contact-note { color: var(--muted); font-size: .88rem; margin-top: 4px; }

/* ---------- CTA 橫幅 ---------- */
.cta-band {
  padding: 34px 0 96px;
}.cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  padding-top: 46px;
  padding-bottom: 46px;
  border-radius: var(--radius);
  background: linear-gradient(115deg, var(--hero-bg), var(--primary));
  color: var(--hero-text);
}
.cta-heading { margin-bottom: .2em; font-size: clamp(1.35rem, 2.6vw, 1.9rem); }
.cta-text { color: inherit; opacity: .85; margin-bottom: 0; }
.cta-btn { flex: none; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  position: relative;
}
.brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: .18em;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand:has(img)::before { display: none; }
.brand img { margin: 0; }
.brand-logo { height: 32px; width: auto; }
.brand-text { letter-spacing: .18em; }
.brand::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-link {
  padding: 8px 16px;
  border-radius: calc(var(--radius) - 4px);
  color: var(--muted);
  font-weight: 600;
  font-size: .97rem;
  transition: color .15s ease, background .15s ease;
}
.nav-link:hover { color: var(--primary); background: var(--bg); }
.nav-link.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* 漢堡按鈕（手機） */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--text);
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 150px 0 130px;
  color: var(--hero-text);
  background:
    radial-gradient(900px 420px at 85% 12%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 60%),
    linear-gradient(120deg, var(--hero-bg) 0%, var(--primary) 110%);
  background-size: cover, cover;
  background-position: center, center;
  overflow: hidden;
}
/* 有背景圖時改用深色漸層遮罩（build.js 注入 inline style） */
.hero[style*="background-image"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 16, 26, .35) 0%, rgba(10, 16, 26, .62) 100%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }
.hero-inner { max-width: 880px; margin-inline: auto; text-align: center; }
.hero .eyebrow { color: color-mix(in srgb, var(--accent) 65%, var(--hero-text)); }
.hero-title {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: .02em;
  margin-bottom: .35em;
}
.hero-sub {
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  opacity: .92;
  max-width: 640px;
  margin: 0 auto 1.4em;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
/* Hero 之上按鈕用 accent（避免同底色撞色） */
.hero .btn-primary { background: var(--accent); color: var(--on-accent, var(--surface)); border: 0; }

/* ---------- Gate 入場遮罩 ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--hero-text);
  background:
    radial-gradient(800px 420px at 80% 8%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 62%),
    linear-gradient(150deg, var(--hero-bg) 0%, var(--primary) 115%);
  transition: opacity .45s ease, visibility .45s ease;
}
.gate.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.gate-card { max-width: 560px; }
.gate-logo {
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  font-weight: 800;
  letter-spacing: .3em;
  text-indent: .3em;
  line-height: 1.1;
}
.gate-logo::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  margin: 22px auto 8px;
  border-radius: 3px;
  background: var(--accent);
}
.gate-kicker {
  margin: 10px 0 4px;
  font-size: .8rem;
  letter-spacing: .5em;
  text-indent: .5em;
  opacity: .7;
}
.gate-title { font-size: clamp(1.5rem, 3.4vw, 2.2rem); margin-bottom: .3em; }
.gate-sub { opacity: .85; margin-bottom: 30px; }
.gate .btn-primary {
  background: var(--accent);
  color: var(--on-accent, var(--surface));
  padding: 15px 46px;
  font-size: 1.05rem;
  letter-spacing: .12em;
}
.gate-logo-img { max-width: min(300px, 72vw); height: auto; }
.gate-logo:has(img)::after { display: none; }
.gate-logo:has(img) { text-indent: 0; }

/* ---------- Footer ---------- */
.footer {
  background: var(--footer-bg, var(--surface));
  border-top: 1px solid var(--border);
  padding: 46px 0 30px;
  margin-top: 40px;
}
.footer-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
.footer .brand { color: var(--footer-brand, var(--text)); }
.footer-tagline { color: var(--footer-muted, var(--muted)); margin: 0; font-size: .95rem; }
.footer-bottom {
  padding-top: 18px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .88rem;
}
.footer-copy { color: var(--footer-muted, var(--muted)); margin: 0; }
.footer-disclaimer { color: var(--footer-muted, var(--muted)); opacity: .8; margin: 0; }
.footer-logo-img { height: 30px; width: auto; }

/* ---------- 表單（預留：contact 或自訂 section 可用） ---------- */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 0;
  border-color: var(--accent);
}

/* ---------- 其他小工具 ---------- */
.badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--surface);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .05em;
}
.text-center { text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 64px 0; }
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 16px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 18px 24px rgba(0, 0, 0, .08);
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 12px 14px; }
  .hero { padding: 96px 0 84px; }
  .cta-band { padding: 10px 0 70px; }
  .cta-inner { justify-content: center; text-align: center; }
  .data-table th, .data-table td { padding: 12px 14px; }
}

@media (max-width: 600px) {
  .features-grid, .gallery-grid, .contact-grid { grid-template-columns: 1fr; }
  .doc-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .section-head { margin-bottom: 34px; }
}

/* ============================================================
   Floating action buttons (.float-stack) - fixed bottom-right
   Two buttons: booking form (float-booking) + WhatsApp (float-wa)
   Rendered by build.js FLOAT_ACTIONS_HTML when a WA number exists.
   ============================================================ */
.float-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.float-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: #1A2332;
  text-decoration: none;
  border: 1px solid rgba(26, 35, 50, 0.12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.float-btn svg {
  width: 28px;
  height: 28px;
  display: block;
}
.float-btn:hover {
  transform: translateY(-3px) scale(1.04);
}
.float-wa {
  background: #25D366;
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.38);
}
.float-wa:hover {
  background: #1fbe5a;
  color: #FFFFFF;
  box-shadow: 0 10px 24px rgba(37, 211, 102, 0.5);
}
.float-booking {
  background: #C9A96E;
  color: #1A2332;
  box-shadow: 0 6px 18px rgba(201, 169, 110, 0.42);
}
.float-booking:hover {
  background: #A68B4E;
  color: #FFFFFF;
  box-shadow: 0 10px 24px rgba(201, 169, 110, 0.55);
}
.float-btn-label {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: #1C1C1A;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.float-btn-label::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #1C1C1A;
}
.float-btn:hover .float-btn-label {
  opacity: 1;
}
@media (max-width: 768px) {
  .float-stack { right: 16px; bottom: 16px; gap: 10px; }
  .float-btn { width: 52px; height: 52px; }
  .float-btn svg { width: 25px; height: 25px; }
}
