@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&display=swap');
:root{--primary:#2563eb;--primary-600:rgba(37, 99, 235, 0.3);--accent:#940c00;--bg:#ffffff;--surface:#ffffff;--surface-2:#f9fafb;--surface-3:#f3f4f6;--text:#111827;--text-2:#374151;--text-3:#6b7280;--border:#e5e7eb;--shadow:0 10px 30px rgba(17,24,39,.08)}
* {box-sizing: border-box}
html, body {margin: 0; padding: 0; overflow-x: hidden}
html {scroll-behavior: smooth; -webkit-text-size-adjust: 100%}
body {font-family: "Noto Sans TC", "Segoe UI", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, Arial, sans-serif; background: linear-gradient(180deg, #ffffff, #f9fafb); color: var(--text); line-height: 1.65; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-kerning: normal; font-feature-settings: "pnum" on, "lnum" on}

/* 微調全站段落間距，提升可讀性 */
p {margin: 0 0 .9rem}
.container {width: min(1100px, 90%); margin-inline: auto}
/* Full-width container variant for footer */
.container.no-fcontainer { width: 100%; max-width: none; margin-inline: 0; padding-inline: 16px; }

/* Header */
.site-header {position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: transparent; backdrop-filter: none; border-bottom: 1px solid transparent; transition: all 0.3s ease;  /* background-image: url('../img/ball.gif'); */ background-size: 280px 280px; background-position: center center; background-repeat: no-repeat; background-blend-mode: overlay; opacity: 0.8}
.site-header.scrolled {background: rgba(255,255,255,.95); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--border); background-image: none}
/* 讓內容不被固定導航覆蓋，動態高度由 JS 設定 --header-offset */
body { padding-top: var(--header-offset, 64px); }
.nav {display: flex; align-items: center; justify-content: space-between; min-height: 56px; max-width: 1200px; margin: 0 auto; padding: 0 20px}
.brand {display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-size: 1.1rem}
.brand-text {font-weight: 700; letter-spacing: .02em}
.nav-links {display: flex; align-items: center; gap: 1.5rem}
.nav-links a {color: var(--text-2); text-decoration: none; padding: .5rem .8rem; border-radius: .6rem; font-weight: 500; font-size: 0.95rem; transition: all 0.2s ease}
.nav-links a:hover {color: var(--text); background: rgba(0,0,0,.04)}
.nav-toggle {display: none; background: none; border: 0; color: var(--text); font-size: 1.5rem}

/* 导航栏下拉菜单 - 鼠标悬停显示 */
.nav-dropdown {
  position: relative;
}

.nav-dropdown .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 1001;
  padding: 8px 0;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown:hover .dropdown-menu {
  display: flex;
}

.dropdown-menu a {
  display: block;
  padding: 10px 24px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 6px;
  width: 100%;
  text-align: left;
}

.dropdown-menu a:hover {
  background: var(--surface-2);
  color: var(--primary);
}

/* Hero */
.hero {position: relative; isolation: isolate; padding:0 0 68px}
.hero-grid {display: grid; grid-template-columns: 280px 1fr; gap: 40px; align-items: start}
.hero-nav {position: sticky; top: 100px}
.service-nav {background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)); border: 1px solid var(--border); border-radius: 14px; padding: 20px; box-shadow: var(--shadow)}
.service-nav h3 {margin: 0 0 16px; font-size: 18px; color: var(--text); font-weight: 600}
.service-nav ul {list-style: none; padding: 0; margin: 0}
.service-nav li {margin-bottom: 8px}
.service-nav a {display: block; padding: 10px 16px; color: var(--text-2); text-decoration: none; border-radius: 8px; transition: all 0.2s ease; font-size: 14px; font-weight: 500}
.service-nav a:hover {background: var(--surface-2); color: var(--primary); transform: translateX(4px)}
.hero-content {position: relative}
.hero-inner {position: relative; text-align: center}
.hero-title {font-size: clamp(28px, 4.2vw, 44px); line-height: 1.2; margin: -50px 0 12px}
.hero-subtitle {margin: 0 auto 24px; color: var(--text-2); max-width: 760px}
.hero .hl {color: var(--primary)}
.hero-ctas {display: flex; gap: 12px; justify-content: center}
.hero.playable {cursor: pointer}
.hero .hero-bg.is-gif {
  padding-top: 600px;
  background: radial-gradient(600px 300px at 50% -10%, #98b4f0, transparent 50%),
              radial-gradient(400px 200px at 10% 10%, rgba(169, 5, 5, 0.2), transparent 50%),
              radial-gradient(500px 260px at 90% 20%, rgba(204, 39, 6, 0.1), transparent 50%),
              url('../img/bg9.png');
  background-size: auto, auto, auto, cover;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-position: center, center, center, center;
  transition: opacity .6s ease;
}

/* hero-bg GIF responsive overrides - keep desktop unchanged */
@media (max-width: 1024px) {
  .hero .hero-bg.is-gif {
    /* 將固定高度改為相對視窗高度，避免小螢幕過高 */
    padding-top: clamp(280px, 40vh, 520px);
    /* 僅最後一層圖像改為 contain，避免被裁切；前面三層為漸層維持 auto */
    background-size: auto, auto, auto, contain;
    /* 前三層維持置中，最後一層微調到頂部置中以提升可視範圍 */
    background-position: center, center, center, center top;
  }
}
@media (max-width: 640px) {
  .hero .hero-bg.is-gif {
    /* 手機進一步調整高度比例 */
    padding-top: clamp(220px, 50vh, 480px);
    background-size: auto, auto, auto, contain;
    background-position: center, center, center, center top;
  }
}
.hero-bg {position: absolute; inset: 0; z-index: -1; background: radial-gradient(600px 300px at 50% -10%, rgba(169, 5, 5, 0.2), transparent 50%), radial-gradient(400px 200px at 10% 10%, rgba(169, 5, 5, 0.2), transparent 50%), radial-gradient(500px 260px at 90% 20%, rgba(169, 5, 5, 0.2), transparent 50%)}

/* Sections */
.section {padding: 72px 0; border-top: 1px solid var(--border)}
/* section-alt 內容居中顯示 */
.section-alt {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  
}

.section-alt .container {
  display: flex;
  flex-direction: column;
  align-items: center; /* 水平居中 */
  justify-content: center; /* 垂直居中 */
}

.section-alt .section-head {
  text-align: center; /* 標題文字居中 */
}

.section-alt .grid,
.section-alt .cards-3,
.section-alt .cards-4 {
  justify-content: center; /* 網格內容居中 */
}

.section-head {margin-bottom: 28px; text-align: center}
.section-head.left {text-align: left}
.section-head h2 {margin: 0 0 8px; font-size: clamp(22px, 3vw, 28px)}
.section-head p {margin: 0; color: var(--text-2)}

/* Buttons */
.btn {display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .8rem 1.1rem; border-radius: .8rem; border: 1px solid var(--border); text-decoration: none; color: var(--text); box-shadow: var(--shadow)}
.btn-primary {background: linear-gradient(180deg, var(--primary), var(--primary-600)); border-color: transparent; color: #111827}
.btn-primary:hover {filter: brightness(1.05)}
.btn-ghost {background: transparent}

/* Cards */
.grid {display: grid; gap: 20px}
.cards-2 {grid-template-columns: repeat(2, 1fr)}
.cards-3 {grid-template-columns: repeat(3, 1fr)}
.cards-4 {grid-template-columns: repeat(4, 1fr)}
.card {background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)); border: 1px solid var(--border); border-radius: 14px; padding: 22px; box-shadow: var(--shadow)}
.card .icon {display: grid; place-items: center; width: 100%; max-width: 310px; height: 156px; border-radius: 12px; background: rgba(136, 169, 5, 0.507); color: var(--primary); margin: 0 auto 10px}
.card h3 {margin: 6px 0 6px; font-size: 18px}
.card p {margin: 0; color: var(--text-2)}

