/* Yumincraft — 配色與元件語言沿用 yuminhuang.dev（海軍藍、圓角分級、藥丸式導覽、深色模式） */

@font-face {
  font-family: 'Noto Sans ZH';
  src: url('../fonts/NotoSansTC-Medium.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+3000-303F, U+3105-3129, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FF00-FFEF;
}
@font-face {
  font-family: 'Noto Sans';
  src: url('../fonts/NotoSans_Condensed-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --navy-blue: #071F5D;
  --accent-blue: #356899;
  --light-gray: #6B6B66;
  --border-color: #E7E5DF;
  --text-main: #2D2D2D;
  --bg-pure-white: #FFFFFF;
  --bg-hover-gray: #E8EDF6;
  --bg-page: #FAFAF8;
  --navy-rgb: 7 31 93;
  --hover-alpha: 0.08;
  --ink-rgb: 0 0 0;
  --shadow-rgb: 7 31 93;
  --radius-sm: 7px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --fs-2: 0.75rem;
  --fs-3: 0.85rem;
  --fs-5: 0.95rem;
  --fs-6: 1rem;
  --fs-8: 1.15rem;
  --fs-10: 1.5rem;
  --fs-12: 2rem;
  --fw-strong: 600;
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 44px;
  --nav-item-h: 36px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --navy-blue: #A9C0F0;
  --accent-blue: #86AAD8;
  --light-gray: #A3A099;
  --border-color: #3A3833;
  --text-main: #DDDAD3;
  --bg-pure-white: #262521;
  --bg-hover-gray: #2C2F3A;
  --bg-page: #1C1B18;
  --navy-rgb: 169 192 240;
  --hover-alpha: 0.16;
  --ink-rgb: 255 255 255;
  --shadow-rgb: 0 0 0;
  -webkit-font-smoothing: antialiased;
}

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

html {
  font-size: clamp(15px, 0.85vw + 12px, 18px);
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: "Noto Sans ZH", "Noto Sans", "Noto Sans JP", "Microsoft JhengHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: var(--fs-6);
  line-height: 1.8;
  letter-spacing: 0.05em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: color 0.2s var(--ease-standard), text-decoration-color 0.25s var(--ease-standard);
}
a:hover { color: var(--navy-blue); text-decoration-color: var(--navy-blue); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- Header / Nav ---------- */
.sticky-header-wrapper {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: color-mix(in srgb, var(--bg-page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
}
.main-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; }
.logo-link { text-decoration: none; transition: opacity 0.2s var(--ease-standard); }
.logo-link:hover { opacity: 0.85; }
.site-title h1 { font-size: 1.2em; color: var(--navy-blue); font-weight: var(--fw-strong); }

.nav-tabs { display: flex; align-items: center; padding: 0; margin: 0; }

/* 大 pill：灰底膠囊容器，裡面是一顆顆小 pill（同 yuminhuang.dev） */
.nav-tabs-links {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--nav-h);
  background-color: var(--bg-hover-gray);
  padding: 4px;
  border-radius: var(--radius-pill);
  box-sizing: border-box;
}

/* 小 pill：預設淺灰字，hover 淺色底，active 實心海軍藍 */
.tab-item, .chip, .btn, .mobile-tab-item { text-decoration: none; }
.tab-item {
  display: inline-flex;
  align-items: center;
  color: var(--light-gray);
  text-decoration: none;
  font-size: 0.95em;
  height: var(--nav-item-h);
  line-height: var(--nav-item-h);
  padding: 0 20px;
  border-radius: var(--radius-pill);
  box-sizing: border-box;
  white-space: nowrap;
  transition: all 0.2s var(--ease-standard);
}
.tab-item:hover:not(.active) { background-color: rgb(var(--navy-rgb) / var(--hover-alpha)); color: var(--navy-blue); }
.tab-item.active { background-color: var(--navy-blue) !important; color: var(--bg-pure-white) !important; }

.theme-toggle, .menu-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--nav-h); height: var(--nav-h);
  border: none; border-radius: 50%; padding: 0;
  background-color: var(--bg-hover-gray);
  color: var(--navy-blue);
  cursor: pointer; flex-shrink: 0;
  transition: background-color 0.2s var(--ease-standard);
}
.theme-toggle { margin-left: 8px; }
.theme-toggle:hover, .menu-toggle:hover { background-color: color-mix(in srgb, var(--bg-hover-gray), var(--navy-blue) 14%); }
.theme-toggle svg, .menu-toggle svg { width: 18px; height: 18px; display: block; }
.js-theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .js-theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .js-theme-toggle .icon-moon { display: none; }

.menu-toggle { display: none; }
.mobile-nav-panel { display: none; }

@media (max-width: 900px) {
  .nav-tabs { display: none; }
  .menu-toggle { display: inline-flex; }

  .mobile-nav-panel {
    display: block;
    max-height: 0;
    overflow: hidden;
    border-top: 1px solid var(--border-color);
    transition: max-height 0.28s var(--ease-standard);
  }
  .mobile-nav-panel.open { max-height: 480px; }

  .mobile-nav-panel-inner {
    padding-top: 16px;
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-tab-item {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    font-size: var(--fs-6);
    color: var(--navy-blue);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s var(--ease-standard), color 0.2s var(--ease-standard);
  }
  .mobile-tab-item:hover:not(.active) { background-color: rgb(var(--navy-rgb) / var(--hover-alpha)); }
  .mobile-tab-item.active {
    background-color: var(--navy-blue);
    color: var(--bg-pure-white);
    font-weight: var(--fw-strong);
  }

  .mobile-theme-toggle {
    width: 100%;
    gap: 12px;
    border: 0;
    background: transparent;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    margin-top: 6px;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    padding-top: 6px;
    min-height: 52px;
  }
  .mobile-theme-toggle svg { width: 18px; height: 18px; display: block; flex-shrink: 0; }
}

/* ---------- Layout ---------- */
main { flex: 1; }
/* .container 的 padding 簡寫權重比 main 高，要用 main.container 才蓋得過去，否則頂部間距會被歸零、內容貼在導覽列下面 */
main.container { padding-top: 40px; padding-bottom: 64px; }
.section { margin-top: 40px; scroll-margin-top: 84px; }
.section:first-child { margin-top: 0; }
.section > h2 { font-size: var(--fs-10); color: var(--navy-blue); font-weight: var(--fw-strong); margin-bottom: 16px; line-height: 1.4; }
.card {
  background-color: var(--bg-pure-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
}
.muted { color: var(--light-gray); font-size: var(--fs-3); }
.member.card { transition: border-color 0.2s var(--ease-standard), box-shadow 0.2s var(--ease-standard); }
.member.card:hover { border-color: var(--accent-blue); box-shadow: 0 2px 12px rgb(var(--shadow-rgb) / 0.08); }

/* ---------- Hero ---------- */
.hero h2 { font-size: var(--fs-12); color: var(--navy-blue); font-weight: var(--fw-strong); line-height: 1.3; }
.hero p { color: var(--light-gray); margin-top: 6px; }
.versions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.pill {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 6px 16px; border-radius: var(--radius-pill);
  background-color: var(--bg-hover-gray); color: var(--navy-blue);
  font-size: var(--fs-5); line-height: 1.6;
  white-space: nowrap;
}
.pill small { color: var(--light-gray); font-size: var(--fs-3); }

/* ---------- Members ---------- */
.member-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.member { display: flex; align-items: center; gap: 14px; }
.member-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background-color: var(--navy-blue); color: var(--bg-pure-white);
  font-weight: var(--fw-strong); text-transform: uppercase;
  overflow: hidden;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0; }
.member > div:last-child { min-width: 0; }
.member-name { font-weight: var(--fw-strong); color: var(--text-main); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 每一段（身分、加入日期）各自不換行；空間不夠時以「整段」為單位換到下一行 */
.member-meta { display: flex; flex-wrap: wrap; gap: 0 10px; color: var(--light-gray); font-size: var(--fs-3); line-height: 1.5; }
.member-meta span { white-space: nowrap; }

/* ---------- Markdown 內容 ---------- */
.md > * + * { margin-top: 0.9em; }
.md h1, .md h2, .md h3 { color: var(--navy-blue); line-height: 1.4; }
.md h1 { font-size: var(--fs-10); } .md h2 { font-size: var(--fs-8); } .md h3 { font-size: var(--fs-6); }
.md ol, .md ul { padding-left: 1.6em; }
.md li + li { margin-top: 0.7em; }
.md li::marker { color: var(--light-gray); }
.md strong { font-weight: var(--fw-strong); color: var(--text-main); }
.md blockquote { border-left: 3px solid var(--border-color); padding-left: 14px; color: var(--light-gray); }
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em; padding: 1px 6px; border-radius: 5px;
  background-color: rgb(var(--ink-rgb) / 0.06); letter-spacing: 0;
}
.md pre { background-color: rgb(var(--ink-rgb) / 0.06); border-radius: var(--radius-md); padding: 14px 16px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md img { max-width: 100%; height: auto; border-radius: var(--radius-md); display: block; }
.md .spoiler {
  background-color: var(--text-main); color: transparent; border-radius: 4px; padding: 0 3px; cursor: pointer;
  transition: background-color 0.2s var(--ease-standard), color 0.2s var(--ease-standard);
}
.md .spoiler.revealed { background-color: rgb(var(--ink-rgb) / 0.08); color: inherit; cursor: auto; }

/* ---------- 404 ---------- */
.error-block { text-align: center; padding: 72px 0; }
.error-block .code { font-size: 5rem; line-height: 1.1; color: var(--navy-blue); font-weight: var(--fw-strong); }
.error-block p { color: var(--light-gray); margin: 8px 0 24px; }
.error-block a.btn {
  display: inline-flex; align-items: center; height: var(--nav-h); padding: 0 24px;
  border-radius: var(--radius-pill); text-decoration: none;
  background-color: var(--navy-blue); color: var(--bg-pure-white);
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border-color); padding: 24px 0; color: var(--light-gray); font-size: var(--fs-3); text-align: center; }

@media (max-width: 600px) {
  .card { padding: 20px; }
  .hero h2 { font-size: var(--fs-10); }
}

/* ==========================================================================
   日夜漸變 (主題切換動畫) — 與 yuminhuang.dev 相同
   - 支援 View Transitions 的瀏覽器：整頁交叉淡化（app.js setTheme）。
   - 其餘瀏覽器：把主題色註冊成真正的顏色型別 (@property)，切換時短暫掛上 .theme-fading，
     讓所有 var(--xxx) 在同一個節奏下一起漸變；不支援 @property 的舊瀏覽器則瞬間切換。
   ========================================================================== */
@property --navy-blue     { syntax: '<color>'; inherits: true; initial-value: #071F5D; }
@property --accent-blue   { syntax: '<color>'; inherits: true; initial-value: #356899; }
@property --light-gray    { syntax: '<color>'; inherits: true; initial-value: #6B6B66; }
@property --border-color  { syntax: '<color>'; inherits: true; initial-value: #E7E5DF; }
@property --text-main     { syntax: '<color>'; inherits: true; initial-value: #2D2D2D; }
@property --bg-pure-white { syntax: '<color>'; inherits: true; initial-value: #FFFFFF; }
@property --bg-hover-gray { syntax: '<color>'; inherits: true; initial-value: #E8EDF6; }
@property --bg-page       { syntax: '<color>'; inherits: true; initial-value: #FAFAF8; }
@property --navy-rgb      { syntax: '<number>+'; inherits: true; initial-value: 7 31 93; }
@property --ink-rgb       { syntax: '<number>+'; inherits: true; initial-value: 0 0 0; }
@property --shadow-rgb    { syntax: '<number>+'; inherits: true; initial-value: 7 31 93; }
@property --hover-alpha   { syntax: '<number>'; inherits: true; initial-value: 0.08; }

:root { --theme-fade: 1.5s; --theme-fade-vt: 1s; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--theme-fade-vt);
  animation-timing-function: ease-in-out;
}

:root.theme-fading {
  transition:
    --navy-blue var(--theme-fade) ease-in-out,
    --accent-blue var(--theme-fade) ease-in-out,
    --light-gray var(--theme-fade) ease-in-out,
    --border-color var(--theme-fade) ease-in-out,
    --text-main var(--theme-fade) ease-in-out,
    --bg-pure-white var(--theme-fade) ease-in-out,
    --bg-hover-gray var(--theme-fade) ease-in-out,
    --bg-page var(--theme-fade) ease-in-out,
    --navy-rgb var(--theme-fade) ease-in-out,
    --ink-rgb var(--theme-fade) ease-in-out,
    --shadow-rgb var(--theme-fade) ease-in-out,
    --hover-alpha var(--theme-fade) ease-in-out;
}

/* 切換鈕上的月亮/太陽：換圖示時轉一下、淡入，呼應「日昇月落」 */
@keyframes themeIconIn {
  from { transform: rotate(-80deg) scale(0.5); opacity: 0; }
  to   { transform: rotate(0) scale(1); opacity: 1; }
}
.js-theme-toggle.is-switching svg { animation: themeIconIn 0.9s var(--ease-standard); }

/* 「減少動態效果」：位移/縮放/旋轉關掉，但顏色漸變保留（沒有物體在移動） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  :root.theme-fading { transition-duration: var(--theme-fade) !important; }
}
