/* =========================================================
   Ahmed Abdelnabi — Portfolio
   Design concept: an "operations dashboard" for a backend/
   DevOps engineer — panels, hairline grid, status signals,
   and a stack diagram literally built from his own skills.
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Color */
  --bg: #0B1015;
  --panel: #131B21;
  --panel-2: #0F161B;
  --border: #22303A;
  --border-soft: #1A252C;
  --text: #E7EDF1;
  --text-muted: #95A7B3;
  --text-faint: #7A8E97;

  --amber: #F0A857;
  --amber-strong: #F5B96E;
  --green: #59C88F;
  --blue: #6FA3D6;

  /* Type */
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* Space */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Layout */
  --content-width: 1120px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(240, 168, 87, 0.07), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%, rgba(111, 163, 214, 0.06), transparent 60%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.dim { color: var(--text-faint); }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--amber);
  color: var(--bg);
  padding: var(--space-3) var(--space-4);
  z-index: 200;
  border-radius: 0 0 var(--radius-sm) 0;
  font-family: var(--font-mono);
  font-size: 14px;
}
.skip-link:focus { left: 0; }

a:focus-visible,
button:focus-visible,
.project-link:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 16, 21, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

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

.logo {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
}
.logo-bracket { color: var(--amber); }

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-list a {
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.2s var(--ease);
}
.nav-list a:hover { color: var(--text); }

.nav-cta {
  border: 1px solid var(--border);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--text) !important;
}
.nav-cta:hover { border-color: var(--amber); color: var(--amber) !important; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.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); }

.mobile-nav {
  display: none;
  max-height: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
  transition: max-height 0.3s var(--ease);
}
.mobile-nav.open { max-height: 400px; }
.mobile-nav ul { padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.mobile-nav a { font-size: 15px; color: var(--text-muted); }
.mobile-nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero {
  padding-block: var(--space-9) var(--space-8);
  border-bottom: 1px solid var(--border-soft);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--green);
  background: rgba(89, 200, 143, 0.08);
  border: 1px solid rgba(89, 200, 143, 0.25);
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  margin-bottom: var(--space-6);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(89, 200, 143, 0.6);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(89, 200, 143, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(89, 200, 143, 0); }
  100% { box-shadow: 0 0 0 0 rgba(89, 200, 143, 0); }
}

.hero-name {
  font-size: clamp(2.75rem, 6vw, 4.75rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}

.hero-role {
  font-size: clamp(1.1rem, 2vw, 1.375rem);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 500;
  margin-bottom: var(--space-5);
}

.hero-tagline {
  max-width: 640px;
  font-size: 1.0625rem;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 600;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--amber);
  color: #1A1204;
}
.btn-primary:hover { background: var(--amber-strong); transform: translateY(-1px); }

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--text-muted); transform: translateY(-1px); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.stat-card {
  background: var(--panel);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-num {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  color: var(--amber);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* ---------- Sections (shared) ---------- */
.section {
  padding-block: var(--space-9);
  border-bottom: 1px solid var(--border-soft);
  scroll-margin-top: 80px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-amber { background: var(--amber); }
.dot-green { background: var(--green); }
.dot-blue { background: var(--blue); }

.section-heading {
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-6);
}

.section-sub {
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: var(--space-7);
  font-size: 1rem;
}

.section-heading + .section-sub {
  margin-top: calc(var(--space-6) * -1 + var(--space-2));
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-7);
}

.about-lead {
  font-size: 1.1875rem;
  color: var(--text);
}

.about-grid p:not(.about-lead) {
  color: var(--text-muted);
}

/* ---------- Timeline (Experience) ---------- */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-left: var(--space-7);
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--amber);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--amber);
  margin-bottom: var(--space-2);
}

.timeline-role {
  font-size: 1.25rem;
  margin-bottom: var(--space-1);
}

.timeline-org {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: var(--space-4);
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 680px;
}

.timeline-list li {
  position: relative;
  padding-left: var(--space-4);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.timeline-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-faint);
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.project-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.project-card:hover { border-color: var(--border); transform: translateY(-3px); }

.project-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: var(--space-1) var(--space-2);
  border-radius: 4px;
  white-space: nowrap;
}
.badge-green { background: rgba(89, 200, 143, 0.1); color: var(--green); border: 1px solid rgba(89, 200, 143, 0.25); }
.badge-blue { background: rgba(111, 163, 214, 0.1); color: var(--blue); border: 1px solid rgba(111, 163, 214, 0.25); }

.project-date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

.project-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-3);
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.9375rem;
  flex-grow: 1;
  margin-bottom: var(--space-5);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.pill {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 3px var(--space-2);
  border-radius: 4px;
  background: var(--panel-2);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-4);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--amber);
}
.project-link:hover { color: var(--amber-strong); }
.arrow { display: inline-block; transition: transform 0.2s var(--ease); }
.project-link:hover .arrow,
.contact-link:hover .arrow { transform: translate(2px, -2px); }

.more-repos {
  margin-top: var(--space-6);
  font-size: 0.9375rem;
  color: var(--text-muted);
}
.more-repos a { color: var(--blue); font-weight: 600; }
.more-repos a:hover { color: var(--amber); }

/* ---------- Skills stack ---------- */
.stack {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stack-band {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-5);
  align-items: center;
  padding: var(--space-5);
}
.stack-band:not(:last-child) { border-bottom: 1px solid var(--border-soft); }
.stack-band:nth-child(odd) { background: var(--panel); }
.stack-band:nth-child(even) { background: var(--panel-2); }

.stack-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

/* ---------- Education ---------- */
.edu-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.edu-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.edu-main {
  flex: 1 1 auto;
  min-width: 260px;
}

.edu-school {
  font-size: 1.25rem;
  margin-bottom: var(--space-2);
}

.edu-degree { color: var(--text); margin-bottom: var(--space-1); }
.edu-loc { color: var(--text-muted); font-size: 0.9375rem; }

.edu-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-3);
}

/* ---------- Contact ---------- */
.contact-section { border-bottom: none; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.contact-link {
  background: var(--panel);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: background 0.2s var(--ease);
}
.contact-link:hover { background: var(--panel-2); }

.contact-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.contact-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  word-break: break-word;
}
.contact-link:hover .contact-value { color: var(--amber); }

/* ---------- Footer ---------- */
.site-footer { padding-block: var(--space-6); }
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  color: var(--text-faint);
  font-size: 13px;
}
.footer-log { font-family: var(--font-mono); }

/* ---------- Scroll reveal ----------
   Hidden-until-revealed state only applies once JS has confirmed it can
   run (html.js) and will actually flip .is-visible back on. Without JS,
   .no-js stays on <html> and content is visible by default. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav { display: none; }
  .nav-toggle { display: flex; }
  .mobile-nav { display: block; }

  .about-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .project-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; }

  .stack-band { grid-template-columns: 1fr; gap: var(--space-2); }

  .edu-card { flex-direction: column; }
  .edu-meta { align-items: flex-start; }
}

@media (max-width: 520px) {
  .hero { padding-block: var(--space-7) var(--space-6); }
  .section { padding-block: var(--space-7); }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }
}
