:root {
  --bg: #0a0e13;
  --surface: #10161d;
  --surface-alt: #151c24;
  --border: #212b34;
  --text: #e6ebf0;
  --text-muted: #8a97a3;
  --accent: #1b7a8c;
  --accent-hover: #26a0b7;
  --accent-dim: rgba(27, 122, 140, 0.14);
  --accent-blue: #3b6fa0;
  --accent-violet: #6c5fa8;

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  --radius: 8px;
  --max-width: 72rem;
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Background decor: faint grid + slow-drifting aurora glow */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 179, 191, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 179, 191, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 75%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.18;
  animation: drift 26s ease-in-out infinite alternate;
  will-change: transform;
  transform: translateZ(0);
}

.orb-1 { width: 460px; height: 460px; top: -120px; left: -80px; background: var(--accent); }
.orb-2 { width: 520px; height: 520px; top: 15vh; right: -160px; background: var(--accent-blue); animation-duration: 30s; animation-delay: -8s; }
.orb-3 { width: 400px; height: 400px; bottom: -160px; left: 25vw; background: var(--accent-violet); animation-duration: 34s; animation-delay: -14s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(50px, 40px) scale(1.12); }
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3 { line-height: 1.2; margin: 0; }

section {
  margin: 0 auto;
  max-width: var(--max-width);
  padding: var(--space-5) var(--space-3);
  scroll-margin-top: 5rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: transparent;
  transition: background-color 250ms ease;
}

.site-header.is-scrolled {
  background: rgba(10, 14, 19, 0.4);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  max-width: var(--max-width);
  margin: 0 auto;
}

.brand {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.1rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.brand-accent {
  color: var(--accent);
  animation: blink 1.1s step-end infinite;
}

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

.nav {
  display: flex;
  gap: var(--space-3);
  font-size: 0.9rem;
}

.nav a {
  color: var(--text-muted);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  transition: color 150ms ease;
  min-height: 44px;
  padding: 0 0.25rem;
  display: flex;
  align-items: center;
}

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

/* Hero */
.hero {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.hero-copy { flex: 1 1 32rem; min-width: 0; }

.hero-media {
  flex-shrink: 0;
  position: relative;
  width: 220px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-media-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

.hero-media.is-empty { background: var(--surface); }
.hero-media.is-empty .profile-photo { display: none; }
.hero-media.is-empty .hero-media-fallback { display: flex; }

@media (max-width: 720px) {
  .hero {
    flex-direction: column-reverse;
    text-align: center;
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
    gap: var(--space-3);
  }
  .hero-copy { flex: none; }
  .hero-media { width: 160px; }
  .hero-links { justify-content: center; }
}

.eyebrow {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0 0 var(--space-2);
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-lede {
  max-width: 40rem;
  color: var(--text-muted);
  font-size: 1.15rem;
  margin: var(--space-2) 0 var(--space-4);
  text-align: justify;
}

.hero-links {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--text);
}

.btn-primary:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.97); }

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* About */
.about h2, .projects h2, .stack h2, .site-footer h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-3);
}

.about p {
  max-width: 46rem;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1.6;
  text-align: justify;
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-3);
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  transition: border-color 150ms ease, transform 150ms ease;
}

.project-thumb {
  aspect-ratio: 16 / 9;
  background: var(--surface-alt);
  display: grid;
  place-items: center;
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-placeholder {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}

.project-cat {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-hover);
}

.project-body {
  padding: var(--space-3);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.5), 0 0 32px var(--accent-dim);
}

.project-card.is-placeholder {
  border-style: dashed;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-3);
}

.project-card.is-placeholder:hover {
  border-color: var(--border);
  transform: none;
}

.project-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex-grow: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: var(--space-2) 0;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-hover);
  background: var(--accent-dim);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.project-links {
  display: flex;
  gap: var(--space-2);
  font-size: 0.9rem;
}

.project-links a {
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: color 150ms ease, border-color 150ms ease;
}

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

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* Stack */
.chip-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: 0;
  margin: 0;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.8rem;
}

/* Footer */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  scroll-margin-top: 5rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin-bottom: var(--space-3);
}

.footer-links a {
  color: var(--text-muted);
  min-height: 44px;
  padding: 0 0.25rem;
  display: inline-flex;
  align-items: center;
  transition: color 150ms ease;
}

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

.footer-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; gap: var(--space-1); }
  .nav { gap: var(--space-2); font-size: 0.85rem; }
  section { padding: var(--space-4) var(--space-2); }
}
