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

:root {
  --clr-bg: #fafafa;
  --clr-bg-alt: #f0f0f0;
  --clr-surface: #ffffff;
  --clr-text: #1a1a1a;
  --clr-text-muted: #666666;
  --clr-accent: #2563eb;
  --clr-accent-hover: #1d4ed8;
  --clr-border: #e5e5e5;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  --font-mono: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  --nav-h: 64px;
  --container: 1080px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --nav-bg: rgba(250, 250, 250, 0.85);
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --clr-bg: #111111;
  --clr-bg-alt: #1a1a1a;
  --clr-surface: #222222;
  --clr-text: #f0f0f0;
  --clr-text-muted: #999999;
  --clr-accent: #60a5fa;
  --clr-accent-hover: #3b82f6;
  --clr-border: #2a2a2a;
  --nav-bg: rgba(17, 17, 17, 0.85);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

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

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

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

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

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  z-index: 1000;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.nav--scrolled {
  border-bottom-color: var(--clr-border);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.nav__logo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nav__links {
  display: flex;
  gap: 32px;
  list-style: none;
  align-items: center;
}

.nav__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--clr-text-muted);
  position: relative;
  transition: color 0.2s var(--ease);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--clr-accent);
  transition: width 0.3s var(--ease);
}

.nav__link:hover,
.nav__link.active {
  color: var(--clr-text);
}

.nav__link.active::after {
  width: 100%;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--clr-border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--clr-text);
  font-size: 1.125rem;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--clr-text);
  background: var(--clr-bg-alt);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

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

/* Sub-navigation dropdown */
.nav__item--projects {
  position: relative;
}

.nav__sub {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 180px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  padding: 8px 0;
  list-style: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.nav__item--projects:hover .nav__sub,
.nav__item--projects:focus-within .nav__sub {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav__sublink {
  display: block;
  padding: 8px 20px;
  font-size: 0.8125rem;
  color: var(--clr-text-muted);
  transition: background 0.15s, color 0.15s;
}

.nav__sublink:hover {
  background: var(--clr-bg-alt);
  color: var(--clr-text);
}

/* Mobile toggle */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--clr-text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.nav__toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav__toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: left;
  justify-content: flex-start;
  text-align: left;
  padding: var(--nav-h) 24px 80px;
}

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

.hero__greeting {
  font-size: 1.22rem;
  font-weight: 500;
  color: var(--clr-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 48px;
  margin-bottom: 12px;
}

.hero__name {
  font-size: clamp(2.75rem, 9vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero__title {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--clr-text-muted);
  margin-top: 40px;
  margin-bottom: 40px;
}

.hero__cta {
  display: inline-block;
  padding: 14px 36px;
  border: 2px solid var(--clr-text);
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

.hero__cta:hover {
  background: var(--clr-accent);
  color: var(--clr-bg);
  border: 2px solid var(--clr-accent);
}

/* ===== Sections ===== */
.section {
  padding: 100px 0;
}

.section--alt {
  background: var(--clr-bg-alt);
}

.section__heading {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 56px;
  position: relative;
  display: inline-block;
}

.section__heading::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--clr-accent);
  border-radius: 2px;
}

/* ===== About ===== */
.about__grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: start;
}

.about__photo-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  color: var(--clr-text-muted);
  border: 1px dashed var(--clr-border);
}

.about__text p {
  font-size: 1.0625rem;
  color: var(--clr-text-muted);
  margin-bottom: 20px;
  line-height: 1.75;
}

.about__stats {
  display: flex;
  gap: 40px;
  margin-top: 32px;
}

.stat {
  text-align: center;
}

.stat__number {
  display: inline;
  font-size: 3rem;
  font-weight: 800;
  color: var(--clr-text);
  line-height: 1;
}

.stat__plus {
  font-size: 2rem;
  font-weight: 800;
  color: var(--clr-text);
  line-height: 1;
}

.stat__label {
  font-size: 0.75rem;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
  display: block;
}

