/* ===========================================================
   Youssef Gargai — CV Website
   Design system: dark technical-professional, cyan/emerald accents
   =========================================================== */

:root {
  --bg: #0a0f1c;
  --bg-elevated: #0d1424;
  --surface: #111a2e;
  --surface-2: #16213a;
  --border: #223049;
  --border-soft: #1a2438;

  --text: #e7ecf5;
  --text-muted: #9aa8c2;
  --text-faint: #6b7a99;

  --accent: #38bdf8;
  --accent-strong: #7dd3fc;
  --accent-2: #34d399;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-2-soft: rgba(52, 211, 153, 0.12);

  --font-heading: 'Sora', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --container: 1120px;
  --nav-h: 72px;

  --ease: cubic-bezier(.16,1,.3,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

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

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

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; line-height: 1.15; margin: 0; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #05202e; padding: 10px 16px;
  border-radius: 0 0 8px 0; z-index: 200; font-weight: 600;
}
.skip-link:focus { left: 0; }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 200ms var(--ease), background 200ms, border-color 200ms, color 200ms, box-shadow 200ms;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #04202e; box-shadow: 0 8px 24px -8px rgba(56,189,248,.55); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--text-muted); padding: 10px 14px; }
.btn-ghost:hover { color: var(--text); }
.btn-icon { padding: 10px; border-radius: 50%; border: 1px solid var(--border); color: var(--text-muted); }
.btn-icon:hover { color: var(--accent-strong); border-color: var(--accent); }
.btn-lg { padding: 15px 28px; font-size: 1rem; margin-top: 8px; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100; height: var(--nav-h);
  display: flex; align-items: center;
  background: rgba(10,15,28,0.55);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: background 250ms, border-color 250ms;
}
.nav.scrolled { background: rgba(10,15,28,0.92); border-color: var(--border-soft); }

.nav-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-heading); font-weight: 700; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04202e; font-size: 0.85rem; font-weight: 800;
}
.brand-text { font-size: 1.02rem; }

.nav-links { display: flex; gap: 30px; }
.nav-links a { color: var(--text-muted); font-size: 0.94rem; font-weight: 500; position: relative; padding: 6px 0; transition: color 200ms; }
.nav-links a:hover { color: var(--text); }
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 0;
  background: var(--accent); transition: width 250ms var(--ease);
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--accent-strong); }

.nav-actions { display: flex; align-items: center; gap: 8px; }

.lang-switch {
  display: flex; align-items: center; gap: 2px;
  border: 1px solid var(--border); border-radius: 999px; padding: 3px;
  background: var(--surface);
}
.lang-btn {
  border: none; background: transparent; color: var(--text-faint);
  font-family: var(--font-mono); font-size: 0.76rem; font-weight: 600; letter-spacing: 0.03em;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  transition: background 200ms, color 200ms;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { background: var(--accent); color: #04202e; }

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; background: transparent; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
}
.nav-toggle span { width: 18px; height: 2px; background: var(--text); margin: 0 auto; transition: transform 250ms, opacity 250ms; }
.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); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: calc(var(--nav-h) + 72px) 0 100px;
  overflow: hidden;
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black 30%, transparent 75%);
  opacity: 0.6;
}
.hero-grid::before {
  content: '';
  position: absolute; top: -200px; right: -160px;
  width: 560px; height: 560px; border-radius: 50%;
  background: radial-gradient(circle, rgba(56,189,248,0.20), transparent 65%);
  filter: blur(10px);
}
.hero-grid::after {
  content: '';
  position: absolute; bottom: -220px; left: -160px;
  width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle, rgba(52,211,153,0.14), transparent 65%);
}

.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: center;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent-2);
  background: var(--accent-2-soft); border: 1px solid rgba(52,211,153,0.3);
  padding: 6px 14px; border-radius: 999px; margin: 0 0 22px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px rgba(52,211,153,0.18); }

.hero-copy h1 {
  font-size: clamp(2.4rem, 4.6vw, 3.6rem);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.hero-copy .role {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  color: var(--accent-strong);
  font-weight: 600; margin-bottom: 12px;
}
.role-sub { color: var(--text-muted); font-size: 0.96rem; margin-bottom: 22px; line-height: 1.7; }
.role-sub .cred { color: var(--accent-2); font-weight: 700; }
.tag-inline {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent-strong);
  background: var(--accent-soft); border: 1px solid rgba(56,189,248,0.28);
  padding: 3px 9px; border-radius: 6px;
}

.lede { color: var(--text-muted); font-size: 1.04rem; max-width: 58ch; margin-bottom: 32px; }
.lede strong { color: var(--text); }

.hero-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 34px; }

.hero-meta { display: flex; flex-wrap: wrap; gap: 20px; color: var(--text-faint); font-size: 0.88rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }

.hero-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border); border-radius: 20px;
  padding: 32px; position: relative;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.6);
}
.avatar {
  width: 84px; height: 84px; border-radius: 18px;
  object-fit: cover; object-position: center top;
  border: 2px solid var(--border);
  box-shadow: 0 0 0 4px var(--accent-soft);
  margin-bottom: 26px;
}
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-family: var(--font-heading); font-size: 1.9rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: 0.82rem; color: var(--text-faint); }
.hero-card-footer { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--border-soft); }
.badge {
  font-size: 0.78rem; font-weight: 600; color: var(--accent-2);
  background: var(--accent-2-soft); border: 1px solid rgba(52,211,153,0.28);
  padding: 5px 11px; border-radius: 999px;
}
.badge-accent {
  color: #04202e; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; font-weight: 700;
}

