/* ============================================================
   Navnit Portfolio — Design System & Styles
   Inspired by nawin.xyz | Dark theme, green accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

/* ---------- Custom Properties ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #09090b;
  --bg-card: #111116;
  --bg-card-hover: #16161b;

  /* Borders */
  --border: #1e1e26;
  --border-hover: #2d2d3a;

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  /* Accent */
  --accent: #22c55e;
  --accent-dim: #16a34a;
  --accent-glow: rgba(34, 197, 94, 0.12);

  /* GitHub Calendar */
  --gh-0: #161b22;
  --gh-1: #0e4429;
  --gh-2: #006d32;
  --gh-3: #26a641;
  --gh-4: #39d353;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --max-w: 700px;
  --section-py: 60px;
  --radius: 10px;
  --radius-sm: 6px;
}

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #27272a #09090b;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #27272a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3f3f46; }

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- Container ---------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Sections ---------- */
.section {
  padding: var(--section-py) 0;
}

.section-title {
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 6px;
}

.section-description {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.7;
}

/* ============================================================
   HERO
   ============================================================ */
#hero {
  padding: 110px 0 40px;
  position: relative;
}

.hero-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-glow {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  height: 140px;
  background: radial-gradient(ellipse, var(--accent-glow), transparent 70%);
  filter: blur(50px);
  pointer-events: none;
  z-index: 0;
  animation: pulseGlow 4s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
  0%   { opacity: 0.6; transform: translateX(-50%) scale(1); }
  100% { opacity: 1;   transform: translateX(-50%) scale(1.15); }
}

/* Profile Avatar */
.hero-avatar {
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.avatar-img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  box-shadow: 0 0 30px var(--accent-glow), 0 0 60px rgba(34, 197, 94, 0.06);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.avatar-img:hover {
  border-color: var(--accent);
  box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(34, 197, 94, 0.1);
  transform: scale(1.05);
}

.hero-name {
  font-size: 52px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1.1;
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
}

.hero-tagline {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 520px;
  position: relative;
  z-index: 1;
  margin-bottom: 28px;
}

/* Social Links */
.social-links {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  position: relative;
  z-index: 1;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.25s ease, transform 0.25s ease;
}

.social-link:hover {
  color: var(--text-primary);
  transform: translateY(-3px);
}

.social-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Resume Button */
.resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  text-decoration: none;
  transition: all 0.25s ease;
  position: relative;
  z-index: 1;
  cursor: pointer;
}

.resume-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 24px var(--accent-glow);
}

.resume-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ============================================================
   GITHUB CALENDAR
   ============================================================ */
.github-calendar-wrapper {
  overflow-x: auto;
  padding-bottom: 4px;
}

.github-calendar {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  min-width: 660px;
}

.github-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--gh-0);
  transition: outline 0.15s ease;
  cursor: pointer;
}

.github-cell:hover {
  outline: 1px solid var(--text-muted);
  outline-offset: 1px;
}

.github-cell[data-level="1"] { background: var(--gh-1); }
.github-cell[data-level="2"] { background: var(--gh-2); }
.github-cell[data-level="3"] { background: var(--gh-3); }
.github-cell[data-level="4"] { background: var(--gh-4); }

.github-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.github-count {
  color: var(--text-muted);
  font-size: 13px;
}

.github-count span {
  color: var(--text-secondary);
  font-weight: 600;
}

.github-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

/* ============================================================
   ABOUT
   ============================================================ */
#about p {
  color: var(--text-secondary);
  line-height: 1.85;
}

#about a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

#about a:hover {
  border-bottom-color: var(--accent);
}

/* ============================================================
   EXPERIENCE
   ============================================================ */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.experience-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.experience-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

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

.exp-company {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.exp-company a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.exp-company a:hover { color: var(--accent); }

.exp-dates {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.exp-role {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.exp-description {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 14px;
}

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

.tag {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s;
}

.tag:hover {
  color: var(--text-secondary);
  border-color: var(--border-hover);
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.25s ease;
  cursor: default;
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.08);
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.project-image-wrapper {
  position: relative;
  overflow: hidden;
}

.project-image {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
  transition: transform 0.4s ease;
}

.project-card:hover .project-image {
  transform: scale(1.05);
}

.project-content {
  padding: 16px;
}

.project-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.project-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.project-year {
  font-size: 12px;
  color: var(--text-muted);
}

.project-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

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

.project-links {
  display: flex;
  gap: 8px;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.25s ease;
  cursor: pointer;
}

.project-link svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.project-link.primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.project-link.primary:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 18px var(--accent-glow);
}

.project-link.secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.project-link.secondary:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* ============================================================
   EDUCATION
   ============================================================ */
.education-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.education-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.education-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

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

.edu-school {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.edu-years {
  font-size: 13px;
  color: var(--text-muted);
}

.edu-degree {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.edu-details {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   CONTACT
   ============================================================ */
#contact p {
  color: var(--text-secondary);
  line-height: 1.85;
}

#contact a {
  color: #60a5fa;
  text-decoration: none;
  transition: color 0.2s;
}

#contact a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

footer p {
  font-size: 13px;
  color: var(--text-muted);
}

footer .footer-heart {
  color: var(--accent);
}

/* ============================================================
   SCROLL-TO-TOP BUTTON
   ============================================================ */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 100;
  font-family: var(--font);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

/* ============================================================
   SCROLL-TRIGGERED FADE-IN ANIMATIONS
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

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

/* Staggered children */
.fade-in-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

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

.fade-in-children.visible > *:nth-child(1) { transition-delay: 0.04s; }
.fade-in-children.visible > *:nth-child(2) { transition-delay: 0.08s; }
.fade-in-children.visible > *:nth-child(3) { transition-delay: 0.12s; }
.fade-in-children.visible > *:nth-child(4) { transition-delay: 0.16s; }
.fade-in-children.visible > *:nth-child(5) { transition-delay: 0.20s; }
.fade-in-children.visible > *:nth-child(6) { transition-delay: 0.24s; }

/* ============================================================
   TOOLTIP (for GitHub Calendar)
   ============================================================ */
.tooltip {
  position: fixed;
  padding: 6px 12px;
  background: #1a1a24;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text-secondary);
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tooltip.show {
  opacity: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .hero-name {
    font-size: 38px;
  }

  .hero-container {
    flex-direction: column-reverse;
    text-align: center;
    gap: 24px;
  }

  .social-links {
    justify-content: center;
  }

  .avatar-img {
    width: 120px;
    height: 120px;
  }

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

  .exp-header,
  .edu-header {
    flex-direction: column;
    gap: 4px;
  }

  .github-calendar {
    min-width: 600px;
  }

  :root {
    --section-py: 48px;
  }
}

@media (max-width: 480px) {
  .hero-name {
    font-size: 32px;
  }

  .hero-tagline {
    font-size: 14px;
  }

  .container {
    padding: 0 16px;
  }

  .social-links {
    gap: 14px;
  }

  #hero {
    padding: 80px 0 32px;
  }

  .section-title {
    font-size: 20px;
  }

  .avatar-img {
    width: 100px;
    height: 100px;
  }

  :root {
    --section-py: 40px;
  }
}
