/* ========== CSS Custom Properties ========== */
:root {
  --color-primary: #1a1a2e;
  --color-primary-light: #16213e;
  --color-accent: #0077b6;
  --color-accent-hover: #005f8a;
  --color-bg: #f8f9fa;
  --color-bg-alt: #ffffff;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-text-muted: #999999;
  --color-border: #e0e0e0;
  --color-code-bg: #1e1e2e;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Fira Code', 'Consolas', 'Monaco', monospace;
  --max-width: 1100px;
  --header-height: 64px;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
  --transition: 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

ul {
  list-style: none;
}

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

/* ========== Header ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-primary);
  z-index: 1000;
  transition: background var(--transition), box-shadow var(--transition);
}

.header.scrolled {
  background: rgba(26, 26, 46, 0.95);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo:hover {
  color: #ffffff;
}

.logo-img {
  height: 50px;
  width: auto;
  max-width: initial;
}

/* ========== Nav (mobile default: slide-out) ========== */
.nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100vh;
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  padding: 80px 32px 32px;
  gap: 4px;
  transition: right var(--transition);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.nav.open {
  right: 0;
}

.nav-link {
  color: rgba(255, 255, 255, 0.75);
  font-size: 1rem;
  font-weight: 500;
  padding: 12px 16px;
  width: 100%;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.lang-link {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}

.lang-link:hover {
  color: #ffffff;
}

.lang-link.active {
  color: #ffffff;
  background: var(--color-accent);
}

.lang-mobile {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  margin-left: auto;
  transition: color var(--transition);
}

.lang-mobile:hover {
  color: #ffffff;
}

/* ========== Hamburger (mobile default: visible) ========== */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ========== Hero (mobile default) ========== */
.hero {
  padding: 100px 0 50px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 50%, #0f3460 100%);
  color: #ffffff;
  text-align: center;
}

.hero-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

.hero-subtitle {
  font-size: 1.1rem;
  font-weight: 300;
  opacity: 0.9;
  margin-bottom: 16px;
}

.hero-description {
  font-size: 0.95rem;
  opacity: 0.75;
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-direction: column;
  align-items: center;
}

.stat {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 12px 20px;
  backdrop-filter: blur(4px);
  user-select: none;
  width: 100%;
  max-width: 240px;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ========== Sections ========== */
.section {
  padding: 50px 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.section-intro {
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.95rem;
  max-width: 600px;
  margin: 0 auto 16px;
}

.section-notice {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-style: italic;
  max-width: 600px;
  margin: 0 auto 48px;
}

/* ========== Components / Packages ========== */
.component-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.component-group {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

.section-alt .component-group {
  background: var(--color-bg);
}

.group-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-accent);
}

.component-list li {
  padding: 6px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.component-list li:last-child {
  border-bottom: none;
}

.component-list li strong {
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.component-list li>strong:first-child {
  font-style: italic;
  opacity: 0.6;
}

.component-list li span {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.component-list li a {
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: color var(--transition);
}

.component-list li a:hover {
  color: var(--color-accent);
}

/* ========== About ========== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.about-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
}

.about-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.about-card p {
  color: var(--color-text-light);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 12px;
}

.about-card p:last-child {
  margin-bottom: 0;
}

.about-links a {
  font-weight: 600;
}

/* ========== Package Detail ========== */
.hero-package {
  padding: 120px 0 48px;
}

.hero-package .hero-title {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.hero-package .hero-subtitle {
  font-size: 1.15rem;
  margin-bottom: 16px;
}

.back-link {
  display: inline-block;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  margin-bottom: 24px;
  transition: color var(--transition);
}

.back-link:hover {
  color: #ffffff;
}

.pkg-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pkg-detail {
  max-width: 800px;
  margin: 0 auto;
}

.pkg-detail h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}

.pkg-detail h2:first-child {
  margin-top: 0;
}

.pkg-detail p {
  color: var(--color-text-light);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 12px;
}

.pkg-detail ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.pkg-detail ul li {
  padding: 6px 0;
  font-size: 0.9rem;
  color: var(--color-text-light);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  padding-left: 16px;
  position: relative;
}

.pkg-detail ul li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: 700;
}

.pkg-detail ul li:last-child {
  border-bottom: none;
}

.pkg-detail ul li strong {
  color: var(--color-text);
}

.pkg-install {
  margin-top: 48px;
}

.pkg-github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 16px;
  transition: color var(--transition);
}

.pkg-github-link:hover {
  color: #ffffff;
}

.pkg-github-link svg {
  flex-shrink: 0;
}

.pkg-install pre {
  background: #eef1f5;
  color: var(--color-text);
  padding: 16px 20px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  overflow-x: auto;
  border: 1px solid var(--color-border);
}

.pkg-install code {
  font-family: inherit;
}

/* ========== Footer ========== */
.footer {
  background: var(--color-primary);
  color: rgba(255, 255, 255, 0.6);
  padding: 32px 0;
  text-align: center;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-meta {
  font-size: 0.8rem;
  opacity: 0.5;
}

.footer-nav a {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  transition: color var(--transition);
}

.footer-nav a:hover {
  color: #ffffff;
}

.footer-nav a+a::before {
  content: ' - ';
  color: rgba(255, 255, 255, 0.4);
}

/* ========== Desktop (768px+) ========== */
@media (min-width: 768px) {
  .container {
    padding: 0 24px;
  }

  .hero {
    padding: 140px 0 80px;
  }

  .hero-title {
    font-size: 3.2rem;
  }

  .hero-subtitle {
    font-size: 1.4rem;
  }

  .hero-description {
    font-size: 1.05rem;
  }

  .hero-stats {
    flex-direction: row;
    gap: 32px;
  }

  .stat {
    width: auto;
    max-width: none;
    padding: 16px 28px;
  }

  .section {
    padding: 80px 0;
  }

  .section-title {
    font-size: 2.2rem;
  }

  .section-intro {
    font-size: 1.05rem;
  }

  .component-groups {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .component-group {
    padding: 24px;
  }

  .about-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .about-card {
    padding: 32px;
  }
}

/* ========== Captcha form ========== */
.captcha-form {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.captcha-form .jdzc {
  margin: 0 auto;
}

.captcha-message {
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--color-accent);
  padding: 10px 16px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto;
}

.captcha-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  display: inline-block;
  padding: 10px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-submit {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.btn-submit:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff;
}

.btn-cancel {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  color: #fff;
}

/* ========== Project repos cards ========== */
.project-repos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 24px 0 32px;
}

.repo-card {
  background: var(--color-bg-alt);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.repo-card h3 {
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.repo-card .repo-type {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.subsection-title {
  margin-top: 32px;
  margin-bottom: 12px;
  font-size: 1.2rem;
  color: var(--color-primary);
}

.project-list {
  margin: 0 0 16px 1.2rem;
  list-style: disc;
}

.project-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}

ol.project-list {
  list-style: decimal;
}

/* ========== Footer legal ========== */
.footer-legal {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-top: 6px;
}

@media (min-width: 768px) {
  .project-repos {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

/* ========== Project steps ========== */
.project-steps h4 {
  margin-top: 20px;
  margin-bottom: 4px;
  font-size: 1rem;
  color: var(--color-primary);
}

.project-steps > p {
  margin: 0 0 4px;
}

.project-steps pre {
  margin-top: 8px;
  background: var(--color-code-bg);
  color: #e6e6f0;
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

.project-steps pre code {
  background: none;
  padding: 0;
  color: inherit;
  white-space: pre;
}