/* Gallery */
.gallery {grid-template-columns: repeat(3, 1fr)}
.work {margin: 0}
.work .ph {width: 100%; height: auto; display: block}
.work figcaption {font-size: 14px; color: var(--text-3); margin-top: 8px}

/* Flip card for portfolio */
.gallery .work {position: relative; aspect-ratio: 3/2; perspective: 1000px; border-radius: 16px; cursor: pointer}
.gallery .work .ph, .gallery .work figcaption {position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.22,1,.36,1), box-shadow .3s ease}
.gallery .work .ph {width: 100%; height: 100%; display: block; position: relative; overflow: hidden}
.work .ph::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* background: url('../img/ball.gif') center/contain no-repeat; */
    opacity: 0.15;
    z-index: 1;
    animation: float 3s ease-in-out infinite;
}
.work .ph::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    z-index: 2;
}
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(180deg); }
}
.gallery .work figcaption {margin-top: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(180deg, var(--primary), var(--primary-600)); color: #111827; text-align: center; transform: rotateY(180deg); font-size: 16px}
.gallery .work figcaption::after {content: ""; white-space: pre; display: block; font-size: 12px; color: rgba(17,24,39,.75); margin-top: 6px}
.gallery .work:hover .ph, .gallery .work.flipped .ph {transform: rotateY(180deg)}
.gallery .work:hover .ph::before, .gallery .work.flipped .ph::before { opacity: 0.3; animation-duration: 1.5s; }
.gallery .work:hover .ph::after { opacity: 0; }
.gallery .work:hover figcaption, .gallery .work.flipped figcaption {transform: rotateY(360deg)}
.gallery .work:focus-visible {outline: 2px solid var(--primary); outline-offset: 4px}

@media (max-width: 900px){
  .gallery .work {aspect-ratio: 4/3}
}
/* Two columns */
.two-col2 {display: grid; grid-template-columns: 2fr 0fr; gap: 24px; align-items: start}
.two-col {display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start}
.about-card {display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)); border: 1px solid var(--border); border-radius: 14px; padding: 18px}
.kpi {display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 12px; padding: 18px}
.kpi strong {font-size: 22px}
.kpi span {color: var(--text-3); font-size: 12px}

/* Two columns v2 - two-col2 */
.section-alt .container.two-col2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  align-items: center;
  justify-content: center; /* 在 section-alt 內也能置中 */
}

.two-col2 .col { padding: 0; }

.two-col2 h2 {
  margin: 0 0 12px;
  font-size: clamp(22px, 3vw, 28px);
  text-align: left; /* 覆寫 section-alt 置中 */
}

.two-col2 p {
  color: var(--text-2);
  margin: 0 0 12px;
  text-align: left; /* 覆寫 section-alt 置中 */
}

