/* =========================================================
   Saad - Homepage (React build)
   Modern dark theme + seamless animation system.
   ========================================================= */

:root {
  --bg:        #07080d;
  --bg-soft:   #0d1019;
  --surface:   #121622;
  --surface-2: #181f30;
  --surface-3: #1f2840;
  --border:    #232b3d;
  --border-2:  #2b3550;

  --fg:        #edf1f8;
  --fg-soft:   #b5bdcc;
  --fg-mute:   #7b8597;
  --fg-dim:    #5a6378;

  --blue:    #6e8eff;
  --teal:    #5eead4;
  --violet:  #c4b5fd;
  --pink:    #ff9bd1;
  --green:   #34d399;
  --yellow:  #f5c451;
  --red:     #ff7373;

  --grad: linear-gradient(120deg, #6e8eff 0%, #5eead4 55%, #c4b5fd 100%);
  --grad-soft: linear-gradient(135deg, rgba(110,142,255,0.18), rgba(94,234,212,0.10) 50%, rgba(196,181,253,0.12));

  --mono: 'JetBrains Mono', 'Fira Code', Consolas, ui-monospace, monospace;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  --shadow:    0 8px 30px rgba(0,0,0,0.25);
  --shadow-lg: 0 30px 80px rgba(0,0,0,0.55);

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;

  --t-fast: 0.18s;
  --t:      0.35s;
  --t-slow: 0.7s;
  --easing: cubic-bezier(0.16, 1, 0.3, 1);

  --maxw: 1180px;
  --gutter: 28px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

html, body { max-width: 100%; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Defensive: nothing should ever be wider than the viewport. */
img, video, iframe, pre, table { max-width: 100%; }
/* Every grid child can shrink - kills overflow from long pre/code/text content. */
.hero > *, .stats > *, .about-grid > *, .projects-grid > *,
.skills-grid > *, .contact-box > *, .hero-meta > *,
.skill-card > .skill-chips > .skill-chip, .project > * { min-width: 0; }

a { color: var(--blue); text-decoration: none; transition: color var(--t-fast) ease; }
a:hover { color: #a8b8ff; }

img, svg { display: block; max-width: 100%; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* =========================================================
   Reveal - scroll-triggered fade + slide
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--t-slow) var(--easing), transform var(--t-slow) var(--easing);
  will-change: opacity, transform;
}
.reveal.inView {
  opacity: 1;
  transform: none;
}

.stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--t-slow) var(--easing), transform var(--t-slow) var(--easing);
}
.stagger.inView > * {
  opacity: 1;
  transform: none;
}
.stagger.inView > *:nth-child(1) { transition-delay: 50ms; }
.stagger.inView > *:nth-child(2) { transition-delay: 130ms; }
.stagger.inView > *:nth-child(3) { transition-delay: 210ms; }
.stagger.inView > *:nth-child(4) { transition-delay: 290ms; }
.stagger.inView > *:nth-child(5) { transition-delay: 370ms; }
.stagger.inView > *:nth-child(6) { transition-delay: 450ms; }
.stagger.inView > *:nth-child(7) { transition-delay: 520ms; }
.stagger.inView > *:nth-child(8) { transition-delay: 590ms; }

/* =========================================================
   NAV
   ========================================================= */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7,8,13,0.65);
  border-bottom: 1px solid rgba(35,43,61,0.6);
  transition: padding var(--t) var(--easing);
}
.nav.scrolled { padding: 2px 0; background: rgba(7,8,13,0.85); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.logo { display: flex; align-items: center; gap: 12px; color: var(--fg); font-weight: 700; font-size: 15px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--grad);
  color: #07080d;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  transition: transform var(--t) var(--easing);
}
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.05); }

