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

:root,
html[data-theme="dark"] {
  --bg: #0a0a0f;
  --text: #e8e8ed;
  --text-muted: #5a5a6e;
  --accent: #7c83ff;
  --accent-dim: rgba(124, 131, 255, 0.15);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.06);
  --link-hover: #a5aaff;
}

html[data-theme="light"] {
  --bg: #f0ede8;
  --text: #1a1a1f;
  --text-muted: #8a8578;
  --accent: #5a4a3a;
  --accent-dim: rgba(90, 74, 58, 0.1);
  --card-bg: rgba(0, 0, 0, 0.03);
  --card-border: rgba(0, 0, 0, 0.06);
  --link-hover: #3a2a1a;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.6s ease, color 0.6s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Canvas */

#constellation {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Theme toggle */

.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  width: 44px;
  height: 44px;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.theme-toggle:hover {
  background: var(--accent-dim);
  transform: scale(1.1);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.6s ease;
}

html[data-theme="dark"] .icon-sun,
html[data-theme="light"] .icon-moon {
  display: none;
}

html[data-theme="dark"] .icon-moon,
html[data-theme="light"] .icon-sun {
  display: block;
}

/* Main content */

main {
  position: relative;
  z-index: 1;
}

/* Hero */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.hero-name {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0;
  user-select: none;
  line-height: 1;
  cursor: default;
}

.letter {
  display: inline-block;
  font-size: clamp(3rem, 12vw, 10rem);
  font-weight: 200;
  font-family: "Inter", sans-serif;
  text-transform: lowercase;
  color: var(--text);
  opacity: 0.9;
  transition: color 0.6s ease;
  will-change: transform, font-weight, font-size, font-family;
}

html[data-theme="dark"] .letter {
  text-shadow: 0 0 40px rgba(124, 131, 255, 0.08);
}

.hero-tagline {
  margin-top: 2rem;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.04em;
  min-height: 1.8em;
  transition: color 0.6s ease;
}

.hero-tagline::after {
  content: "|";
  animation: blink 1s step-end infinite;
  margin-left: 2px;
  color: var(--accent);
}

.hero-tagline.done::after {
  animation: blink 1s step-end infinite 2s;
  opacity: 0;
  animation-fill-mode: forwards;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Scroll indicator */

.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.3;
  animation: float 2s ease-in-out infinite;
}

.scroll-hint svg {
  width: 24px;
  height: 24px;
  stroke: var(--text);
  stroke-width: 1.5;
  fill: none;
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* Sections */

.section {
  max-width: 640px;
  margin: 0 auto;
  padding: 8rem 2rem;
}

.section h2 {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 600;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.section p {
  color: var(--text-muted);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.8;
  transition: color 0.6s ease;
}

/* Project cards */

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.project-card {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-decoration: none;
  color: var(--text);
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.project-card:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-card .card-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.project-card .card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.6s ease;
}

/* Footer */

footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 4rem 2rem 3rem;
  text-align: center;
}

.footer-nick {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
  transition: color 0.6s ease;
}

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

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease, transform 0.2s ease;
}

.social-links a:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: scale(1.1);
}

.social-links svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Scroll reveal */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile */

@media (max-width: 600px) {
  .section {
    padding: 5rem 1.5rem;
  }

  .theme-toggle {
    top: 1rem;
    right: 1rem;
  }
}