.two-col2 img {
  width: 100%;
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: block;
  object-fit: cover;
}

.two-col2 .btn { margin-top: 16px; }

/* 第二欄使用網格置中元素，並去除內聯 padding-top 對齊需求 */
.two-col2 .col:last-child {
  padding-top: 0 !important;
  display: grid;
  gap: 16px;
  justify-items: center;
}

@media (max-width: 900px) {
  .section-alt .container.two-col2 {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .two-col2 h2,
  .two-col2 p { text-align: center; }
  .two-col2 .col:last-child { order: 2; }
}

@media (max-width: 640px) {
  .section-alt .container.two-col2 { gap: 16px; }
}

/* section-alt 自適應：保留桌面端，優化平板與手機呈現 */
@media (max-width: 1024px) {
  .section.section-alt { padding: 56px 0; }
  .section-alt .container { padding-left: 16px; padding-right: 16px; }
  .section-alt .grid { gap: 16px; }
  .section-alt img { max-width: 100%; height: auto; display: block; }
}
@media (max-width: 640px) {
  .section.section-alt { padding: 48px 0; }
  .section-alt .container { padding-left: 12px; padding-right: 12px; }
  .section-alt .grid { gap: 12px; }

  /* 避免圖片在手機端扭曲或裁切 */
  .section-alt img,
  .section-alt .container img,
  .section-alt .two-col2 img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center top !important;
    /* 防止 inline 樣式影響布局 */
    display: block !important;
  }

  /* 防止多欄導致內容擠壓或顯示不全（覆蓋 inline style="columns: 3;"） */
  .section.section-alt {
    columns: auto !important;
    column-count: 1 !important;
    column-gap: 16px;
  }

  /* 容器允許內容自然溢出顯示 */
  .section-alt .container,
  .section-alt .grid,
  .section-alt .cards-3,
  .section-alt .cards-4 {
    overflow: visible;
  }
}

/* two-col 在 section-alt 中的斷點行為 */
@media (max-width: 900px) {
  .section-alt .container.two-col { grid-template-columns: 1fr; gap: 20px; }
  .two-col h2, .two-col p { text-align: center; }
  .two-col .col:last-child { order: 2; }
}
@media (max-width: 640px) {
  .section-alt .container.two-col { gap: 16px; }
}

/* #about 段落：保留 PC 端樣式，移動端自適應修正 */
@media (max-width: 1024px) {
  #about .container.two-col { gap: 20px; }
  #about .about-card { grid-template-columns: 1fr; justify-items: center; }
}
@media (max-width: 640px) {
  /* 佈局改為單欄，避免擠壓 */
  #about .container.two-col { grid-template-columns: 1fr; gap: 16px; }

  /* 圖片避免扭曲與溢出（覆蓋 inline width/height） */
  #about .about-card img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    object-fit: contain !important;
    object-position: center top !important;
    margin-left: auto; margin-right: auto;
  }
}

/* Contact */
.contact {grid-template-columns: 1.1fr 1.9fr; gap: 32px}
.contact-info {background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: 0 4px 16px rgba(0,0,0,0.05)28px}
.form {background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)); border: 1px solid var(--border); border-radius: 14px; padding: 24px}
.field {display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px}
.field label {font-weight: 500; color: var(--text-2)}
.field input, .field textarea, .field select {width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: inherit; font-size: 16px; line-height: 1.5; caret-color: var(--primary)}
.field input::placeholder, .field textarea::placeholder {color: var(--text-3)}
.field textarea {min-height: 120px; resize: vertical}

/* Horizontal align label and input in .field on >=640px */
@media (min-width: 640px){
  .field { flex-direction: row; align-items: center; gap: 12px; }
  .field label { min-width: 160px; margin: 0; }
  .field input, .field textarea, .field select { flex: 1 1 auto; width: auto; }
}

/* 焦點樣式：增加可見度與可用性 */
.field input:focus, .field textarea:focus, .field select:focus {outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); background: #fff}
.form-tip {margin: .6rem 0 0; color: var(--text-3); font-size: 13px}

/* Center contact section vertically */
#contact .container { min-height: 100vh; }

/* Contact Actions - 美化聯繫按鈕區塊 */
.contact-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7));
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    backdrop-filter: blur(10px);
}

.contact-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.contact-link:active {
    transform: translateY(0);
}

.contact-link img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.contact-link span {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
}

.contact-link.fb:hover {
    background: linear-gradient(135deg, rgba(24,119,242,0.1), rgba(13,71,185,0.05));
    border-color: #1877f2;
}

.contact-link.wa:hover {
    background: linear-gradient(135deg, rgba(37,211,102,0.1), rgba(18,140,126,0.05));
    border-color: #25d366;
}

@media (max-width: 900px) {
    .contact {grid-template-columns: 1fr; gap: 24px}
    .contact-link {
        padding: 18px 20px;
    }
    .contact-link img {
        width: 42px;
        height: 42px;
    }
    .contact-link span {
        font-size: 15px;
    }
}