/* Headshot avatar - replaces the MS gradient mark */
.logo-photo {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    var(--grad) border-box;
  transition: transform var(--t) var(--easing);
}
.logo:hover .logo-photo { transform: scale(1.06); }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: var(--fg-soft);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  padding: 6px 0;
  transition: color var(--t-fast) ease;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a::after {
  content: "";
  position: absolute; left: 0; right: 100%; bottom: -2px;
  height: 2px; border-radius: 2px;
  background: var(--grad);
  transition: right var(--t) var(--easing);
}
.nav-links a:hover::after,
.nav-links a.active::after { right: 0; }
.nav-links a.active { color: var(--fg); }

.nav-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--fg);
  color: #07080d;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 18px;
  border-radius: 999px;
  transition: transform var(--t) var(--easing), background var(--t) ease;
}
.nav-cta:hover { background: #fff; transform: translateY(-1px); }

/* Hamburger - hidden on desktop, shown on small screens */
.nav-burger {
  display: none;
  background: transparent;
  border: 0;
  padding: 8px;
  cursor: pointer;
  position: relative;
  width: 40px; height: 40px;
}
.nav-burger span {
  display: block;
  position: absolute;
  left: 8px; right: 8px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform .3s var(--easing), opacity .2s ease, top .3s var(--easing);
}
.nav-burger span:nth-child(1) { top: 13px; }
.nav-burger span:nth-child(2) { top: 19px; }
.nav-burger span:nth-child(3) { top: 25px; }
.nav-burger.open span:nth-child(1) { top: 19px; transform: rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { top: 19px; transform: rotate(-45deg); }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  padding: 92px 28px 72px;
  position: relative;
}
/* CRITICAL: grid items default to min-width:auto which is content-size.
   For columns containing the code window (with long pre lines), that
   forces the column wider than the viewport on mobile. Override so
   they can shrink and the pre scrolls internally. */
.hero-left, .hero-right { min-width: 0; }
.hero-right { width: 100%; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-soft);
  background: rgba(94,234,212,0.07);
  border: 1px solid rgba(94,234,212,0.20);
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.4px;
  margin-bottom: 22px;
}
.led {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(52,211,153,0.7);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.4; box-shadow: 0 0 2px rgba(52,211,153,0.3); } }

/* View toggle pills */
.view-toggle {
  display: inline-flex;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 26px;
  position: relative;
  font-family: var(--mono);
  font-size: 12.5px;
}
.vt-pill {
  position: relative;
  background: transparent;
  border: none;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--fg-soft);
  font-family: inherit; font-size: inherit;
  font-weight: 500;
  letter-spacing: 0.3px;
  z-index: 1;
  transition: color var(--t-fast) ease;
}
.vt-pill:hover { color: var(--fg); }
.vt-pill.active { color: #07080d; font-weight: 700; }
.vt-indicator {
  position: absolute;
  top: 4px; bottom: 4px;
  background: var(--grad);
  border-radius: 999px;
  transition: left var(--t) var(--easing), width var(--t) var(--easing);
  z-index: 0;
}

/* Hero title - gradient & reveal */
.hero-title {
  font-size: clamp(38px, 5.4vw, 64px);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 24px;
  position: relative;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.hero-title .line {
  display: block;
  overflow: hidden;
  max-width: 100%;
}
.hero-title .line span {
  /* Block (not inline-block) so multi-word titles wrap inside the line
     instead of forcing the page wider than the viewport. Transform
     still animates on block elements. */
  display: block;
  max-width: 100%;
  transform: translateY(110%);
  animation: titleRise 1s var(--easing) forwards;
}
.hero-title .line:nth-child(1) span { animation-delay: 100ms; }
.hero-title .line:nth-child(2) span { animation-delay: 250ms; }
@keyframes titleRise { to { transform: none; } }
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: 17px;
  color: var(--fg-soft);
  max-width: 56ch;
  margin: 0 0 28px;
}
.hero-sub strong { color: var(--fg); }

.hero-cta {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 38px;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform var(--t) var(--easing), background var(--t) ease, border-color var(--t) ease;
  will-change: transform;
}
.btn-primary {
  background: var(--grad);
  background-size: 200% 100%;
  background-position: 0% 50%;
  color: #07080d;
  transition: background-position 0.8s var(--easing), transform var(--t) var(--easing);
}
.btn-primary:hover { background-position: 100% 50%; transform: translateY(-2px); color: #07080d; }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-2);
}
.btn-ghost:hover { background: var(--surface); color: var(--fg); border-color: var(--blue); }
.arrow { transition: transform var(--t) var(--easing); }
.btn:hover .arrow { transform: translateX(4px); }

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 14px 36px;
  font-family: var(--mono);
  font-size: 12.5px;
}
.hero-meta > div { display: flex; flex-direction: column; gap: 2px; }
.meta-k { color: var(--fg-mute); text-transform: uppercase; letter-spacing: 0.6px; font-size: 11px; }
.meta-v { color: var(--fg); }

