/* ==========================================================================
   Portfolio | Muath Alsawaier
   Design tokens, layout, and component styles.
   ========================================================================== */

:root {
  --bg: #020202;
  --card-bg: #0a0a0a;
  --card-bg-dark: #050505;
  --primary: #8b5cf6;
  --secondary: #06b6d4;
  --pink: #ec4899;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #eab308;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --muted-dim: rgba(255, 255, 255, 0.35);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', Consolas, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

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

@media (pointer: fine) {
  body { cursor: none; }
  a, button, input, textarea, label { cursor: none; }
}

::selection { background: rgba(139, 92, 246, 0.4); color: #fff; }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #26262e; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #3b3b46; }

.container { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }
@media (min-width: 768px) { .container { padding: 0 3rem; } }

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

/* ── Fixed backdrop: particle canvas + noise grain ─────────────────────── */
#bg-canvas {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.grain {
  position: fixed; inset: -50%; z-index: 1;
  pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 8s steps(10) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}
/* Exclude the custom cursor elements AND the fixed-position chrome (.nav,
   .logo, .preloader, .scroll-progress, .to-top): without the exclusions this
   rule (higher specificity than those classes) would override their
   `position: fixed` with `position: relative`, dropping the nav into normal
   flow where the hero paints over its lower half and steals clicks on the
   bottom of every link. Same class of bug that stranded the cursor in the
   top-left corner when .cursor-dot/.cursor-ring were not excluded. */
body > *:not(#bg-canvas):not(.grain):not(.cursor-glow):not(.cursor-dot):not(.cursor-ring):not(.nav):not(.logo):not(.preloader):not(.scroll-progress):not(.to-top) {
  position: relative; z-index: 2;
}

/* ── Custom cursor ──────────────────────────────────────────────────────── */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 9999;
  pointer-events: none; border-radius: 50%;
  display: none;
}
@media (pointer: fine) {
  .cursor-dot, .cursor-ring { display: block; }
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--primary);
  transform: translate(-50%, -50%);
}
.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid rgba(139, 92, 246, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out),
              border-color 0.25s, background 0.25s;
}
.cursor-ring.is-hovering {
  width: 56px; height: 56px;
  border-color: rgba(6, 182, 212, 0.7);
  background: rgba(139, 92, 246, 0.08);
}
.cursor-glow {
  position: fixed; top: 0; left: 0; z-index: 1;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.10), transparent 65%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: none;
}
@media (pointer: fine) { .cursor-glow { display: block; } }

/* ── Scroll progress ────────────────────────────────────────────────────── */
.scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 100;
  height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--pink));
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
}

/* ── Fixed logo ─────────────────────────────────────────────────────────── */
.logo {
  position: fixed; top: 1.25rem; left: 1.25rem; z-index: 60;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.8rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--text);
  text-decoration: none;
}
@media (min-width: 768px) { .logo { display: none; } }

/* ── Nav pill (desktop) ─────────────────────────────────────────────────── */
.nav {
  display: none;
  position: fixed; top: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 50;
  align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}
@media (min-width: 768px) { .nav { display: flex; } }
.nav a {
  color: var(--muted); text-decoration: none;
  font-size: 0.8rem; font-weight: 500;
  padding: 0.35rem 0.85rem; border-radius: 9999px;
  transition: color 0.25s, background 0.25s;
}
.nav a:hover, .nav a.active { color: var(--text); background: rgba(255, 255, 255, 0.08); }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 6rem 0 3rem;
  position: relative; overflow: hidden;
}
.hero-orb {
  position: absolute; width: 24rem; height: 24rem; border-radius: 50%;
  background: linear-gradient(to top right, rgba(139, 92, 246, 0.3), rgba(6, 182, 212, 0.3));
  filter: blur(100px); opacity: 0.4;
  animation: orbPulse 6s ease-in-out infinite;
  pointer-events: none;
}
.hero-orb-1 { bottom: 6rem; right: 4rem; z-index: 0; }
.hero-orb-2 { top: 4rem; left: -6rem; z-index: 0; opacity: 0.25;
  background: linear-gradient(to bottom right, rgba(236, 72, 153, 0.25), rgba(139, 92, 246, 0.2)); }