/* Footer */
.site-footer { border-top: 1px solid #1f2937; padding: 32px 0; background: #0b0f14; color: #e5e7eb; }
.site-footer a { color: #e5e7eb; }
.site-footer .footer-inner { display: block; }
.site-footer .footer-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; align-items: start; }
.site-footer .footer-col h4 { margin: 0 0 12px; font-size: 16px; color: #ffffff; }
.site-footer .footer-col p { margin: 4px 0; color: #cbd5e1; }
.site-footer .footer-col ul { list-style: none; padding: 0; margin: 0; }
.site-footer .footer-col ul li a { color: #cbd5e1; text-decoration: none; display: inline-block; padding: 4px 0; }
.site-footer .footer-col ul li a:hover { color: #ffffff; }
.site-footer .footer-bottom { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #1f2937; margin-top: 24px; padding-top: 16px; }
.site-footer .to-top { color: #cbd5e1; text-decoration: none; border: 1px solid #334155; padding: .25rem .65rem; border-radius: .6rem; }
.site-footer .to-top:hover { color: #ffffff; border-color: #475569; }
@media (max-width: 900px){ .site-footer .footer-columns { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px){ .site-footer .footer-columns { grid-template-columns: 1fr; } }

/* Utilities */
.ticks {list-style: none; padding-left: 0; margin: 16px 0 0}
.ticks li {position: relative; padding-left: 22px}
.ticks li::before {content: "✔"; position: absolute; left: 0; color: var(--accent)}

/* Responsive */
@media (max-width: 900px){
  .hero-grid {grid-template-columns: 1fr; gap: 24px}
  .hero-nav {position: static; margin-bottom: 20px}
  .service-nav {padding: 16px}
  .cards-2, .cards-3, .gallery {grid-template-columns: repeat(2, 1fr)}
  .contact {grid-template-columns: 1fr}
  .two-col {grid-template-columns: 1fr}
}
@media (max-width: 640px){
  .nav-links {position: absolute; top: 64px; right: 5%; left: 5%; flex-direction: column; gap: .4rem; padding: .6rem; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.95); display: none}
  .nav-links.open {display: flex}
  .nav-toggle {display: block}
  .cards-2, .cards-3, .gallery {grid-template-columns: 1fr}
  .features-grid {grid-template-columns: 1fr; gap: 20px; margin: 32px 0;}
  .feature-item {padding: 24px 20px; border-radius: 14px;}
  .feature-item h4::before {margin-right: 6px; font-size: 0.9em;}
}
/* Motion */
@media (prefers-reduced-motion: no-preference){
  .reveal {opacity: 0; transform: translateY(16px) scale(.98); filter: blur(2px)}
  .reveal.inview {opacity: 1; transform: none; filter: none; transition: opacity .7s ease, transform .7s cubic-bezier(.22,1,.36,1), filter .5s ease}
  .anim-jump {transform: translateY(24px) scale(.96)}
  .anim-jump.inview {animation: jump-in .7s cubic-bezier(.22,1,.36,1) both}
  .stagger > * {transition-delay: calc(var(--i,0) * 90ms)}
  .stagger-jump > * {animation-delay: calc(var(--i,0) * 90ms)}
}
@keyframes jump-in{
  0% {opacity: 0; transform: translateY(24px) scale(.96)}
  60% {opacity: 1; transform: translateY(-6px) scale(1)}
  100% {transform: translateY(0) scale(1)}
}
/* Reduced motion: show immediately */
@media (prefers-reduced-motion: reduce){
  .reveal {opacity: 1 !important; transform: none !important; filter: none !important}
}

/* Floating Actions */
.floating-actions {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 950; /* 低於 header(1000) 以避免干擾 */
    pointer-events: none; /* 不阻擋頁面其他區域點擊 */
}
.floating-actions .floating-btn { pointer-events: auto; }

@media (max-width: 640px) {
    .floating-actions {
        gap: 12px;
    }
    .floating-btn {
        width: 52px;
        height: 52px;
    }
    .floating-btn img {
        width: 20px;
        height: 20px;
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(50px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(-10px);
    }
    70% {
        transform: scale(0.9) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes glow {
    0% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(37, 99, 235, 0.6), 0 0 20px rgba(37, 99, 235, 0.3); }
    100% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4); }
}

.floating-btn {
    animation: bounceIn 0.6s ease-out;
}

.floating-btn:nth-child(1) {
    animation-delay: 0.1s;
}

.floating-btn:nth-child(2) {
    animation-delay: 0.2s;
}

.floating-btn:nth-child(3) {
    animation-delay: 0.3s;
}

.floating-btn:hover {
    animation: glow 1.5s infinite;
}

/* 懸浮按鈕顏色 */
#topBtn {
  background: linear-gradient(135deg, var(--accent), #6a0000);
  color: #fff;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

#topBtn.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

#contactBtn {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
}
#shareBtn {
  background: linear-gradient(135deg, #1877f2, #0d47b9);
  color: #fff;
}

.floating-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.floating-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.floating-btn:active {
    transform: translateY(-1px) scale(0.95);
    box-shadow: 0 2px 15px rgba(0,0,0,0.2);
}

.floating-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.floating-btn:active::before {
    width: 100px;
    height: 100px;
}

.floating-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.floating-btn.clicked::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 120px;
        height: 120px;
        opacity: 0;
    }
}



/* Language Switch */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  margin-left: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  background: transparent;
}

.lang-switch:hover,
.lang-switch:focus {
  background: var(--accent);
  color: white;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .lang-switch {
    margin-left: 0;
    margin-top: 0.5rem;
    width: 100%;
    justify-content: center;
  }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-links a,
  .nav-links .btn {
    margin: 0.25rem 0;
  }
}
/* Government Fund Page Styles */
.content-section { padding: 60px 0; }
.hero { text-align: center; padding: 80px 0; background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(148, 12, 0, 0.1)); }
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; color: var(--text); }
.hero p { font-size: 1.2rem; color: var(--text-2); max-width: 600px; margin: 0 auto; }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin: 48px 0; }
.feature-item { 
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.98)); 
  border: 1px solid var(--border); 
  border-radius: 16px; 
  padding: 32px 28px; 
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}
.feature-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  border-color: var(--primary);
}
.feature-item h4 { 
  color: var(--primary); 
  margin-bottom: 16px; 
  font-size: 1.25rem;
  font-weight: 600;
  position: relative;
}
.feature-item h4::before {
  content: "✓";
  display: inline-block;
  margin-right: 8px;
  color: var(--accent);
  font-weight: bold;
}
.feature-item p { 
  color: var(--text-2); 
  margin: 0; 
  line-height: 1.6;
  font-size: 0.95rem;
}