/* ===== Timeline / Experience ===== */
.timeline {
  position: relative;
  padding-left: 32px;
}

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

.timeline__item {
  position: relative;
  margin-bottom: 48px;
}

.timeline__item:last-child {
  margin-bottom: 0;
}

.timeline__dot {
  position: absolute;
  left: -32px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--clr-bg-alt);
  border: 3px solid var(--clr-accent);
  z-index: 1;
}

.timeline__date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--clr-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.timeline__role {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 4px;
}

.timeline__company {
  font-size: 0.9375rem;
  color: var(--clr-text-muted);
  margin-top: 2px;
}

.timeline__desc {
  font-size: 0.9375rem;
  color: var(--clr-text-muted);
  margin-top: 12px;
  line-height: 1.7;
  max-width: 600px;
}

/* ===== Projects ===== */
.projects__nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.projects__tab {
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  background: transparent;
  border: 1px solid var(--clr-border);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.projects__tab:hover {
  border-color: var(--clr-text);
  color: var(--clr-text);
}

.projects__tab.active {
  background: var(--clr-text);
  color: var(--clr-bg);
  border-color: var(--clr-text);
}

.projects__panels {
  position: relative;
}

.project {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  animation: fadeSlideUp 0.45s var(--ease);
}

.project.active {
  display: grid;
}

.project__placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  color: var(--clr-text-muted);
  border: 1px dashed var(--clr-border);
}

.project__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.project__desc {
  font-size: 0.9375rem;
  color: var(--clr-text-muted);
  line-height: 1.7;
  margin-bottom: 20px;
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.tag {
  padding: 4px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--clr-accent);
  background: rgba(37, 99, 235, 0.08);
  border-radius: 100px;
}

.project__links {
  display: flex;
  gap: 12px;
}

.project__link {
  padding: 12px 28px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 100px;
  background: var(--clr-accent);
  color: #fff;
  transition: background 0.25s var(--ease), transform 0.2s var(--ease);
}

.project__link:hover {
  background: var(--clr-accent-hover);
  transform: translateY(-1px);
}

.project__link--ghost {
  background: transparent;
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}

.project__link--ghost:hover {
  background: var(--clr-bg-alt);
  transform: translateY(-1px);
}

/* ===== Footer ===== */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--clr-border);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--clr-text-muted);
}

.footer__links {
  display: flex;
  gap: 24px;
}

.footer__links a {
  transition: color 0.2s;
}

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

/* ===== Scroll Reveal Animations ===== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

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

/* Stagger children */
.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.2s; }

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .about__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .about__photo-placeholder {
    max-width: 220px;
  }

  .project.active {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  :root {
    --nav-h: 56px;
  }

  .nav {
    padding: 0 20px;
  }

  .nav__toggle {
    display: flex;
  }

  .nav__links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    gap: 0;
    background: var(--clr-bg);
    padding: 24px 20px;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease);
  }

  .nav__links.open {
    transform: translateX(0);
  }

  .nav__link {
    font-size: 1.125rem;
    padding: 14px 0;
    display: block;
  }

  /* Mobile sub-nav becomes inline */
  .nav__sub {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0 0 0 20px;
    min-width: 0;
    display: none;
  }

  .nav__item--projects:hover .nav__sub,
  .nav__item--projects.sub-open .nav__sub {
    display: block;
  }

  .nav__sublink {
    padding: 10px 0;
    font-size: 0.9375rem;
  }

  .section {
    padding: 72px 0;
  }

  .section__heading {
    margin-bottom: 40px;
  }

  .about__stats {
    gap: 24px;
  }

  .stat__number {
    font-size: 1.5rem;
  }

  .projects__nav {
    gap: 6px;
  }

  .projects__tab {
    padding: 8px 16px;
    font-size: 0.75rem;
  }

  .footer__inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero__name {
    font-size: 2rem;
  }

  .about__stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .stat {
    text-align: left;
  }

  .project__links {
    flex-direction: column;
  }

  .project__link {
    text-align: center;
  }
}
