/* ══════════════════════════════════════════
   HXOVA 會展電子邀請函 v3
   設計稿基準：Figma「電子邀請函_v3_web_ZH / EN」（179-235 / 206-141）1440 寬，內容寬 1200
   下載檔版面見 app.js 的 TPL
══════════════════════════════════════════ */
@property --rot { syntax: '<angle>'; inherits: true; initial-value: 0deg; }
:root {
  --navy: #0b3b98;
  --blue: #066be0;
  --icon: #0768e2;
  --orange: #f46929;
  --orange-dark: #c1501b;
  --base: #f1f7fd;
  --grad-bar: linear-gradient(173deg, #0668e2 2.2%, #12abd4 100.9%);
  --font-serif: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;   /* v3 全改 Noto Sans TC（變數名沿用） */
  --font-sans: 'Montserrat', 'Noto Sans TC', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--base); overflow-x: hidden; }
/* 永遠保留捲軸位置：彈窗鎖捲動時捲軸消失也不會讓版面往右跳 */
html { scrollbar-gutter: stable; }
body { font-family: var(--font-serif); color: var(--navy); -webkit-font-smoothing: antialiased; }
img, svg { display: block; }
.nowrap { white-space: nowrap; }

/* ── 背景（滿版；由下而上：主視覺底圖 → 光暈 → 城市 → 右上光暈；製作區的綠色漸層在 .lower 裡） ── */
.bg { position: absolute; inset: 0; overflow: hidden; background: var(--base); isolation: isolate; pointer-events: none; z-index: 0; }
/* 主視覺底圖（地球在右側、底部漸淡）固定在畫面右上，捲動時留在背景 */
.bg-hero { position: fixed; right: 0; top: 0; width: 1440px; height: 1050px; background: url(uploads/bg_hero.webp) 0 0 / 100% 100% no-repeat; }
/* 光暈跟著內容區定位（Figma：內容左緣 118 → 光暈 -136,-130） */
.bg-glow { position: absolute; left: calc(max(24px, (100% - 1200px) / 2) - 254px); top: -130px; width: 1263px; height: 1319px; }
.bg-glow2 { position: absolute; left: calc(max(24px, (100% - 1200px) / 2) + 386px); top: -360px; width: 1287px; height: 818px; }
.bg-city { position: absolute; left: 0; bottom: 0; width: 830px; height: 542px; background: url(uploads/bg_city.webp) 0 0 / 100% 100% no-repeat; }

.page { position: relative; min-height: 100vh; display: flex; flex-direction: column; }
.wrap { position: relative; z-index: 1; width: min(1200px, calc(100% - 48px)); margin: 0 auto; }

/* ── 捲動後出現的 header ── */
.sticky-hdr {
  position: fixed; left: 0; right: 0; top: 0; z-index: 60; height: 72px;
  background: #f1f7fd; border-bottom: 1px solid rgba(11,59,152,.08);
  transform: translateY(-100%); visibility: hidden;
  transition: transform .3s ease, visibility 0s linear .3s;
}
.sticky-hdr.is-shown { transform: translateY(0); visibility: visible; transition: transform .3s ease, visibility 0s; }
.sticky-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.sticky-logo img { height: 48px; width: auto; }
.sticky-hdr .lang { margin-top: 0; }