@keyframes orbPulse { 0%, 100% { opacity: 0.3; transform: scale(1); } 50% { opacity: 0.55; transform: scale(1.08); } }

.hero-grid {
  display: grid; gap: 2rem; align-items: center;
  position: relative; z-index: 10;
}
@media (min-width: 768px) { .hero-grid { grid-template-columns: 1fr 1fr; gap: 3rem; } }

.hero-kicker {
  font-family: var(--font-mono); font-size: 0.9rem;
  letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--primary); margin-bottom: 1rem;
}
.hero-title-1 {
  font-size: clamp(1.8rem, 6vw, 4.5rem);
  font-weight: 900; letter-spacing: -0.04em;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.05;
}
.hero-title-2 {
  font-size: clamp(1.8rem, 6vw, 4.5rem);
  font-weight: 900; letter-spacing: -0.04em;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.05; margin-top: 0.25rem;
}
.hero-desc {
  color: rgba(255, 255, 255, 0.8); max-width: 28rem;
  margin: 1.5rem 0 2rem; font-weight: 500; font-size: 0.95rem;
}
.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  display: inline-block; text-decoration: none;
  padding: 0.75rem 1.75rem; border-radius: 9999px;
  font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  transition: all 0.25s ease; text-align: center;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s var(--ease-out);
}
.btn:hover::after { transform: translateX(120%); }
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 10px 30px -5px rgba(139, 92, 246, 0.35);
}
/* No translate on hover: moving an interactive target makes it hard to click.
   Hover feedback is color/shadow only. */
