/* =========================================================
   賴家榮講師 — 首頁樣式
   結構：Tokens → Base → Components → Sections → Animations → RWD
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --navy: #173f7c;
  --navy-600: #1d4f91;
  --blue: #2a7de1;
  --blue-300: #8ec2ee;
  --sky-50: #f5fbff;
  --sky-100: #e7f4fd;
  --sky-200: #cfe6f7;
  --yellow: #ffd84a;
  --yellow-600: #f5b62a;
  --pink: #e8587a;
  --pink-200: #f9c5cf;
  --green: #7cc56a;
  --green-200: #cdeccc;
  --ink: #1f2d3d;
  --ink-2: #4a5a70;
  --white: #fff;

  --radius-sm: 12px;
  --radius: 22px;
  --radius-lg: 32px;
  --shadow-sm: 0 4px 14px rgba(23, 63, 124, .08);
  --shadow: 0 12px 32px rgba(23, 63, 124, .12);
  --shadow-lg: 0 22px 48px rgba(23, 63, 124, .18);

  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-script: "Caveat", cursive;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
  --dur-in: .8s;
  --dur-hover: .25s;

  --header-h: 76px;
  --container: 1200px;
  --gutter: 24px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--white);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
/* 刻意超出容器寬度的裝飾 SVG（波浪左右各多 3%，擺動時才不會露出邊緣） */
.hero__hills, .story__wave, .cta__wave { max-width: none; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, figure { margin: 0; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 999; background: var(--navy); color: #fff; padding: 8px 16px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--navy-600); --fg: #fff;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .8em 1.6em;
  border: 0; border-radius: 999px;
  background: var(--bg); color: var(--fg);
  font-weight: 700; font-size: 1.05rem; letter-spacing: .04em; line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(23, 63, 124, .22);
  transition: transform var(--dur-hover) var(--ease-out), box-shadow var(--dur-hover), background-color var(--dur-hover), color var(--dur-hover);
  overflow: hidden;
  isolation: isolate;
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(23, 63, 124, .28); }
.btn:active { transform: translateY(0) scale(.98); }
.btn__arrow { display: inline-block; font-size: 1.3em; line-height: 0; margin-top: -.08em; transition: transform var(--dur-hover) var(--ease-out); }
.btn:hover .btn__arrow { transform: translateX(5px); }
.btn__icon, .btn svg { width: 1.3em; height: 1.3em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.btn__icon circle { fill: currentColor; stroke: none; }

.btn--navy { --bg: var(--navy-600); }
.btn--yellow { --bg: var(--yellow); --fg: var(--navy); box-shadow: 0 8px 20px rgba(245, 182, 42, .35); }
.btn--outline { --bg: #fff; --fg: var(--navy); border: 2px solid var(--navy-600); box-shadow: none; }
.btn--outline:hover { --bg: var(--navy-600); --fg: #fff; box-shadow: 0 8px 18px rgba(23, 63, 124, .22); }
.btn--sm { font-size: .95rem; padding: .5em 1.3em; }
.btn--lg { font-size: 1.3rem; padding: .85em 2em; border: 3px solid #fff; }

/* 光澤掃過 */
.btn--shine::after {
  content: ""; position: absolute; inset: 0 auto 0 -60%; width: 40%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: skewX(-20deg);
  transition: left .7s var(--ease-out);
}
.btn--shine:hover::after { left: 130%; }
/* 大按鈕外有光圈（overflow: visible），光澤改用背景位移，避免溢出 */
.btn--lg {
  background-image: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, .7) 50%, transparent 65%);
  background-size: 260% 100%; background-position: 130% 0; background-repeat: no-repeat;
  transition: transform var(--dur-hover) var(--ease-out), box-shadow var(--dur-hover), background-position .8s var(--ease-out);
}
.btn--lg:hover { background-position: -30% 0; }

/* 擴散光圈 */
.btn--pulse { overflow: visible; }
.btn--pulse::before {
  content: ""; position: absolute; inset: -3px; border-radius: inherit; z-index: -2;
  border: 3px solid var(--yellow);
  animation: pulseRing 3.2s var(--ease-out) infinite;
}

/* ---------- Highlight (螢光筆) ---------- */
/* 用背景漸層畫底線：換行時每一行都會有（box-decoration-break: clone） */
.hl {
  --hl-color: var(--yellow);
  color: inherit; padding: 0 .08em; border-radius: .15em;
  background-color: transparent; /* 蓋掉 <mark> 預設黃底 */
  background-image: linear-gradient(var(--hl-color), var(--hl-color));
  background-repeat: no-repeat; background-position: 0 88%;
  background-size: 100% .42em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size .9s var(--ease-out);
}
.js .hl { background-size: 0% .42em; }

/* ---------- Script text ---------- */
.script {
  font-family: var(--font-script); font-weight: 700;
  font-size: 2.6rem; line-height: 1; color: var(--navy-600);
  transform: rotate(-4deg); transform-origin: left;
}
.script--sm { font-size: 2.1rem; }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: height .35s var(--ease-out), background-color .35s, box-shadow .35s;
}
.site-header.is-scrolled { --header-h: 62px; background: rgba(255, 255, 255, .94); box-shadow: 0 6px 24px rgba(23, 63, 124, .1); }
.header__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.logo { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.logo__img { height: 54px; width: auto; transition: height .35s var(--ease-out), transform .5s var(--ease-back); }
.logo:hover .logo__img { transform: scale(1.03); }
.is-scrolled .logo__img { height: 46px; }
.logo__mark { width: 46px; height: 46px; transition: transform .6s var(--ease-back); }
.logo:hover .logo__mark { transform: rotate(-8deg) scale(1.06); }
.logo__text { display: flex; flex-direction: column; line-height: 1.1; }
.logo__text strong { font-size: 1.45rem; font-weight: 900; color: var(--navy); letter-spacing: .08em; }
.logo__text small { font-size: .68rem; font-weight: 700; letter-spacing: .28em; color: var(--navy); }
.is-scrolled .logo__mark { width: 40px; height: 40px; }

.nav { position: relative; display: flex; align-items: center; gap: 28px; }
.nav__list { position: relative; display: flex; gap: 26px; }
.nav__link { position: relative; display: block; padding: 8px 0; font-size: .95rem; font-weight: 700; color: var(--ink); transition: color var(--dur-hover); }
.nav__link:hover, .nav__link.is-active { color: var(--navy-600); }
.nav__indicator {
  position: absolute; bottom: 8px; left: 0; height: 3px; width: 0;
  background: var(--navy-600); border-radius: 3px; pointer-events: none;
  transition: transform .45s var(--ease-out), width .45s var(--ease-out), opacity .3s;
}
.nav__cta svg { fill: none; }

.nav-toggle { display: none; position: relative; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; }
.nav-toggle span { position: absolute; left: 11px; width: 22px; height: 2.5px; border-radius: 2px; background: var(--navy); transition: transform .35s var(--ease-out), opacity .2s; }
.nav-toggle span:nth-child(1) { top: 14px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 28px; }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative; overflow: hidden;
  padding: calc(var(--header-h) + 36px) 0 120px;
  min-height: min(820px, 100svh);
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(255, 255, 255, .9), transparent 70%),
    linear-gradient(180deg, #e3f2fd 0%, #eef8ff 55%, #f8fcff 100%);
}
.hero__sky { position: absolute; inset: 0; pointer-events: none; }
.deco { position: absolute; will-change: transform; }

.sun { width: 96px; left: 3%; top: 120px; }
.sun__rays { transform-origin: 60px 60px; animation: spin 40s linear infinite; }
.cloud { opacity: .95; animation: drift 22s ease-in-out infinite alternate; }
.cloud--1 { width: 150px; top: 110px; left: 30%; }
.cloud--2 { width: 110px; top: 330px; left: 47%; animation-duration: 28s; opacity: .8; }
.cloud--3 { width: 170px; top: 150px; right: 4%; animation-duration: 26s; animation-delay: -8s; }
.rainbow { width: 110px; top: 120px; left: 47%; }
.sparkle { animation: twinkle 2.8s ease-in-out infinite; }
.sparkle--1 { width: 22px; top: 110px; right: 25%; }
.sparkle--2 { width: 16px; top: 280px; left: 6%; animation-delay: -1s; }
.sparkle--3 { width: 14px; top: 92px; right: 22%; animation-delay: -1.8s; }

.city { right: 0; bottom: 78px; width: min(50vw, 660px); }
/* 間隔設為 2：偏移 1 時不會在路徑終點留下圓頭線帽的小點 */
.draw-path { stroke-dasharray: 1 2; stroke-dashoffset: 0; }
.js .city__arrow { stroke-dashoffset: 1; }
.js .city__arrow-head { opacity: 0; }

.ai-orb {
  right: 2.5%; top: 330px; width: 96px; height: 96px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, rgba(255, 255, 255, .7), rgba(120, 180, 240, .35) 60%, rgba(42, 125, 225, .2));
  border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, .25), 0 0 40px rgba(42, 125, 225, .35);
}
.ai-orb span { font-size: 2.2rem; font-weight: 900; color: #fff; text-shadow: 0 2px 10px rgba(23, 63, 124, .5); animation: orbPulse 3s ease-in-out infinite; }

.hero__inner { position: relative; display: grid; grid-template-columns: 1.08fr .92fr; align-items: center; gap: 24px; }
.hero__copy { position: relative; }

.hero__eyebrow {
  margin: 0 0 14px 120px;
  font-size: 1.15rem; font-weight: 700; color: var(--navy); line-height: 1.6;
  transform: skewX(-8deg);
}
.hero__title {
  font-size: clamp(2.5rem, 5.4vw, 4.5rem); font-weight: 900; line-height: 1.2;
  color: var(--navy); letter-spacing: .03em;
  transform: skewX(-7deg);
  text-shadow: 0 3px 0 #fff;
}
.hero__title .line { display: block; overflow: hidden; padding: .04em .1em .08em 0; }
.hero__title .line:last-child { padding-left: .5em; }
.hero__title .line__in { display: inline-block; }
.hero__title .hl { color: var(--navy-600); }

.hero__tag {
  display: inline-flex; align-items: center;
  margin: 22px 0 18px 110px; padding: .45em 1.6em;
  border-radius: 999px;
  background: linear-gradient(90deg, #e04d72, #ef7a8f);
  color: #fff; font-weight: 700; font-size: 1.2rem; letter-spacing: .14em;
  box-shadow: 0 8px 18px rgba(232, 88, 122, .3);
}
.hero__tag i { width: 1.5px; height: 1em; margin: 0 .7em; background: rgba(255, 255, 255, .7); }
.hero__desc { margin-left: 170px; font-size: 1.1rem; font-weight: 700; color: var(--ink); line-height: 1.85; letter-spacing: .04em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 16px; margin: 26px 0 0 170px; }
.hero__team { position: absolute; left: -10px; bottom: -8px; width: 176px; }
.team__glow { animation: glowPulse 2.4s ease-in-out infinite; }
.team__p { transform-box: fill-box; transform-origin: bottom center; animation: bob 3.6s ease-in-out infinite; }
.team__p--2 { animation-delay: -1.2s; }
.team__p--3 { animation-delay: -2.4s; }

.hero__visual { position: relative; display: flex; justify-content: center; align-self: end; margin-bottom: -120px; }
.hero__portrait {
  position: relative; width: min(450px, 100%);
  /* 淡化設計：橢圓羽化左右與底部 ∩ 頂部 8% 淡入。
     刻意不用 mix-blend-mode：部分 Chromium 手機版會讓整個 Hero 不顯示 */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 8%), radial-gradient(ellipse 50% 60% at 50% 40%, #000 56%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to bottom, transparent 0, #000 8%), radial-gradient(ellipse 50% 60% at 50% 40%, #000 56%, transparent 100%);
          mask-composite: intersect;
}
/* 天空色疊層：照片外圍的辦公室背景染成 banner 淺藍，臉部保持原色 */
.hero__portrait::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 44% 52% at 50% 36%, rgba(232, 244, 253, 0) 58%, rgba(232, 244, 253, .8) 100%),
    linear-gradient(to bottom, rgba(232, 244, 253, .45), rgba(232, 244, 253, 0) 22%);
}
.hero__portrait img { position: relative; width: 100%; }
.bubble {
  position: absolute; top: 4%; right: -6%;
  padding: 18px 26px; border-radius: 50% 50% 48% 52% / 55% 55% 45% 45%;
  background: #fff; border: 3px solid var(--navy);
  box-shadow: var(--shadow);
  font-size: 1.25rem; font-weight: 900; color: var(--navy); line-height: 1.4; text-align: center;
  transform: rotate(-8deg);
}
.bubble p { transform: skewX(-6deg); }
.bubble b { color: var(--pink); font-size: 1.15em; }
.bubble::after {
  content: ""; position: absolute; left: 22%; bottom: -16px; width: 26px; height: 22px;
  background: #fff; border: 3px solid var(--navy); border-top: 0; border-right: 0;
  transform: skewX(30deg) rotate(-10deg);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.bubble > p { animation: float 4s ease-in-out infinite; }

.hero__hills { position: absolute; left: -3%; bottom: -1px; width: 106%; height: 150px; z-index: 3; pointer-events: none; }
.wave { animation: sway 9s ease-in-out infinite alternate; }
.wave--back { animation-duration: 12s; animation-direction: alternate-reverse; }

/* =========================================================
   Section head
   ========================================================= */
.section { padding: 72px 0; }
.section-head { display: flex; align-items: center; justify-content: center; gap: 14px 18px; margin-bottom: 40px; flex-wrap: wrap; }
.section-head__title { font-size: clamp(1.9rem, 3.2vw, 2.5rem); font-weight: 900; color: var(--navy); letter-spacing: .08em; transform: skewX(-7deg); line-height: 1.2; }
.section-head__sub {
  position: relative; padding: 2px 0 6px 18px;
  font-size: 1.05rem; font-weight: 700; color: var(--ink);
  border-bottom: 2px solid var(--sky-200);
}
.section-head__sub::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 8px; width: 2px; background: var(--navy); }
.dash { position: relative; width: 38px; height: 34px; align-self: flex-start; }
.dash::before {
  content: ""; position: absolute; left: 6px; top: 10px; width: 4.5px; height: 17px; border-radius: 3px;
  background: var(--yellow-600);
  transform: rotate(-38deg);
  box-shadow: 11px -6px 0 var(--yellow-600), 23px -7px 0 var(--yellow-600);
}

