/* ---------- Design tokens ---------- */
:root {
  --bg: #0b0f14;
  --bg-elevated: #11161d;
  --bg-card: #141a22;
  --text: #eef2f6;
  --text-muted: #9aa7b5;
  --accent: #4fd1ff;
  --accent-soft: rgba(79, 209, 255, 0.14);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --radius: 14px;
  --max-width: 1120px;
  --font-heading: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --text: #10151b;
  --text-muted: #52606d;
  --accent: #0086b3;
  --accent-soft: rgba(0, 134, 179, 0.1);
  --border: rgba(16, 21, 27, 0.1);
  --shadow: 0 20px 50px -25px rgba(16, 21, 27, 0.25);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f7fa;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --text: #10151b;
    --text-muted: #52606d;
    --accent: #0086b3;
    --accent-soft: rgba(0, 134, 179, 0.1);
    --border: rgba(16, 21, 27, 0.1);
    --shadow: 0 20px 50px -25px rgba(16, 21, 27, 0.25);
  }
}

/* ---------- Reset ---------- */
* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

img {
  max-width: 100%;
  display: block;
}

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

a:hover {
  text-decoration: underline;
}

ul {
  padding-left: 1.2em;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 96px 0;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 56px;
}

.section-head .eyebrow {
  color: var(--accent);
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 600;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin-top: 0.4em;
}

.section-head p {
  color: var(--text-muted);
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 18px 0;
  transition: background 0.25s ease, padding 0.25s ease, box-shadow 0.25s ease;
}

.nav.is-scrolled {
  background: rgba(11, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  padding: 12px 0;
  box-shadow: 0 1px 0 var(--border);
}

:root[data-theme="light"] .nav.is-scrolled {
  background: rgba(245, 247, 250, 0.85);
}

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

.nav-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.nav-brand:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

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

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: inline-block; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 24px;
  position: relative;
}

.nav-toggle span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 11px; }
.nav-toggle span:nth-child(3) { top: 22px; }

.nav.is-open .nav-toggle span:nth-child(1) { transform: translateY(11px) rotate(45deg); }
.nav.is-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav.is-open .nav-toggle span:nth-child(3) { transform: translateY(-11px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  background:
    radial-gradient(60% 50% at 80% 10%, var(--accent-soft), transparent),
    var(--bg);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
  opacity: 0.6;
}

.hero .container {
  position: relative;
}

.hero-kicker {
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  margin: 0.3em 0 0.2em;
}

.hero-tagline {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  color: var(--text-muted);
  min-height: 1.6em;
}

.hero-tagline .cursor {
  display: inline-block;
  width: 2px;
  background: var(--accent);
  margin-left: 4px;
  animation: blink 0.9s steps(1) infinite;
}

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

.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Card shell ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 48px;
}

.about-photo img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.about-facts {
  margin-top: 20px;
  font-size: 0.95rem;
}

.about-facts p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.about-facts .label {
  color: var(--text-muted);
}

.interest-list {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.interest-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.interest-item .icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.interest-item .icon svg {
  width: 18px;
  height: 18px;
}

.interest-item .label {
  font-weight: 600;
  display: block;
  font-size: 0.9rem;
}

.interest-item .value {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.about-bio h3 {
  font-size: 1.4rem;
}

.about-bio p {
  color: var(--text-muted);
}

.about-bio strong,
.about-bio b {
  color: var(--text);
}

/* ---------- Timeline (experience / education) ---------- */
.timeline {
  position: relative;
  margin-top: 8px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 27px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 24px;
  padding-bottom: 40px;
  position: relative;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.timeline-marker img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.timeline-marker .fallback {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent);
}

.timeline-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.timeline-body h3 {
  font-size: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.timeline-date {
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
}

.timeline-body p,
.timeline-body ul {
  color: var(--text-muted);
  margin: 8px 0 0;
}

/* ---------- Highlights ---------- */
.highlights {
  padding: 56px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.highlights .container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.highlight-number {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--accent);
  font-weight: 700;
}

.highlight-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.project-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover {
  transform: translateY(-6px);
}

.project-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg-elevated);
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-card:hover .project-image img {
  transform: scale(1.06);
}

.project-body {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-meta {
  font-size: 0.78rem;
  color: var(--accent);
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.project-body h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.project-body p.desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 12px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.project-tags strong {
  color: var(--text);
}

.project-link {
  font-size: 0.88rem;
  font-weight: 600;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 9, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 40px;
}

.lightbox.is-open {
  display: flex;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

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

.skill-card {
  padding: 28px 24px;
  text-align: center;
}

.skill-card .icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.skill-card h3 {
  font-size: 1.05rem;
}

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

/* ---------- Blog ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.blog-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.25s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  text-decoration: none;
}

.blog-date {
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.blog-card h3 {
  font-size: 1.15rem;
}

.blog-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
}

.post-header {
  padding-top: 140px;
  padding-bottom: 40px;
  text-align: center;
}

.post-header .blog-date {
  display: block;
  margin-bottom: 12px;
}

.post-content {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 96px;
}

.post-content h2 {
  margin-top: 1.4em;
}

.post-content p,
.post-content li {
  color: var(--text-muted);
}

.post-content img {
  border-radius: var(--radius);
  margin: 24px 0;
}

.post-content pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  overflow-x: auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  font-size: 0.9rem;
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.contact-grid--single {
  grid-template-columns: 1fr;
  max-width: 480px;
  margin: 0 auto;
}

.contact-card {
  padding: 32px;
}

.social-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.social-row a {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.social-row a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.social-row svg {
  width: 18px;
  height: 18px;
}

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

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #041016;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 90;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-3px);
  text-decoration: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

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

  .highlights .container {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }
}

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

  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px 24px;
    display: none;
  }

  .nav.is-open .nav-links {
    display: flex;
  }

  .nav-links a {
    padding: 10px 0;
    width: 100%;
  }

  .project-grid,
  .skill-grid,
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .timeline::before {
    left: 19px;
  }

  .timeline-item {
    grid-template-columns: 40px 1fr;
    gap: 16px;
  }

  .timeline-marker {
    width: 40px;
    height: 40px;
  }

  .timeline-marker img {
    width: 22px;
    height: 22px;
  }
}