.cta-section { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; padding: 60px 0; text-align: center; }
.cta-section .big-text { font-size: 2rem; margin-bottom: 30px; }
.consultation-form { max-width: 500px; margin: 0 auto; }
.consultation-form input,
.consultation-form textarea { width: 100%; padding: 12px; margin-bottom: 16px; border: none; border-radius: 8px; background: rgba(255, 255, 255, 0.9); }
.consultation-form button { background: white; color: var(--primary); border: none; padding: 12px 24px; border-radius: 8px; font-weight: bold; cursor: pointer; }

/* Marquee (gundong) */
.gundong { position: relative; overflow: hidden; width: 100%; padding: 10px 0; }
.gundong .marquee { display: inline-flex; align-items: center; gap: 2rem; white-space: nowrap; will-change: transform; animation: marquee var(--marquee-duration, 15s) linear infinite; }
.gundong:hover .marquee { animation-play-state: paused; }
.gundong li { list-style: none; display: inline-block; margin: 0; padding: 0 .75rem; font-weight: 600; color: var(--text); }
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.card .icon { overflow: hidden; }
.card .icon .icon-img,
.card .icon img.icon-img { 
  width: 100%; 
  height: 100%; 
  max-width: 100%;
  max-height: 100%;
  object-fit: cover; 
  border-radius: inherit;
  display: block; 
}
#power { padding: 30px 0; }
.guanggao { display: flex; align-items: center; gap: .75rem; justify-content: center; text-align: center; }
.guanggao .ad-icon { color: var(--primary); filter: drop-shadow(0 1px 1px rgba(0,0,0,.06)); flex-shrink: 0; }
.guanggao h2 { margin: 0; font-size: 1.25rem; }
.card .icon { overflow: hidden; }
.card .icon .icon-img,
.card .icon img.icon-img { 
  width: 100%; 
  height: 100%; 
  max-width: 100%;
  max-height: 100%;
  object-fit: cover; 
  border-radius: inherit;
  display: block; 
}

/* Enlarge cards-2 grid cards and image container */
.grid.cards-1 { gap: 28px; }
.grid.cards-1 .card { padding: 26px; }
.grid.cards-1 .card .icon { max-width: none; height: 300px; }
@media (max-width: 1024px){ .grid.cards-2 .card .icon { height: 240px; } }
@media (max-width: 640px){ .grid.cards-2 .card .icon { height: 220px; } }

/* Contact Us Footer Section */
.contact-us-footer {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(148, 12, 0, 0.03));
  border-top: 1px solid var(--border);
  padding: 80px 0 60px 0;
  margin-top: 60px;
}

/* Contact Footer Section - SDMC Style */
.contact-footer {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(148, 12, 0, 0.05));
  border-top: 1px solid var(--border);
  padding: 60px 0;
  margin-top: 40px;
}

.contact-footer .container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.contact-footer-header {
  text-align: center;
  margin-bottom: 40px;
}

.contact-footer-title {
  font-size: clamp(28px, 3.5vw, 36px);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.contact-footer-subtitle {
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--primary);
  font-weight: 600;
  margin: 0;
  opacity: 0.9;
}

.contact-footer-form {
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(255,255,255,0.99));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
  max-width: 800px;
  margin: 0 auto;
  backdrop-filter: blur(10px);
}

.contact-footer-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 28px;
}

.contact-footer-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-footer-field.full-width {
  grid-column: 1 / -1;
}

.contact-footer-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 2px;
}

.contact-footer-input,
.contact-footer-select,
.contact-footer-textarea {
  width: 100%;
  padding: 16px 20px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.contact-footer-input:focus,
.contact-footer-select:focus,
.contact-footer-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.contact-footer-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.contact-footer-submit {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: white;
  border: none;
  padding: 18px 32px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: inherit;
}

.contact-footer-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.3);
  background: linear-gradient(135deg, #2563eb, #1e40af);
}

/* WPCF7 Specific Styles for Contact Footer */
.contact-footer .wpcf7-form-control-wrap {
  margin-bottom: 0;
}

.contact-footer .wpcf7-not-valid-tip {
  font-size: 12px;
  color: #dc2626;
  margin-top: 4px;
  font-weight: 500;
}