.btn-primary:hover { background: rgba(139, 92, 246, 0.9); box-shadow: 0 14px 34px -5px rgba(139, 92, 246, 0.45); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  color: #fff; backdrop-filter: blur(4px);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--primary); }

.hero-scroll {
  position: absolute; bottom: 1.75rem; left: 50%; transform: translateX(-50%);
  z-index: 10;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.6rem;
  letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--muted-dim); text-decoration: none;
}
.hero-scroll-line {
  width: 1px; height: 2.25rem;
  background: linear-gradient(to bottom, var(--primary), transparent);
  animation: scrollLine 1.8s ease-in-out infinite;
}
@keyframes scrollLine {
  0% { transform: scaleY(0); transform-origin: top; }
  45% { transform: scaleY(1); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ── Terminal card ──────────────────────────────────────────────────────── */
.terminal-body { padding: 1rem; }
@media (min-width: 640px) { .terminal-body { padding: 1.5rem; } }
.terminal-header {
  display: flex; align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.term-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; margin-right: 0.4rem; }
.term-title { flex: 1; text-align: center; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted-dim); }
.term-content {
  padding: 1.25rem;
  font-family: var(--font-mono); font-size: 0.8rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  min-height: 11rem;
}
@media (min-width: 640px) { .term-content { min-height: 17.5rem; } }
.term-line { display: flex; align-items: center; gap: 0.5rem; min-height: 1.25rem; }
.term-prompt { color: var(--primary); font-weight: 700; }
.term-cmd { color: #fff; font-weight: 500; white-space: pre-wrap; word-break: break-all; }
.term-out { color: var(--muted); padding-left: 1.15rem; white-space: pre-wrap; word-break: break-word; }
.term-out.ok { color: rgba(34, 197, 94, 0.85); }
.term-out.dim { color: var(--muted-dim); }
.term-cursor {
  display: inline-block; width: 0.55rem; height: 1.1rem;
  background: rgba(139, 92, 246, 0.8);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Glow border card (signature) ───────────────────────────────────────── */
.glow-card {
  --cursor-angle: 45deg;
  position: relative;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.1), 0 8px 20px rgba(0,0,0,0.15);
  isolation: isolate;
  transition: border-color 0.25s ease-out;
}
.glow-card::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  z-index: -1;
  background: conic-gradient(
    from var(--cursor-angle),
    transparent 0%,
    var(--primary) 8%,
    var(--secondary) 18%,
    var(--pink) 26%,
    transparent 36%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}
.glow-card:hover { border-color: transparent; }
.glow-card:hover::before { opacity: 1; }
/* mouse-following inner spotlight */
.glow-card::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  z-index: -1;
  background: radial-gradient(
    320px circle at var(--mx, 50%) var(--my, 50%),
    rgba(139, 92, 246, 0.09),
    transparent 60%
  );
  opacity: 0; transition: opacity 0.3s;
}
.glow-card:hover::after { opacity: 1; }

/* ── Sections ───────────────────────────────────────────────────────────── */
section { padding: 5rem 0; position: relative; overflow: hidden; }
@media (min-width: 768px) { section { padding: 8rem 0; } }
.section-bleed {
  position: absolute; top: 0; right: 0;
  width: 30rem; height: 30rem; border-radius: 50%;
  background: rgba(139, 92, 246, 0.08);
  filter: blur(150px); pointer-events: none;
}

.section-head { margin-bottom: 3rem; position: relative; }
@media (min-width: 768px) { .section-head { margin-bottom: 4rem; } }
.ghost-num {
  position: absolute; top: -2rem; left: -1rem;
  font-family: var(--font-mono);
  font-size: clamp(4.5rem, 14vw, 8rem); font-weight: 900;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), transparent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  user-select: none; pointer-events: none; line-height: 1;
}
.head-border { border-left: 2px solid var(--primary); padding-left: 1rem; }
.section-title {
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 900; letter-spacing: -0.02em;
  text-transform: uppercase; color: #fff;
  position: relative; display: inline-block;
}
/* Glitch layers */
.section-title::before, .section-title::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0;
  width: 100%; opacity: 0; pointer-events: none;
}
.section-title::before { color: var(--secondary); z-index: -1; }
.section-title::after { color: var(--pink); z-index: -2; }
.section-title:hover::before { opacity: 0.8; animation: glitchTop 0.35s steps(2) infinite; }
.section-title:hover::after { opacity: 0.8; animation: glitchBottom 0.35s steps(2) infinite reverse; }
@keyframes glitchTop {
  0% { clip-path: inset(0 0 60% 0); transform: translate(-3px, -2px); }
  50% { clip-path: inset(20% 0 30% 0); transform: translate(2px, 1px); }
  100% { clip-path: inset(50% 0 10% 0); transform: translate(-1px, -1px); }
}
@keyframes glitchBottom {
  0% { clip-path: inset(60% 0 0 0); transform: translate(3px, 2px); }
  50% { clip-path: inset(30% 0 20% 0); transform: translate(-2px, -1px); }
  100% { clip-path: inset(10% 0 50% 0); transform: translate(1px, 1px); }
}
.section-sub {
  font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--muted); margin-top: 0.5rem;
}

/* ── About ──────────────────────────────────────────────────────────────── */
.about-lead {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 1.5rem; max-width: 46rem;
}
.about-lead span {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.about-text { color: var(--muted); max-width: 52rem; margin-bottom: 1rem; font-size: 0.95rem; }

.badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.5rem 1rem; border-radius: 9999px;
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}
.badge-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--green); animation: pulseDot 2s ease-in-out infinite; }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.about-cards { display: grid; gap: 1rem; margin-top: 2.5rem; }
@media (min-width: 768px) { .about-cards { grid-template-columns: 1fr 1fr; } }
.about-card { padding: 1.5rem; }
.about-card-label {
  font-family: var(--font-mono); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--secondary); margin-bottom: 0.75rem;
}
.about-card-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.25rem; }
.about-card-meta { color: var(--muted-dim); font-size: 0.85rem; }
.about-card-body { color: var(--muted); font-size: 0.88rem; margin-top: 0.75rem; }

.internships-grid { display: grid; gap: 1rem; margin-top: 2.5rem; }
@media (min-width: 768px) { .internships-grid { grid-template-columns: 1fr 1fr; } }
.internships-grid ~ .about-card { margin-top: 1rem; }