/* Hero illustration card (code window) */
.code-window {
  background: linear-gradient(180deg, #0e1320 0%, #07080d 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.02) inset;
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
  transform-style: preserve-3d;
  transition: transform 0.5s var(--easing);
  will-change: transform;
}
.code-window-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}
.code-window-bar .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.code-window-bar .dot.red    { background: #ff5f56; }
.code-window-bar .dot.yellow { background: #ffbd2e; }
.code-window-bar .dot.green  { background: #27c93f; }
.code-window-title { margin-left: 12px; font-family: var(--mono); font-size: 12px; color: var(--fg-mute); }
.code-window-body {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 18px 20px;
  color: var(--fg);
  overflow-x: auto;
  /* pre-wrap so long lines fold inside the window instead of overflowing. */
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}
.code-window-body code { font-family: inherit; color: inherit; word-break: break-word; }
/* Scale up slightly on very wide screens where there's room. */
@media (min-width: 1280px) {
  .code-window-body { font-size: 13px; }
}
.k    { color: #ff7b9c; }
.s    { color: #a6d8ff; }
.n    { color: #ffb86c; }
.c    { color: #ffd580; }
.cls  { color: #ffd580; }
.fn   { color: #c4a8ff; }
.v    { color: #edf1f8; }
.comment { color: #828fa6; font-style: italic; }
.b    { color: #7dd3fc; }
.d    { color: #f5c451; }
.m    { color: #ffa657; }

/* View cross-fade for hero content */
.view-fade {
  animation: viewFade 0.5s var(--easing);
}
@keyframes viewFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* =========================================================
   STATS
   ========================================================= */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  padding: 24px 28px 84px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  transition: transform var(--t) var(--easing), border-color var(--t) ease, background var(--t) ease;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; inset: -1px;
  background: var(--grad);
  border-radius: inherit;
  opacity: 0; transition: opacity var(--t) ease;
  z-index: -1;
}
.stat:hover {
  transform: translateY(-4px);
  border-color: transparent;
  background: var(--surface);
}
.stat:hover::before { opacity: 0.6; }
.stat-num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 4px;
  line-height: 1;
}
.stat-lbl { font-size: 13.5px; color: var(--fg-soft); line-height: 1.45; }

/* =========================================================
   SECTIONS - heads
   ========================================================= */
.section {
  padding: 96px 28px;
  scroll-margin-top: 80px;
  position: relative;
}
.section-head { max-width: 760px; margin-bottom: 44px; }
.section-tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--teal);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 14px;
}
.section h2 {
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

/* =========================================================
   ABOUT
   ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 36px;
  align-items: start;
}
.about-copy p {
  font-size: 16px;
  color: var(--fg-soft);
  margin: 0 0 14px;
}
.about-copy strong { color: var(--fg); }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(110,142,255,0.10);
  border: 1px solid rgba(110,142,255,0.25);
  color: var(--fg);
  transition: transform var(--t-fast) ease, background var(--t-fast) ease;
}
.tag:hover { transform: translateY(-1px); background: rgba(110,142,255,0.18); }

.aside-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.aside-card::after {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad);
}
.aside-card-head {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 14px;
}
.aside-card dl { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; margin: 0; }
.aside-card dt { font-family: var(--mono); font-size: 12.5px; color: var(--fg-mute); padding-top: 2px; }
.aside-card dd { margin: 0; font-size: 13.5px; color: var(--fg); }

/* =========================================================
   TIMELINE
   ========================================================= */
.timeline {
  list-style: none;
  margin: 0; padding: 0 0 0 18px;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute; top: 10px; bottom: 10px; left: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--blue), var(--teal) 50%, var(--violet));
  border-radius: 2px;
  opacity: 0.4;
}
.t-item { position: relative; padding: 0 0 28px 36px; }
.t-marker {
  position: absolute; left: -3px; top: 24px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 5px rgba(110,142,255,0.18), 0 0 0 1px var(--bg);
  transition: box-shadow var(--t) ease;
}
.t-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px 24px;
  transition: border-color var(--t) ease, transform var(--t) var(--easing);
}
.t-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.t-card:hover ~ .t-marker,
.t-item:has(.t-card:hover) .t-marker {
  box-shadow: 0 0 0 8px rgba(110,142,255,0.22), 0 0 0 1px var(--bg);
}
.t-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.t-head h3 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.t-when { font-family: var(--mono); font-size: 12.5px; color: var(--fg-mute); }
.t-company { font-family: var(--mono); font-size: 13px; color: var(--teal); margin-bottom: 12px; }
.t-points { margin: 0; padding-left: 20px; color: var(--fg-soft); font-size: 14.5px; }
.t-points li { margin: 4px 0; }
.t-points em { color: var(--blue); font-style: normal; }
.t-points strong { color: var(--fg); }

/* =========================================================
   PROJECTS
   ========================================================= */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}
/* Full-width umbrella heading + blurb so it never sits beside a card */
.projects-grid > .project-section-heading { grid-column: 1 / -1; }
/* The MES dashboard mock-up is a full-width strip above the featured card */
.projects-grid > .mes-thumbs { grid-column: 1 / -1; }
.project {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 26px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: border-color var(--t) ease, transform var(--t) var(--easing), background var(--t) ease;
}
.project::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(110,142,255,0.12), transparent 60%);
  opacity: 0;
  transition: opacity var(--t) ease;
  pointer-events: none;
}
.project:hover { border-color: var(--blue); transform: translateY(-3px); background: var(--surface-2); }
.project:hover::before { opacity: 1; }
.project.featured {
  grid-column: span 2;
  background: linear-gradient(160deg, rgba(110,142,255,0.06), rgba(94,234,212,0.04)), var(--surface);
}
.project-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--fg-mute); margin-bottom: 10px; }
.project-kind { color: var(--teal); }
.project-title { margin: 0 0 10px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.project-desc { margin: 0 0 14px; color: var(--fg-soft); font-size: 14.5px; }
.project-bullets { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.project-bullets li {
  font-family: var(--mono); font-size: 12.5px; color: var(--fg-soft);
  padding-left: 18px; position: relative;
}
.project-bullets li::before { content: "▸"; color: var(--teal); position: absolute; left: 2px; top: 0; }
.project-bullets strong { color: var(--fg); }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-impl {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}
.mini-code { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: var(--fg); white-space: pre; overflow-x: auto; }
.project-cta { margin-top: auto; padding-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.project-cta .cta-subtitle { flex-basis: 100%; font-size: 12.5px; color: var(--fg-mute); margin-top: 4px; }
.project-cta .cta-tip { flex-basis: 100%; font-size: 12.5px; color: var(--accent); margin-top: 2px; padding: 8px 12px; background: rgba(94,234,212,.06); border: 1px solid rgba(94,234,212,.18); border-radius: 8px; }
.project-cta .cta-tip strong { color: var(--fg); font-weight: 600; }
.project-cta .cta-tip em { font-style: normal; color: var(--accent); font-weight: 500; }

/* =========================================================
   SKILLS
   ========================================================= */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  transition: border-color var(--t) ease, transform var(--t) var(--easing);
}
.skill-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.skill-card h3 {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--teal);
}
.skill-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-chip {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
  transition: all var(--t-fast, 120ms) var(--easing);
}
.skill-chip:hover {
  border-color: rgba(124,156,255,0.35);
  background: rgba(124,156,255,0.06);
  color: #d8e2ff;
}

/* =========================================================
   CONTACT
   ========================================================= */
.contact-box {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 36px;
  align-items: center;
  background: linear-gradient(160deg, rgba(110,142,255,0.10), rgba(94,234,212,0.06)), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 48px;
  position: relative;
  overflow: hidden;
}
.contact-box::after {
  content: "";
  position: absolute; bottom: -60%; right: -40%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(196,181,253,0.18), transparent 60%);
  pointer-events: none;
}
.contact-left p { color: var(--fg-soft); margin: 12px 0 22px; max-width: 50ch; }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; position: relative; z-index: 1; }
.contact-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  align-items: center;
  background: rgba(7,8,13,0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  transition: border-color var(--t) ease, transform var(--t) var(--easing);
}
.contact-list li:hover { border-color: var(--blue); transform: translateX(4px); }
.contact-k {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.contact-v { font-size: 14.5px; color: var(--fg); }
a.contact-v:hover { color: var(--blue); }

/* =========================================================
   SCROLL PROGRESS BAR
   ========================================================= */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad);
  z-index: 100;
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
  box-shadow: 0 0 14px rgba(110,142,255,0.6);
}

/* =========================================================
   WORD-BY-WORD REVEAL (section headings)
   ========================================================= */
.word-reveal { display: inline; }
.word-reveal .wr-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(40%);
  filter: blur(4px);
  transition: opacity 0.7s var(--easing), transform 0.7s var(--easing), filter 0.7s var(--easing);
}
.word-reveal.inView .wr-word {
  opacity: 1;
  transform: none;
  filter: none;
}


