/* ============================================================
   CSS Variables — Light & Dark Themes
   ============================================================ */
:root,
[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #444466;
  --text-muted: #777799;
  --accent: #6c63ff;
  --accent-hover: #4b44cc;
  --accent-soft: #ede9ff;
  --border: #ddddf0;
  --shadow: 0 2px 12px rgba(108, 99, 255, 0.08);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.07);
  --nav-bg: rgba(245, 245, 245, 0.92);
  --tag-bg: #ede9ff;
  --tag-text: #4b44cc;
  --toggle-bg: #6c63ff;
  --toggle-icon: "☀️";
}

[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #16162a;
  --bg-card: #1c1c32;
  --text-primary: #e8e8f5;
  --text-secondary: #a0a0c0;
  --text-muted: #6060a0;
  --accent: #8b83ff;
  --accent-hover: #6c63ff;
  --accent-soft: #1e1e3a;
  --border: #2a2a4a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --nav-bg: rgba(15, 15, 26, 0.95);
  --tag-bg: #1e1e3a;
  --tag-text: #8b83ff;
  --toggle-bg: #8b83ff;
  --toggle-icon: "🌙";
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.5rem); }

p {
  color: var(--text-secondary);
  max-width: 65ch;
}

/* ============================================================
   Layout Utilities
   ============================================================ */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  margin: 0.75rem auto 0;
}

/* ============================================================
   Navigation
   ============================================================ */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding-bottom: 2px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.2s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 2px solid var(--border);
  border-radius: 50px;
  width: 48px;
  height: 26px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
  left: 3px;
  transition: transform 0.25s ease;
}

[data-theme="dark"] .theme-toggle::before {
  transform: translateY(-50%) translateX(22px);
}

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Page offset for fixed nav */
.page-content {
  padding-top: 72px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(108, 99, 255, 0.15);
}

/* ============================================================
   Tags / Badges
   ============================================================ */
.tag {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--tag-bg);
  color: var(--tag-text);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

/* ============================================================
   Hero Section
   ============================================================ */
.hero {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
  opacity: 0.5;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

.hero h1 {
  margin-bottom: 1rem;
}

.hero h1 .highlight {
  color: var(--accent);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 55ch;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ============================================================
   Grid Layouts
   ============================================================ */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

/* ============================================================
   Skills
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.skill-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.skill-item:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.skill-icon {
  font-size: 1.75rem;
  margin-bottom: 0.4rem;
}

/* ============================================================
   Project Cards
   ============================================================ */
.project-card {
  display: flex;
  flex-direction: column;
}

.project-card h3 {
  margin-bottom: 0.5rem;
  word-break: break-word;
  overflow-wrap: break-word;
}

.project-card p {
  font-size: 0.92rem;
  flex: 1;
  margin-bottom: 0;
}

.project-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.35rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.project-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ============================================================
   Timeline (for Resume)
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 2.5rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 6px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.timeline-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.3rem;
}

.timeline-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.timeline-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.timeline-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 60ch;
}

/* ============================================================
   Contact Form
   ============================================================ */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 3rem;
  align-items: start;
}

.contact-info h3 {
  margin-bottom: 1rem;
}

.contact-info p {
  margin-bottom: 1.5rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-link-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.contact-link-item:hover {
  color: var(--accent);
}

.contact-link-icon {
  font-size: 1.25rem;
  width: 1.5rem;
  text-align: center;
}

/* Form */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
}

.form-submit {
  width: 100%;
}

/* ============================================================
   Footer
   ============================================================ */
#main-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  background: var(--bg-secondary);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-social {
  display: flex;
  gap: 1rem;
}

.footer-social a {
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: color 0.2s ease;
}

.footer-social a:hover {
  color: var(--accent);
}

/* ============================================================
   404 Page
   ============================================================ */
.not-found {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.not-found-code {
  font-size: clamp(6rem, 20vw, 10rem);
  font-weight: 900;
  color: var(--accent);
  opacity: 0.15;
  line-height: 1;
  margin-bottom: -1rem;
}

.not-found h2 {
  margin-bottom: 1rem;
}

.not-found p {
  margin: 0 auto 2rem;
}

/* ============================================================
   Misc Utilities
   ============================================================ */
.text-center { text-align: center; }
.text-accent  { color: var(--accent); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: fixed;
    top: 65px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-hamburger {
    display: flex;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .contact-wrapper {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 3rem 0;
  }

  .container {
    padding: 0 1rem;
  }
}
