*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

:root {
  --accent-rgb: 30, 64, 175;
  --bg:           #f0f4fb;
  --surface:      #ffffff;
  --text:         #1e293b;
  --heading:      #0f172a;
  --muted:        #64748b;
  --blue:         #2563eb;
  --accent:       #1e40af;
  --accent-hover: #1e3a8a;
  
  --border:       rgba(var(--accent-rgb), 0.14);
  --tag-bg:       rgba(var(--accent-rgb), 0.07);
  --glow:         rgba(var(--accent-rgb), 0.22);
  --transition:   0.3s ease;

  --shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.02);
  --shadow-md:      0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-glow:    0 4px 20px var(--glow);
  --shadow-glow-hi: 0 6px 25px rgba(var(--accent-rgb), 0.4);
  --shadow-card:    0 10px 20px rgba(var(--accent-rgb), 0.08);
  --shadow-contact: 0 16px 40px rgba(var(--accent-rgb), 0.12);

  --header-bg:          rgba(240, 244, 251, 0.85);
  --header-scrolled-bg: rgba(255, 255, 255, 0.95);
  --scrollbar-track:    #e2e8f0;
  --section-alt-bg:     rgba(var(--accent-rgb), 0.03);

  --canvas-particle:   #1e40af;
  --canvas-line:       rgba(30, 64, 175, 0.15);
  --error-grid-line:   rgba(30, 64, 175, 0.03);
}

[data-theme="dark"] {
  --accent-rgb: 96, 165, 250;
  --bg:           #0b0f19;
  --surface:      #131b2e;
  --text:         #cbd5e1;
  --heading:      #f8fafc;
  --muted:        #94a3b8;
  --blue:         #3b82f6;
  --accent:       #60a5fa;
  --accent-hover: #93c5fd;
  
  --border:       rgba(96, 165, 250, 0.18);
  --tag-bg:       rgba(96, 165, 250, 0.10);
  --glow:         rgba(96, 165, 250, 0.25);

  --shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:      0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-glow:    0 4px 20px rgba(96, 165, 250, 0.2);
  --shadow-glow-hi: 0 6px 25px rgba(96, 165, 250, 0.35);
  --shadow-card:    0 10px 25px rgba(0, 0, 0, 0.4);
  --shadow-contact: 0 16px 40px rgba(0, 0, 0, 0.5);

  --header-bg:          rgba(11, 15, 25, 0.85);
  --header-scrolled-bg: rgba(19, 27, 46, 0.95);
  --scrollbar-track:    #1e293b;
  --section-alt-bg:     rgba(96, 165, 250, 0.04);

  --canvas-particle:   #60a5fa;
  --canvas-line:       rgba(96, 165, 250, 0.15);
  --error-grid-line:   rgba(96, 165, 250, 0.05);
}

html { 
  scroll-behavior: smooth; 
  scrollbar-width: thin;
  scrollbar-color: var(--muted) var(--scrollbar-track);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  overflow-x: hidden;
  transition: background-color var(--transition), color var(--transition);
}

/* Focus Accessibility */
:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}

/* Scrollbar (WebKit) */
::-webkit-scrollbar { 
  width: 6px; 
}
::-webkit-scrollbar-track { 
  background: var(--scrollbar-track); 
}
::-webkit-scrollbar-thumb { 
  background: var(--muted); 
  border-radius: 4px; 
  
  &:hover { 
    background: var(--accent); 
  }
}

/* Canvas grid background */
#canvas-bg {
  position: fixed; inset: 0; z-index: 0;
  opacity: 0.25; pointer-events: none;
}

/* Header & Nav */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 60px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  transition: padding var(--transition), background var(--transition), border-color var(--transition);

  &.scrolled {
    padding: 15px 60px;
    background: var(--header-scrolled-bg);
    box-shadow: var(--shadow-card);
  }
}

.nav-logo {
  text-decoration: none;
  display: flex; align-items: center; justify-content: center;

  &:hover .logo-circle {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--glow);
  }
}

.logo-circle {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-weight: 800; font-size: 18px;
  color: var(--accent);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  padding: 0;

  &:hover {
    transform: translateY(-2px) rotate(15deg);
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    background: var(--tag-bg);
  }

  svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.4s ease, opacity 0.3s ease;
  }

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

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