.contact-footer .wpcf7-response-output {
  margin: 20px 0 0 0;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.contact-footer .wpcf7-mail-sent-ok {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #166534;
}

.contact-footer .wpcf7-validation-errors,
.contact-footer .wpcf7-mail-failed {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

/* Responsive Design */
@media (max-width: 768px) {
  .contact-footer-form {
    padding: 24px;
  }
  
  .contact-footer-form-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .contact-footer-title {
    font-size: 24px;
  }
  
  .contact-footer-subtitle {
    font-size: 18px;
  }
  
  .contact-footer {
    padding: 40px 0;
  }
}

@media (max-width: 480px) {
  .contact-footer-form {
    padding: 20px;
    border-radius: 16px;
  }
  
  .contact-footer-input,
  .contact-footer-select,
  .contact-footer-textarea {
    padding: 14px 16px;
    font-size: 14px;
  }
  
  .contact-footer-submit {
    padding: 16px 24px;
    font-size: 15px;
  }
}

/* Col-inner style for section boxes */
.col-inner {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.99));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.col-inner:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  border-color: var(--primary);
}

.col-inner h2,
.col-inner h3 {
  color: var(--primary);
  margin-bottom: 16px;
}

.col-inner p {
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 16px;
}

.contact-us-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.contact-us-header {
  text-align: center;
  margin-bottom: 48px;
}

.contact-us-title {
  font-size: clamp(36px, 4.5vw, 52px);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.contact-us-subtitle {
  font-size: clamp(22px, 2.8vw, 30px);
  color: var(--primary);
  font-weight: 600;
  margin: 0;
  opacity: 0.9;
}

.contact-us-form {
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(255,255,255,0.99));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px;
  box-shadow: 0 24px 72px rgba(0,0,0,0.08);
  max-width: 760px;
  margin: 0 auto;
  backdrop-filter: blur(10px);
}

.contact-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin-bottom: 32px;
}

.contact-form-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-form-field.full-width {
  grid-column: 1 / -1;
}

.contact-form-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 2px;
}

.contact-form-input,
.contact-form-select,
.contact-form-textarea {
  width: 100%;
  padding: 18px 22px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.contact-form-input:focus,
.contact-form-select:focus,
.contact-form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.contact-form-textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.5;
}

.contact-form-submit {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: white;
  border: none;
  padding: 20px 36px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: inherit;
}

.contact-form-submit:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, #2563eb, #1e40af);
}

@media (max-width: 768px) {
  .contact-us-form {
    padding: 24px;
  }
  
  .contact-form-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .contact-us-title {
    font-size: 28px;
  }
  
  .contact-us-subtitle {
    font-size: 20px;
  }
}

/* 四個步驟樣式 */
.steps-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 48px;
}

.step-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.99));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.step-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #1d4ed8);
  opacity: 0.8;
}

.step-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.step-number {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 16px;
  line-height: 1;
  opacity: 0.9;
}

.step-content h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
}

.step-content p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0;
}

/* 響應式設計 */
@media (max-width: 1024px) {
  .steps-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 640px) {
  .steps-4 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .step-card {
    padding: 24px 20px;
  }
  
  .step-number {
    font-size: 36px;
  }
  
  .step-content h3 {
    font-size: 18px;
  }
}

/* SEO-SEM 表格样式 */
.seo-sem {
  margin: 40px 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.99));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}

.seo-sem h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 24px 0;
  text-align: center;
  position: relative;
}

.seo-sem h3::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #1d4ed8);
  border-radius: 2px;
}

.seo-sem table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.seo-sem th {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: white;
  font-weight: 600;
  font-size: 16px;
  padding: 18px 16px;
  text-align: left;
  border: none;
  position: relative;
}

.seo-sem th:first-child {
  border-top-left-radius: 16px;
}

.seo-sem th:last-child {
  border-top-right-radius: 16px;
}

.seo-sem td {
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  transition: all 0.2s ease;
}

.seo-sem tr:nth-child(even) td {
  background: var(--surface-2);
}

