/* ===== Panda Zhuyin Design System ===== */
/* 貓熊黑白配色 + 腮紅粉/棕色點綴 */

/* ===== 0. CSS Variables ===== */
:root {
  /* Panda Light */
  --bg: #fafaf5;
  --bg-alt: #f2f0eb;
  --bg-card: #ffffff;
  --text: #161616;
  --text-secondary: #6b6b6b;
  --border: #e0dbd3;
  --border-light: #eae6df;

  /* Panda Accents */
  --accent: #b09a85;
  --accent-pink: #d4918a;
  --accent-muted: #b0859a;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  /* Typography */
  --font-serif: "Noto Serif TC", "Source Han Serif TC", "PMingLiU", serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;

  /* Layout */
  --max-width: 64rem;

  /* Gradients */
  --gradient-panda: var(--accent), var(--accent-pink), var(--accent-muted);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(22, 22, 22, 0.06);
  --shadow-md: 0 4px 12px rgba(22, 22, 22, 0.08);
  --shadow-hover: 0 8px 24px rgba(212, 145, 138, 0.18);
}

[data-theme="dark"] {
  --bg: #151515;
  --bg-alt: #1c1c1c;
  --bg-card: #242424;
  --text: #e5e5e0;
  --text-secondary: #8a8a8a;
  --border: #3a3a3a;
  --border-light: #2e2e2e;
  --accent: #c4ad97;
  --accent-pink: #d4918a;
  --accent-muted: #c49ab0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ===== 1. Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; background: var(--bg); }

body {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  transition: opacity 0.5s ease;
}
.js-loading body { opacity: 0; }
.ph { vertical-align: -0.125em; }

/* ===== 2. Layout ===== */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-md); }

/* ===== 3. Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.08em;
}
.site-logo img { width: 28px; height: 28px; border-radius: 6px; }
.header-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: color 0.2s, border-color 0.2s;
}
.header-btn:hover { color: var(--text); border-color: var(--text-secondary); }

/* ===== 4. Hero ===== */
.hero { padding: var(--space-2xl) 0; }
.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: center;
}
.hero-text h1 {
  font-family: var(--font-serif);
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
}
.hero-subtitle {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}
.hero-tagline {
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: var(--space-md);
}
.hero-accent {
  height: 3px;
  width: 6rem;
  margin-bottom: var(--space-md);
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gradient-panda));
}
.hero-description {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 28rem;
  margin-bottom: var(--space-lg);
}
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-icon {
  width: 280px;
  height: 280px;
  border-radius: 56px;
  filter: drop-shadow(0 12px 32px rgba(22, 22, 22, 0.12));
}
[data-theme="dark"] .hero-icon-light { display: none; }
[data-theme="dark"] .hero-icon-dark { display: block; }
.hero-icon-dark { display: none; }

/* ===== 5. Shared Components ===== */
.section { padding: var(--space-xl) 0; }

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.gradient-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gradient-panda), transparent);
  opacity: 0.5;
}

.btn-primary {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1.5rem;
  background: var(--accent-pink);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.btn-primary:hover {
  background: #c47e77;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.hero-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.js-fade-ready .fade-in { opacity: 0; transform: translateY(16px); }
.js-fade-ready .fade-in.visible { animation: fadeInUp 0.6s ease forwards; }

/* ===== 5b. Video ===== */
.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: 56.25%;
}
.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
}

/* ===== 6. Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: var(--space-lg);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: var(--accent-pink);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
}
.card:hover::before { opacity: 1; }
.card-icon {
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}
.card h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
}
.card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===== 6b. Design Philosophy Cards ===== */
.design-philosophy .card::before { background: var(--accent); }

/* ===== 7. Features ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}
.feature-item {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  padding: var(--space-md);
  border-radius: 8px;
  transition: background 0.2s;
}
.feature-item:hover { background: var(--bg-alt); }
.feature-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--accent);
  background: var(--bg-alt);
  border-radius: 8px;
}
[data-theme="dark"] .feature-icon { background: var(--bg-card); }
.feature-text h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.feature-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===== 8. CTA Section ===== */
.cta-section {
  text-align: center;
  padding: var(--space-2xl) 0;
}
.cta-section h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}
.cta-section p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}
.cta-note {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  letter-spacing: 0.03em;
}
.cta-note a { color: var(--text-secondary); text-decoration: underline; }
.cta-note a:hover { color: var(--text); }
.social-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: var(--space-lg);
}
.social-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 0.25s, border-color 0.25s, background 0.25s, box-shadow 0.25s, transform 0.25s;
}
.social-pill .ph { font-size: 1.05em; }
.social-pill:hover {
  color: var(--accent-pink);
  border-color: var(--accent-pink);
  background: color-mix(in srgb, var(--accent-pink) 6%, transparent);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent-pink) 15%, transparent);
  transform: translateY(-1px);
}

.cta-credit {
  margin-top: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.cta-credit a { color: var(--text); }

/* ===== 9. Footer ===== */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding: var(--space-lg) 0;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-copyright {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
}
.footer-links {
  display: flex;
  gap: var(--space-md);
}
.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--text); }

/* ===== 10. Privacy Page ===== */
.page-header {
  padding: var(--space-xl) 0 var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}
.page-header h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-xs);
}
.page-header-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.page-content {
  max-width: 42rem;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}
.page-content h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  margin: var(--space-lg) 0 var(--space-sm);
}
.page-content p {
  margin-bottom: var(--space-sm);
  line-height: 1.8;
}
.page-content ul {
  margin-bottom: var(--space-sm);
  padding-left: 1.5em;
}
.page-content li {
  margin-bottom: 0.5em;
  line-height: 1.7;
}
.page-content a,
.cta-credit a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness 0.2s;
}
.page-content a:hover,
.cta-credit a:hover { text-decoration-thickness: 2px; }

.page-content .last-updated {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: var(--space-xl);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-light);
}

/* ===== 11. Responsive ===== */
@media (max-width: 768px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--space-lg);
  }
  .hero-visual { order: -1; }
  .hero-icon { width: 180px; height: 180px; border-radius: 36px; }
  .hero-text h1 { font-size: 2.4rem; }
  .hero-accent { margin-left: auto; margin-right: auto; }
  .hero-description { margin-left: auto; margin-right: auto; }
  .card-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: var(--space-sm); text-align: center; }
}
