/* CSS Variables - Dark mode (default) */
:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg: #0f0f14;
  --bg-card: #1a1a24;
  --bg-card-hover: #22222e;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --accent: #22d3ee;
  --accent-soft: rgba(34, 211, 238, 0.15);
  --border: #27272a;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 40px rgba(99, 102, 241, 0.2);
  --gradient-hero: linear-gradient(
    135deg,
    #0f0f14 0%,
    #1a1a2e 50%,
    #16213e 100%
  );
  --gradient-accent: linear-gradient(135deg, #6366f1, #22d3ee);
}

/* Light mode */
body.light-mode {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 12px 40px rgba(99, 102, 241, 0.15);
  --gradient-hero: linear-gradient(
    135deg,
    #f8fafc 0%,
    #e0e7ff 50%,
    #c7d2fe 100%
  );
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.3s ease, transform 0.3s ease;
}

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

/* Navbar */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  gap: 1rem;
}

.nav__brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.nav__brand:hover {
  color: var(--primary);
}

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

.nav__links a {
  color: var(--text);
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
}

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

.nav__links a:hover::after,
.nav__links a.active::after {
  width: 100%;
}

/* Dark mode toggle button */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow);
}

.theme-toggle:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Hamburger (mobile) */
.nav__hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: transform 0.3s ease;
}

.nav__hamburger:hover {
  color: var(--primary);
}

.nav__hamburger:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Main content */
.main {
  min-height: calc(100vh - 180px);
  padding: 2rem 1.5rem 4rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Hero (Home) */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 0 4rem;
  background: var(--gradient-hero);
  border-radius: 1rem;
  margin-bottom: 2rem;
}

.hero__photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease;
}

.hero__photo:hover {
  transform: scale(1.05);
}

.hero__title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__tagline {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  max-width: 500px;
}

.hero__intro {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  border: none;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn--primary {
  background: var(--gradient-accent);
  color: #0f0f14;
}

.btn--secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn--secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Section titles */
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* About page */
.about-grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}

.about__photo-wrap {
  text-align: center;
}

.about__photo {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary);
  margin: 0 auto 1rem;
  box-shadow: var(--shadow);
}

.about__bio {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

.about__list {
  list-style: none;
}

.about__list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.about__list li:last-child {
  border-bottom: none;
}

/* Skills page - Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    background-color 0.3s ease;
}

.skill-card:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-hover);
  background: var(--bg-card-hover);
}

.skill-card__icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

.skill-card__name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

/* Projects page - Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.project-card__img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--border);
}

.project-card__body {
  padding: 1.25rem;
}

.project-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.project-card__desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.project-card__links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.project-card__links a {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Contact page - Form */
.contact-wrap {
  display: grid;
  gap: 2rem;
  max-width: 600px;
  margin: 0 auto;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group textarea {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

.form-group .error {
  font-size: 0.875rem;
  color: #ef4444;
}

.contact__social {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.contact__info {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* Footer */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer a {
  color: var(--primary);
}

/* Scroll reveal (hidden until observed) */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Responsive */

/* Mobile: < 600px */
@media (max-width: 599px) {
  .nav__links {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    flex-direction: column;
    padding: 5rem 1.5rem 1.5rem;
    gap: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
  }

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

  .nav__links li {
    width: 100%;
    border-bottom: 1px solid var(--border);
  }

  .nav__links a {
    display: block;
    padding: 1rem;
  }

  .nav__hamburger {
    display: block;
  }

  .hero {
    padding: 2rem 1rem 3rem;
  }

  .hero__cta {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .skill-card {
    padding: 1rem;
  }

  .skill-card__icon {
    font-size: 2rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* Tablet: 600px - 1024px */
@media (min-width: 600px) and (max-width: 1024px) {
  .about-grid {
    grid-template-columns: 1fr 1.5fr;
  }

  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

/* Desktop: > 1024px */
@media (min-width: 1025px) {
  .about-grid {
    grid-template-columns: 300px 1fr;
  }

  .skills-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (min-width: 600px) {
  .nav__hamburger {
    display: none;
  }
}