.roadmap-strip {
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  margin-top: 2rem; padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.roadmap-label {
  font-family: var(--font-mono); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--secondary); white-space: nowrap;
}
.roadmap-items { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.chip {
  font-family: var(--font-mono); font-size: 0.7rem;
  padding: 0.35rem 0.8rem; border-radius: 9999px;
  border: 1px solid var(--border-strong);
  color: var(--muted); background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
  transition: border-color 0.25s, color 0.25s;
}
.chip:hover { border-color: var(--primary); color: #fff; }

/* ── Projects intro + process strip (lives inside the Projects section) ─── */
.projects-intro { color: var(--muted); max-width: 52rem; font-size: 0.95rem; margin-bottom: 2.5rem; }
.process-label { margin-bottom: 1rem; }
.process-grid { display: grid; gap: 1rem; margin-bottom: 3rem; }
@media (min-width: 768px) { .process-grid { grid-template-columns: repeat(4, 1fr); } }
.process-card { padding: 1.5rem; position: relative; }
.process-step {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.2em; color: var(--secondary); margin-bottom: 0.75rem;
}
.process-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.4rem; }
.process-desc { color: var(--muted); font-size: 0.82rem; }

/* ── Skills marquee ─────────────────────────────────────────────────────── */
.marquee { overflow: hidden; margin-bottom: 0.75rem; position: relative; }
.marquee:last-child { margin-bottom: 0; }
.marquee::before, .marquee::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 5rem; z-index: 2;
  pointer-events: none;
}
.marquee::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.marquee::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.marquee-track {
  display: flex; gap: 0.75rem; width: max-content;
  animation: marquee 30s linear infinite;
}
.marquee.reverse .marquee-track { animation-direction: reverse; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-chip {
  font-family: var(--font-mono); font-size: 0.8rem;
  padding: 0.6rem 1.25rem; border-radius: 10px;
  border: 1px solid var(--border-strong);
  color: rgba(255, 255, 255, 0.75);
  background: var(--card-bg);
  white-space: nowrap;
  transition: border-color 0.25s, color 0.25s;
}
.marquee-chip:hover { border-color: var(--primary); color: #fff; }

/* RAG card: the demo terminal leads (top), the write-up sits beneath it.
   Full width so the terminal gets a proper reading surface instead of being
   crammed into a half-width slot next to a short text block. */
.project-card--rag { grid-column: 1 / -1; }
.project-card--rag .project-visual { margin-bottom: 1.25rem; }
@media (min-width: 768px) {
  /* Two-column write-up beneath the full-width terminal: headline left,
     metric + link right, so the row fills the width without dead space. */
  .project-card--rag .project-rag-copy {
    display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem;
    align-items: start;
  }
  .project-card--rag .project-desc { flex: none; }
  .project-card--rag .project-metric { margin-top: 0; }
  .project-card--rag .chip-row { margin-top: 0.75rem; }
}

/* Wide demo cards (profiler, scanner): full-width visual on top, write-up
   beneath in the same two-column pattern as the RAG card, so the flame graph
   and the findings list get a proper reading surface instead of a half slot. */
.project-card--wide { grid-column: 1 / -1; }
.project-card--wide .project-visual { margin-bottom: 1.25rem; }
@media (min-width: 768px) {
  .project-card--wide .project-wide-copy {
    display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem;
    align-items: start;
  }
  .project-card--wide .project-desc { flex: none; }
  .project-card--wide .project-metric { margin-top: 0; }
  .project-card--wide .chip-row { margin-top: 0.75rem; }
}

/* ── Projects ───────────────────────────────────────────────────────────── */
.projects-grid { display: grid; gap: 1.25rem; }
/* Long unbroken code strings (live scan findings) must never stretch a card:
   min-width:0 lets the track hold its size, and the visual clips its content. */
.projects-grid > * { min-width: 0; }
@media (min-width: 768px) {
  .projects-grid { grid-template-columns: 1fr 1fr; }
  .project-card--featured { grid-column: span 2; }
}
.project-card { display: flex; flex-direction: column; padding: 1.75rem; height: 100%; }
.project-slug {
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--muted-dim); letter-spacing: 0.1em;
  margin-bottom: 1rem;
}
.project-slug b { color: var(--primary); font-weight: 700; }
.project-name { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 0.6rem; }
.project-desc { color: var(--muted); font-size: 0.9rem; flex: 1; }
.project-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 1.25rem;
  color: var(--primary); text-decoration: none;
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600;
  transition: gap 0.2s;
}
.project-link:hover { gap: 0.75rem; }

