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

/* ── Design tokens ── */
:root {
  /* Colors */
  --bg: #ffffff;
  --surface: #f9fafb;
  --surface-hover: #f3f4f6;
  --border: #e5e7eb;
  --accent: #059669;
  --accent-hover: #047857;
  --accent2: #6366f1;
  --text: #111827;
  --text-secondary: #374151;
  --muted: #6b7280;
  --nav-bg: rgba(255,255,255,0.92);

  /* Spacing (8pt grid) */
  --sp-1: 0.5rem;   /* 8px */
  --sp-2: 1rem;     /* 16px */
  --sp-3: 1.5rem;   /* 24px */
  --sp-4: 2rem;     /* 32px */
  --sp-6: 3rem;     /* 48px */
  --sp-8: 4rem;     /* 64px */
  --sp-10: 5rem;    /* 80px */
  --sp-12: 6rem;    /* 96px */

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;

  /* Shape */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
}

/* ── Base ── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Skip link (accessibility) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-2);
  background: var(--accent);
  color: #fff;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 999;
  transition: top 0.2s;
}
.skip-link:focus { top: var(--sp-2); }

/* ── Focus styles (WCAG 2.1) ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  white-space: nowrap;
  vertical-align: middle;
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--sp-2) var(--sp-4);
  height: 60px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
nav ul { list-style: none; display: flex; gap: var(--sp-1); align-items: center; }
nav ul a {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  /* min 44px touch target */
  min-height: 44px;
  display: flex;
  align-items: center;
}
nav ul a:hover { color: var(--text); background: var(--surface-hover); text-decoration: none; }
nav ul a.active {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
}

/* ── Sections ── */
section { padding: var(--sp-8) var(--sp-4); max-width: 900px; margin: 0 auto; }

/* ── HERO ── */
#about {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--sp-12);
  padding-bottom: var(--sp-8);
  padding-left: var(--sp-4);
  padding-right: var(--sp-4);
  max-width: 900px;
  margin: 0 auto;
}
#about h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-2);
}
#about h1 span { color: var(--accent); }
#about p {
  font-size: var(--text-lg);
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: var(--sp-4);
}
.hero-btns { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.5rem;
  min-height: 44px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  letter-spacing: -0.01em;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ── Section header ── */
.section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: var(--sp-1);
}
.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-6);
}

/* ── ABOUT ── */
#about .about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-8);
  align-items: start;
}
#about p {
  color: var(--muted);
  margin-bottom: var(--sp-2);
  line-height: 1.75;
}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); }
.stat-card .stat-icon { font-size: 1.3rem; margin-bottom: var(--sp-1); }
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--accent); letter-spacing: -0.03em; line-height: 1; }
.stat-card .label { font-size: var(--text-xs); font-weight: 600; color: var(--muted); margin-top: 0.35rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .sublabel { font-size: 0.7rem; color: #9ca3af; margin-top: 0.15rem; }

/* ── SKILLS ── */
.skills-grid { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.skill-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.skill-tag:hover { border-color: var(--accent); color: var(--accent); background: rgba(5,150,105,0.04); }

/* ── PROJECTS ── */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); transform: translateY(-2px); }
.project-card .proj-icon { font-size: 1.25rem; line-height: 1; flex-shrink: 0; }
.project-card h3 { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--sp-1); display: flex; align-items: center; gap: 0.4rem; }
.project-card p { font-size: var(--text-sm); color: var(--muted); margin-bottom: var(--sp-2); line-height: 1.6; flex: 1; }
.proj-points { font-size: var(--text-sm); color: var(--muted); margin: 0 0 var(--sp-2) var(--sp-2); padding: 0; line-height: 1.6; flex: 1; list-style: disc; }
.proj-links { display: flex; gap: var(--sp-1); margin-bottom: var(--sp-2); }
.proj-link {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 0.25rem 0.625rem;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  transition: border-color 0.15s, background 0.15s;
}
.proj-link svg { display: block; flex-shrink: 0; margin-right: 0.35rem; }
.proj-link:hover { border-color: var(--accent); background: rgba(5,150,105,0.04); text-decoration: none; }
.proj-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.proj-tag {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(99,102,241,0.08);
  color: var(--accent2);
  border: 1px solid rgba(99,102,241,0.15);
}

