/* ============================================
   MAIN.CSS — Global styles, variables, animations
   Portfolio: Adham Rashed — Cybersecurity Researcher
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  /* Accent colors */
  --cyan: #00f0ff;
  --cyan-dim: #00f0ff66;
  --cyan-glow: 0 0 20px #00f0ff44, 0 0 40px #00f0ff22;
  --blue: #3b82f6;
  --blue-dim: #3b82f666;
  --blue-glow: 0 0 20px #3b82f644, 0 0 40px #3b82f622;
  --green: #22c55e;
  --green-dim: #22c55e66;
  --green-glow: 0 0 20px #22c55e44, 0 0 40px #22c55e22;
  --amber: #f59e0b;
  --amber-dim: #f59e0b66;
  --amber-glow: 0 0 20px #f59e0b44, 0 0 40px #f59e0b22;
  --purple: #a855f7;
  --purple-dim: #a855f766;

  /* Base palette */
  --bg-primary: #030712;
  --bg-secondary: #0a0f1a;
  --bg-card: #111827;
  --bg-card-hover: #1f2937;
  --border-color: #1f293766;
  --border-glow: #1f293799;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-dim: #6b7280;

  /* Typography */
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', system-ui, sans-serif;

  /* Sizing */
  --nav-height: 64px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan-dim) var(--bg-primary);
}

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

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 3px; }

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.3s ease;
}
a:hover { color: #fff; }

img { max-width: 100%; height: auto; }

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(3, 7, 18, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  height: var(--nav-height);
}

.nav-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--cyan);
  transition: width 0.3s ease, background 0.3s ease;
  width: 0;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--cyan) !important;
  letter-spacing: -0.02em;
}
.nav-logo .prompt { color: var(--text-dim); }

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

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--cyan);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--cyan);
  transition: width 0.3s ease;
}
.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Mobile menu button */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem;
  cursor: pointer;
  font-size: 1.2rem;
  border-radius: 4px;
}

/* Mobile overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.98);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.mobile-menu a::before {
  content: '> ';
  color: var(--cyan);
}

.mobile-menu a:hover { color: var(--cyan); }

.mobile-menu-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

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

/* --- Footer --- */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 240, 255, 0.015) 2px,
    rgba(0, 240, 255, 0.015) 4px
  );
  pointer-events: none;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.footer-socials {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.footer-socials a {
  color: var(--text-dim);
  font-size: 1.1rem;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.footer-socials a:hover {
  color: var(--cyan);
  text-shadow: var(--cyan-glow);
}

/* --- Section Shared --- */
.section {
  padding: 6rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--cyan);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-header::before {
  content: '//';
  color: var(--text-dim);
}

.section-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  line-height: 1.1;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin-bottom: 3rem;
}

/* --- Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* Typewriter cursor */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--cyan);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Glow pulse */
@keyframes glow-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: glow-pulse 2s ease-in-out infinite;
  margin-right: 0.5rem;
}

.status-dot.amber { background: var(--amber); }
.status-dot.cyan { background: var(--cyan); }
.status-dot.blue { background: var(--blue); }

/* Scan-line overlay */
.scanline-overlay {
  position: relative;
  overflow: hidden;
}

.scanline-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 240, 255, 0.03) 2px,
    rgba(0, 240, 255, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* Particle canvas */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

/* --- Utility --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-content {
  padding-top: var(--nav-height);
  position: relative;
  z-index: 1;
}

.accent-cyan { color: var(--cyan); }
.accent-blue { color: var(--blue); }
.accent-green { color: var(--green); }
.accent-amber { color: var(--amber); }
.accent-purple { color: var(--purple); }

.glow-cyan { text-shadow: var(--cyan-glow); }
.glow-blue { text-shadow: var(--blue-glow); }
.glow-green { text-shadow: var(--green-glow); }
.glow-amber { text-shadow: var(--amber-glow); }

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-cyan { background: rgba(0, 240, 255, 0.1); color: var(--cyan); border: 1px solid var(--cyan-dim); }
.badge-blue { background: rgba(59, 130, 246, 0.1); color: var(--blue); border: 1px solid var(--blue-dim); }
.badge-green { background: rgba(34, 197, 94, 0.1); color: var(--green); border: 1px solid var(--green-dim); }
.badge-amber { background: rgba(245, 158, 11, 0.1); color: var(--amber); border: 1px solid var(--amber-dim); }
.badge-purple { background: rgba(168, 85, 247, 0.1); color: var(--purple); border: 1px solid var(--purple-dim); }

/* Grid layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .section { padding: 4rem 1rem; }
  #about-preview > .reveal:nth-child(2) { grid-template-columns: 1fr !important; }
  #about-preview .dossier-card { justify-self: stretch !important; max-width: 100% !important; }
  #expertise-preview .reveal:nth-child(2) { grid-template-columns: repeat(2, 1fr) !important; }
  #blog-preview .reveal > div { grid-template-columns: 1fr !important; }
}

/* --- Button styles --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn:hover {
  background: rgba(0, 240, 255, 0.1);
  box-shadow: var(--cyan-glow);
  color: #fff;
}

.btn-filled {
  background: var(--cyan);
  color: var(--bg-primary);
  border-color: var(--cyan);
}

.btn-filled:hover {
  background: #33f5ff;
  color: var(--bg-primary);
}

/* Skills ticker */
.ticker-wrapper {
  overflow: hidden;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-top: 3rem;
}

.ticker {
  display: flex;
  animation: ticker-scroll 30s linear infinite;
  white-space: nowrap;
  gap: 2rem;
}

.ticker span {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  flex-shrink: 0;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Gauge */
.gauge-container {
  position: relative;
  width: 80px;
  height: 80px;
}

.gauge-svg {
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 4;
}

.gauge-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease;
}

.gauge-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
}

/* Declassified stamp */
.stamp {
  display: inline-block;
  border: 3px solid var(--cyan);
  padding: 0.25rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--cyan);
  transform: rotate(-5deg);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.stamp.visible {
  opacity: 1;
}