/* =========================================================
   Services
   ========================================================= */
.services { position: relative; padding-top: 36px; background: linear-gradient(180deg, #fff 0%, var(--sky-50) 100%); }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 26px 18px 26px;
  background: #fff;
  border: 2px solid #d4e7f7; border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), border-color .3s;
}
.card::after { /* 上方光暈 */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 60% at 50% 0%, rgba(255, 216, 74, .18), transparent 60%);
  opacity: 0; transition: opacity .45s;
}
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); border-color: var(--blue-300); }
.card:hover::after { opacity: 1; }
.card__icon { width: 170px; height: 136px; margin-bottom: 6px; overflow: visible; color: #26375a; transition: transform .5s var(--ease-back); }
.card:hover .card__icon { transform: translateY(-4px) scale(1.04); }
.bulb__glow { opacity: .6; }
.icon-spark { transform-origin: center; animation: twinkle 2.6s ease-in-out infinite; }
.card:hover .icon-spark { animation-duration: 1s; }
.card__title { font-size: 1.32rem; font-weight: 900; color: var(--navy); letter-spacing: .06em; margin-bottom: 6px; }
.card__text { font-size: .95rem; color: var(--ink-2); font-weight: 500; margin-bottom: 18px; flex-grow: 1; }

/* icon micro-interactions */
.card__icon * { transform-box: fill-box; }
.icon-bars rect { transform-origin: bottom center; }
.card:hover .icon-bars rect { animation: barGrow .7s var(--ease-back) both; }
.card:hover .icon-bars rect:nth-child(2) { animation-delay: .08s; }
.card:hover .icon-bars rect:nth-child(3) { animation-delay: .16s; }
.icon-bulb { transform-origin: center bottom; transition: transform .4s var(--ease-back); }
.card--ai:hover .icon-bulb { transform: rotate(-10deg) translateY(-3px); }
.card--ai:hover .bulb__glow { animation: flicker 1.4s ease-in-out infinite; }
.icon-pointer { transform-origin: 70% 100%; }
/* 線條人物插畫的 hover 動態（規範見 .claude/skills/line-illustration） */
.ch-figure, .icon-chip, .icon-bubble, .icon-play { transform-origin: center; }
.card:hover .ch-figure { animation: bob .9s ease-in-out infinite; }
.card--ai:hover .icon-chip { animation: popIn .7s var(--ease-back); }
.card--ai:hover .icon-wire { animation: dashFlow .8s linear infinite; }
.card--talk:hover .icon-bubble { animation: popIn .7s var(--ease-back); }
.card--books:hover .icon-play { animation: popIn .7s var(--ease-back); }
.card--talk:hover .icon-pointer { animation: wiggle .8s ease-in-out infinite; }
.icon-magnifier { transition: transform .5s var(--ease-back); }
.card--column:hover .icon-magnifier { transform: translate(-8px, -4px) rotate(-8deg); }
.card--column:hover .icon-trend { animation: draw 1s var(--ease-out) both; }
.icon-book-top { transform-origin: left bottom; transition: transform .45s var(--ease-back); }
.card--books:hover .icon-book-top { transform: translateY(-5px) rotate(-4deg); }
.icon-page { transform-origin: left bottom; }
.card--books:hover .icon-page { animation: pageFlip 1.2s var(--ease-out) infinite; }

/* stats */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: 44px; padding: 26px 12px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
  border: 2px dashed #d4e7f7;
}
.stats li { text-align: center; padding: 4px 8px; }
.stats li + li { border-left: 1px solid var(--sky-200); }
.stats strong { display: block; font-size: clamp(1.8rem, 3vw, 2.4rem); font-weight: 900; color: var(--navy-600); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stats span:not([data-count]) { font-size: .92rem; color: var(--ink-2); font-weight: 500; }

/* =========================================================
   Story
   ========================================================= */
.story {
  position: relative; overflow: hidden;
  padding: 110px 0 90px;
  background:
    radial-gradient(ellipse 50% 40% at 85% 25%, rgba(255, 255, 255, .8), transparent 70%),
    linear-gradient(180deg, #e6f3fd 0%, #f2f9ff 60%, #fff 100%);
}
.story__wave { position: absolute; left: -3%; width: 106%; height: 70px; }
.story__wave--top { top: -1px; }

.story__banner { position: relative; display: grid; grid-template-columns: 340px 1fr 220px; align-items: center; gap: 40px; }
.story__portrait { position: relative; }
.blob {
  aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--navy-600);
  border: 6px solid #fff;
  box-shadow: var(--shadow);
  border-radius: 58% 42% 52% 48% / 50% 46% 54% 50%;
  animation: blobMorph 14s ease-in-out infinite;
}
.blob { position: relative; }
.blob::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(21, 56, 111, .45), transparent 45%), radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, .12), transparent 60%); }
.blob img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: 50% 30%;          /* 偏上裁切，保留頭頂空間 */
  transform: scale(1.04); transform-origin: 50% 75%;   /* hover 放大時不把頭頂推出框外 */
  transition: transform 1.2s var(--ease-out);
}
.story__portrait:hover .blob img { transform: scale(1.1); }
.story__trees { position: absolute; left: -34px; bottom: -22px; width: 132px; }