.project-card--featured {
  display: grid; gap: 1.5rem;
}
@media (min-width: 768px) {
  .project-card--featured { grid-template-columns: 1.1fr 1fr; align-items: center; }
}
.project-visual {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg-dark);
  overflow: hidden;
  font-family: var(--font-mono);
}
.project-visual-bar {
  display: flex; gap: 0.4rem; align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.project-visual-bar .term-dot { margin-right: 0; width: 0.55rem; height: 0.55rem; }
.project-visual-title {
  margin-left: auto; font-size: 0.65rem; color: var(--muted-dim);
}
.project-visual-body {
  padding: 0.9rem 1rem;
  font-size: 0.7rem; line-height: 1.7;
  min-height: 9.5rem;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}

/* contract diff visual */
.diff-line { white-space: pre; display: block; }
.diff-add { color: rgba(34, 197, 94, 0.9); background: rgba(34, 197, 94, 0.07); }
.diff-del { color: rgba(239, 68, 68, 0.9); background: rgba(239, 68, 68, 0.07); text-decoration: line-through; }
.diff-ctx { color: var(--muted-dim); }
.diff-ver { color: var(--secondary); }
.diff-flag { color: var(--amber); }
.diff-line.hidden-line { display: none; }

/* flame graph visual */
.project-visual--flame .project-visual-body { min-height: 13rem; }
.flame-wrap { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.flame-row {
  height: 0.95rem; border-radius: 2px;
  transition: width 0.9s var(--ease-out);
  min-width: 8%;
}
.flame-meta {
  width: 100%; display: flex; justify-content: space-between;
  font-size: 0.62rem; color: var(--muted-dim); margin-top: 0.4rem;
}
.flame-meta b { color: var(--secondary); font-weight: 600; }

/* scanner visual */
.scan-line {
  color: var(--muted-dim); white-space: pre; display: block;
  border-left: 2px solid transparent; padding-left: 0.5rem;
  transition: border-color 0.3s, background 0.3s, color 0.3s;
  overflow: hidden; text-overflow: ellipsis;
}
.scan-line.scanning {
  border-left-color: var(--secondary);
  background: rgba(6, 182, 212, 0.06);
  color: rgba(255, 255, 255, 0.85);
}
.scan-line.hit { border-left-color: var(--red); background: rgba(239, 68, 68, 0.08); }
.scan-line.hit::after {
  content: attr(data-finding);
  color: var(--red); margin-left: 0.5rem; font-size: 0.62rem;
}
.scan-line.passed { border-left-color: var(--green); background: rgba(34, 197, 94, 0.06); }
.scan-line.passed::after {
  content: "safe";
  color: var(--green); margin-left: 0.5rem; font-size: 0.62rem;
}
.scan-progress {
  height: 3px; background: rgba(255, 255, 255, 0.06);
  border-radius: 99px; overflow: hidden; margin-top: 0.75rem;
}
.scan-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.5s var(--ease-out);
}

/* RAG visual */
.rag-q {
  display: block; color: var(--muted); font-size: 0.68rem;
  margin-bottom: 0.6rem; padding-left: 0.5rem;
  border-left: 2px solid var(--primary);
}
.rag-q::before { content: "> "; color: var(--primary); }
.rag-src {
  display: block; color: var(--muted-dim); font-size: 0.64rem;
  white-space: pre; padding-left: 0.5rem; margin-bottom: 0.15rem;
  border-left: 2px solid transparent;
  transition: border-color 0.3s, color 0.3s, background 0.3s;
}
.rag-src .rag-score { color: var(--secondary); font-weight: 600; }
.rag-src.is-hit { border-left-color: var(--secondary); color: rgba(255,255,255,0.85); background: rgba(6,182,212,0.06); }
.rag-answer {
  display: block; margin-top: 0.6rem; padding: 0.5rem 0.6rem;
  font-size: 0.66rem; line-height: 1.5; color: rgba(255,255,255,0.8);
  background: rgba(139,92,246,0.08); border: 1px solid rgba(139,92,246,0.25);
  border-radius: 6px;
}
.rag-answer .rag-cite { color: var(--secondary); }
.project-visual-body.is-live .rag-src,
.project-visual-body.is-live .rag-answer { white-space: pre-wrap; word-break: break-word; }
/* Canned (pre-demo) RAG lines: revealed in sequence once the card scrolls
   into view, so the terminal isn't a blank box before the first run. The
   selector includes the body so it outranks the base .rag-src/.rag-answer
   `display: block` rules. */
.project-visual--rag .rag-src.hidden-line,
.project-visual--rag .rag-answer.hidden-line { display: none; }
.project-visual--rag .rag-src.rag-revealed,
.project-visual--rag .rag-answer.rag-revealed {
  display: block;
  animation: ragFadeIn 0.45s var(--ease-out) both;
}
@keyframes ragFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* live demo controls (terminal-bar footer) */
.live-status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin-left: 0.75rem; font-size: 0.6rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-dim);
}
.live-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--muted-dim); flex: none;
  transition: background 0.4s, box-shadow 0.4s;
}
.live-dot.is-live { background: var(--green); box-shadow: 0 0 6px rgba(34, 197, 94, 0.7); }
.live-dot.is-offline { background: var(--amber); box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.live-dot.is-running {
  background: var(--secondary);
  box-shadow: 0 0 6px rgba(6, 182, 212, 0.7);
  animation: live-pulse 1s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.live-text { color: var(--muted); }
.rag-error { color: #fca5a5; border-left-color: rgba(248, 113, 113, 0.5); }
.live-metric {
  color: var(--secondary); font-weight: 600; margin-left: 0.25rem;
  text-transform: none; letter-spacing: 0;
}
.live-run {
  margin-left: 0.75rem; font-family: var(--font-mono);
  font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.15rem 0.5rem; cursor: pointer; transition: all 0.2s;
}
.live-run:hover { color: var(--foreground); border-color: var(--primary); background: rgba(139, 92, 246, 0.08); }
/* Running state: animated stripes plus a per-engine verb make even a
   sub-second run clearly visible instead of a one-frame text flicker. */
.live-run.is-running {
  color: var(--foreground);
  border-color: var(--primary);
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.12) 25%, rgba(139, 92, 246, 0.38) 50%, rgba(139, 92, 246, 0.12) 75%);
  background-size: 200% 100%;
  animation: live-run-stripes 0.9s linear infinite;
}
@keyframes live-run-stripes { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* real-data body re-render */
.project-visual-body.is-live .diff-line,
.project-visual-body.is-live .scan-line { white-space: pre; }
.diff-badge {
  display: inline-block; margin-left: 0.4rem; padding: 0 0.35rem;
  border-radius: 4px; font-size: 0.6rem;
}
.diff-badge.breaking { color: var(--red); background: rgba(239, 68, 68, 0.1); }
.diff-badge.ok { color: var(--green); background: rgba(34, 197, 94, 0.1); }

/* ── Contact ────────────────────────────────────────────────────────────── */
.contact-grid { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 768px) { .contact-grid { grid-template-columns: 1fr 1fr; } }
.contact-lead {
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 900; letter-spacing: -0.03em; line-height: 1.1;
  margin-bottom: 1.25rem;
}
.contact-lead span {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.contact-links { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.75rem; }
.contact-link-row {
  display: flex; align-items: center; gap: 1rem;
  text-decoration: none; padding: 0.9rem 1.1rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.25s, background 0.25s;
}
.contact-link-row:hover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.05);
}
.contact-link-label {
  font-family: var(--font-mono); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted-dim); width: 5rem; flex-shrink: 0;
}
.contact-link-value { color: #fff; font-size: 0.85rem; font-weight: 500; }

.form-card { padding: 1.75rem; }
.form-title { font-weight: 800; font-size: 1.1rem; margin-bottom: 1.25rem; }
.form-label {
  display: block; font-family: var(--font-mono); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); margin-bottom: 0.4rem; margin-top: 1rem;
}
.form-input {
  width: 100%; padding: 0.7rem 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: #fff; font-family: var(--font-mono); font-size: 0.85rem;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.form-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.form-input::placeholder { color: var(--muted-dim); }
.form-input.invalid { border-color: var(--red); }
.form-status {
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--muted-dim); margin-top: 1rem;
  transition: color 0.3s;
}
.form-status.ok { color: var(--green); }
.form-status.err { color: var(--red); }
.form-submit {
  margin-top: 1.25rem; width: 100%;
  padding: 0.8rem; border: none; border-radius: 9999px;
  background: var(--primary); color: #fff;
  font-family: var(--font-sans); font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 10px 30px -5px rgba(139, 92, 246, 0.35);
  transition: background 0.25s, box-shadow 0.25s;
}
.form-submit:hover { background: rgba(139, 92, 246, 0.85); box-shadow: 0 14px 34px -5px rgba(139, 92, 246, 0.45); }

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted-dim);
}
.footer-inner {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  text-align: center;
}
@media (min-width: 768px) {
  .footer-inner { flex-direction: row; justify-content: space-between; }
}
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--muted); text-decoration: none; transition: color 0.25s; }
.footer-links a:hover { color: var(--primary); }

