/* ===== Variables ===== */
:root {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --surface: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-dim: rgba(88, 166, 255, 0.15);
  --border: #30363d;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --container: min(90vw, 1100px);
  --radius: 12px;
  --radius-sm: 8px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul {
  margin: 0;
  padding-left: 1.25rem;
}

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin: 0 0 2rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subsection-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--text-muted);
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text);
}

.logo:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 64px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-dim), transparent),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-label {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  color: var(--text);
}

.hero-title .accent {
  color: var(--accent);
}

.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 0 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
  animation: scroll-pulse 2s ease-in-out infinite;
}

@keyframes scroll-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: #79b8ff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent-dim);
  text-decoration: none;
}

/* ===== About ===== */
.about-grid {
  display: grid;
  gap: 2rem;
}

.about-text .lead {
  font-size: 1.15rem;
  color: var(--text);
}

.about-text p {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.about-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.skill-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.skill-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text);
}

.skill-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.soft-skills-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.soft-skills-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.soft-skills-list li:last-child {
  border-bottom: none;
}

.languages p {
  margin: 0;
  color: var(--text-muted);
}

/* ===== Experience / Timeline ===== */
.timeline {
  position: relative;
}

.timeline-item {
  position: relative;
  padding-left: 2rem;
  padding-bottom: 2.5rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 1.25rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
  display: block;
}

.timeline-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.timeline-content .company {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.timeline-content ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.timeline-content li {
  margin-bottom: 0.4rem;
}

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.project-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.project-card:hover {
  border-color: var(--accent);
}

.project-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.project-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== Education ===== */
.education-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.education-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1.5rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.edu-date {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
}

.education-item h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.education-item p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.edu-note {
  margin-top: 0.35rem !important;
  font-size: 0.85rem !important;
  opacity: 0.9;
}

/* ===== Achievements ===== */
.achievements-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.achievements-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.achievements-list li:last-child {
  border-bottom: none;
}

/* ===== Contact ===== */
.contact-section .section-title {
  margin-bottom: 2rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.contact-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.contact-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.contact-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.contact-card a,
.contact-card p {
  display: block;
  margin: 0.25rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.contact-card a:hover {
  color: var(--accent);
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.downloads-label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

/* ===== Footer ===== */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== Mobile-friendly: base improvements ===== */
/* Touch targets min 44px; safe area for notched devices */
.container {
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

.btn {
  min-height: 44px;
  padding: 0.875rem 1.5rem;
}

.nav-links a {
  padding: 0.5rem 0;
  display: inline-block;
  min-height: 44px;
  line-height: 2;
}

/* ===== Tablet and below ===== */
@media (max-width: 768px) {
  .container {
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
  }

  .section {
    padding: 3rem 0;
  }

  .section-title {
    margin-bottom: 1.5rem;
  }

  .nav {
    height: 56px;
  }

  .nav-toggle {
    display: flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px;
  }

  .nav-toggle span {
    width: 22px;
    height: 2px;
  }

  .nav-links {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top, 0));
    left: 0;
    right: 0;
    bottom: auto;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem max(1.25rem, env(safe-area-inset-left)) 1.5rem max(1.25rem, env(safe-area-inset-right));
    gap: 0;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
  }

  .nav-links.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links li {
    border-bottom: 1px solid var(--border);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-links a {
    padding: 1rem 0;
    font-size: 1rem;
    min-height: 48px;
    line-height: 1.5;
    display: flex;
    align-items: center;
  }

  /* Hero */
  .hero {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: calc(56px + env(safe-area-inset-top, 0));
    padding-bottom: 4rem;
    align-items: center;
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 3rem);
    line-height: 1.15;
  }

  .hero-tagline {
    font-size: 1rem;
    margin-bottom: 1.75rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  .hero-actions .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .hero-scroll {
    bottom: max(1rem, env(safe-area-inset-bottom));
  }

  /* About */
  .about-text .lead {
    font-size: 1.05rem;
  }

  .about-badges {
    gap: 0.5rem;
  }

  .badge {
    padding: 0.5rem 0.9rem;
  }

  /* Skills */
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .skill-card {
    padding: 1rem 1.25rem;
  }

  /* Timeline */
  .timeline-item {
    padding-left: 1.75rem;
    padding-bottom: 2rem;
  }

  .timeline-marker {
    width: 8px;
    height: 8px;
    top: 0.4rem;
  }

  .timeline-item::before {
    left: 3px;
  }

  .timeline-content ul {
    font-size: 0.9rem;
  }

  /* Projects */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .project-card {
    padding: 1.25rem;
  }

  /* Education */
  .education-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
  }

  .edu-date {
    order: -1;
    margin-bottom: 0.25rem;
  }

  /* Contact */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .contact-card {
    padding: 1.25rem;
  }

  .contact-card a {
    padding: 0.35rem 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .downloads {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .downloads .btn {
    width: 100%;
    min-height: 48px;
  }

  .footer {
    padding: 1.5rem 1rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
}

/* ===== Small phones ===== */
@media (max-width: 480px) {
  .container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .section {
    padding: 2.5rem 0;
  }

  .section-title {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
  }

  .hero-title {
    font-size: 1.85rem;
  }

  .hero-tagline {
    font-size: 0.95rem;
  }

  .timeline-content h3 {
    font-size: 1.1rem;
  }

  .contact-grid {
    gap: 0.75rem;
  }
}

/* ===== Prevent horizontal overflow on mobile ===== */
html, body {
  overflow-x: hidden;
}

img, video, iframe {
  max-width: 100%;
  height: auto;
}