.nav-links { 
  display: flex; gap: 36px; align-items: center; 
  
  a {
    color: var(--muted); text-decoration: none;
    font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
    transition: color 0.2s;
    position: relative;

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

    &:hover, &.active { 
      color: var(--accent); 
      &::after { width: 100%; }
    }
  }
}

.mobile-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  flex-direction: column; gap: 5px; padding: 10px;

  span {
    display: block; width: 24px; height: 2px; background: var(--accent);
    transition: var(--transition);
  }

  &.open span {
    &:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    &:nth-child(2) { opacity: 0; }
    &:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  }
}

/* Layout & Main */
main { position: relative; z-index: 1; }
section { padding: 120px 60px; }

/* Hero */
#hero {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center; align-items: center; 
  padding-top: 80px;
  width: 100%;
}

.hero-inner {
  display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-end;
  text-align: left; gap: 60px; max-width: 1340px; width: 100%; padding: 0 60px;
}

.hero-content {
  flex: 1; min-width: 320px; max-width: 600px; padding-bottom: 20px;
}

.hero-image {
  flex: 1; min-width: 320px; display: flex; justify-content: center; align-items: flex-end;

  img {
    width: 100%; max-width: 640px; height: auto; display: block;
    filter: drop-shadow(0 20px 30px rgba(var(--accent-rgb), 0.15));
  }
}

h1 {
  font-size: clamp(48px, 6vw, 88px); font-weight: 800; line-height: 1; letter-spacing: -3px;
  color: var(--heading); margin-bottom: 12px;
  
  span { color: var(--accent); }
}

.hero-subtitle {
  font-size: 16px; font-weight: 600;
  color: var(--muted); letter-spacing: 2px;
  text-transform: uppercase; margin: 16px 0 32px;
}

.hero-desc {
  color: var(--muted); font-size: 15px; max-width: 540px; line-height: 1.8; margin: 0 0 40px 0;
}

.hero-actions { display: flex; gap: 16px; flex-wrap: nowrap; justify-content: flex-start; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 32px; border-radius: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  text-decoration: none; transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s, border-color 0.2s; 
  cursor: pointer; border: none; white-space: nowrap;
}

.btn-primary {
  background: var(--accent); color: #ffffff;
  box-shadow: var(--shadow-glow);

  &:hover {
    background: var(--accent-hover); 
    box-shadow: var(--shadow-glow-hi);
    transform: translateY(-3px);
  }
}

.btn-ghost {
  background: transparent; color: var(--text);
  border: 2px solid var(--border);

  &:hover {
    border-color: var(--accent); color: var(--accent);
    transform: translateY(-3px);
    background: var(--tag-bg);
  }
}

.hero-divider {
  width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 15%, var(--border) 85%, transparent);
}

/* Section Headers */
.section-header {
  display: flex; align-items: center; gap: 24px; margin-bottom: 40px;
}
.section-num {
  font-size: 12px; font-weight: 700; letter-spacing: 3px; color: var(--accent); text-transform: uppercase;
}
.section-line { flex: 1; height: 1px; background: var(--border); }

h2 {
  font-size: clamp(32px, 4vw, 48px); font-weight: 800; color: var(--heading);
  letter-spacing: -2px; line-height: 1.1; margin-bottom: 60px;
  
  em { color: var(--accent); font-style: normal; }
}

.skill-icon svg,
.contact-icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--transition);
}

.skill-icon { margin-bottom: 20px; }

.edu-years span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.edu-years svg {
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Skills */
#skills {
  background: linear-gradient(180deg, transparent 0%, var(--section-alt-bg) 50%, transparent 100%);
}
.skills-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px;
}
.skill-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; transition: var(--transition); 
  position: relative; overflow: hidden; box-shadow: var(--shadow-sm);

  &::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--blue));
    transform: scaleX(0); transform-origin: left; transition: transform 0.4s ease;
  }

  &:hover { 
    border-color: rgba(var(--accent-rgb), 0.30); 
    transform: translateY(-5px);
    box-shadow: var(--shadow-card);
    
    &::after { transform: scaleX(1); }
  }
}

