:root {
  --bg: #f5f7fb;
  --bg-alt: #ffffff;
  --text: #1c2433;
  --muted: #6b7280;
  --accent: #1d976c;
  --accent-soft: rgba(29, 151, 108, 0.12);
  --border: rgba(15, 23, 42, 0.08);
  --card-shadow: 0 18px 40px rgba(15, 23, 42, 0.15);
}

body.dark-theme {
  --bg: #020617;
  --bg-alt: #020617;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --border: rgba(148, 163, 184, 0.3);
  --card-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.18), transparent 50%) var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Map background */
#map-bg {
  position: fixed;
  inset: 0;
  z-index: -3;
}

.map-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0.6),
    rgba(15, 23, 42, 0.7)
  );
  mix-blend-mode: multiply;
  opacity: 0.85;
  pointer-events: none;
  z-index: -2;
}

body.light-theme .map-overlay {
  background: linear-gradient(
    to bottom,
    rgba(79, 213, 167, 0.55),
    rgba(15, 118, 110, 0.7)
  );
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  background: linear-gradient(
    to right,
    rgba(15, 23, 42, 0.9),
    rgba(15, 23, 42, 0.5)
  );
  padding: 0.8rem 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

body.light-theme .site-header {
  background: linear-gradient(
    to right,
    rgba(240, 253, 249, 0.9),
    rgba(219, 234, 254, 0.9)
  );
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: radial-gradient(circle at 20% 20%, #4ade80, #0f766e);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.6);
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.brand-tagline {
  font-size: 0.8rem;
  color: var(--muted);
}

.nav-links {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.nav-links a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle {
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.65rem;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.45);
}

/* Hero */
.hero {
  padding: 5rem 4vw 3rem;
  display: flex;
  justify-content: center;
}

.hero-content {
  max-width: 960px;
  padding: 2rem;
  border-radius: 26px;
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.2), transparent 55%),
    radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.18), transparent 55%),
    linear-gradient(to bottom right, rgba(15, 23, 42, 0.93), rgba(15, 23, 42, 0.9));
  color: #e5e7eb;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

body.light-theme .hero-content {
  background: radial-gradient(circle at top left, rgba(45, 212, 191, 0.22), transparent 55%),
    radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.18), transparent 55%),
    linear-gradient(to bottom right, #ecfdf3, #eef2ff);
  color: #0f172a;
  box-shadow: 0 24px 55px rgba(15, 23, 42, 0.18);
}

.hero-content::before {
  content: "";
  position: absolute;
  inset: -30%;
  background-image: radial-gradient(circle at 10% 20%, rgba(34, 211, 238, 0.15) 0, transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(74, 222, 128, 0.12) 0, transparent 50%);
  opacity: 0.7;
  mix-blend-mode: screen;
  pointer-events: none;
}

.hero-content h2 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}

.hero-content p {
  font-size: 1rem;
  max-width: 50rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.btn {
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s, color 0.2s, border-color 0.2s;
}

.btn.primary {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ecfdf5;
  box-shadow: 0 18px 40px rgba(34, 197, 94, 0.65);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 50px rgba(34, 197, 94, 0.8);
}

.btn.ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.5);
  color: inherit;
}

.btn.ghost:hover {
  background: rgba(15, 23, 42, 0.16);
  border-color: rgba(148, 163, 184, 0.8);
}

body.light-theme .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.7);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #cbd5f5;
  position: relative;
  z-index: 1;
}

body.light-theme .hero-meta {
  color: #4b5563;
}

.hero-meta a {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Sections */
.section {
  padding: 3.5rem 4vw;
  max-width: 1120px;
  margin: 0 auto;
  position: relative;
}

.section::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 32px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.95));
  opacity: 0.36;
  filter: blur(30px);
  z-index: -1;
  pointer-events: none;
}

body.light-theme .section::before {
  background: radial-gradient(circle at top, rgba(125, 211, 252, 0.45), rgba(240, 249, 255, 0.85));
  opacity: 0.9;
  filter: blur(42px);
}

.section-title {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
}

.section-intro {
  max-width: 720px;
  margin-bottom: 1.5rem;
  color: var(--muted);
}

/* Layout utilities */
.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2.5fr);
  gap: 2.5rem;
  align-items: start;
}

.bullet-list {
  padding-left: 1.1rem;
  color: var(--muted);
}

.bullet-list li {
  margin-bottom: 0.3rem;
}

.pill-row {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pill {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  color: #e5e7eb;
  font-size: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

body.light-theme .pill {
  background: #ecfdf3;
  color: #166534;
  border-color: rgba(34, 197, 94, 0.6);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chips span {
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.72);
}

body.light-theme .chips span {
  background: #f9fafb;
}

/* Timeline */
.timeline {
  border-left: 2px dashed rgba(148, 163, 184, 0.6);
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.timeline-item {
  position: relative;
  padding-left: 0.4rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.36rem;
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.35);
}

.timeline-item h3 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.timeline-item .meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.6rem;
}

.card {
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.2), transparent 60%),
    radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.16), transparent 60%),
    rgba(15, 23, 42, 0.9);
  border-radius: 18px;
  padding: 1.4rem 1.3rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: var(--card-shadow);
}

body.light-theme .card {
  background: radial-gradient(circle at top left, rgba(45, 212, 191, 0.22), transparent 60%),
    radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.18), transparent 60%),
    #f9fafb;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.card p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.card-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.card-link:hover {
  text-decoration: underline;
}

/* Repo cards */
.repos .card {
  position: relative;
}

.repo-meta {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.repo-meta span {
  margin-right: 0.7rem;
}

.loading {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
}

/* 3D Globe section */
.section-globe {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 3fr);
  gap: 2.5rem;
  align-items: stretch;
}

.globe-info {
  max-width: 480px;
}

.globe-canvas-wrap {
  border-radius: 24px;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.25), transparent 55%),
    rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.5);
  display: flex;
  align-items: stretch;
  justify-content: center;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  min-height: 260px;
}

#globe-canvas {
  width: 100%;
  height: 100%;
  min-height: 260px;
  display: block;
}

/* Contact */
.contact-list {
  list-style: none;
  margin-top: 0.5rem;
  color: var(--muted);
}

.contact-list li {
  margin-bottom: 0.4rem;
}

.contact-list i {
  width: 18px;
}

/* Footer */
.site-footer {
  padding: 1.5rem 4vw 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Scroll to top button */
#scrollTopBtn {
  position: fixed;
  bottom: 1.7rem;
  right: 1.7rem;
  z-index: 30;
  background: linear-gradient(135deg, var(--accent), #0f766e);
  color: #f9fafb;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s, box-shadow 0.25s;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.75);
}

#scrollTopBtn.show {
  opacity: 1;
  pointer-events: auto;
}

#scrollTopBtn:hover {
  transform: translateY(-3px);
}

/* Responsive */
@media (max-width: 900px) {
  .site-header {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .section-grid,
  .section-globe {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-content {
    padding: 1.7rem;
  }
}

@media (max-width: 640px) {
  .hero {
    padding-top: 4rem;
  }

  .nav-links {
    display: none;
  }
}
