/* ============================================================
   shared.css — McPippi 網站共用樣式
   所有頁面載入此檔案。頁面專屬 CSS 保留在各頁面的 <style> 內。
   ============================================================ */

:root {
  --primary: #f19645;
  --primary-soft: #f0a55c;
  --primary-dim: rgba(241, 150, 69, 0.1);

  --text: #111111;
  --muted: #888888;
  --bg: #ffffff;
  --card: #fafafa;
  --border: #ebebeb;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-pill: 999px;

  --font-sans: "LXGW WenKai Mono TC", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-heading: "Noto Serif TC", "LXGW WenKai Mono TC", "PingFang TC", "Microsoft JhengHei", serif;

  --nav-height: 56px;
}

[data-theme="dark"] {
  --text: #e8e6e3;
  --muted: #999999;
  --bg: #111111;
  --card: #1a1a1a;
  --border: #2a2a2a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ---- 新年主題色覆蓋 ---- */
[data-newyear="true"] {
  --primary: #C83A3A;
  --primary-soft: #d45050;
  --primary-dim: rgba(200, 58, 58, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.container { width: min(1000px, 90%); margin: 0 auto; }

/* ================================================================
   導覽列
   ================================================================ */
.page-nav {
  position: sticky;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.nav-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}
.nav-logo:hover { color: var(--primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links > a,
.nav-dropdown-trigger {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-links > a:hover,
.nav-links > a.active,
.nav-dropdown-trigger:hover,
.nav-dropdown-trigger[aria-expanded="true"],
.nav-dropdown-trigger.active {
  color: var(--text);
  background: var(--card);
}

.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
}
.nav-dropdown-trigger::after {
  content: "";
  width: 0; height: 0;
  border: 4px solid transparent;
  border-top-color: currentColor;
  margin-top: 3px;
  flex-shrink: 0;
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 160px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top left;
  transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
  z-index: 100;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.nav-dropdown-menu a {
  display: block;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-dropdown-menu a:hover {
  background: var(--card);
  color: var(--text);
}
.nav-dropdown-menu a[href^="http"]::after {
  content: " \2197";
  font-size: 0.7em;
  opacity: 0.5;
}

/* 深色模式 */
[data-theme="dark"] .page-nav {
  background: rgba(17, 17, 17, 0.9);
  border-bottom-color: var(--border);
}
[data-theme="dark"] .nav-links > a:hover,
[data-theme="dark"] .nav-links > a.active,
[data-theme="dark"] .nav-dropdown-trigger:hover,
[data-theme="dark"] .nav-dropdown-trigger[aria-expanded="true"],
[data-theme="dark"] .nav-dropdown-trigger.active {
  background: var(--card);
  color: var(--text);
}
[data-theme="dark"] .nav-dropdown-menu {
  background: var(--card);
}
[data-theme="dark"] .nav-dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

/* ================================================================
   深色／淺色切換按鈕
   ================================================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  margin-left: 4px;
}
.theme-toggle:hover {
  background: var(--card);
  color: var(--text);
}
.theme-toggle i { font-size: 1rem; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ================================================================
   頁尾
   ================================================================ */
footer {
  margin-top: auto;
  padding: 48px 0 40px;
  background: #0d0d0d;
  color: #e8e6e3;
}

[data-theme="dark"] footer {
  background: #0d0d0d;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.footer-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  color: #666;
  background: rgba(255, 255, 255, 0.05);
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.footer-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}
.footer-links a i { font-size: 1.1rem; }

.footer-tagline {
  margin: 20px 0 0;
  padding: 0;
  text-align: center;
  color: #444;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.footer-note {
  margin: 8px 0 0;
  padding: 0;
  text-align: center;
  color: #333;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  font-weight: 700;
}