.skill-cat {
  font-size: 14px; font-weight: 700; color: var(--accent);
  letter-spacing: 1px; text-transform: uppercase; margin-bottom: 20px;
}
.skill-items { display: flex; flex-wrap: wrap; gap: 10px; }
.skill-tag {
  padding: 6px 12px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text);
}

/* Experience */
.timeline { 
  position: relative; margin-top: 40px;
  
  &::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
    background: linear-gradient(180deg, var(--accent), var(--blue), transparent);
  }
}

.timeline-item {
  display: grid; grid-template-columns: 280px 1fr; gap: 40px; 
  padding: 0 0 60px 40px; position: relative;

  &::before {
    content: ''; position: absolute; left: -6px; top: 6px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--surface); border: 3px solid var(--accent);
    box-shadow: 0 0 12px var(--glow);
  }
}

.tl-company { font-weight: 800; font-size: 18px; color: var(--heading); margin-bottom: 4px; }
.tl-brand { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.tl-total {
  display: inline-block; background: var(--tag-bg); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--accent);
}

.tl-stack { 
  margin-top: 20px; 
}

.tl-stack-label { 
  font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; 
}

.tl-stack-list { 
  display: flex; flex-wrap: wrap; gap: 6px; 
}

.tl-stack-tag {
  padding: 4px 10px; border-radius: 4px;
  background: var(--tag-bg); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--accent);
}

.tl-roles { display: flex; flex-direction: column; gap: 24px; }
.tl-role {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; transition: var(--transition);
  box-shadow: var(--shadow-sm);

  &:hover { 
    border-color: rgba(var(--accent-rgb), 0.30); 
    box-shadow: var(--shadow-card);
  }
}

.tl-role-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.tl-role-title { font-weight: 800; font-size: 16px; color: var(--accent); }
.tl-date {
  font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.5px;
  background: var(--bg); padding: 4px 12px; border-radius: 6px; white-space: nowrap;
}

.tl-role ul { 
  list-style: none; 
  
  li {
    color: var(--text); font-size: 14px; line-height: 1.8;
    padding-left: 24px; position: relative; margin-bottom: 8px;
    
    &:last-child { margin-bottom: 0; }
    &::before {
      content: '→'; position: absolute; left: 0; top: 0;
      color: var(--accent); font-weight: bold;
    }
  }
}

/* Education & Certs */
#education { 
  background: linear-gradient(180deg, transparent 0%, var(--section-alt-bg) 50%, transparent 100%); 
}

.edu-title, .certs-title { 
  font-size: 24px; font-weight: 800; color: var(--heading); margin-bottom: 32px; letter-spacing: -0.5px;
}

.edu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-bottom: 60px; }
.edu-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; transition: var(--transition);
  box-shadow: var(--shadow-sm);
  
  &:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: var(--shadow-card); }
}
.edu-degree { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--accent); text-transform: uppercase; margin-bottom: 12px; }
.edu-school { font-weight: 800; font-size: 18px; color: var(--heading); margin-bottom: 8px; }
.edu-field { color: var(--text); font-size: 14px; margin-bottom: 20px; }

.edu-years {
  font-size: 13px; 
  font-weight: 600; 
  color: var(--muted);
  border-top: 1px solid var(--border); 
  padding-top: 16px;
  display: flex; 
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.certs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.cert-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; transition: var(--transition);
  display: flex; flex-direction: column; justify-content: center;
  box-shadow: var(--shadow-sm);
  
  &:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-card); }
}
.cert-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 12px; line-height: 1.5; }
.cert-issuer { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.5px; }

/* Contact */
#contact { 
  text-align: center; 
  background: linear-gradient(180deg, transparent 0%, var(--section-alt-bg) 100%); 
}
.contact-header { max-width: 700px; margin: 0 auto; }
.contact-desc { color: var(--muted); font-size: 16px; max-width: 500px; margin: 20px auto 0; line-height: 1.6; }

.contact-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px; max-width: 800px; margin: 60px auto 0;
}
.contact-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 24px;
  text-decoration: none; transition: var(--transition);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);

  &:hover {
    border-color: var(--accent); transform: translateY(-6px);
    box-shadow: var(--shadow-contact);
  }
  
  &:hover .contact-icon svg {
    transform: scale(1.1);
  }
}
.contact-label { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.contact-value { font-size: 14px; font-weight: 600; color: var(--text); word-break: break-all; }

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 60px; background: var(--surface);
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 20px;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background-color var(--transition), border-color var(--transition);
}

