/* home.css — 課程首頁專用 */

.home-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: center; padding-top: var(--space-section); }
@media (max-width: 860px) { .home-hero { grid-template-columns: 1fr; } }
.home-hero .eyebrow { font-weight: 800; color: var(--brand); letter-spacing: .08em; font-size: .85rem; }
.home-hero h1 { font-size: var(--text-hero); font-weight: 900; margin: .3em 0 .4em; line-height: 1.15; }
.home-hero h1 em { font-style: normal; white-space: nowrap; color: var(--brand); background: linear-gradient(transparent 62%, color-mix(in srgb, var(--brand) 22%, transparent) 62%); }
.home-hero .lead { font-size: clamp(1.05rem, 1rem + .4vw, 1.25rem); color: var(--muted); max-width: 36em; }
.hero-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.hero-actions .btn-primary { padding: 14px 26px; font-size: 1.05rem; }

.flow .card { position: relative; }
.flow h3 { margin-top: 10px; }

.course-map { display: grid; gap: 22px; }
/* 每一段一整列，卡片固定三欄：段落卡片數不同時也不會長短不齊、字被擠成兩行 */
.map-part-title { font-size: .85rem; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.map-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.map-list > li { display: grid; }
.map-item {
  display: grid; grid-template-columns: auto auto 1fr auto; gap: 12px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; box-shadow: var(--shadow);
  transition: transform var(--fast) var(--ease), border-color var(--fast), box-shadow var(--fast);
}
a.map-item:hover { transform: translateX(4px); border-color: var(--brand); box-shadow: var(--shadow-lift); }
.map-item.is-done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.map-item.is-soon { opacity: .55; box-shadow: none; border-style: dashed; }
.map-item.is-closed { opacity: .6; box-shadow: none; }
.map-item.is-closed .map-state { color: var(--warn); }
.map-num { font-family: "Inter", sans-serif; font-weight: 900; font-size: 1.3rem; color: transparent; -webkit-text-stroke: 1.2px var(--brand); min-width: 1.5em; text-align: center; }
.map-emoji { font-size: 1.4rem; }
.map-title { font-weight: 800; line-height: 1.4; }
.map-title small { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; }
.map-state { font-size: .8rem; color: var(--muted); font-weight: 700; }

/* ---------- 視覺改版：極光背景、AI 對話視窗、數字條、作品牆 ---------- */
.aurora { position: absolute; inset: 0 0 auto; height: 980px; overflow: hidden; pointer-events: none; z-index: -1; }
.aurora span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .45; animation: drift 22s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { width: 520px; height: 520px; background: #1f4fbf; top: -160px; left: -120px; }
.aurora span:nth-child(2) { width: 460px; height: 460px; background: #a855f7; top: 60px; right: -140px; animation-delay: -8s; opacity: .32; }
.aurora span:nth-child(3) { width: 380px; height: 380px; background: #22d3ee; top: 420px; left: 38%; animation-delay: -14s; opacity: .22; }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.12); } }
body { position: relative; isolation: isolate; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .aurora span { opacity: .28; } }
:root[data-theme="dark"] .aurora span { opacity: .28; }

.home-hero h1 .rotator { display: inline-block; min-width: 5.2em; }
.home-hero h1 .rotator::after { content: ""; display: inline-block; width: .08em; height: .9em; margin-left: .06em; vertical-align: -.08em; background: var(--brand-fill); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.ai-window {
  --win: #16152a; --win-ink: #e8e6ff; --win-dim: #8f8ab8;
  background: var(--win); color: var(--win-ink); border-radius: var(--radius-l); overflow: hidden;
  box-shadow: 0 30px 60px -24px rgb(49 46 129 / 55%), 0 0 0 1px rgb(255 255 255 / 6%) inset;
  transform: perspective(1200px) rotateY(-6deg) rotateX(2deg); transition: transform 600ms var(--ease);
  font-size: .92rem; min-height: 330px; display: flex; flex-direction: column;
}
.ai-window:hover { transform: none; }
.ai-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; background: rgb(255 255 255 / 5%); font-size: .78rem; color: var(--win-dim); }
.ai-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.ai-bar i:nth-child(2) { background: #febc2e; } .ai-bar i:nth-child(3) { background: #28c840; }
.ai-bar span { margin-left: 8px; font-family: var(--mono); }
.ai-body { padding: 18px 20px 20px; display: grid; gap: 10px; align-content: start; flex: 1; }
.ai-you { background: rgb(134 168 255 / 16%); border: 1px solid rgb(134 168 255 / 30%); border-radius: 12px; padding: 10px 14px; min-height: 3.2em; }
.ai-you b { display: block; font-size: .75rem; color: #86a8ff; letter-spacing: .08em; }
.ai-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-family: var(--mono); font-size: .84rem; }
.ai-lines li { animation: pop 380ms var(--ease) both; color: var(--win-ink); }
.ai-lines li.dim { color: var(--win-dim); }
.ai-lines li.warn { color: #fcd34d; }
.ai-done { margin-top: 4px; padding: 10px 14px; border-radius: 12px; background: rgb(52 211 153 / 14%); color: #6ee7b7; font-weight: 700; animation: pop 380ms var(--ease) both; }

.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: clamp(28px, 4vw, 48px); }
@media (max-width: 700px) { .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: color-mix(in srgb, var(--card) 80%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; }
.stat b { display: block; font-family: "Inter", sans-serif; font-size: clamp(2rem, 1.5rem + 1.8vw, 2.8rem); font-weight: 900; line-height: 1.05; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat span { font-size: .88rem; font-weight: 700; color: var(--muted); }

.roles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border-radius: var(--radius-l); overflow: hidden; box-shadow: var(--shadow-lift); }
@media (max-width: 760px) { .roles { grid-template-columns: 1fr; } }
.role { padding: clamp(20px, 3vw, 32px); }
.role h3 { font-size: 1.35rem; }
.role .tag { font-size: .75rem; font-weight: 800; letter-spacing: .1em; }
.role ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.role-you { background: var(--card); }
.role-you .tag { color: var(--brand); }
.role-ai { background: #1b2226; color: #eef2f3; }
.role-ai .tag { color: #86a8ff; }
.roles-quote { margin: 16px 0 0; font-weight: 700; color: var(--muted); }

.showcase { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.show-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-l); padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  transition: transform 250ms var(--ease), box-shadow var(--normal), border-color var(--normal);
}
.show-glyph { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; background: var(--brand-soft); }
.show-kind { font-size: .75rem; font-weight: 800; letter-spacing: .08em; color: var(--brand); }
.show-card h3 { margin: 0; }
.show-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.show-hl { font-size: .88rem; font-weight: 700; background: var(--warn-soft); color: var(--ink); border-radius: 10px; padding: 8px 10px; }
.show-learn { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.show-learn a { font-size: .8rem; font-weight: 700; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: var(--ink); }
.show-learn a:hover { border-color: var(--brand); color: var(--brand); }
.show-links { display: flex; gap: 12px; font-size: .88rem; font-weight: 700; }
.show-links a { text-decoration: none; }

/* 課程地圖的段落跳躍鈕：23 個單元太長，要能直接跳到想看的那一段 */
.map-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.map-jump a {
  display: inline-flex; align-items: baseline; gap: 7px; padding: 8px 15px; border-radius: 999px;
  background: var(--card); border: 1.5px solid var(--line); text-decoration: none;
  color: var(--ink); font-weight: 800; font-size: .9rem; transition: all var(--fast) var(--ease);
}
.map-jump a:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.map-jump small { color: var(--muted); font-weight: 600; font-size: .78rem; }
.map-part { scroll-margin-top: 130px; }

/* ---------- 關卡路線：完成的單元點亮，下一關閃爍 ---------- */
.map-path { display: grid; gap: 14px; margin-bottom: 22px; padding: clamp(14px, 3vw, 22px); border-radius: var(--radius-l);
  background: radial-gradient(90% 120% at 0% 0%, rgb(134 168 255 / 16%), transparent 60%), var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.mp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.mp-head b { font-size: .95rem; }
.mp-head span { font-size: .85rem; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.mp-lane.is-clear .mp-head span { color: #d97706; }
.mp-road { list-style: none; margin: 0; padding: 22px 0 4px; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.mp-node { position: relative; display: grid; justify-items: center; }
/* 和前一關之間的路：兩關都完成才點亮 */
.mp-node + .mp-node::before {
  content: ""; position: absolute; top: 50%; right: 50%; width: 100%; height: 4px; translate: 0 -50%; z-index: 0;
  border-radius: 999px; background: var(--paper-2);
}
.mp-node.is-linked::after {
  content: ""; position: absolute; top: 50%; right: 50%; width: 100%; height: 4px; translate: 0 -50%; z-index: 0;
  border-radius: 999px; background: linear-gradient(90deg, #34d399, #fbbf24); box-shadow: 0 0 10px rgb(52 211 153 / 60%);
  transform-origin: left; animation: mp-link .45s ease-out calc(var(--i) * 60ms + .2s) both;
}
@keyframes mp-link { from { transform: scaleX(0); } }
.mp-node a {
  position: relative; z-index: 1; display: grid; place-items: center; width: min(44px, 92%); aspect-ratio: 1; border-radius: 50%;
  background: var(--card); border: 2px solid var(--line); text-decoration: none; font-size: clamp(.8rem, 2.6vw, 1.25rem);
  filter: grayscale(1); opacity: .6; transition: transform var(--fast) var(--ease), opacity var(--fast), filter var(--fast);
  animation: mp-in .4s var(--ease) calc(var(--i) * 60ms) both;
}
.mp-node a:hover, .mp-node a:focus-visible { transform: scale(1.18); opacity: 1; filter: none; }
@keyframes mp-in { from { transform: scale(0); opacity: 0; } }
.mp-node.is-soon a { border-style: dashed; }
.mp-node.is-done a {
  filter: none; opacity: 1; border-color: #34d399;
  background: radial-gradient(circle, #fef9c3, #bbf7d0);
  box-shadow: 0 0 0 3px rgb(52 211 153 / 20%), 0 0 16px rgb(251 191 36 / 55%);
}
.mp-node.is-next a {
  filter: none; opacity: 1; border-color: var(--brand); background: var(--brand-soft);
  animation: mp-in .4s var(--ease) calc(var(--i) * 60ms) both, mp-pulse 1.6s ease-in-out 1s infinite;
}
@keyframes mp-pulse { 50% { box-shadow: 0 0 0 7px rgb(29 35 39 / 18%), 0 0 18px rgb(29 35 39 / 45%); } }
.mp-here {
  position: absolute; bottom: calc(100% + 2px); left: 50%; translate: -50% 0; white-space: nowrap; z-index: 2;
  font-style: normal; font-size: .75rem; font-weight: 900; color: #fff; background: var(--brand-fill); border-radius: 999px; padding: 1px 8px;
  animation: mp-bob 1.6s ease-in-out infinite;
}
@keyframes mp-bob { 50% { transform: translateY(-3px); } }
.mp-lane.is-clear .mp-road { filter: drop-shadow(0 0 6px rgb(251 191 36 / 45%)); }

/* 地圖卡片：下一關加一個標籤、邊框發光 */
.map-item.is-next { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow-lift); }
.map-item.is-next .map-state { color: var(--brand); }
.map-item.is-next .map-state::before { content: "▶ 下一關 "; }
.map-item.is-done .map-num { -webkit-text-stroke-color: var(--ok); }

@media (prefers-reduced-motion: reduce) {
  .mp-node a, .mp-node.is-next a, .mp-node.is-linked::after, .mp-here { animation: none; }
}
@media print { .map-path { display: none; } }

/* ---------- 白板改版（2026-09）：拿掉極光背景，主視覺是寫在白板上的字 ---------- */
:root .aurora { display: none; }
:root .home-hero .eyebrow { font-family: var(--hand-text); font-size: 1.1rem; letter-spacing: 0; font-weight: 700; }
:root .home-hero h1 { line-height: 1.3; }
/* 重點：藍筆在底下畫一道線 */
:root .home-hero h1 em {
  background: none; text-decoration: underline; text-decoration-color: var(--brand);
  text-decoration-thickness: max(3px, .06em); text-underline-offset: .16em; text-decoration-skip-ink: none;
}
:root .home-hero h1 .rotator::after { background: var(--brand); }
:root .ai-window { --win: #1b2226; --win-ink: #eef2f3; --win-dim: #9aa6ad; box-shadow: var(--shadow-lift); }
:root .map-num { font-family: var(--hand); color: var(--brand); -webkit-text-stroke: 0; font-size: 1.45rem; }
:root .map-part-title { font-family: var(--hand); font-size: 1.15rem; letter-spacing: 0; color: var(--ink); }
:root .map-item { border-radius: var(--radius-m); }
:root .ai-bar i, :root .ai-bar i:nth-child(n) { display: none; }
:root .ai-bar span { margin-left: 0; }
:root .map-path { background: var(--card); }
:root .mp-node.is-linked::after { background: var(--ok-fill); box-shadow: none; }
:root .mp-node.is-done a { background: var(--ok-soft); border-color: var(--ok-fill); box-shadow: none; }
:root .home-hero > div:first-child { display: flex; flex-direction: column; align-items: flex-start; }
:root .home-hero > div:first-child h1 { order: -1; margin-bottom: .15em; }
:root .home-hero .eyebrow { margin-bottom: 10px; }

/* 主打的單元（LINE 場）：在一堆選修裡要一眼找得到 */
.map-item.is-featured { border: 2px solid var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-soft); }
.map-item { scroll-margin-top: 130px; }
