/* ========== CSS VARIABLES ========== */
:root {
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 12px;
  --max-w: 1100px;
  --transition-speed: 0.4s;
}

[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-elevated: #141416;
  --bg-card: #1a1a1e;
  --border: #2a2a2e;
  --text-primary: #f0f0f2;
  --text-secondary: #8a8a94;
  --text-tertiary: #5a5a64;
  --accent: #6e8efb;
  --accent-soft: rgba(110, 142, 251, 0.1);
  --accent-glow: rgba(110, 142, 251, 0.15);
  --tag-bg: #1e1e24;
  --tag-border: #2e2e34;
  --timeline-line: #2a2a2e;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --overlay: rgba(10, 10, 11, 0.85);
}

[data-theme="light"] {
  --bg: #fafaf9;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --border: #e8e8e4;
  --text-primary: #1a1a1e;
  --text-secondary: #6a6a72;
  --text-tertiary: #9a9aa2;
  --accent: #4a6cf7;
  --accent-soft: rgba(74, 108, 247, 0.08);
  --accent-glow: rgba(74, 108, 247, 0.1);
  --tag-bg: #f0f0ee;
  --tag-border: #e0e0dc;
  --timeline-line: #e0e0dc;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --overlay: rgba(250, 250, 249, 0.85);
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background var(--transition-speed) var(--ease), color var(--transition-speed) var(--ease);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: #fff;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}
a:hover { opacity: 0.8; }

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

/* ========== NAV ========== */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-speed) var(--ease), border-color var(--transition-speed) var(--ease);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

.nav-links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 450;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); opacity: 1; }

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  font-size: 1rem;
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(30deg);
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
}

/* ========== HERO ========== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 80px;
  position: relative;
}

.hero-inner {
  max-width: var(--max-w);
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 80px;
  align-items: center;
}

.hero-text { animation: fadeUp 0.8s var(--ease) both; }

.hero-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: inline-block;
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.hero-name em {
  font-style: italic;
  color: var(--accent);
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 520px;
  line-height: 1.8;
  margin-bottom: 36px;
}

.hero-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s var(--ease);
}

.hero-link.primary {
  background: var(--accent);
  color: #fff;
}
.hero-link.primary:hover { opacity: 0.9; transform: translateY(-1px); }

.hero-link.secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.hero-link.secondary:hover { border-color: var(--accent); }

.hero-photo-wrapper {
  animation: fadeUp 0.8s var(--ease) 0.15s both;
}

.hero-photo {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  transition: border-color 0.3s;
}
.hero-photo:hover { border-color: var(--accent); }

/* ========== SCROLL ARROW ========== */
.scroll-arrow {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  text-decoration: none;
  animation: bounce 2s infinite;
}

.scroll-arrow-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 1.1rem;
  transition: all 0.3s var(--ease);
}

.scroll-arrow:hover .scroll-arrow-icon {
  border-color: var(--accent);
  color: var(--accent);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-8px); }
  60% { transform: translateX(-50%) translateY(-4px); }
}

/* ========== SECTIONS ========== */
.section {
  padding: 64px 24px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.02em;
  margin-bottom: 48px;
  color: var(--text-primary);
}

/* ========== ABOUT ========== */
.about-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 60px;
  align-items: start;
}

.about-text {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.9;
}

.about-text p + p { margin-top: 20px; }

.about-stats {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.3s, background var(--transition-speed) var(--ease);
}

.stat-number {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

/* ========== EXPERIENCE TIMELINE ========== */
.timeline { position: relative; }

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--timeline-line);
}

.timeline-item {
  position: relative;
  padding-left: 40px;
  padding-bottom: 48px;
}

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

.timeline-dot {
  position: absolute;
  left: -5px;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
  transition: background var(--transition-speed) var(--ease), box-shadow var(--transition-speed) var(--ease);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.timeline-company {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.timeline-role {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 12px;
  font-weight: 450;
}

.timeline-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-bullets li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding-left: 16px;
  position: relative;
}

.timeline-bullets li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ========== PROJECTS ========== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.project-card:hover::before { opacity: 1; }

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.project-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-primary);
}

.project-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.project-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--text-secondary);
  transition: all var(--transition-speed) var(--ease);
}

/* ========== SKILLS ========== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.skill-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all 0.3s var(--ease);
}
.skill-group:hover { border-color: var(--accent); }

.skill-group-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--text-primary);
  font-weight: 450;
  transition: all var(--transition-speed) var(--ease);
}

/* ========== PHOTOGRAPHY ========== */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.photo-item {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.photo-item img {
  width: 100%;
  display: block;
  aspect-ratio: 4/5;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.photo-item:hover img { transform: scale(1.03); }

.photo-placeholder {
  aspect-ratio: var(--ratio, 3/4);
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  margin-bottom: 16px;
  break-inside: avoid;
}

/* ========== CONTACT ========== */
.contact-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s var(--ease);
  text-decoration: none;
  color: var(--text-primary);
  flex: 1;
  min-width: 220px;
}

.contact-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  opacity: 1;
}

.contact-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--accent);
  flex-shrink: 0;
}

.contact-label {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.contact-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ========== FOOTER ========== */
footer {
  text-align: center;
  padding: 48px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-tertiary);
  transition: border-color var(--transition-speed) var(--ease);
}

/* ========== ANIMATIONS ========== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== LIGHTBOX ========== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 0.3s var(--ease);
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  .hero-photo-wrapper { order: -1; justify-self: center; }
  .hero-photo { width: 200px; height: 200px; }
  .hero-desc { margin: 0 auto 36px; }
  .hero-links { justify-content: center; }
  .about-content { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .photo-gallery { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
  .nav-hamburger { display: block; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--overlay);
    backdrop-filter: blur(20px);
    padding: 24px;
    border-bottom: 1px solid var(--border);
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .photo-gallery { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
}