/*
 * 視覺比照個人網站 MUZI GOING's AI LAB（muzi-going.web.app，2026-10-18）。
 * :root 照抄品牌真本（作品集 repo 的 public/assets/style.css）；
 * 導覽列與頁尾照抄 site-chrome.css。真本改了，這裡要跟著改。
 * 個人網站只有淺色版，這裡也不做深色模式。
 */
:root {
  --bg: #FAFAF7;
  --bg-soft: #F2F2EC;
  --ink: #1A1D1A;
  --ink-soft: #4A4F4A;
  --ink-dim: #676C67;
  --line: rgba(26, 29, 26, 0.08);
  --line-strong: rgba(26, 29, 26, 0.14);

  --green: #2D5F3F;
  --green-deep: #1F4530;
  --green-soft: #E8EFE9;
  --green-glow: rgba(45, 95, 63, 0.12);
  --moss: #7A9B76;
  --sand: #D9D3C3;

  --font-display: 'Fraunces', 'Noto Serif TC', Georgia, serif;
  --font-body: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;

  --fs-caption: 12px;
  --fs-label: 0.78rem;
  --fs-compact: 0.9rem;
  --fs-body: 1rem;
  --fs-lead: 1.16rem;
  --fs-h3: 1.45rem;
  --fs-h2: clamp(1.5rem, 2.8vw, 1.94rem);
  --fs-hero: clamp(2.6rem, 7vw, 5.2rem);

  --lh-tight: 1.15;
  --lh-body: 1.62;

  --radius-md: 12px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.4s;

  --max: 1280px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --nav-h: 82px;
  color-scheme: light;
}
@media (max-width: 860px) { :root { --nav-h: 77px; } }
@media (max-width: 480px) { :root { --nav-h: 65px; } }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 18px; scroll-padding-top: calc(var(--nav-h) + 1rem); }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }

.icon-sprite { position: absolute; }
.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.skip-link { position: absolute; left: -9999px; top: 8px; }
.skip-link:focus { left: 16px; z-index: 200; background: #fff; padding: 8px 12px; border-radius: var(--radius-md); }

/* ============ Nav（同 site-chrome.css） ============ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250, 250, 247, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--max); margin: 0 auto; padding: 0.95rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; font-size: 1rem; letter-spacing: 0.01em; }
.logo-mark { width: 32px; height: 32px; background: url("assets/05-icon-192.webp") center / contain no-repeat; flex: none; }
.logo-mark.large { width: 60px; height: 60px; }
.logo-dim { color: var(--ink-dim); font-weight: 400; }
.nav-links { display: flex; align-items: center; gap: 0.75rem; }
.nav-mail {
  font-size: 1rem; color: var(--ink-soft); padding: 0.45rem 1rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill); white-space: nowrap;
  transition: all 0.3s ease;
}
.nav-mail:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ============ Hero ============ */
.hero-wrap { position: relative; overflow-x: clip; }
.hero {
  position: relative; max-width: var(--max); margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) var(--gutter) clamp(1.5rem, 3vw, 2.5rem);
}
.hero::after {
  /* 個人網站首頁同款的綠色光暈，只當背景氛圍。
     外層 .hero-wrap 要 overflow-x: clip（只裁左右，上下照常淡出不留硬邊）：光暈超出右邊時，手機會把整頁版面撐寬再縮小（實測 375 變 412），底部固定列就掉出畫面 */
  content: ''; position: absolute; top: -30%; right: -10%; width: 560px; height: 560px; border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, rgba(122, 155, 118, 0.26), rgba(45, 95, 63, 0.1) 45%, transparent 75%);
  filter: blur(30px); z-index: -1; pointer-events: none;
}
.hero-title {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1.08; letter-spacing: -0.025em; font-variation-settings: 'opsz' 144; margin-bottom: 1.25rem;
}
.hero-title em { font-style: italic; color: var(--green); font-variation-settings: 'opsz' 144, 'SOFT' 50; }
.hero-sub { font-size: var(--fs-lead); color: var(--ink-soft); max-width: 640px; line-height: 1.78; }