/* Error Page */
body.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  background-image:
    linear-gradient(var(--error-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--error-grid-line) 1px, transparent 1px);
  background-size: 30px 30px;
}

.error-page main {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 140px 30px 80px;
}

.error-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 50px 40px;
  max-width: 580px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-contact);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.8s cubic-bezier(0.5, 0, 0, 1) forwards;

  &::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--blue));
  }
}

.error-visual {
  position: relative;
  margin-bottom: 30px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.error-illustration { animation: float 4s ease-in-out infinite; }

.error-code {
  font-size: 64px; font-weight: 800; color: var(--heading);
  letter-spacing: -2px; line-height: 1; margin-top: 10px; margin-bottom: 5px;
}

.error-title {
  font-size: 28px; font-weight: 800; color: var(--heading);
  letter-spacing: -1px; line-height: 1.2; margin-bottom: 8px;
}

.error-subtitle {
  font-size: 13px; font-weight: 700; color: var(--accent);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 24px;
}

.error-desc { color: var(--muted); font-size: 14.5px; line-height: 1.8; margin-bottom: 36px; }

.error-actions {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;

  .btn { padding: 14px 28px; font-size: 12px; }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

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

@media (max-width: 768px) {
  .error-page main { padding-top: 120px; padding-bottom: 60px; }
  .error-card { padding: 40px 24px; }
  .error-actions { flex-direction: column; width: 100%; gap: 12px; }
  .error-actions .btn { width: 100%; justify-content: center; }
}

/* Reveal Animations */
.reveal {
  opacity: 0; 
  transform: translateY(30px);
  will-change: opacity, transform;
  transition: opacity 0.8s cubic-bezier(0.5, 0, 0, 1), transform 0.8s cubic-bezier(0.5, 0, 0, 1);
  
  &.visible { opacity: 1; transform: translateY(0); }
}

/* Utilities */
.delay-50  { transition-delay: 0.05s; }
.delay-100 { transition-delay: 0.1s; }
.delay-150 { transition-delay: 0.15s; }
.delay-200 { transition-delay: 0.2s; }
.delay-250 { transition-delay: 0.25s; }
.delay-300 { transition-delay: 0.3s; }
.delay-350 { transition-delay: 0.35s; }
.delay-400 { transition-delay: 0.4s; }
.delay-450 { transition-delay: 0.45s; }

/* Responsive Design */
@media (max-width: 1024px) {
  header, header.scrolled { padding: 15px 30px; }
  
  .nav-links {
    position: fixed; top: 65px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    flex-direction: column; gap: 0; padding: 20px 0;
    box-shadow: var(--shadow-card);
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transition: clip-path 0.4s ease-in-out;

    &.open { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
    
    a { 
      padding: 15px 30px; width: 100%; text-align: center; font-size: 14px; 
      
      &::after { display: none; }
    }
  }

  .mobile-menu-btn { display: flex; }
  section { padding: 80px 30px; }
  #hero { padding-top: 100px; }
  .hero-inner { padding: 0 40px; gap: 30px; align-items: flex-end; }
  .hero-content { min-width: 0; padding-bottom: 30px; }
  .hero-desc { margin: 0 0 40px 0; }
  .hero-image { min-width: 0; img { max-width: 100%; } }
  .timeline-item { grid-template-columns: 1fr; gap: 24px; padding: 0 0 48px 32px; }
  footer { padding: 30px; flex-direction: column; text-align: center; }
}

@media (max-width: 768px) {
  .hero-inner { flex-direction: column; text-align: center; padding: 0 24px; gap: 40px; align-items: center; }
  .hero-content { padding-bottom: 0; width: 100%; }
  .hero-desc { margin: 0 auto 40px auto; }
  .hero-actions { justify-content: center; width: 100%; }
  .hero-image { width: 100%; img { max-width: 400px; margin: 0 auto; } }
}

@media (max-width: 600px) {
  h1 { font-size: 40px; }
  .contact-grid { grid-template-columns: 1fr; }
}