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

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --accent: #6FA8DC;
  --accent-hover: #5a93c7;
  --border: #d2d2d7;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --max-width: 960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2d2d2f;
    --bg-alt: #1d1d1f;
    --text: #f5f5f7;
    --text-muted: #a1a1a6;
    --accent: #6FA8DC;
    --accent-hover: #8fbce8;
    --border: #424245;
    --card-bg: #3d3d3f;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

/* Nav */
header {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 48px;
  width: auto;
}

.logo-light {
  display: block;
}

.logo-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .logo-light {
    display: none;
  }
  .logo-dark {
    display: block;
  }
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.lang-switch {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem !important;
}

.lang-switch:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
}

/* Sections */
section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

.section-intro {
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 600px;
}

/* Hero */
.hero {
  padding: 6rem 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* Services */
.services {
  background: var(--bg-alt);
  max-width: 100%;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.services h2 {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.service-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}

.service-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.service-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Open Source */
.opensource {
  text-align: center;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: left;
}

.project-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Contact */
.contact {
  text-align: center;
  padding-bottom: 5rem;
}

.contact p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.contact-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.contact-links a {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.contact-links a:hover {
  border-color: var(--accent);
}

/* 404 page */
.error-page {
  text-align: center;
  padding: 6rem 1.5rem;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.error-page h1 {
  font-size: 6rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.error-page p {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.error-page a {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.error-page a:hover {
  border-color: var(--accent);
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 600px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .hero-sub {
    font-size: 1rem;
  }

  nav {
    flex-direction: column;
    gap: 0.75rem;
  }

  .nav-links {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  section {
    padding: 3rem 1.25rem;
  }

  .hero {
    padding: 4rem 1.25rem;
  }
}
