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

:root {
  --primary: #0078d4;
  --primary-dark: #005a9e;
  --primary-light: #deecf9;
  --primary-gradient: linear-gradient(135deg, #0078d4, #005a9e);
  --success: #107c10;
  --warning: #ff8c00;
  --danger: #d13438;
  --neutral-bg: #f8f9fc;
  --card-bg: #ffffff;
  --text-primary: #1b1b1f;
  --text-secondary: #5c5c6d;
  --text-muted: #8e8ea0;
  --border-color: #e1e5eb;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--primary-dark);
}

/* Focus visible for keyboard accessibility */
a:focus-visible,
.btn:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

img {
  max-width: 100%;
}

/* ===== Layout ===== */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 96px 0;
}

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

.section-title {
  font-size: 2.25rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 56px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.header.scrolled {
  border-bottom-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.nav-brand:hover {
  color: var(--text-primary);
}

.nav-logo {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

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

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-link-github {
  display: flex;
  color: var(--text-secondary) !important;
}

.nav-link-github:hover {
  color: var(--text-primary) !important;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== Hero ===== */
.hero {
  padding: 160px 0 96px;
  text-align: center;
  background: linear-gradient(180deg, #f0f6ff 0%, #ffffff 100%);
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 20px;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 3.25rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero-highlight {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.2rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 640px;
  margin: 0 auto 40px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 64px;
}

.hero-stats {
  display: flex;
  gap: 64px;
  justify-content: center;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}

.hero-stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #ffffff;
}

.btn-secondary {
  background: var(--text-secondary);
  color: #ffffff;
  border-color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn:active {
  transform: scale(0.97);
}

/* ===== Features ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.feature-card {
  padding: 32px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: box-shadow 0.2s, transform 0.2s;
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: var(--radius);
  margin-bottom: 20px;
  color: var(--primary);
}

.feature-icon svg {
  width: 24px;
  height: 24px;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== v5 Section ===== */
.v5-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.v5-card {
  padding: 32px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}

.v5-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: 50%;
  margin: 0 auto 20px;
  color: var(--primary);
}

.v5-icon svg {
  width: 28px;
  height: 28px;
}

.v5-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.v5-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.v5-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ===== Services ===== */
.services-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.service-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: box-shadow 0.2s, transform 0.2s;
  width: calc(25% - 15px);
  min-width: 200px;
}

.service-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.service-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 12px;
}

.service-icon svg,
.service-icon img {
  width: 36px;
  height: 36px;
}

.service-card span {
  font-weight: 600;
  font-size: 0.95rem;
}

.service-card small {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Providers ===== */
.providers-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}

.provider-card {
  padding: 12px 24px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.provider-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.providers-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Certificate Authorities ===== */
.ca-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

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

.ca-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 6px;
}

.ca-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  background: #fff3e0;
  color: #e65100;
  margin-bottom: 8px;
}

.ca-free {
  background: #e8f5e9;
  color: #2e7d32;
}

.ca-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Deploy ===== */
.deploy-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}

.deploy-card {
  padding: 36px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
}

.deploy-card-primary {
  border: 2px solid var(--primary);
}

.deploy-version {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.deploy-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--primary);
  color: #ffffff;
}

.deploy-tag-legacy {
  background: var(--text-muted);
}

.deploy-card > p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.deploy-features {
  list-style: none;
  margin-bottom: 24px;
}

.deploy-features li {
  padding: 6px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.deploy-features li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  margin-right: 8px;
}

.deploy-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-deploy {
  padding: 10px 20px;
  font-size: 0.85rem;
}

.deploy-alt {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.deploy-alt a {
  font-weight: 600;
}

/* ===== Steps ===== */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 48px;
}

.step-card {
  text-align: center;
  padding: 32px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: box-shadow 0.2s, transform 0.2s;
}

.step-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.step-number {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-gradient);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  border-radius: 50%;
  margin: 0 auto 20px;
}

.step-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.step-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.steps-cta {
  text-align: center;
}

/* ===== Sponsors ===== */
.sponsors-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: center;
  margin-bottom: 40px;
}

.sponsor-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 40px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: box-shadow 0.2s, transform 0.2s;
}

.sponsor-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.sponsor-card img {
  max-height: 48px;
  width: auto;
}

.sponsors-cta {
  text-align: center;
}

.sponsors-cta p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ===== Community ===== */
.community-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.community-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  transition: box-shadow 0.2s, transform 0.2s;
}

.community-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--text-primary);
}

.community-card svg {
  margin-bottom: 16px;
  color: var(--primary);
}

.community-card strong {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.community-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== Footer ===== */
.footer {
  background: var(--text-primary);
  color: #ffffff;
  padding: 64px 0 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand strong {
  font-size: 1.25rem;
}

.footer-brand p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 8px;
  max-width: 300px;
}

.footer-links {
  display: flex;
  gap: 56px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  padding: 4px 0;
}

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

.footer-bottom {
  padding: 24px 0;
  text-align: center;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
}

/* ===== Responsive ===== */
.hide-mobile {
  display: inline;
}

@media (max-width: 900px) {
  .section {
    padding: 64px 0;
  }

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

  .section-subtitle {
    font-size: 1rem;
    margin-bottom: 40px;
  }

  .hero {
    padding: 120px 0 64px;
  }

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

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

  .hero-stats {
    gap: 32px;
  }

  .hide-mobile {
    display: none;
  }

  .features-grid,
  .v5-grid,
  .steps-grid,
  .community-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .ca-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .services-grid {
    gap: 12px;
  }

  .service-card {
    width: calc(50% - 6px);
    min-width: 0;
  }

  .deploy-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .footer-content {
    flex-direction: column;
    gap: 32px;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 32px;
  }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 24px;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links a {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-links a:last-child,
  .nav-link-github {
    border-bottom: none;
  }

  .nav-toggle {
    display: flex;
  }

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

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-stats {
    flex-direction: column;
    gap: 16px;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .service-card {
    width: 100%;
  }

  .features-grid,
  .v5-grid,
  .steps-grid,
  .community-grid {
    grid-template-columns: 1fr;
  }

  .ca-grid {
    grid-template-columns: 1fr;
  }

  .deploy-buttons {
    flex-direction: column;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
