@import url('./tokens.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---- 背景 ---- */
.thd-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.thd-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: thdOrb 18s ease-in-out infinite;
}

.thd-orb-1 {
  top: -8%; right: -5%;
  width: min(55vw, 480px); height: min(55vw, 480px);
  background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, transparent 70%);
}

.thd-orb-2 {
  bottom: 15%; left: -10%;
  width: min(45vw, 380px); height: min(45vw, 380px);
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  animation-delay: -6s;
}

.thd-orb-3 {
  top: 45%; right: 20%;
  width: min(30vw, 260px); height: min(30vw, 260px);
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
  animation-delay: -12s;
}

.thd-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 30%, black 0%, transparent 75%);
  animation: thdGrid 8s ease-in-out infinite;
}

@keyframes thdOrb {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(24px,-20px) scale(1.05); }
  66% { transform: translate(-16px,12px) scale(0.96); }
}

@keyframes thdGrid {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.cursor-glow {
  position: fixed;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s;
}

body:hover .cursor-glow { opacity: 1; }

/* ---- 導覽 ---- */
.thd-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.thd-nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.thd-nav-search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 320px;
  padding: 4px 4px 4px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.thd-nav-search input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}

.thd-nav-search input::placeholder { color: var(--text-muted); }

.thd-nav-search button {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--bg);
  background: var(--text);
  border: none;
  border-radius: var(--radius-full);
}

.thd-wrap-wide { max-width: 1100px; }

.thd-disclaimer {
  margin-bottom: 32px;
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  line-height: 1.7;
}

.thd-disclaimer strong { color: var(--text); }

/* ---- 維基首頁 ---- */
.thd-mainpage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.thd-portal {
  margin-bottom: 24px;
  padding: 24px 28px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.thd-portal-compact { padding: 20px 22px; }

.thd-portal-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}

.thd-portal-lead {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: 12px;
}

.thd-portal-lead a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.thd-portal-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.thd-portal-meta a { color: var(--text-secondary); text-decoration: underline; }

.thd-portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.thd-portal-tile {
  display: block;
  padding: 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), transform var(--transition-bounce);
}

.thd-portal-tile:hover {
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-3px);
}

.thd-portal-tile strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
}

.thd-portal-tile span {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.thd-featured-link {
  display: block;
  padding: 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), transform var(--transition-bounce);
}

.thd-featured-link:hover {
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-2px);
}

.thd-featured-cat {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.thd-featured-link h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.35rem;
  margin: 8px 0;
  letter-spacing: -0.02em;
}

.thd-featured-link p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 8px;
}

