/* ==============================================
   CSS VARIABLES
   ============================================== */
:root {
  --bg:               #0d1117;
  --bg-card:          #161b22;
  --bg-card-hover:    #1c2128;
  --border:           #30363d;
  --text:             #e6edf3;
  --text-muted:       #8b949e;
  --accent:           #00ff41;
  --accent-glow:      rgba(0, 255, 65, 0.12);
  --accent-glow-strong: rgba(0, 255, 65, 0.28);
  --font-mono:        'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-body:        -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --nav-height:       60px;
  --radius:           6px;
  --transition:       180ms ease;
}

/* ==============================================
   SCROLL PROGRESS BAR
   ============================================== */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  z-index: 9998; /* below CRT overlay at 9999 */
  pointer-events: none;
  will-change: width;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* CRT Scanline Overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.025) 2px,
    rgba(0, 0, 0, 0.025) 4px
  );
  pointer-events: none;
  z-index: 9999;
  animation: scanlines 10s linear infinite;
}

@keyframes scanlines {
  0%   { background-position: 0 0; }
  100% { background-position: 0 80px; }
}

a {
  color: inherit;
  text-decoration: none;
}

ul { list-style: none; }

/* ==============================================
   NAVIGATION
   ============================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow-strong);
  transition: text-shadow var(--transition);
  letter-spacing: -0.02em;
}

.nav-brand:hover {
  text-shadow: 0 0 24px var(--accent), 0 0 40px var(--accent-glow);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
  text-shadow: 0 0 8px var(--accent-glow-strong);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all var(--transition);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==============================================
   HERO
   ============================================== */
.hero {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4rem;
  padding: 4rem 2rem;
  position: relative;
  overflow: hidden;
}

/* Subtle grid background */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 65, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 65, 0.025) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

.hero-content {
  flex: 1;
  max-width: 580px;
  position: relative;
  z-index: 1;
}

.hero-prompt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
  min-height: 3rem;
}

.prompt-symbol {
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent);
  flex-shrink: 0;
}

.typewriter {
  color: var(--text);
}

.cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
  text-shadow: 0 0 12px var(--accent);
  flex-shrink: 0;
  line-height: 1;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.hero-title {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 2.2vw, 1.1rem);
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.hero-location {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.accent {
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow-strong);
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
  display: inline-block;
}

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

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

.btn-secondary {
  background: transparent;
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-glow);
  box-shadow: 0 0 24px var(--accent-glow-strong);
}

/* Terminal window decoration */
.hero-decoration {
  flex: 0 1 400px;
  position: relative;
  z-index: 1;
}

.terminal-window {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 40px rgba(0, 255, 65, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.6);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: #1c2128;
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.terminal-body {
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.9;
}

.terminal-body p {
  color: var(--text);
}

.terminal-body p.output {
  color: var(--text-muted);
  padding-left: 1rem;
}

.cursor-inline {
  color: var(--accent);
}

.blink {
  animation: blink 1s step-end infinite;
}

/* ==============================================
   SECTIONS
   ============================================== */
.section {
  padding: 5rem 2rem;
}

.section:nth-child(even) {
  background: rgba(22, 27, 34, 0.4);
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

.section-header {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
  margin-left: 1rem;
}

.prompt {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow-strong);
}

/* ==============================================
   CARDS
   ============================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-2px);
}

/* ==============================================
   ABOUT
   ============================================== */
.about-content {
  max-width: 720px;
}

.about-text {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.85;
}

.about-text:last-child {
  margin-bottom: 0;
}

/* ==============================================
   TIMELINE / EXPERIENCE
   ============================================== */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent) 0%, rgba(0, 255, 65, 0.1) 100%);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
  margin-left: 1.25rem;
}

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

.timeline-marker {
  position: absolute;
  left: -2.6rem;
  top: 1.5rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px var(--accent);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.company {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.location {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-top: 0.15rem;
}

.roles {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.role {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
}

.role-title {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.1rem;
}

.role-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.65;
}

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

.skill-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.38rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--accent);
  background: var(--accent-glow);
  cursor: default;
  transition: all var(--transition);
  user-select: none;
}

.skill-tag:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 16px var(--accent-glow-strong);
  transform: translateY(-2px);
}

/* ==============================================
   EDUCATION & CERTIFICATIONS
   ============================================== */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.edu-card {
  text-align: center;
}

.edu-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
}

.edu-card h3 {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.school {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin-bottom: 0.2rem;
}

.field {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.sub-header {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.cert-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.cert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1.5;
}

.cert-card p {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.45;
}

.cert-card small {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  margin-top: 0.3rem;
}

/* ==============================================
   CONTACT
   ============================================== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  transition: all var(--transition);
}

.contact-icon {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  flex-shrink: 0;
  transition: all var(--transition);
}

.contact-link:hover .contact-icon {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 14px var(--accent-glow-strong);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.15rem;
}

.contact-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
}

.contact-link:hover .contact-value {
  color: var(--accent);
}

/* ==============================================
   FOOTER
   ============================================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-cmd {
  font-style: italic;
  opacity: 0.7;
}

.footer-output {
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: 0.3rem;
}

/* ==============================================
   FADE-IN SCROLL ANIMATION
   ============================================== */
.fade-in {
  opacity: 0;
  transition: opacity 0.55s ease, transform 0.55s ease;
  /* transform is set inline by Motion One; only opacity needed for CSS fallback */
}

.fade-in.visible {
  opacity: 1;
  transform: none;
}

/* ==============================================
   RESPONSIVE — TABLET
   ============================================== */
@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    gap: 3rem;
    min-height: auto;
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .hero-content {
    max-width: 100%;
    order: 1;
  }

  .hero-decoration {
    order: 2;
    flex: none;
    width: 100%;
    max-width: 480px;
    align-self: center;
  }
}

/* ==============================================
   RESPONSIVE — MOBILE
   ============================================== */
@media (max-width: 768px) {
  .nav {
    flex-wrap: wrap;
    height: auto;
    padding: 0.75rem 1.25rem;
    gap: 0;
  }

  .nav-brand {
    flex: 1;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0 0.25rem;
    gap: 0.15rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    padding: 0.5rem 0.5rem;
  }

  .section {
    padding: 3.5rem 1.25rem;
  }

  .timeline {
    padding-left: 1.5rem;
  }

  .timeline-marker {
    left: -2.1rem;
  }

  .edu-grid,
  .cert-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-prompt {
    font-size: 1.2rem;
  }

  .section-header {
    font-size: 0.95rem;
  }

  .hero-cta {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    text-align: center;
  }
}