/* ── 主視覺 ── */
.hero {
  --grad-title: linear-gradient(96deg, #0667e2 0.5%, #12acd4 99.6%);
}
.hero { padding: 40px 0 27px; min-height: 861px; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; }
.title {
  font-family: var(--font-sans); font-weight: 900; font-size: 50px; line-height: 61px;
  text-transform: uppercase; white-space: nowrap;
  background: var(--grad-title); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* 語系切換（地球 icon＋文字整塊可點） */
.lang {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 8px; margin: 13px -8px 0 0; border: 0; border-radius: 4px;
  background: transparent; color: var(--navy);
  font: 500 20px/1.2 var(--font-serif); text-transform: uppercase;
  white-space: nowrap; flex-shrink: 0; cursor: pointer;
  transition: background-color .2s, color .2s;
}
.lang-icon { width: 22px; height: 22px; flex-shrink: 0; fill: currentColor; }
/* 同時顯示「中文 / EN」：目前所在的語言為深藍，另一個語言為灰色（hover 時變亮藍，提示可點） */
.lang-opt, .lang-sep { color: #9aa7bd; transition: color .2s; }
.lang-opt.is-current { color: var(--navy); }
.lang-opt:not(.is-current):hover { color: #0667e2; }
.lang:hover { background: rgba(255,255,255,.6); color: #0667e2; }
.lang:focus-visible { outline: 2px solid #0667e2; outline-offset: 2px; }

.hero-body { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; margin-top: 27px; }

/* 10 週年 logo */
.logo { position: relative; width: 400px; max-width: 100%; aspect-ratio: 400 / 87; }
.logo img { width: 100%; height: 100%; object-fit: contain; }
.slogan { font-family: var(--font-sans); font-weight: 400; font-size: 82px; line-height: 1; text-transform: uppercase; white-space: nowrap; }
.slogan-where { display: block; color: var(--navy); }
/* 標語漸層：Figma 色 #006eff → #0dd1bd；角度 6 秒旋轉 360°，全程不停，綠色端經過 HEALTH（+130°）時放慢到約 60% 速度
   關鍵影格由 v = 360(1 - 0.4·cos 2π(t - t0)) 積分產生，循環接點速度連續 */
.slogan-grad {
  display: block; color: transparent;
  background: linear-gradient(calc(100.35deg + var(--rot)), #006eff 2.2%, #0dd1bd 89.1%);
  -webkit-background-clip: text; background-clip: text;
  animation: grad-rotate 6s linear infinite;
}
@keyframes grad-rotate {
  0% { --rot: 0.0deg; }
  5% { --rot: 23.0deg; }
  10% { --rot: 44.2deg; }
  15% { --rot: 63.3deg; }
  20% { --rot: 80.1deg; }
  25% { --rot: 94.8deg; }
  30% { --rot: 107.7deg; }
  35% { --rot: 119.3deg; }
  40% { --rot: 130.2deg; }
  45% { --rot: 141.2deg; }
  50% { --rot: 152.8deg; }
  55% { --rot: 165.8deg; }
  60% { --rot: 180.6deg; }
  65% { --rot: 197.5deg; }
  70% { --rot: 216.7deg; }
  75% { --rot: 238.0deg; }
  80% { --rot: 261.1deg; }
  85% { --rot: 285.5deg; }
  90% { --rot: 310.6deg; }
  95% { --rot: 335.6deg; }
  100% { --rot: 360.0deg; }
}

.slogan-grad span, .slogan-grad b { display: block; }
.slogan-grad span { line-height: 1.0976; }            /* 90 / 82 */
.slogan-grad b { font-weight: 800; font-size: 1.2073em; line-height: .8485; }   /* 99px；Figma 此段總高 264 → 末行 84 */

.expo { display: flex; flex-direction: column; gap: 8px; }
.expo-name {
  font-size: 60px; font-weight: 700; line-height: normal; letter-spacing: .16em; white-space: nowrap;
  background: linear-gradient(to bottom, #00aeb4, #0772b5); -webkit-background-clip: text; background-clip: text; color: transparent;
}
html[lang="en"] .expo-name { letter-spacing: 0; }
.expo-date { font-size: 45px; font-weight: 700; line-height: normal; color: #3ac4c9; white-space: nowrap; }
.expo-venue { font-size: 45px; font-weight: 600; line-height: normal; color: #0c6d80; letter-spacing: .1em; white-space: nowrap; }

/* ── 表單區（滿版半透明白底） ── */
.lower { position: relative; overflow: hidden; flex: 1 0 auto; display: flex; flex-direction: column; }
.maker { position: relative; background: rgba(255,255,255,.6); padding: 40px 0; }
/* 頁面底部的綠色漸層：Figma 匯出的圖（BG_L_G），疊在 60% 白底之上、以 HardLight 混合，與設計稿一致
   （不用 CSS 漸層：CSS 會把顏色與透明度一起內插，中段偏黃綠；Figma 是分開內插，中段為青色） */
.maker-tint { position: absolute; left: 0; bottom: 0; width: 1440px; height: 1050px; background: url(uploads/bg_tint.webp) 0 0 / 100% 100% no-repeat; mix-blend-mode: hard-light; pointer-events: none; }
.maker-inner { display: flex; flex-direction: column; align-items: center; gap: 30px; }
.maker-title { align-self: stretch; display: flex; align-items: center; gap: 12px; font-size: 32px; font-weight: 800; line-height: 46px; }
.maker-title::before { content: ''; width: 4px; height: 40px; border-radius: 1px; background: var(--grad-bar); flex-shrink: 0; }

.fields { width: 800px; max-width: 100%; display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; column-gap: 14px; row-gap: 16px; }
.fields > label, .tpl-label { font-size: 24px; font-weight: 700; line-height: 36.4px; text-align: right; white-space: nowrap; }
.fields input[type="text"] {
  width: 100%; height: 56px; min-width: 0; padding: 0 16px;
  background: #fff; border: 1.4px solid #e5e5e5; border-radius: 7px;
  font: 800 22px/1 var(--font-serif); color: var(--navy);
  transition: border-color .15s, box-shadow .15s;
}
.fields input[type="text"]:hover { border-color: #b9d3ef; }
.fields input[type="text"]:focus { outline: none; border-color: #0667e2; box-shadow: 0 0 0 3px rgba(6,103,226,.15); }

/* 模板選擇 */
.tpl-options { display: flex; gap: 14px; border: 0; min-width: 0; }
html[lang="en"] .fields > label, html[lang="en"] .tpl-label { text-align: left; }
html[lang="en"] .tpl-label { grid-column: 1 / -1; }
html[lang="en"] .tpl-options { grid-column: 1 / -1; }
.tpl {
  position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 11px; background: #fff; border: 1px solid #e5e5e5; border-radius: 10px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.tpl:hover { padding: 10px; border: 2px solid #9cc3ee; }
.tpl:has(input:checked) { padding: 10px; border: 2px solid var(--blue); }
.tpl:has(input:checked) .tpl-pick { color: var(--blue); }
.tpl:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(6,103,226,.25); }
.tpl-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 48px; font-size: 24px; font-weight: 700; line-height: 36.4px; text-align: center; white-space: nowrap; }
html[lang="en"] .tpl-pick { min-width: 0; font-size: 20px; }   /* Figma 英文稿：Landscape／Portrait 20px */
.tpl input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; border-radius: 50%; background: #fff; border: 1px solid #d1d5db; box-shadow: inset 0 0 0 2.5px #fff; cursor: pointer; }
.tpl input:checked { background: var(--blue); box-shadow: inset 0 0 0 4px #fff; }
.tpl input:focus { outline: none; }
/* 預覽區：固定 246×174 淺色底，直式預覽圖置中 */
.tpl-stage { flex: 0 0 auto; width: 246px; height: 174px; display: flex; align-items: center; justify-content: center; border-radius: 4px; background: #eaf2f8; overflow: hidden; }
.tpl-stage img { height: 100%; width: auto; max-width: 100%; }

.btns { width: 800px; max-width: 100%; display: flex; gap: 16.8px; }
.btn {
  flex: 1 1 0; min-width: 0; height: 58.4px; padding: 0 14px;
  background: var(--orange); border: .7px solid var(--orange-dark); border-radius: 8.4px;
  font: 800 32px/1 var(--font-serif); color: #fff; white-space: nowrap;
  cursor: pointer; transition: filter .15s, transform .12s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 5px 12px rgba(193,80,27,.22); }
.btn:active { filter: brightness(.95); transform: translateY(0); box-shadow: none; }
.btn:focus-visible { outline: 3px solid #0667e2; outline-offset: 2px; }
.btn[disabled] { cursor: progress; transform: none; box-shadow: none; }
/* 產生中：隱藏文字、顯示轉圈（按鈕尺寸不變） */
.btn.is-loading { position: relative; color: transparent; }
.btn.is-loading::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%;
  animation: btn-spin .8s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.copyright { margin-top: auto; padding: 33px 0 20px; font-size: 14px; font-weight: 500; line-height: 1.6; color: #4a5f86; text-align: center; }

/* ── 主辦單位 ── */
.orgs { width: min(800px, calc(100% - 48px)); margin-top: 40px; display: flex; flex-direction: column; gap: 16px; font-size: 24px; font-weight: 500; line-height: normal; color: var(--navy, #0b3b98); }
.org-row { display: flex; align-items: flex-start; }
.org-row dt { flex: 0 0 124px; font-weight: 800; white-space: nowrap; }
html[lang="en"] .org-row dt { flex-basis: 190px; text-align: right; }
.org-row dd { flex: 1 1 0; min-width: 0; margin: 0; }

/* ── 漂浮 QR 卡片（桌機固定右下角；窄螢幕改放在按鈕下方） ── */
.qr-card {
  position: fixed; right: 20px; bottom: 24px; z-index: 50;
  display: flex; flex-direction: column; gap: 10px; width: 230px; padding: 20px;
  border-radius: 10px; background: #1a8fe0 url(uploads/qrcard_bg.webp) center / cover no-repeat;
  color: #fff; text-decoration: none; text-align: center;
  font-size: 24px; font-weight: 500; line-height: normal;
  box-shadow: 0 6px 18px rgba(6,103,226,.18);
  animation: qr-float 3.6s ease-in-out infinite;
  transition: box-shadow .3s ease;
}
.qr-card img { width: 100%; aspect-ratio: 1; border-radius: 10px; }
.qr-card:hover { animation-play-state: paused; box-shadow: 0 0 0 1px rgba(255,255,255,.5), 0 0 22px 4px rgba(18,171,212,.55), 0 6px 18px rgba(6,103,226,.2); }
.qr-card:focus { outline: none; }
.qr-card:focus-visible { outline: 3px solid #0667e2; outline-offset: 3px; }
@keyframes qr-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ── 提示視窗 ── */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.is-open { display: flex; }
.modal-mask { position: absolute; inset: 0; background: rgba(11,40,90,.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-card { position: relative; width: 100%; max-width: 500px; padding: 32px 28px 24px; border-radius: 18px; background: #fff; box-shadow: 0 30px 80px rgba(11,59,152,.3); text-align: center; }
.modal-msg { font-size: 22px; font-weight: 800; line-height: 1.7; margin-bottom: 22px; }
.modal-btn { width: 100%; height: 52px; font-size: 22px; }

@media (prefers-reduced-motion: reduce) {
  .sticky-hdr, .sticky-hdr.is-shown { transition: none; }
  .qr-card { animation: none; }
  .slogan-grad { animation: none; }
  .btn, .tpl { transition: none; }
}

/* ══════════ RWD ══════════ */
/* 1280–1439：卡片縮小，避免壓到表單 */
@media (max-width: 1439px) {
  .qr-card { width: 196px; padding: 17px; gap: 8px; font-size: 20px; border-radius: 9px; }
}
/* ≤1279：卡片改放在按鈕下方 */
@media (max-width: 1279px) {
  .qr-card { position: static; animation: none; margin-top: 4px; }
}
@media (max-width: 1100px) {
  .hero { min-height: 0; padding-bottom: 56px; }
  .slogan { font-size: 68px; }
  .expo-name { font-size: min(52px, 5.4vw); white-space: normal; }
  .expo-date, .expo-venue { font-size: min(38px, 4.2vw); white-space: normal; }
  /* 模板卡片：寬度不夠時預覽區等比例縮小 */
  .tpl-options { min-width: 0; }
  .tpl-stage { flex: 1 1 auto; min-width: 0; width: auto; max-width: 246px; height: auto; aspect-ratio: 246 / 174; }
  .bg-hero { width: 1080px; height: 788px; }
}
@media (max-width: 768px) {
  .wrap { width: calc(100% - 32px); }
  .hero { padding: 24px 0 40px; }
  .title { font-size: 36px; line-height: 44px; }
  .lang { font-size: 17px; margin-top: 6px; gap: 6px; }
  .sticky-hdr { height: 60px; }
  .sticky-logo img { height: 36px; }
  .lang-icon { width: 20px; height: 20px; }
  .hero-body { margin-top: 24px; gap: 14px; }
  .logo { width: 260px; }
  .slogan { font-size: min(10vw, 52px); }
  .expo { gap: 4px; }
  .expo-name { font-size: min(7.2vw, 34px); }
  .expo-date, .expo-venue { font-size: min(5.2vw, 23px); }
  .bg-hero { width: 720px; height: 525px; opacity: .6; }   /* 手機上底圖會疊在標語後面，調淡讓文字好讀 */
  .bg-glow { left: -238px; }
  .bg-glow2 { display: none; }
  .bg-city { width: 520px; height: 340px; }

  .maker { padding-top: 32px; }
  .maker-inner { gap: 22px; }
  .maker-title { font-size: 22px; line-height: 1.4; gap: 10px; }
  .maker-title::before { height: 28px; }
  .fields { grid-template-columns: 1fr; row-gap: 6px; }
  .fields > label, .tpl-label { font-size: 19px; line-height: 1.5; text-align: left; }
  .fields input[type="text"] { height: 50px; font-size: 19px; margin-bottom: 10px; }
  .tpl-options { gap: 10px; margin-bottom: 10px; }
  .tpl { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 6px; padding: 7px; }   /* A／B 版文字在預覽圖上方 */
  .tpl:hover, .tpl:has(input:checked) { padding: 6px; }
  .tpl-stage { width: 100%; max-width: none; height: auto; aspect-ratio: 246 / 174; }
  .tpl-pick { flex-direction: row; gap: 6px; font-size: 17px; line-height: 1.4; min-width: 0; }
  html[lang="en"] .tpl-pick { min-width: 0; font-size: 17px; }
  html[lang="en"] .tpl-pick br { display: none; }
  .tpl input { width: 18px; height: 18px; }
  .btns { gap: 10px; }
  .btn { height: 52px; font-size: 21px; padding: 0 10px; }
  .qr-card { width: 170px; padding: 14px; gap: 6px; font-size: 17px; }
  .copyright { padding-top: 32px; font-size: 12px; }
  /* 主辦單位：標題在上、內容在下，置中 */
  .orgs { width: calc(100% - 32px); margin-top: 32px; gap: 20px; font-size: 17px; line-height: 1.6; }
  .org-row { flex-direction: column; align-items: center; text-align: center; }
  .org-row dt, html[lang="en"] .org-row dt { flex: none; text-align: center; margin-bottom: 4px; }
  .org-row dt::after { content: ''; display: block; width: 40px; height: 2px; background: currentColor; margin: 4px auto 0; }
  .org-sep { display: none; }
  .modal-card { padding: 28px 20px 22px; border-radius: 16px; }
  .modal-msg { font-size: 19px; }
  .modal-btn { height: 48px; font-size: 19px; }
}
@media (max-width: 380px) {
  .btns { flex-direction: column; }
  .btn { flex: none; width: 100%; }
}