.thd-dyk-list,
.thd-recent-list,
.thd-quick-links {
  list-style: none;
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.thd-dyk-list li,
.thd-recent-list li,
.thd-quick-links li {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.thd-dyk-list li:last-child,
.thd-recent-list li:last-child,
.thd-quick-links li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.thd-dyk-list a,
.thd-recent-list a,
.thd-quick-links a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.thd-recent-list time {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.thd-cat-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.thd-cat-filter .thd-cat-btn {
  text-decoration: none;
}

.thd-cat-article-list {
  list-style: none;
  margin: 0;
}

.thd-cat-article-list li {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.thd-cat-article-list li:last-child { border-bottom: none; }

.thd-cat-article-list strong {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
}

.thd-cat-article-list p {
  margin: 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.thd-cat-tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  margin-right: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.thd-cat-article-list time {
  font-size: 11px;
  color: var(--text-muted);
}

.thd-empty {
  font-size: 14px;
  color: var(--text-muted);
  padding: 16px 0;
}

/* ---- 條目：維基式元素 ---- */
.thd-lead {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.9;
  margin-bottom: 24px;
}

.thd-lead strong { color: var(--text); font-weight: 600; }

.thd-content .thd-ref sup a {
  font-size: 11px;
  text-decoration: none;
  color: var(--text-muted);
}

.thd-references {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.thd-references h2 {
  font-size: 1.2rem !important;
  margin-top: 0 !important;
}

.thd-references ol {
  font-size: 13px;
  color: var(--text-muted);
}

.thd-cat-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.thd-cat-footer a {
  display: inline-block;
  margin: 4px 8px 4px 0;
  padding: 4px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.thd-cat-footer a:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.thd-timeline {
  margin: 20px 0;
  padding-left: 20px;
  border-left: 2px solid var(--border);
}

.thd-timeline li {
  margin-bottom: 16px;
  list-style: none;
  position: relative;
}

.thd-timeline time {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.thd-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}

.thd-brand-main {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.thd-brand-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.thd-nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.thd-nav-link {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  transition: color var(--transition), background var(--transition);
}

.thd-nav-link:hover,
.thd-nav-link.is-active {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.thd-nav-toggle {
  display: none;
  width: 40px; height: 40px;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.thd-nav-toggle span {
  display: block;
  width: 18px; height: 2px;
  margin: 4px auto;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--transition);
}

.thd-nav-mobile {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  padding: 16px 24px 24px;
  background: rgba(0,0,0,0.95);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  gap: 4px;
  z-index: 99;
}

.thd-nav-mobile.is-open { display: flex; }

.thd-nav-mobile a {
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}

.thd-nav-mobile a:hover { color: var(--text); background: rgba(255,255,255,0.04); }

/* ---- 主體 ---- */
.thd-main {
  position: relative;
  z-index: 2;
  padding-top: calc(var(--nav-h) + 48px);
}

.thd-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px 120px;
}

/* ---- 首頁 Hero ---- */
.thd-hero {
  text-align: center;
  padding: 48px 0 64px;
}

.thd-hero-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  margin-bottom: 20px;
  animation: thdTagGlow 4s ease-in-out infinite;
}

@keyframes thdTagGlow {
  0%, 100% { border-color: var(--border); }
  50% { border-color: rgba(255,255,255,0.2); box-shadow: 0 0 24px rgba(255,255,255,0.04); }
}

.thd-hero-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.thd-hero-desc {
  max-width: 520px;
  margin: 0 auto 32px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.thd-search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
  padding: 6px 6px 6px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition-bounce);
}

.thd-search:focus-within {
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.04);
  transform: translateY(-2px);
}

.thd-search-icon { flex-shrink: 0; color: var(--text-muted); }

.thd-search-input {
  flex: 1; min-width: 0;
  padding: 10px 0;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}

.thd-search-input::placeholder { color: var(--text-muted); }

.thd-search-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--bg);
  background: var(--text);
  border: none;
  border-radius: var(--radius-full);
  transition: transform var(--transition-bounce), opacity var(--transition);
}

.thd-search-btn:hover { transform: scale(1.04); opacity: 0.92; }

.thd-search-results {
  max-width: 480px;
  margin: 12px auto 0;
  text-align: left;
  display: none;
}

.thd-search-results.is-open { display: block; }

.thd-search-hit {
  display: block;
  padding: 12px 16px;
  margin-top: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), transform var(--transition-bounce);
}

.thd-search-hit:hover {
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

.thd-search-hit strong { display: block; font-size: 14px; margin-bottom: 4px; }
.thd-search-hit span { font-size: 12px; color: var(--text-muted); }

/* ---- 分類 ---- */
.thd-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.thd-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 48px;
}

.thd-cat-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: all var(--transition-bounce);
}

.thd-cat-btn:hover,
.thd-cat-btn.is-active {
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

/* ---- 條目卡片 ---- */
.thd-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.thd-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition:
    border-color var(--transition),
    transform var(--transition-bounce),
    box-shadow var(--transition);
}

.thd-card:hover {
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.thd-card-cat {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.thd-card-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.thd-card-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  flex: 1;
}

.thd-card-arrow {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition);
}

.thd-card:hover .thd-card-arrow {
  color: var(--text);
  transform: translateX(4px);
}

/* ---- 條目頁 Hero ---- */
.thd-article-hero {
  padding: 32px 0 40px;
}

.thd-breadcrumb {
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.thd-breadcrumb a {
  color: var(--text-secondary);
  transition: color var(--transition);
}

.thd-breadcrumb a:hover { color: var(--text); }

.thd-article-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.thd-article-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 24px;
}

/* ---- 條目版面 ---- */
.thd-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
}