.story__copy .script { margin-bottom: 6px; }
.story__title { font-size: clamp(1.6rem, 2.8vw, 2.3rem); font-weight: 900; color: var(--navy); line-height: 1.35; transform: skewX(-6deg); margin-bottom: 14px; }
.story__lead { font-size: 1.05rem; font-weight: 500; color: var(--ink); max-width: 36em; margin-bottom: 22px; }

.mountain { width: 240px; align-self: end; overflow: visible; }
.climber { opacity: 0; transition: opacity .4s; }
.mountain.is-climbing .climber { opacity: 1; }
.mountain.is-climbing .climber__legs { animation: walk .35s steps(2) 10; }
.flag__cloth { transform-box: fill-box; transform-origin: left center; animation: flagWave 1.6s ease-in-out infinite; }

.journey {
  position: relative;
  display: grid; grid-template-columns: 1fr 290px; gap: 48px; align-items: center;
  margin-top: 56px; padding: 40px 48px;
  background: #fff; border: 2px solid #d6e8f7; border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.journey__title { font-size: 1.5rem; font-weight: 900; color: var(--navy); margin: 4px 0 12px; }
.journey__body > p:not(.script) { color: var(--ink-2); margin-bottom: 10px; font-size: .98rem; }

.timeline { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 26px 0 28px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; right: 8px; top: 8px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--blue-300), var(--yellow));
  transform: scaleX(0); transform-origin: left; transition: transform 1.2s var(--ease-out) .3s;
}
.timeline li { position: relative; padding-top: 28px; opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); transition-delay: calc(var(--i) * 220ms + 500ms); }
.timeline li::before { content: ""; position: absolute; left: 0; top: 0; width: 19px; height: 19px; border-radius: 50%; background: #fff; border: 4px solid var(--navy-600); }
.timeline li:last-child::before { background: var(--yellow); }
.timeline b { display: block; color: var(--navy); font-size: 1.02rem; }
.timeline span { font-size: .88rem; color: var(--ink-2); }
.journey.is-in .timeline::before { transform: scaleX(1); }
.journey.is-in .timeline li { opacity: 1; transform: none; }

.cert-wrap { justify-self: center; width: 100%; max-width: 290px; text-align: center; }
.cert {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 50%;
  position: relative; display: block; width: 100%; padding: 0; border: 0; background: none;
  border-radius: 6px; overflow: hidden; cursor: zoom-in;
  box-shadow: 0 26px 44px rgba(23, 63, 124, .28), 0 4px 10px rgba(23, 63, 124, .12);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s var(--ease-out), box-shadow .4s;
}
.cert.is-tilting { transition: transform .08s linear; }
.cert:hover { box-shadow: 0 34px 56px rgba(23, 63, 124, .32), 0 6px 14px rgba(23, 63, 124, .14); }
.cert img { width: 100%; }
.cert__glare { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s; background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, .5), transparent 55%); }
.cert:hover .cert__glare { opacity: 1; }
.cert__zoom {
  position: absolute; right: 12px; bottom: 12px; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .92); box-shadow: var(--shadow-sm);
  opacity: 0; transform: scale(.7); transition: opacity .3s, transform .4s var(--ease-back);
}
.cert__zoom svg { width: 22px; height: 22px; fill: none; stroke: var(--navy); stroke-width: 2.2; stroke-linecap: round; }
.cert:hover .cert__zoom, .cert:focus-visible .cert__zoom { opacity: 1; transform: none; }
.cert__cap { margin-top: 16px; font-size: .86rem; font-weight: 700; color: var(--navy); line-height: 1.55; }

