/* ==========================================================================
   Munawar Khan — Cloud DevOps Engineer · Terminal-inspired dark theme
   ========================================================================== */

:root {
  --bg: #0d1117;
  --bg-alt: #10161d;
  --surface: #161b22;
  --surface-2: #1f2630;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;       /* electric blue */
  --accent-2: #2dd4bf;     /* teal */
  --amber: #f5b942;
  --red: #ff5f56;
  --yellow: #ffbd2e;
  --green: #27c93f;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --sans: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --radius: 12px;
  --maxw: 1080px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  overflow-x: hidden;
}

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

/* Background canvas */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.55;
}

.prompt { color: var(--accent); font-family: var(--mono); }
.accent { color: var(--accent); }

/* ---------- Navbar ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(10, 14, 23, 0.8);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.scrolled { border-bottom-color: var(--border); }

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.88rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }

.nav-cta {
  border: 1px solid var(--accent);
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  color: var(--accent) !important;
}
.nav-cta:hover { background: rgba(88, 166, 255, 0.1); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 24px; height: 2px;
  background: var(--text);
  transition: 0.3s;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 7rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
  position: relative;
}

.hero-hello { font-family: var(--mono); color: var(--text-dim); margin-bottom: 0.6rem; }

.hero-name {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--text) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title {
  font-family: var(--mono);
  font-size: clamp(1.1rem, 2.6vw, 1.5rem);
  color: var(--accent-2);
  font-weight: 500;
  min-height: 2.2rem;
  margin: 0.4rem 0 1.2rem;
}

.cursor { animation: blink 1s step-end infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

.hero-summary { color: var(--text-dim); max-width: 46ch; margin-bottom: 1.4rem; }
.hero-summary strong { color: var(--text); }

.hero-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.8rem; }

.badge {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  background: var(--surface);
  transition: all 0.2s;
}
.badge:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

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

.btn {
  font-family: var(--mono);
  font-size: 0.92rem;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--accent);
  color: #06121f;
  font-weight: 700;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(88, 166, 255, 0.3); }
.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-2); }

.scroll-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  text-decoration: none;
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translate(-50%, 8px); } }

/* ---------- Terminal windows ---------- */
.term-window {
  background: #0b0f14;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0.65rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }
.term-title {
  margin-left: auto; margin-right: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.term-body {
  padding: 1.1rem 1.2rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 280px;
}

.hero-terminal .term-body { min-height: 320px; }

/* Interactive terminal */
.term-window.interactive { cursor: text; }
.term-window.interactive .term-body {
  max-height: 380px;
  min-height: 260px;
  overflow-y: auto;
}
.term-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.2rem 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}
#term-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  caret-color: var(--accent);
}
.term-line-cmd { color: var(--accent); }
.term-line-out { color: var(--text-dim); }
.term-line-err { color: var(--red); }
.term-line-info { color: var(--accent-2); }
.term-line-warn { color: var(--amber); }
.term-hint { font-family: var(--mono); color: var(--text-dim); font-size: 0.85rem; margin-bottom: 1rem; }
.term-hint code { color: var(--amber); }

/* ---------- Sections ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

.section-title {
  font-family: var(--mono);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  margin-bottom: 2.2rem;
  font-weight: 700;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  align-items: center;
}
.about-text p { color: var(--text-dim); margin-bottom: 1rem; }
.about-text strong { color: var(--text); }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.stat-num, .stat-plus {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-top: 0.3rem; }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2), var(--border));
}
.timeline-item { position: relative; margin-bottom: 2.2rem; }
.timeline-marker {
  position: absolute;
  left: -2rem; top: 8px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.5);
}
.timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1.8rem;
  transition: border-color 0.2s, transform 0.2s;
}
.timeline-card:hover { border-color: var(--accent-2); transform: translateX(4px); }
.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.timeline-head h3 { font-size: 1.15rem; }
.timeline-when {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.25);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}
.timeline-org { color: var(--accent-2); font-size: 0.9rem; margin: 0.2rem 0 0.9rem; font-weight: 500; }
.timeline-points { list-style: none; }
.timeline-points li {
  color: var(--text-dim);
  font-size: 0.92rem;
  padding-left: 1.2rem;
  position: relative;
  margin-bottom: 0.45rem;
}
.timeline-points li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
}
.timeline-points strong { color: var(--text); }

/* ---------- Skills ---------- */
.skills-tabs {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.8rem;
}
.tab {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.55rem 1.1rem;
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.tab:hover { color: var(--text); border-color: var(--accent-2); }
.tab.active {
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent);
  border-color: var(--accent);
}

.skills-panel { display: none; }
.skills-panel.active { display: block; animation: fadeUp 0.4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }

.skill { margin-bottom: 1.2rem; }
.skill-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.86rem;
  margin-bottom: 0.4rem;
}
.skill-head span:last-child { color: var(--accent); }
.bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.skills-panel.active .bar-fill,
.bars-animated .bar-fill { width: var(--w); }

/* ---------- Certifications ---------- */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
}
.cert-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.cert-card h3::after {
  content: ' ↗';
  font-size: 0.8em;
  color: var(--accent-2);
  opacity: 0;
  transition: opacity 0.2s;
}
.cert-card:hover h3::after { opacity: 1; }
.cert-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}
.cert-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.cert-card:hover::before { transform: scaleX(1); }
.cert-top {
  display: block;
  margin-bottom: 0.9rem;
}
.cert-badge {
  display: block;
  width: 88px;
  height: 88px;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
  transition: transform 0.25s;
}
.cert-card:hover .cert-badge { transform: scale(1.08); }

.cert-year {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
}
.cert-card { text-align: center; }
.cert-card h3 { margin: 0.3rem 0 0.4rem; font-size: 1.05rem; }
.cert-card p { color: var(--text-dim); font-size: 0.83rem; }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem 1.4rem;
  text-align: center;
  text-decoration: none;
  transition: all 0.25s;
}
.contact-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 16px 40px rgba(88, 166, 255, 0.12);
}
.contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
}
.contact-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.contact-value { display: block; color: var(--text); margin-top: 0.2rem; font-size: 0.95rem; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}
.footer-sub { margin-top: 0.4rem; font-size: 0.72rem; opacity: 0.6; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 6rem; }
  .hero-terminal { display: none; }
  .about-grid { grid-template-columns: 1fr; }

  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 1.2rem;
    gap: 1rem;
    display: none;
  }
  .nav-links.open { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .bar-fill { width: var(--w); }
}