.thd-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  align-self: start;
}

.thd-sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.thd-toc a {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: all var(--transition);
}

.thd-toc a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  transform: translateX(4px);
}

.thd-toc a.is-active {
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border-left-color: var(--text);
  font-weight: 600;
}

.thd-sidebar-tools {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.thd-sidebar-tools a {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.thd-sidebar-tools a:hover { color: var(--text-secondary); }

.thd-menu-toggle {
  display: none;
  margin-bottom: 20px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

/* ---- 條目內容 ---- */
.thd-content { min-width: 0; }

.thd-hatnote {
  margin-bottom: 28px;
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid rgba(255,255,255,0.35);
  border-radius: var(--radius-md);
  line-height: 1.75;
}

.thd-hatnote strong { color: var(--text); }

.thd-content h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 48px 0 16px;
  padding-top: 16px;
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}

.thd-content h2:first-of-type { margin-top: 0; }

.thd-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 28px 0 12px;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}

.thd-content p {
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.85;
}

.thd-content a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255,255,255,0.3);
  transition: text-decoration-color var(--transition);
}

.thd-content a:hover { text-decoration-color: var(--text); }

.thd-content ul, .thd-content ol {
  margin: 0 0 20px 1.25em;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.85;
}

.thd-content li { margin-bottom: 8px; }

.thd-content code {
  font-size: 0.9em;
  padding: 2px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  color: var(--text);
}

.thd-infobox {
  float: right;
  width: min(100%, 280px);
  margin: 0 0 24px 28px;
  padding: 0;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.thd-infobox-title {
  padding: 14px 16px;
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
}

.thd-infobox table { width: 100%; border-collapse: collapse; font-size: 13px; }

.thd-infobox th,
.thd-infobox td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-align: left;
  vertical-align: top;
}

.thd-infobox th {
  width: 38%;
  color: var(--text-muted);
  font-weight: 500;
}

.thd-infobox td { color: var(--text-secondary); }

.thd-related {
  margin-top: 48px;
  padding: 24px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.thd-related h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.thd-related ul { list-style: none; margin: 0; }

.thd-related li { margin-bottom: 8px; }

.thd-related a {
  font-size: 14px;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.thd-related a:hover { color: var(--text); }

/* ---- 動畫 ---- */
.thd-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--thd-ease), transform 0.6s var(--thd-ease);
}

.thd-reveal.is-visible {
  opacity: 1;
  transform: none;
}

.thd-animate {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s var(--thd-ease), transform 0.5s var(--thd-ease);
}

.thd-animate.is-visible {
  opacity: 1;
  transform: none;
}

/* ---- 頁尾 ---- */
.thd-footer {
  position: relative;
  z-index: 2;
  padding: 32px 24px 48px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.thd-footer p {
  font-size: 12px;
  color: var(--text-muted);
}

.thd-footer a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- 響應式 ---- */
@media (max-width: 900px) {
  .thd-layout { grid-template-columns: 1fr; gap: 0; }

  .thd-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(300px, 85vw);
    padding: calc(var(--nav-h) + 16px) 20px 24px;
    background: rgba(0,0,0,0.96);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.4s var(--thd-ease);
    z-index: 98;
    overflow-y: auto;
  }

  .thd-sidebar.is-open { transform: translateX(0); }

  .thd-menu-toggle { display: inline-flex; align-items: center; gap: 8px; }

  .thd-infobox {
    float: none;
    width: 100%;
    margin: 0 0 24px;
  }

  .thd-nav-links { display: none; }
  .thd-nav-toggle { display: block; }
  .thd-nav-search { display: none; }
  .thd-mainpage-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .thd-reveal, .thd-animate { opacity: 1; transform: none; }
}