/* ---------- Sections ---------- */
.section { padding: 104px 0; }
.section-alt { background: var(--bg-elevated); border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }

.section-kicker {
  font-family: var(--font-mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent); margin: 0 0 12px;
}
.section-title { font-size: clamp(1.7rem, 3vw, 2.3rem); max-width: 46ch; letter-spacing: -0.01em; }
.section-lede { color: var(--text-muted); font-size: 1.04rem; max-width: 68ch; margin-top: 16px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 48px; }
.about-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; transition: transform 250ms var(--ease), border-color 250ms;
}
.about-card:hover { transform: translateY(-4px); border-color: rgba(56,189,248,0.4); }
.about-icon {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 18px;
}
.about-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.about-card p { color: var(--text-muted); font-size: 0.92rem; margin: 0; line-height: 1.55; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 56px 0 0; padding: 0; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--border), var(--border) 90%, transparent);
}
.timeline-item { position: relative; padding-left: 40px; margin-bottom: 48px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg-elevated); border: 2px solid var(--accent);
  box-shadow: 0 0 0 5px rgba(56,189,248,0.12);
}
.timeline-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; margin-bottom: 4px; }
.timeline-head h3 { font-size: 1.2rem; }
.timeline-date { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-faint); }
.timeline-org { color: var(--accent-strong); font-weight: 600; font-size: 0.94rem; margin: 0 0 14px; }
.timeline-content ul { margin: 0 0 18px; padding-left: 20px; color: var(--text-muted); }
.timeline-content li { margin-bottom: 8px; font-size: 0.96rem; line-height: 1.6; }
.timeline-content li::marker { color: var(--accent); }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 0.8rem; font-weight: 500; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 999px;
}

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 48px; }
.skill-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.skill-card h3 { font-size: 0.98rem; margin-bottom: 14px; color: var(--text); }

/* ---------- Certifications ---------- */
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 48px; }
.cert-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: transform 250ms var(--ease), border-color 250ms;
}
.cert-card:hover { transform: translateY(-4px); border-color: rgba(52,211,153,0.4); }
.cert-icon { color: var(--accent-2); margin-bottom: 16px; }
.cert-card h3 { font-size: 0.98rem; line-height: 1.4; margin: 0; }
.cert-featured {
  background: linear-gradient(160deg, var(--accent-soft), var(--accent-2-soft));
  border-color: rgba(56,189,248,0.4);
}
.cert-featured .cert-icon { color: var(--accent-strong); }
.cert-featured h3 { font-weight: 700; }
.cert-meta { color: var(--text-faint); font-size: 0.85rem; margin: 8px 0 0; font-family: var(--font-mono); }

.edu-lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
.edu-block, .lang-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
}
.block-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin-bottom: 20px; color: var(--accent-strong); }
.edu-item { padding: 14px 0; border-top: 1px solid var(--border-soft); }
.edu-item:first-of-type { border-top: none; padding-top: 0; }
.edu-degree { font-weight: 600; margin: 0 0 4px; font-size: 0.96rem; }
.edu-meta { color: var(--text-faint); font-size: 0.86rem; margin: 0; }

.lang-item { margin-bottom: 18px; }
.lang-item:last-child { margin-bottom: 0; }
.lang-item span:first-child { font-weight: 600; font-size: 0.92rem; }
.lang-level { float: right; color: var(--text-faint); font-size: 0.84rem; font-family: var(--font-mono); }
.lang-bar { clear: both; height: 6px; background: var(--surface-2); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.lang-bar div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }

/* ---------- Contact ---------- */
.contact-inner { text-align: center; }
.contact .section-lede { margin-left: auto; margin-right: auto; }
.contact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 44px 0 40px; }
.contact-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 16px; color: var(--text-muted); font-size: 0.88rem; word-break: break-word;
  transition: transform 250ms var(--ease), border-color 250ms, color 250ms;
}
.contact-card .icon { color: var(--accent); }
.contact-card:hover { transform: translateY(-4px); border-color: rgba(56,189,248,0.45); color: var(--text); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border-soft); padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--text-faint); font-size: 0.85rem; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  display: grid; place-items: center; cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity 250ms, transform 250ms, border-color 250ms;
}
.to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { border-color: var(--accent); color: var(--accent-strong); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-card { max-width: 460px; }
  .about-grid { grid-template-columns: repeat(2, 1fr); }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .cert-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .edu-lang-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav.menu-open .nav-links {
    display: flex; flex-direction: column; gap: 4px;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: rgba(10,15,28,0.98); border-bottom: 1px solid var(--border-soft);
    padding: 16px 24px 24px;
  }
  .nav.menu-open .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
  .about-grid, .skills-grid, .cert-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .hero { padding-top: calc(var(--nav-h) + 40px); }
  .section { padding: 72px 0; }
  .hero-actions .btn span, .hero-actions .btn { font-size: 0.9rem; }
}