/* ============ 版面 ============ */
.layout {
  max-width: var(--max); margin: 0 auto; padding: 0.5rem var(--gutter) 3rem;
  display: grid; gap: 1.25rem;
}
@media (min-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
  .output {
    position: sticky; top: calc(var(--nav-h) + 1rem);
    max-height: calc(100vh - var(--nav-h) - 2rem); display: flex; flex-direction: column;
  }
}
.settings { display: grid; gap: 1.25rem; min-width: 0; }

.panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xl);
  padding: clamp(1.25rem, 2.5vw, 2rem); min-width: 0;
}
.step__title {
  font-family: var(--font-display); font-weight: 500; font-size: var(--fs-h3);
  line-height: 1.25; letter-spacing: -0.015em; margin-bottom: 1.1rem;
}

/* ============ 分頁與模板卡 ============ */
.tabs { display: flex; gap: 0.6rem; margin-bottom: 1.1rem; }
.tab {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; padding: 0 1.1rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: transparent;
  color: var(--ink-soft); font: inherit; font-size: var(--fs-compact); cursor: pointer;
  transition: all 0.3s ease;
}
.tab:hover { border-color: var(--ink); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tab__count { font-family: var(--font-display); font-feature-settings: 'tnum'; opacity: 0.7; }

.template-list { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.template-card {
  display: flex; flex-direction: column; gap: 0.35rem; text-align: left; padding: 1rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg);
  color: var(--ink); font: inherit; cursor: pointer;
  transition: border-color var(--dur) ease, background var(--dur) ease, transform var(--dur) var(--ease-out);
}
.template-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.template-card[aria-pressed="true"] { background: var(--green-soft); border-color: var(--green); }
.template-card__title { font-family: var(--font-display); font-weight: 500; font-size: 1.08rem; line-height: 1.3; }
.template-card[aria-pressed="true"] .template-card__title { color: var(--green-deep); }
.template-card__summary { font-size: var(--fs-compact); color: var(--ink-soft); line-height: 1.55; }

/* ============ 欄位 ============ */
.refs-hint {
  margin-bottom: 1.1rem; padding: 0.8rem 1rem; border-radius: var(--radius-md);
  background: var(--bg-soft); color: var(--ink-soft); font-size: var(--fs-compact);
}
.refs-hint[hidden] { display: none; }
.chip-group { border: 0; margin-bottom: 1.25rem; min-width: 0; }
.chip-group[hidden] { display: none; }
.field { margin-bottom: 1.4rem; }
.field__label { display: block; margin-bottom: 0.45rem; font-weight: 500; font-size: var(--fs-body); }
.field__input {
  width: 100%; min-height: 50px; padding: 0.65rem 0.9rem; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  transition: border-color 0.3s ease, background 0.3s ease;
}
.field__input:hover { border-color: rgba(26, 29, 26, 0.28); }
.field__input:focus-visible { outline-offset: 0; border-color: var(--green); background: #fff; }
.field__input::placeholder { color: var(--ink-dim); }

.chips, .suggestions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.suggestions { margin-top: 0.6rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span, .suggestion {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0.4rem 1rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: transparent;
  color: var(--ink-soft); font: inherit; font-size: var(--fs-compact); line-height: 1.4; cursor: pointer; text-align: left;
  transition: all 0.3s ease;
}
/* 建議值是可點的填入選項，不是標籤：用方角跟性別這類單選區分開 */
.suggestion { border-radius: var(--radius-md); min-height: 40px; padding: 0.35rem 0.8rem; max-width: 100%; }
.chip span:hover, .suggestion:hover { border-color: var(--ink); color: var(--ink); }
.chip input:checked + span, .suggestion[aria-pressed="true"] {
  background: var(--green-soft); border-color: var(--green); color: var(--green-deep); font-weight: 500;
}
.chip input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 3px; }

/* ============ 按鈕 ============ */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 52px; padding: 0 1.5rem;
  border-radius: var(--radius-pill); border: 1px solid transparent; font: inherit; font-weight: 500; cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.button--primary { background: var(--green); color: #fff; }
.button--primary:hover { background: var(--green-deep); }
.button--ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); font-size: var(--fs-compact); min-height: 44px; }
.button--ghost:hover { border-color: var(--ink); color: var(--ink); }
.button--compact { min-height: 46px; padding: 0 1.2rem; }
.output > .button--primary { width: 100%; }

/* ============ 輸出 ============ */
.output__meta { margin: -0.6rem 0 1.1rem; color: var(--ink-dim); font-size: var(--fs-compact); }
.how-to { margin: 1.25rem 0; padding-left: 1.3rem; color: var(--ink-soft); font-size: var(--fs-compact); }
.how-to li + li { margin-top: 0.3rem; }
.how-to li::marker { color: var(--green); font-family: var(--font-display); }
.prompt-text {
  padding: 1.1rem 1.2rem; background: var(--bg-soft); border-radius: var(--radius-md);
  font-family: var(--font-body); font-size: var(--fs-compact); line-height: 1.75; color: var(--ink);
  white-space: pre-wrap; word-break: break-word; overflow: auto; max-height: 60vh;
}
@media (min-width: 1000px) { .prompt-text { flex: 1 1 auto; max-height: none; min-height: 200px; } }
.output__source { margin-top: 0.75rem; font-size: var(--fs-label); color: var(--ink-dim); }

/* ============ 說明與頁尾（頁尾同 site-chrome.css） ============ */
.credits { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 2.5rem; }
.credits p { max-width: 760px; color: var(--ink-dim); font-size: var(--fs-compact); line-height: 1.75; }

.foot { padding: 4rem var(--gutter) 3rem; border-top: 1px solid var(--line); background: var(--bg); }
.foot-inner {
  max-width: var(--max); margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 1.5rem;
}
.foot-brand { display: flex; align-items: center; gap: 0.85rem; font-family: var(--font-display); font-size: 1.05rem; font-weight: 500; }
.foot-links { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; font-size: 1rem; }
.foot-links a { color: var(--ink); font-weight: 500; transition: color 0.3s ease; }
.foot-links a:hover { color: var(--green); }
.copy { color: var(--ink-dim); font-size: var(--fs-caption); }
.foot-sig { height: 46px; width: auto; margin-bottom: 0.4rem; }

/* ============ 手機固定列與提示 ============ */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.6rem var(--gutter) calc(0.6rem + env(safe-area-inset-bottom));
  background: rgba(250, 250, 247, 0.9);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.action-bar__title { font-family: var(--font-display); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (min-width: 1000px) { .action-bar { display: none; } }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 12px); z-index: 120;
  padding: 0.6rem 1.1rem; border-radius: var(--radius-pill); background: var(--ink); color: var(--bg);
  font-size: var(--fs-compact); opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform var(--dur) var(--ease-out); max-width: calc(100% - 32px);
}
.toast--visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 1000px) { .toast { bottom: 32px; } }

/* ============ RWD ============ */
@media (max-width: 999px) {
  .foot { padding-bottom: 7rem; }
  /* 手機：模板卡左右滑，填欄位的區塊不用滑很久才看到 */
  .template-list {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78%;
    overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px;
    margin: 0 calc(-1 * clamp(1.25rem, 2.5vw, 2rem));
    padding-left: clamp(1.25rem, 2.5vw, 2rem); padding-right: clamp(1.25rem, 2.5vw, 2rem);
    scroll-padding: 0 clamp(1.25rem, 2.5vw, 2rem);
  }
  .template-card { scroll-snap-align: start; }
}
@media (max-width: 860px) {
  .foot-inner { flex-direction: column; align-items: flex-start; }
  .foot-links { align-items: flex-start; }
  .nav-inner { gap: 0.5rem; }
  .nav-logo { gap: 0.45rem; font-size: 0.95rem; min-width: 0; }
  .logo-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-mail { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
}
@media (max-width: 480px) {
  .nav-inner { padding: 0.7rem var(--gutter); }
  .logo-dim { display: none; }
  .nav-logo { font-size: 0.9rem; }
  .nav-mail { padding: 0.36rem 0.7rem; font-size: 0.84rem; }
  .nav-links { gap: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