/* 燈箱 */
.lightbox { padding: 0; border: 0; background: transparent; overflow: visible; max-width: 92vw; max-height: 92vh; }
.lightbox img { display: block; width: auto; height: auto; max-width: min(92vw, 680px); max-height: 88vh; border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.lightbox::backdrop { background: rgba(12, 28, 56, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.lightbox[open] { animation: lbIn .45s var(--ease-out); }
.lightbox__close {
  position: absolute; top: -16px; right: -16px; width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: #fff; color: var(--navy); font-size: 1.6rem; line-height: 1; box-shadow: var(--shadow);
  transition: transform .3s var(--ease-back);
}
.lightbox__close:hover { transform: rotate(90deg); }
@keyframes lbIn { from { opacity: 0; transform: scale(.92) translateY(14px); } }

/* =========================================================
   Scenes
   ========================================================= */
.scenes { padding-top: 40px; padding-bottom: 48px; }
.scene-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.scene figure { display: flex; flex-direction: column; align-items: center; }
.scene__img {
  width: 100%; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: 50% 50% 46% 54% / 56% 52% 48% 44%;
  box-shadow: var(--shadow);
  border: 4px solid #fff;
}
.scene__img img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); transition: transform 1.4s var(--ease-out); }
.scene:hover .scene__img img { transform: scale(1.12); }
.ribbon {
  position: relative; margin-top: -24px; padding: .45em 1.6em .5em;
  font-size: 1.12rem; font-weight: 900; color: var(--navy); letter-spacing: .08em;
  clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%, 5% 50%);
  transform: rotate(-4deg);
  transform-origin: center top;
  filter: drop-shadow(0 4px 6px rgba(23, 63, 124, .15));
  transition: transform .5s var(--ease-back);
}
.ribbon--pink { background: var(--pink-200); }
.ribbon--green { background: var(--green-200); }
.ribbon--yellow { background: #ffe58f; }
.scene:hover .ribbon { animation: swing 1s ease-in-out; }

/* =========================================================
   CTA
   ========================================================= */
.cta {
  position: relative; overflow: hidden;
  padding: 120px 0 96px;
  color: #fff;
  background:
    radial-gradient(ellipse 40% 60% at 75% 30%, rgba(255, 255, 255, .14), transparent 70%),
    linear-gradient(115deg, #174a96 0%, #2370c9 55%, #3a8fe0 100%);
}
.cta__wave { position: absolute; top: -1px; left: -3%; width: 106%; height: 64px; }
.cta__city { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 110px; }
.cta__inner { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 40px; }
.cta__person { width: 200px; overflow: visible; }
.cta__arm { transform-box: fill-box; transform-origin: 82% 95%; animation: wave 2.4s ease-in-out infinite; }
.cta__bubble { transform-box: fill-box; transform-origin: 20% 100%; animation: bubbleFloat 3.2s ease-in-out infinite; }
.cta__line { font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 900; line-height: 1.6; transform: skewX(-8deg); letter-spacing: .06em; }
.cta__line:nth-child(2) { padding-left: 2.2em; }
.cta__line:nth-child(3) { padding-left: 1em; }
.cta .hl { color: var(--yellow); font-size: 1.3em; }
/* 藍底上改用細黃底線，半透明色塊會混成灰綠色 */
.cta .hl { --hl-color: var(--yellow); background-position: 0 100%; background-size: 100% .12em; }
.js .cta .hl { background-size: 0% .12em; }
.cta .is-in .hl--scroll { background-size: 100% .12em; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer { padding: 30px 0 18px; background: #fff; border-top: 1px solid var(--sky-200); }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 0; font-size: .92rem; font-weight: 700; }
.footer__nav li + li::before { content: "|"; margin: 0 14px; color: var(--sky-200); }
.footer__nav a { transition: color var(--dur-hover); }
.footer__nav a:hover { color: var(--blue); }
.social { display: flex; gap: 12px; }
.social a { display: block; width: 38px; height: 38px; transition: transform .35s var(--ease-back); }
.social a:hover { transform: translateY(-4px) rotate(-8deg) scale(1.08); }
.social svg { width: 100%; height: 100%; fill: currentColor; }
.social__yt { color: #ff0000; }
.social__fb { color: #1877f2; }
.social__ig { color: #d6249f; }
.social__line { color: #06c755; }
.footer__copy { margin-top: 16px; text-align: center; font-size: .8rem; color: var(--ink-2); }

.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: var(--navy-600); color: #fff; font-size: 1.3rem; font-weight: 900;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(16px) scale(.8); pointer-events: none;
  transition: opacity .35s, transform .35s var(--ease-back), background-color .25s;
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--blue); }

/* =========================================================
   Animations — 進場（只在 JS 啟用時隱藏，避免無 JS 時看不到內容）
   ========================================================= */

/* Hero 進場時間軸 */
.js .anim-hero { opacity: 0; transform: translateY(22px); }
.js .hero__title .line__in.anim-hero { opacity: 1; transform: translateY(110%); }
.js .anim-pop { opacity: 0; transform: scale(.6) rotate(-8deg); }
.js .anim-portrait { opacity: 0; transform: translateX(40px) scale(.96); }

.is-loaded .anim-hero,
.is-loaded .hero__title .line__in.anim-hero {
  opacity: 1; transform: none;
  transition: opacity var(--dur-in) var(--ease-out), transform var(--dur-in) var(--ease-out);
  transition-delay: calc(var(--d, 0) * 120ms + 150ms);
}
.is-loaded .anim-pop { opacity: 1; transform: none; transition: opacity .5s, transform .7s var(--ease-back); transition-delay: calc(var(--d, 0) * 120ms + 150ms); }
.is-loaded .bubble.anim-pop { transform: rotate(-8deg); }
.is-loaded .hero__tag.anim-pop { transform: none; }
.is-loaded .anim-portrait { opacity: 1; transform: none; transition: opacity 1.1s var(--ease-out) .35s, transform 1.3s var(--ease-out) .35s; }
.is-loaded .hero .hl { background-size: 100% .42em; transition-delay: .75s; }
.is-loaded .city__arrow { animation: draw 1.6s var(--ease-out) 1.2s both; }
.is-loaded .city__arrow-head { animation: fadeIn .4s 2.5s both; }

/* 捲動進場 */
.js [data-reveal] {
  opacity: 0; transform: translateY(28px);
  transition: opacity var(--dur-in) var(--ease-out), transform var(--dur-in) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js .card[data-reveal] {
  transition: opacity var(--dur-in) var(--ease-out) calc(var(--i, 0) * 90ms), transform .6s var(--ease-out) calc(var(--i, 0) * 90ms), box-shadow .45s, border-color .3s;
}
.js .card[data-reveal].is-in:hover { transform: translateY(-8px); }
.js .btn[data-reveal].is-in:hover { transform: translateY(-3px); }
.card.is-in .icon-bars rect { animation: barGrow .8s var(--ease-back) both; animation-delay: calc(var(--i, 0) * 90ms + .3s); }
.js .section-head .dash { transform: scale(0) rotate(-30deg); transition: transform .6s var(--ease-back) .35s; }
.section-head.is-in .dash { transform: none; }
.is-in .hl--scroll { background-size: 100% .42em; transition-delay: .5s; }
.js .ribbon { opacity: 0; transform: translateY(14px) rotate(-12deg); }
.scene.is-in .ribbon { opacity: 1; transform: rotate(-4deg); transition: opacity .5s calc(var(--i) * 90ms + .35s), transform .7s var(--ease-back) calc(var(--i) * 90ms + .35s); }

/* ---------- Keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { from { transform: translateX(-20px); } to { transform: translateX(30px); } }
@keyframes twinkle { 0%, 100% { transform: scale(.7) rotate(0); opacity: .5; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }
@keyframes orbPulse { 0%, 100% { opacity: .85; } 50% { opacity: 1; text-shadow: 0 0 18px rgba(255, 255, 255, .9), 0 2px 10px rgba(23, 63, 124, .5); } }
@keyframes float { 0%, 100% { transform: skewX(-6deg) translateY(0); } 50% { transform: skewX(-6deg) translateY(-5px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes screenGlow { 0%, 100% { fill: #8fd0ff; } 50% { fill: #c6e8ff; } }
@keyframes sway { from { transform: translateX(-1.5%); } to { transform: translateX(1.5%); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes flicker { 0%, 100% { opacity: .2; } 30% { opacity: .9; } 50% { opacity: .5; } 70% { opacity: 1; } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-18deg); } }
@keyframes pageFlip { 0% { opacity: 0; transform: rotateY(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: rotateY(-160deg); } }
@keyframes blobMorph {
  0%, 100% { border-radius: 58% 42% 52% 48% / 50% 46% 54% 50%; }
  33% { border-radius: 46% 54% 44% 56% / 56% 42% 58% 44%; }
  66% { border-radius: 52% 48% 60% 40% / 44% 54% 46% 56%; }
}
@keyframes walk { to { transform: scaleX(-1); } }
@keyframes flagWave { 0%, 100% { transform: skewY(0) scaleX(1); } 50% { transform: skewY(-8deg) scaleX(.9); } }
@keyframes swing { 0%, 100% { transform: rotate(-4deg); } 25% { transform: rotate(3deg); } 50% { transform: rotate(-6deg); } 75% { transform: rotate(-2deg); } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(10deg); } }
@keyframes popIn { 0% { transform: scale(1); } 40% { transform: scale(1.14) rotate(-4deg); } 100% { transform: scale(1); } }
@keyframes dashFlow { to { stroke-dashoffset: -12; } }
@keyframes glowPulse { 0%, 100% { opacity: .35; } 50% { opacity: .95; } }
@keyframes bubbleFloat { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(-3deg); } }
@keyframes pulseRing { 0% { transform: scale(1); opacity: .9; } 70%, 100% { transform: scale(1.25, 1.6); opacity: 0; } }

/* =========================================================
   RWD
   ========================================================= */
@media (max-width: 1180px) {
  .nav__list { gap: 18px; }
  .nav { gap: 18px; }
  .nav__link { font-size: .9rem; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .story__banner { grid-template-columns: 300px 1fr; }
  .hero__tag { margin-left: 40px; }
  .hero__desc, .hero__actions { margin-left: 40px; }
  .hero__team { display: none; }
  .mountain { position: absolute; right: 0; bottom: -40px; width: 160px; opacity: .9; }
}

@media (max-width: 1024px) {
  .nav-toggle { display: block; z-index: 2; }
  .nav {
    position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh; width: min(82vw, 320px);
    flex-direction: column; align-items: stretch; gap: 24px;
    padding: 96px 28px 28px;
    background: #fff; box-shadow: -12px 0 40px rgba(23, 63, 124, .18);
    transform: translateX(105%); visibility: hidden;
    transition: transform .45s var(--ease-out), visibility 0s .45s;
  }
  .nav-open .nav { transform: none; visibility: visible; transition: transform .45s var(--ease-out); }
  .nav__list { flex-direction: column; gap: 4px; }
  .nav__link { padding: 12px 4px; font-size: 1.05rem; border-bottom: 1px solid var(--sky-100); }
  .nav__indicator { display: none; }
  .nav-open .nav__list li { animation: navItemIn .5s var(--ease-out) both; }
  .nav-open .nav__list li:nth-child(2) { animation-delay: .05s; }
  .nav-open .nav__list li:nth-child(3) { animation-delay: .1s; }
  .nav-open .nav__list li:nth-child(4) { animation-delay: .15s; }
  .nav-open .nav__list li:nth-child(5) { animation-delay: .2s; }
  .nav-open .nav__list li:nth-child(6) { animation-delay: .25s; }
  body.nav-open { overflow: hidden; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 99; background: rgba(15, 35, 70, .35); animation: fadeIn .3s both; }
  /* backdrop-filter 會讓 fixed 子元素以 header 為定位基準，抽屜選單會壞掉 */
  .site-header { z-index: 101; -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(255, 255, 255, .96); }
  .header__inner { position: relative; }
}
@keyframes navItemIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  :root { --header-h: 66px; }
  .hero { padding-bottom: 90px; min-height: 0; }
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__eyebrow, .hero__tag, .hero__desc, .hero__actions { margin-left: 0; }
  .hero__actions { justify-content: center; }
  .hero__title .line:last-child { padding-left: 0; }
  .hero__team { display: none; }
  .hero__visual { margin: 10px auto -90px; }
  .hero__portrait { width: min(340px, 80vw); }
  .bubble { right: -4%; font-size: 1.05rem; padding: 14px 20px; }
  .city { width: 90vw; bottom: 60px; opacity: .55; }
  .ai-orb { display: none; }
  .rainbow { left: auto; right: 6%; top: 96px; width: 80px; }
  .cloud--2 { display: none; }

  .story { padding-top: 90px; }
  .story__banner { grid-template-columns: 1fr; text-align: center; justify-items: center; gap: 24px; }
  .story__portrait { width: min(320px, 80vw); }
  .story__copy .script { transform-origin: center; }
  .mountain { display: none; }
  .journey { grid-template-columns: 1fr; padding: 32px 24px; }
  .cert-wrap { max-width: 250px; }

  .scene-list { grid-template-columns: repeat(2, 1fr); gap: 28px 20px; }

  .cta { padding: 96px 0 120px; text-align: center; }
  .cta__inner { grid-template-columns: 1fr; justify-items: center; gap: 20px; }
  .cta__person { width: 150px; }
  .cta__line:nth-child(n) { padding-left: 0; }

  .footer__inner { flex-direction: column; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .logo__text strong { font-size: 1.2rem; }
  .logo__img { height: 44px; }
  .is-scrolled .logo__img { height: 40px; }
  .lightbox__close { top: 8px; right: 8px; }
  .hero__eyebrow { font-size: 1rem; }
  .hero__tag { font-size: 1rem; padding: .45em 1.2em; letter-spacing: .08em; }
  .hero__desc { font-size: .98rem; letter-spacing: .02em; }
  .sun { width: 64px; top: 84px; left: 2%; }
  .cloud--1 { width: 100px; left: 40%; top: 80px; }
  .cloud--3, .rainbow { display: none; }

  .section { padding: 56px 0; }
  .section-head { flex-direction: column; gap: 8px; }
  .dash { display: none; }
  .section-head__sub { text-align: center; padding-left: 0; font-size: .95rem; }
  .section-head__sub::before { display: none; }

  /* 手機：服務卡改成左圖右文，縮短捲動長度 */
  .cards { grid-template-columns: 1fr; gap: 14px; }
  .card {
    display: grid; grid-template-columns: 92px 1fr; column-gap: 14px;
    align-items: center; text-align: left; padding: 18px 16px;
  }
  .card::before { display: none; }
  .card__icon { grid-row: 1 / span 3; width: 100px; height: 80px; margin: 0; }
  .card__title { font-size: 1.12rem; margin-bottom: 2px; }
  .card__text { font-size: .88rem; margin-bottom: 10px; line-height: 1.6; }
  .card__text br { display: none; }
  .card .btn { justify-self: start; font-size: .85rem; padding: .4em 1.1em; }
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
  .stats li:nth-child(3) { border-left: 0; }

  .timeline { grid-template-columns: 1fr; gap: 14px; padding-left: 4px; }
  .timeline::before { left: 8px; right: auto; top: 8px; bottom: 8px; width: 3px; height: auto; transform: scaleY(0); transform-origin: top; }
  .journey.is-in .timeline::before { transform: scaleY(1); }
  .timeline li { padding: 0 0 0 34px; }

  /* 應用場景：橫向滑動 */
  .scene-list {
    display: flex; gap: 16px; overflow-x: auto;
    margin: 0 calc(var(--gutter) * -1); padding: 6px var(--gutter) 18px;
    scroll-snap-type: x mandatory; scrollbar-width: none;
  }
  .scene-list::-webkit-scrollbar { display: none; }
  .scene { flex: 0 0 76%; scroll-snap-align: center; }

  .btn--lg { font-size: 1.1rem; }
  /* 頁尾選單改三欄，避免換行後行首出現分隔線 */
  .footer__nav { display: grid; grid-template-columns: repeat(3, auto); gap: 8px 18px; font-size: .88rem; }
  .footer__nav li + li::before { content: none; }
  .site-footer { padding-bottom: 76px; }
  .cta__line { font-size: 1.2rem; letter-spacing: .02em; }
}

/* 畫面外暫停常駐動畫，省電 */
.is-paused *, .is-paused *::before, .is-paused *::after { animation-play-state: paused !important; }

/* 使用者偏好減少動態 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .js [data-reveal], .js .anim-hero, .js .anim-pop, .js .anim-portrait, .js .ribbon, .timeline li { opacity: 1 !important; }
  .js .hl { background-size: 100% .42em !important; }
  .js .cta .hl { background-size: 100% .12em !important; }
  /* 減少動態：箭頭與箭頭頭直接完整顯示（不依賴延遲動畫） */
  .js .city__arrow { animation: none !important; stroke-dashoffset: 0 !important; }
  .js .city__arrow-head { animation: none !important; opacity: 1 !important; }
}