/* ── TIMELINE (Experience / Education / Certifications) ── */
.timeline { display: flex; flex-direction: column; gap: var(--sp-4); }
.timeline-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--sp-3);
}
.timeline-date {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 500;
  padding-top: 1.2rem;
  line-height: 1.4;
}
.timeline-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.timeline-content:hover { box-shadow: var(--shadow-sm); border-color: #d1d5db; }
.timeline-content h3 { font-size: var(--text-base); font-weight: 600; margin-bottom: 0.25rem; }
.timeline-content .company { color: var(--accent); font-size: var(--text-sm); font-weight: 500; margin-bottom: var(--sp-1); }
.timeline-content p { font-size: var(--text-sm); color: var(--muted); line-height: 1.7; text-align: justify; }


.experience-list {
  list-style: none;
  padding: 0;
  margin-top: var(--sp-1);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.experience-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.7;
}
.experience-list li::before {
  content: '•';
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.05em;
}
.experience-list li span { flex: 1; text-align: justify; }
.experience-list li strong { color: var(--text-secondary); }

.timeline-content .proj-tags {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
}

/* ── NESTED ROLES (e.g. multiple roles at same company) ── */
.role-block {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.role-block:first-of-type {
  margin-top: var(--sp-1);
  padding-top: 0;
  border-top: none;
}
.role-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: 0.25rem;
}
.role-header h3 { margin-bottom: 0; }
.role-date {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

/* ── CONTACT ── */
#contact { text-align: center; }
#contact p { color: var(--muted); margin-bottom: var(--sp-4); max-width: 50ch; margin-left: auto; margin-right: auto; line-height: 1.75; }
.social-links { display: flex; justify-content: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-4); }
.social-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.625rem 1.25rem;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: box-shadow 0.15s, border-color 0.15s, color 0.15s;
}
.social-link:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-sm); text-decoration: none; }

/* ── FOOTER ── */
footer {
  text-align: center;
  padding: var(--sp-4);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ── HAMBURGER ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: var(--sp-1);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.hamburger:hover { background: var(--surface-hover); }
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ── MOBILE ── */
@media (max-width: 680px) {
  .hamburger { display: flex; }
  nav { justify-content: space-between; }

  nav ul {
    display: none;
    flex-direction: column;
    gap: 0;
    position: fixed;
    top: 60px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: var(--sp-1) 0;
    box-shadow: var(--shadow-lg);
  }
  nav ul.open { display: flex; }
  nav ul li a {
    display: flex;
    padding: 0.75rem var(--sp-4);
    font-size: var(--text-base);
    min-height: 48px;
  }

  section { padding: var(--sp-6) var(--sp-3); }
  #about { padding-top: var(--sp-8); padding-left: var(--sp-3); padding-right: var(--sp-3); }
  #about h1 { font-size: clamp(2rem, 8vw, 3rem); }
  #about p { font-size: var(--text-base); }
  .hero-btns { flex-direction: column; }
  .hero-btns .btn { width: 100%; }

  #about .about-grid { grid-template-columns: 1fr; gap: var(--sp-4); }
  .stat-grid { grid-template-columns: 1fr 1fr; }

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

  .timeline-item { grid-template-columns: 1fr; gap: 0.25rem; }
  .timeline-date { padding-top: 0; font-size: var(--text-xs); }
  .role-header { flex-wrap: wrap; gap: 0.25rem; }

  .social-links { flex-direction: column; align-items: center; }
  .social-link { width: 100%; max-width: 300px; justify-content: center; }
}