/* ── Back to top ────────────────────────────────────────────────────────── */
.to-top {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 60;
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
  color: var(--muted); font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity 0.3s, transform 0.3s, border-color 0.3s, color 0.3s;
}
.to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.to-top:hover { border-color: var(--primary); color: #fff; }

/* ── Reveal on scroll ───────────────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); transition-delay: var(--reveal-delay, 0s); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── Preloader intro ────────────────────────────────────────────────────── */
.preloader {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}
.preloader.done { opacity: 0; visibility: hidden; }
.preloader-inner { display: flex; flex-direction: column; align-items: center; gap: 1.25rem; }
.preloader-mark {
  width: 3.5rem; height: 3.5rem; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--primary), var(--secondary));
  font-family: var(--font-mono); font-weight: 700; font-size: 1.75rem; color: #fff;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.5);
  animation: preloaderPulse 1.4s ease-in-out infinite;
}
@keyframes preloaderPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.preloader-bar {
  width: 12rem; height: 2px; border-radius: 99px; overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.preloader-bar span {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  animation: preloaderSlide 1.1s var(--ease-out) infinite;
}
@keyframes preloaderSlide { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.preloader-text {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted-dim);
}
.preloader-dots::after { content: ''; animation: preloaderDots 1.4s steps(4) infinite; }
@keyframes preloaderDots {
  0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; }
}

