/* ==========================================================================
   Ahsan Sajid — Full-Stack Engineer Portfolio CSS
   ========================================================================== */

:root {
  /* Premium Dark Palette */
  --bg: #090d16;
  --bg-soft: #0e1524;
  --surface: #131c2e;
  --surface-hover: #18243b;
  --border: #1f2d47;
  --border-light: #2c3d5c;

  --text: #f0f4fc;
  --text-muted: #9aa7c0;
  --text-faint: #5a6985;

  --accent: #f2b84b;
  --accent-strong: #ffd47d;
  --accent-soft: rgba(242, 184, 75, 0.12);

  --teal: #4ade80;
  --teal-soft: rgba(74, 222, 128, 0.12);
  --blue-accent: #38bdf8;

  /* Fonts */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* Geometry */
  --wrap: 1140px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --header-h: 72px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--text);
}

/* Layout Helpers */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
}

section {
  padding: 100px 0;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  max-width: 32ch;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.75em 1.4em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.45em 0.85em;
  font-size: 0.82rem;
}

.btn-primary {
  background: var(--accent);
  color: #120e04;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 6px 20px rgba(242, 184, 75, 0.25);
}

.btn-outline {
  border-color: var(--border-light);
  color: var(--text);
  background: var(--surface);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-mark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 32px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.nav-link {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  margin-inline: 8px;
  background: var(--text);
  border-radius: 2px;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  padding: 24px;
  flex-direction: column;
  gap: 18px;
  font-family: var(--font-mono);
  z-index: 99;
}

.mobile-nav.is-open {
  display: flex;
}

/* Hero */
.hero {
  padding-top: calc(var(--header-h) + 80px);
  padding-bottom: 90px;
  background:
    radial-gradient(circle at 80% 20%, var(--accent-soft), transparent 40%),
    radial-gradient(
      circle at 10% 80%,
      rgba(56, 189, 248, 0.08),
      transparent 35%
    );
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--teal-soft);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.35em 0.85em;
  border-radius: 999px;
  margin-bottom: 20px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--teal);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(74, 222, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  margin-bottom: 0.4em;
}

.hero-lede {
  color: var(--text-muted);
  font-size: 1.08rem;
  max-width: 48ch;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin: 32px 0;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

/* System Card Component */
.system-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.5);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.window-controls {
  display: flex;
  gap: 6px;
}

.wdot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.wdot.red {
  background: #ef4444;
}
.wdot.yellow {
  background: var(--accent);
}
.wdot.green {
  background: var(--teal);
}

.card-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.card-tabs {
  display: flex;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.card-content {
  padding: 24px 20px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  min-height: 180px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.code-line {
  margin: 0 0 6px;
  color: var(--text-muted);
}
.code-line.indent {
  padding-left: 1.4em;
}

.c-keyword {
  color: #f472b6;
}
.c-var {
  color: var(--blue-accent);
}
.c-prop {
  color: #a78bfa;
}
.c-str {
  color: var(--teal);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* About Section */
.about {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.about-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 48px;
}

.about-body p {
  color: var(--text-muted);
  font-size: 1.02rem;
}

.fact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 32px;
}

.fact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-sm);
}

.fact-title {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.fact-val {
  color: var(--text);
  font-weight: 500;
  font-size: 0.92rem;
}

/* Experience Section Timeline */
.timeline {
  position: relative;
  max-width: 860px;
  margin-top: 40px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-left: 32px;
  margin-bottom: 48px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

.timeline-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.timeline-role {
  color: var(--accent);
  font-weight: 600;
}
.timeline-company {
  color: var(--text);
}
.timeline-date {
  color: var(--text-faint);
  margin-left: auto;
}

.timeline-content h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.timeline-content p {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.timeline-content ul {
  padding-left: 20px;
  list-style-type: disc;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease;
}

.skill-card:hover {
  border-color: var(--accent);
}

.skill-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip-list li {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

/* Projects Grid */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn.active,
.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-light);
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.external-icon {
  color: var(--text-faint);
  font-size: 1.1rem;
  transition: color 0.2s ease;
}

.external-icon:hover {
  color: var(--accent);
}

.project-card h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}
.project-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  flex-grow: 1;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tech-tags span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  background: var(--bg-soft);
  padding: 3px 8px;
  border-radius: 4px;
}

.project-link {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 500;
}

.project-multi-links {
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
}

.more-projects {
  text-align: center;
  margin-top: 48px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.more-projects a {
  color: var(--accent);
  text-decoration: underline;
}

/* Contact */
.contact {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  text-align: center;
}

.contact-inner {
  max-width: 680px;
}

.contact-lede {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.contact-email {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 700;
  color: var(--accent);
  display: inline-block;
  margin-bottom: 8px;
}

.contact-loc {
  color: var(--text-faint);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.contact-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Footer */
.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-faint);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-mono {
  font-family: var(--font-mono);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--teal);
  color: #052e16;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #000;
  padding: 8px;
  z-index: 1000;
}
.skip-link:focus {
  top: 0;
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Fixes
   ========================================================================== */

@media (max-width: 992px) {
  .hero-grid,
  .about-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .skills-grid {
    grid-template-columns: 1fr;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .site-nav {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }

  /* Hide the desktop email button text or hide button entirely on mobile */
  .copy-email-btn {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .timeline::before {
    left: 8px;
  }
  .timeline-item {
    padding-left: 28px;
  }
  .timeline-item::before {
    left: 3px;
  }
  .timeline-date {
    margin-left: 0;
    width: 100%;
  }
  .hero {
    padding-top: calc(var(--header-h) + 80px);
    padding-bottom: 60px;
  }
  section {
    padding: 40px 0;
  }
}

@media (max-width: 480px) {
  .copy-email-btn {
    display: none; /* Hide top email button on small phones to prevent header collisions */
  }
  .fact-grid {
    grid-template-columns: 1fr;
  }
  .contact-card {
    padding: 24px;
  }
  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}