/* =========================================================
   FAQ
   ========================================================= */
.faq-list {
  display: flex; flex-direction: column;
  gap: 10px;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color var(--t) ease;
}
.faq-item:hover { border-color: var(--blue); }
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15.5px;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 20px;
  color: var(--teal);
  transition: transform var(--t) var(--easing);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-answer {
  padding: 0 20px 18px;
  color: var(--fg-soft);
  font-size: 14.5px;
  line-height: 1.6;
}
.faq-answer a { color: var(--blue); }
.faq-answer a:hover { text-decoration: underline; }

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  border-top: 1px solid var(--border);
  padding: 30px 0;
  margin-top: 40px;
}
.footer-inner {
  display: flex; justify-content: space-between; gap: 18px;
  align-items: center; flex-wrap: wrap;
}
.footer-copy { font-family: var(--mono); font-size: 12.5px; color: var(--fg-mute); }
.footer-links { display: flex; gap: 18px; }
.footer-links a { font-family: var(--mono); font-size: 12.5px; color: var(--fg-soft); }
.footer-links a:hover { color: var(--blue); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; padding: 68px 28px 40px; gap: 36px; }
  .stats { grid-template-columns: repeat(2, 1fr); padding-bottom: 56px; }
  .about-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .project.featured { grid-column: auto; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-box { grid-template-columns: 1fr; padding: 32px; }
}