.seo-sem tr:hover td {
  background: var(--surface-3);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.seo-sem tr:last-child td:first-child {
  border-bottom-left-radius: 16px;
}

.seo-sem tr:last-child td:last-child {
  border-bottom-right-radius: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .seo-sem {
    padding: 24px 16px;
    margin: 32px 0;
  }
  
  .seo-sem h3 {
    font-size: 20px;
    margin-bottom: 20px;
  }
  
  .seo-sem table {
    display: block;
    overflow-x: auto;
    border-radius: 12px;
  }
  
  .seo-sem th,
  .seo-sem td {
    padding: 12px 14px;
    font-size: 14px;
    min-width: 120px;
  }
  
  .seo-sem th {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .seo-sem {
    padding: 20px 12px;
  }
  
  .seo-sem h3 {
    font-size: 18px;
  }
  
  .seo-sem th,
  .seo-sem td {
    padding: 10px 12px;
    font-size: 13px;
    min-width: 100px;
  }
}
/* Consent checkbox group */
.consent { display: inline-flex; align-items: center; gap: 10px; }
.consent input[type="checkbox"] { margin-top: 0; }
.consent-text { color: var(--text); line-height: 1.5; }
.consent-text a { color: var(--primary); text-decoration: underline; }

/* Optional: visual cue for disabled submit */
button[disabled], .btn[disabled] { opacity: .6; cursor: not-allowed; }
.consent-text { color: var(--text); line-height: 1.5; }
.consent-text a { color: var(--primary); text-decoration: underline; }
/* Consent checkbox grid - 美觀排列 */
.checkbox-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px 14px; align-items: center }
@media (max-width: 560px){ .checkbox-grid { grid-template-columns: 1fr } }
.cb { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; transition: .2s ease; user-select: none }
.cb:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(37,99,235,.08) }
.cb input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary) }
.cb span { font-size: 15px; color: var(--text) }
.cb:has(input:checked) { background: linear-gradient(180deg, #fff, var(--surface-2)); border-color: var(--primary) }
.cb:focus-within { outline: 3px solid rgba(37,99,235,.15) }
/* Responsive grid to prevent horizontal overflow */
@media (max-width: 1024px){ .cards-4 {grid-template-columns: repeat(2, 1fr)} .cards-3 {grid-template-columns: repeat(2, 1fr)} }
@media (max-width: 640px){ .cards-4, .cards-3 {grid-template-columns: 1fr} }
.site-header.hidden { transform: translateY(-100%); }
/* hero3 專用，確保背景完整顯示且不被裁切 */
.section.hero3{
  background-position:center center;
  background-repeat:no-repeat;
  background-size:contain;
  min-height: min(100vh, 820px);
}

/* 若有內部背景層，不要遮擋 hero3 的背景 */
.section.hero3 .hero-bg{ background: none !important; }

/* hero2 自適應覆蓋：保持 PC 端不變，小螢幕避免背景裁切與位移 */
@media (max-width: 1024px) {
  .section.hero2{
    background-size: contain !important; /* 覆蓋 inline 的 cover */
    background-position: center top !important; /* 提升可視範圍 */
    min-height: min(100vh, 820px) !important; /* 防止過高或過低 */
  }
}
@media (max-width: 640px) {
  .section.hero2{
    background-size: contain !important;
    background-position: center top !important;
    min-height: min(100vh, 720px) !important;
  }
}
/* hero3 專用，確保背景完整鋪滿且不留上下留白 */
.section.hero3{
  background-position:center center;
  background-repeat:no-repeat;
  background-size:cover; /* 由 contain 改為 cover，鋪滿視窗 */
  min-height: 100vh;     /* 視窗等高 */
  padding: 0;            /* 蓋掉 .section 預設 72px 上下間距 */
  border-top: 0;         /* 去除分隔線，避免上方白邊 */
}

/* hero3 自適應覆蓋：保持 PC 端不變，小螢幕避免背景裁切 */
@media (max-width: 1024px) {
  .section.hero3{
    background-size: contain !important; /* 覆蓋 inline 的 cover */
    background-position: center top !important; /* 提升可視範圍 */
    min-height: min(100vh, 820px);
  }
  .section.hero3 .hero-grid{ min-height: min(100vh, 820px); }
}
@media (max-width: 640px) {
  .section.hero3{
    background-size: contain !important;
    background-position: center top !important;
    min-height: min(100vh, 720px);
  }
  /* 手機端略縮內容內距避免擠壓（若已定義會疊加）*/
  .section.hero3 .hero-content{ padding: 24px; }
}

/* 若有內部背景層，不要遮擋 hero3 的背景 */
.section.hero3 .hero-bg{ background: none !important; }
/* hero3 文字定位於右下角 */
.section.hero3 .hero-grid{
  min-height: 100vh;      /* 讓網格高度與首屏一致，便於底部對齊 */
  align-items: stretch;   /* 讓右側內容可撐滿高度 */
}
.section.hero3 .hero-content{
  position: relative;
  display: flex;
  align-items: flex-end;   /* 垂直靠底 */
  justify-content: flex-end; /* 水平靠右 */
  padding: 48px;          /* 與邊緣留間距 */
  text-align: right;      /* 文字靠右對齊 */
}
/* 窄螢幕時略縮內距避免擠壓 */
@media (max-width: 640px){
  .section.hero3 .hero-content{ padding: 24px; }
}

/* SEM 圖片 PC 端間距 */
@media (min-width: 1024px) {
  .work img[src*="sem3.png"],
  .work img[src*="sem4.png"] {
    margin-top: 4rem !important;
    margin-bottom: 2rem !important;
  }
}

/* Grid cards-5 水平滾動佈局 */
.grid.cards-5 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  overflow-x: hidden;
  position: relative;
  transition: grid-template-columns 0.3s ease;
}

.grid.cards-5 .card:nth-child(5) {
  display: none;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.5s ease;
}

.grid.cards-5.show-fifth .card:nth-child(5) {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

.grid.cards-5.show-fifth {
  /* 保持四欄寬度與高度排布，不改變原有布局 */
}

/* 顯示第一個卡片狀態（僅切換第1與第5張卡片）*/
.grid.cards-5.show-first .card:nth-child(1) {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: none;
}

.grid.cards-5.show-first .card:nth-child(5) {
  display: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(100%);
}

/* 顯示第五個卡片狀態（切換第1與第5張卡片）*/
.grid.cards-5.show-fifth .card:nth-child(1) {
  display: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-100%);
}

.grid.cards-5.show-fifth .card:nth-child(5) {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* 滑動按鈕 */
.slide-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  z-index: 10;
}

.slide-left {
  left: -20px;
}

.slide-right {
  right: -20px;
}

.slide-button:hover {
  background: var(--primary-600);
  transform: translateY(-50%) scale(1.1);
}

.slide-button.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Grid cards-5 響應式設計 */
@media (max-width: 1024px) {
  .grid.cards-5 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid.cards-5.show-fifth {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid.cards-5.show-first {
    grid-template-columns: 1fr 0fr 0fr;
  }
  
  .slide-left {
    left: -15px;
  }
  
  .slide-right {
    right: -15px;
  }
  
  .slide-button {
    width: 35px;
    height: 35px;
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  .grid.cards-5 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid.cards-5.show-fifth {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid.cards-5.show-first {
    grid-template-columns: 1fr 0fr;
  }
  
  .slide-left {
    left: -10px;
  }
  
  .slide-right {
    right: -10px;
  }
  
  .slide-button {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .grid.cards-5 {
    grid-template-columns: 1fr;
  }
  
  .grid.cards-5.show-fifth {
    grid-template-columns: 1fr;
  }
  
  .grid.cards-5.show-first {
    grid-template-columns: 1fr;
  }
  
  .slide-left {
    left: -8px;
  }
  
  .slide-right {
    right: -8px;
  }
  
  .slide-button {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

@media (max-width: 640px) {
    .floating-actions {
        gap: 12px;
    }
    .floating-btn {
        width: 52px;
        height: 52px;
    }
    .floating-btn img {
        width: 20px;
        height: 20px;
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(50px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(-10px);
    }
    70% {
        transform: scale(0.9) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes glow {
    0% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(37, 99, 235, 0.6), 0 0 20px rgba(37, 99, 235, 0.3); }
    100% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4); }
}

.floating-btn {
    animation: bounceIn 0.6s ease-out;
}

.floating-btn:nth-child(1) {
    animation-delay: 0.1s;
}

.floating-btn:nth-child(2) {
    animation-delay: 0.2s;
}

.floating-btn:nth-child(3) {
    animation-delay: 0.3s;
}

.floating-btn:hover {
    animation: glow 1.5s infinite;
}

/* 懸浮按鈕顏色 */
#topBtn {
  background: linear-gradient(135deg, var(--accent), #6a0000);
  color: #fff;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

#topBtn.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

#contactBtn {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
}
#shareBtn {
  background: linear-gradient(135deg, #1877f2, #0d47b9);
  color: #fff;
}

.floating-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.floating-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.floating-btn:active {
    transform: translateY(-1px) scale(0.95);
    box-shadow: 0 2px 15px rgba(0,0,0,0.2);
}

.floating-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.floating-btn:active::before {
    width: 100px;
    height: 100px;
}

.floating-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.floating-btn.clicked::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 120px;
        height: 120px;
        opacity: 0;
    }
}



/* Language Switch */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  margin-left: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  background-color: transparent;
  border: 1px solid #fff;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* =====================
   News Page (最新消息) Layout
   ===================== */
.news-layout { 
  display: grid; 
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 24px; 
  align-items: start; 
}
.news-main { min-width: 0; }

.news-main .news-article { margin-bottom: 40px; }

.news-sidebar { 
  position: sticky; 
  top: 96px; 
  align-self: start;
  transition: opacity .2s ease, max-height .25s ease, transform .25s ease;
}

.news-sidebar.scrolling { opacity: .6; }
.news-sidebar.collapsed { 
  max-height: 44px; 
  overflow: hidden; 
  opacity: .3; 
  transform: translateY(-4px);
}

.news-sidebar .sidebar-control {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}
.news-sidebar .sidebar-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: #333;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s ease;
}
.news-sidebar .sidebar-toggle:hover { background: #f5f7fb; }

/* Sidebar widgets */
.news-sidebar .widget {
  background: #fff;
  border: 1px solid #eceff3;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}
.news-sidebar .widget + .widget { margin-top: 16px; }

.news-sidebar .widget-title {
  font-size: 18px;
  margin: 0 0 12px;
}

/* Posts list */
.post-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.post-item { }
.post-link { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.post-link:hover .post-title { text-decoration: underline; }
.post-thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.post-meta { display: flex; flex-direction: column; gap: 4px; }
.post-title { font-size: 15px; line-height: 1.35; margin: 0; }

/* Categories list */
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cat-list a { display: inline-block; padding: 6px 10px; background: #f5f7fb; border: 1px solid #e7ecf3; border-radius: 999px; font-size: 14px; text-decoration: none; color: #333; }
.cat-list a:hover { background: #eef3fb; }

/* Anchor scroll offset */
.news-article { scroll-margin-top: 96px; }

/* ======= Responsive ======= */
@media (max-width: 900px) {
  .news-layout { grid-template-columns: 1fr; }
  .news-sidebar { position: sticky; top: 16px; }
  .post-thumb { width: 64px; height: 64px; }
}

@media (max-width: 640px) {
  .post-thumb { width: 56px; height: 56px; }
  .news-main .news-article { margin-bottom: 32px; }
}

/* 自適應：針對 .bgbg 內的圖片在平板與手機縮放，桌面端維持原樣 */
@media (max-width: 1024px) {
  .bgbg {
    padding-left: 16px;
    padding-right: 16px;
  }
  .bgbg img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
  }
}
@media (max-width: 640px) {
  .bgbg {
    padding-left: 12px;
    padding-right: 12px;
  }
  .bgbg img {
    max-width: 100%;
    width: 100%;
    height: auto;
  }
}