/* ── Hero live status ticker ────────────────────────────────────────────── */
.hero-ticker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
  margin-top: 1.75rem; padding: 0.6rem 0.9rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono); font-size: 0.68rem;
  max-width: 28rem;
}
.ticker-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.ticker-dot {
  width: 0.45rem; height: 0.45rem; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
  animation: pulseDot 2s ease-in-out infinite;
}
.ticker-label { color: var(--muted-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.ticker-val { color: #fff; font-weight: 600; }
.ticker-sep { width: 1px; height: 0.9rem; background: var(--border); }

/* ── Interactive terminal input ─────────────────────────────────────────── */
.term-hint {
  font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted-dim);
  padding: 0.15rem 0.5rem; border: 1px solid var(--border); border-radius: 99px;
  transition: color 0.3s, border-color 0.3s;
}
.glow-card:hover .term-hint { color: var(--secondary); border-color: rgba(6, 182, 212, 0.4); }
.term-input-row {
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}
.term-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--font-mono); font-size: 0.8rem; color: #fff;
  caret-color: var(--primary);
}
.term-input::placeholder { color: var(--muted-dim); }
.term-out.err { color: rgba(239, 68, 68, 0.85); }

/* ── Project outcome metric ─────────────────────────────────────────────── */
.project-metric {
  display: flex; align-items: baseline; gap: 0.6rem;
  margin: 1rem 0 0.25rem; padding: 0.75rem 1rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: rgba(139, 92, 246, 0.05);
}
.metric-num {
  font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700;
  color: var(--primary); line-height: 1;
}
.metric-label { font-size: 0.72rem; color: var(--muted); }

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@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; transform: none; }
  .grain, .cursor-glow { display: none; }
  .preloader { display: none; }
}