/* Tablet to mobile */
@media (max-width: 760px) {
  :root { --gutter: 20px; }
  .container { padding: 0 20px; }

  /* Nav transforms into hamburger layout */
  .nav-inner { height: 60px; }
  .nav-cta { display: none; }
  .nav-burger { display: inline-block; }
  .nav-links {
    position: absolute;
    top: 60px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(7,8,13,0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 8px 0 12px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--t) var(--easing), opacity var(--t) ease;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .nav-links.open {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
  .nav-links a {
    padding: 14px 24px;
    font-size: 15px;
    border-bottom: 1px solid rgba(35,43,61,0.4);
    text-align: left;
  }
  .nav-links a::after { display: none; }
  .nav-links a:hover, .nav-links a.active {
    background: rgba(110,142,255,0.08);
    color: var(--fg);
  }

  /* Hero */
  .hero { padding: 40px 20px 24px; gap: 28px; }
  .hero-title { font-size: clamp(32px, 8vw, 44px); }
  .hero-sub { font-size: 16px; }
  .hero-cta { gap: 10px; }
  .btn { padding: 11px 18px; font-size: 14px; }
  .hero-meta { grid-template-columns: 1fr; gap: 12px; }

  /* View toggle */
  .view-toggle { font-size: 12px; }
  .vt-pill { padding: 6px 12px; }

  /* Code window - shrink font to fit narrow screens */
  .code-window { transform: none !important; }
  .code-window-body { font-size: 10.5px; padding: 14px 14px; line-height: 1.55; }

  /* Stats - single column for the smallest screens */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 18px 20px 56px; }
  .stat { padding: 18px 16px; }
  .stat-num { font-size: 24px; }
  .stat-lbl { font-size: 12.5px; }

  /* Sections */
  .section { padding: 56px 20px; }
  .section h2 { font-size: clamp(24px, 5.8vw, 32px); }
  .section-head { margin-bottom: 28px; }

  /* Timeline */
  .timeline { padding-left: 12px; }
  .timeline::before { left: 6px; }
  .t-item { padding-left: 28px; }
  .t-marker { left: -5px; width: 14px; height: 14px; }
  .t-card { padding: 18px; }
  .t-head h3 { font-size: 17px; }
  .t-points { padding-left: 18px; font-size: 14px; }

  /* Projects */
  .projects-grid { gap: 14px; }
  .project { padding: 22px 20px; }
  .project-title { font-size: 19px; }
  .project-desc { font-size: 14px; }
  .mini-code { font-size: 11.5px; white-space: pre-wrap; word-break: break-word; }

  /* Skills */
  .skills-grid { grid-template-columns: 1fr; gap: 12px; }
  .skill-card { padding: 18px; }

  /* Contact box */
  .contact-box { padding: 28px 22px; gap: 26px; }
  .contact-box::after { display: none; }
  .contact-list li {
    grid-template-columns: 90px 1fr;
    gap: 10px;
    padding: 12px 14px;
  }
  .contact-k { font-size: 11px; }
  .contact-v { font-size: 13.5px; }

  /* Footer */
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .footer-copy { font-size: 11.5px; }
}

/* Very small phones */
@media (max-width: 380px) {
  .hero-title { font-size: 30px; }
  .stats { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }
  .view-toggle { width: 100%; justify-content: space-between; }
  .vt-pill { flex: 1; text-align: center; }
}

/* Touch-target sizing - applies on touch devices */
@media (hover: none) and (pointer: coarse) {
  a, button, .btn, .vt-pill, .tag, .nav-links a, .footer-links a {
    min-height: 44px;
  }
  /* keep raised content vertically centered (inline-block tags otherwise top-align) */
  .vt-pill, .tag {
    display: inline-flex;
    align-items: center;
  }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1f2738; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2b3650; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus rings */
a:focus-visible, button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 999px;
}

/* Skip-to-content link - first focusable element, offscreen until focused */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 200; }
.skip-link:focus {
  left: 8px; top: 8px;
  padding: 10px 16px;
  background: var(--fg);
  color: #07080d;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}

/* ============================================================
   Back-to-top button - fixed bottom-right, appears past 240px.
   Mirror of the rule in styles.css since the homepage doesn't
   load styles.css (only home.css).
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom));
  right: calc(24px + env(safe-area-inset-right));
  z-index: 60;
  width: 48px; height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(124, 156, 255, 0.32);
  border-radius: 999px;
  background: rgba(19, 24, 38, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #edf1f8;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease, background .15s ease, border-color .15s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.back-to-top:hover {
  background: rgba(124, 156, 255, 0.18);
  border-color: rgba(124, 156, 255, 0.55);
  color: #ffffff;
  transform: translateY(-2px) scale(1.04);
}
.back-to-top:active { transform: translateY(0) scale(0.97); }
.back-to-top:focus-visible { outline: 2px solid #7c9cff; outline-offset: 2px; }
.back-to-top svg {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
@media print { .back-to-top { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: opacity .15s linear; transform: none; }
  .back-to-top.visible { transform: none; }
  .back-to-top:hover { transform: none; }
}

/* ============================================================
   MES screenshot thumbnails - rendered above the featured MES
   project card. Pure CSS/JSX mockups, no images needed.
   Replace with real Kingsley screenshots later by swapping a
   card's contents for an <img>.
   ============================================================ */
.mes-thumbs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 0 0 22px;
}
@media (min-width: 780px) { .mes-thumbs { grid-template-columns: 1fr 1fr 1fr; } }
.mes-thumb {
  background: linear-gradient(180deg, #0c1018, #0f1320);
  border: 1px solid rgba(124,156,255,0.22);
  border-radius: 12px;
  padding: 14px 16px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #d3dae7;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  position: relative;
  min-height: 200px;
}
.mes-thumb-head {
  display: flex; align-items: center; gap: 6px;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mes-thumb-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: #f87171; flex: 0 0 8px;
}
.mes-thumb-dot.y { background: #f5c451; }
.mes-thumb-dot.g { background: #34d399; }
.mes-thumb-title {
  flex: 1; text-align: center; font-size: 11px;
  color: #cfd6e3; letter-spacing: 0.4px;
  text-transform: uppercase; font-weight: 600;
}
.mes-thumb-badge {
  font-size: 9px; letter-spacing: 1.2px;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(94,234,212,0.15); color: #5eead4;
  border: 1px solid rgba(94,234,212,0.3);
}
.mes-thumb-meta {
  font-size: 10.5px; color: #7f8a9d;
  margin-bottom: 12px; letter-spacing: 0.3px;
}
.mes-thumb-kpis {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-bottom: 14px;
}
.mes-thumb-kpis > div {
  display: flex; flex-direction: column;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
}
.mes-kpi-k { font-size: 10px; color: #7f8a9d; letter-spacing: 0.5px; text-transform: uppercase; }
.mes-kpi-v { font-size: 15px; color: #edf1f8; font-weight: 700; margin-top: 2px; font-family: 'Inter', sans-serif; }
.mes-thumb-bars {
  display: flex; align-items: flex-end; gap: 6px;
  height: 60px; padding: 0 2px;
}
.mes-thumb-bars > div {
  flex: 1; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #5eead4, #7c9cff);
  min-height: 4px;
}
.mes-thumb-checks, .mes-thumb-rows {
  list-style: none; padding: 0; margin: 0 0 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.mes-thumb-checks li {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
}
.mes-thumb-rows li {
  display: grid; grid-template-columns: 1.1fr 1fr auto; gap: 8px; align-items: center;
  font-size: 11.5px;
}
.mes-thumb-qty { color: #cfd6e3; font-weight: 600; }
.mes-thumb-pass { color: #34d399; font-weight: 700; letter-spacing: 0.4px; font-size: 11px; }
.mes-thumb-ok { color: #5eead4; font-size: 10.5px; }
.mes-thumb-warn { color: #f5c451; font-size: 10.5px; font-weight: 600; }
.mes-thumb-footer {
  font-size: 10.5px; color: #7f8a9d;
  padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: auto;
}
