:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-alt: #EDF4FF;
  --border: #C9DAF0;
  --text: #142B4A;
  --text-muted: #5D718B;
  --gold: #2563EB;
  --teal: #123F73;

  --font-display: "Fraunces", serif;
  --font-mono: "JetBrains Mono", monospace;
  --font-body: "Inter", sans-serif;

  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(20,43,74,0.06);
  --shadow-md: 0 10px 24px rgba(20,43,74,0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

a { color: inherit; text-decoration: none; }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Subtle scanline texture for the "terminal" feel */
.scanline {
  display: none;
}

/* ---------- Nav ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 6%;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(20,43,74,0.02);
}

.topbar-mono {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--teal);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2.2rem;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.nav-links a {
  position: relative;
  color: var(--text-muted);
  padding: 0.2rem 0;
  transition: color 0.2s ease;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1.5px;
  background: var(--gold);
  transition: width 0.2s ease;
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); }
.nav-links a:hover::after, .nav-links a:focus-visible::after { width: 100%; }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  display: block;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 5.5rem 6% 4.5rem;
  border-bottom: 1px solid var(--border);
  background-image:
    linear-gradient(90deg, transparent 49.8%, rgba(255,255,255,0.7) 49.8%, rgba(255,255,255,0.7) 50.2%, transparent 50.2%),
    radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 100% 100%, 22px 22px;
  background-position: center, -11px -11px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -110px;
  right: -70px;
  width: 290px;
  height: 290px;
  border: 2px solid rgba(37, 99, 235, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(37, 99, 235, 0.035), 0 0 0 68px rgba(37, 99, 235, 0.025);
  pointer-events: none;
}
.hero::after {
  display: none;
}

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

.eyebrow {
  font-family: var(--font-mono);
  color: var(--teal);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}
.eyebrow::before { content: "> "; color: var(--gold); }

.hero-main {
  display: flex;
  gap: 3rem;
  align-items: center;
  flex-wrap: wrap;
}

.avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }

.avatar {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--teal), var(--gold));
  border: 3px solid var(--surface-alt);
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 25%;
}

.avatar-caption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 160px;
}

.hero-text { flex: 1; min-width: 280px; }

.hero-text h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 1.1rem;
}

.hero-meta { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 1.6rem; }

.tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 100px;
  color: var(--text-muted);
}

.motto-card {
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.3rem;
  background: rgba(37, 99, 235, 0.06);
  display: inline-block;
}

.motto-arabic {
  font-family: "Amiri", serif;
  font-size: 1.6rem;
  color: var(--gold);
  margin: 0 0 0.3rem;
  direction: rtl;
}
.motto-arabic.small { font-size: 1.1rem; }

.motto-id {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
}

.scroll-cue {
  display: inline-block;
  margin-top: 3rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.scroll-cue:hover, .scroll-cue:focus-visible { border-color: var(--gold); color: var(--gold); }

/* ---------- Sections ---------- */
.section {
  padding: 5.5rem 6%;
  max-width: 980px;
  margin: 0 auto;
}
.section.alt { max-width: none; background: var(--surface); }
.section.alt > * { max-width: 980px; margin-left: auto; margin-right: auto; }

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  color: var(--teal);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  margin: 0 0 0.8rem;
}
.section-eyebrow::after {
  content: "";
  height: 1px;
  width: 36px;
  background: var(--border);
}

.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.7rem;
}

.section-note { margin: 0 0 2.5rem; color: var(--text-muted); }

.edit-hint {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--gold);
  opacity: 0.85;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 3rem;
}

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

.subgroup-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 0.8rem;
  color: var(--gold);
}

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.info-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.85rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: background 0.15s ease;
}
.info-list li:hover { background: rgba(37, 99, 235, 0.04); }
.info-list .k { color: var(--text-muted); white-space: nowrap; }
.info-list .v { color: var(--text); text-align: right; font-weight: 500; }

/* Skills */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.skill-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.skill-card:hover { transform: translateY(-4px); border-color: var(--gold); box-shadow: var(--shadow-md); }

.skill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.skill-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.skill-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.skill-bar {
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}
.skill-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

/* Commit log (roadmap / achievements) */
.commit-log {
  border-left: 2px solid var(--border);
  margin-left: 0.6rem;
}

.commit {
  position: relative;
  padding: 0 0 2.2rem 2rem;
}
.commit:last-child { padding-bottom: 0; }

.commit::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--teal);
}

.commit-hash {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--teal);
  display: block;
  margin-bottom: 0.3rem;
}

.commit-msg {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.3rem;
}

.commit-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}
.commit-meta em { color: var(--gold); font-style: normal; }

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.2rem;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.contact-card:hover, .contact-card:focus-visible {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--teal);
}
.contact-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 3rem 6% 2.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface);
}
.footer .motto-arabic.small { margin-right: 0.4rem; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }

  .menu-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links.open { max-height: 320px; }
  .nav-links li { border-top: 1px solid var(--border); }
  .nav-links a { display: block; padding: 1rem 6%; }
  .nav-links a::after { display: none; }

  .hero-main { flex-direction: column; text-align: center; }
  .hero-meta, .hero-text h1 { text-align: center; justify-content: center; }
  .motto-card { text-align: left; margin: 0 auto; }
}
