/* ============================================================
   Emad Elden Mohmad — Portfolio
   Theme colors live in :root so you can retheme the whole site.
   ============================================================ */

:root {
  --primary: #1b2cc1;
  --secondary: #7692ff;
  --light-blue: #abd2fa;
  --dark: #091540;

  --text: #f4f7ff;
  --text-muted: #abd2fa;
  --white: #ffffff;
  --card: rgba(13, 27, 84, 0.72);
  --card-border: rgba(171, 210, 250, 0.16);
  --danger: #ff8b9a;
  --success: #7dffc1;

  --font-body: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  --font-display: "Outfit", "Inter", system-ui, sans-serif;

  --container: 1120px;
  --header-h: 72px;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --focus: 0 0 0 3px rgba(118, 146, 255, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--dark);
  min-height: 100vh;
  overflow-wrap: break-word;
}

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

a {
  color: var(--secondary);
  text-decoration: none;
}

a:hover {
  color: var(--light-blue);
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.6em;
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

code {
  font-size: 0.9em;
  color: var(--light-blue);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 1000;
  background: var(--primary);
  color: var(--white);
  padding: 0.7rem 1rem;
  border-radius: 10px;
}

.skip-link:focus {
  top: 1rem;
  color: var(--white);
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.section {
  position: relative;
  padding: 4.5rem 0;
}

.section-alt {
  background: linear-gradient(180deg, rgba(27, 44, 193, 0.12), transparent 40%, rgba(9, 21, 64, 0.2));
}

.section-header {
  margin-bottom: 2.25rem;
  max-width: 42rem;
}

.section-kicker {
  color: var(--secondary);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

.section-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 0.5rem;
}

.section-intro {
  color: var(--text-muted);
  margin: 0;
}

/* Background */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(27, 44, 193, 0.45), transparent 55%),
    radial-gradient(900px 500px at 100% 10%, rgba(118, 146, 255, 0.18), transparent 50%),
    var(--dark);
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(171, 210, 250, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(171, 210, 250, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 85%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.45;
  animation: drift 18s ease-in-out infinite;
}

.orb-1 {
  width: 280px;
  height: 280px;
  background: #1b2cc1;
  top: 12%;
  left: -80px;
}

.orb-2 {
  width: 220px;
  height: 220px;
  background: #7692ff;
  right: -60px;
  top: 40%;
  animation-delay: -6s;
}

.orb-3 {
  width: 180px;
  height: 180px;
  background: #abd2fa;
  bottom: 8%;
  left: 30%;
  opacity: 0.18;
  animation-delay: -12s;
}

@keyframes drift {
  0%,
  100% { transform: translate(0, 0); }
  50% { transform: translate(24px, -18px); }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(9, 21, 64, 0.78);
  border-bottom: 1px solid var(--card-border);
}

.navbar {
  position: relative;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
}

.logo:hover {
  color: var(--white);
}

.logo-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--primary), var(--secondary));
  font-size: 0.8rem;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card);
  padding: 0;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  margin-inline: auto;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-menu {
  list-style: none;
  position: absolute;
  left: 0;
  right: 0;
  top: var(--header-h);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.8rem 1rem 1.2rem;
  background: rgba(9, 21, 64, 0.96);
  border-bottom: 1px solid var(--card-border);
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0.28s;
}

.nav-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.nav-link {
  display: block;
  padding: 0.7rem 0.85rem;
  color: var(--light-blue);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--white);
  background: rgba(118, 146, 255, 0.12);
}

.nav-cta {
  color: var(--white);
  background: var(--primary);
  text-align: center;
}

.nav-cta:hover {
  background: var(--secondary);
  color: var(--dark);
}

/* Hero */
.hero {
  padding-top: 2.5rem;
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

.hero-kicker {
  color: var(--secondary);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.hero-title {
  font-size: clamp(2.3rem, 8vw, 4.2rem);
  margin-bottom: 0.4rem;
}

.hero-role {
  min-height: 2.2rem;
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}

.typed-caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-left: 3px;
  background: var(--light-blue);
  animation: blink 1s steps(1) infinite;
}

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

.hero-lead {
  color: var(--text-muted);
  max-width: 36rem;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.5rem 0 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: transform 0.2s var(--ease), background 0.2s, color 0.2s, border-color 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--secondary);
  color: var(--dark);
}

.btn-ghost {
  background: transparent;
  border-color: var(--secondary);
  color: var(--light-blue);
}

.btn-ghost:hover {
  background: rgba(118, 146, 255, 0.12);
  color: var(--white);
}

.btn-sm {
  min-height: 42px;
  padding: 0.55rem 0.95rem;
  font-size: 0.92rem;
}

.social-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  list-style: none;
}

.social-link {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--light-blue);
  transition: transform 0.25s var(--ease), background 0.25s, color 0.25s;
}

.social-link:hover {
  transform: translateY(-4px);
  background: var(--primary);
  color: var(--white);
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.hero-image-placeholder,
.about-image-placeholder,
.project-media {
  position: relative;
  overflow: hidden;
}

.hero-image-placeholder {
  width: min(100%, 360px);
  aspect-ratio: 1;
  border-radius: 28px;
  animation: float 6s ease-in-out infinite;
}

.image-glow {
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  background: conic-gradient(from 180deg, var(--primary), var(--secondary), var(--light-blue), var(--primary));
  animation: spin 8s linear infinite;
  z-index: 0;
}

.hero-image-placeholder img,
.hero-image-placeholder .image-fallback {
  position: relative;
  z-index: 1;
  width: calc(100% - 10px);
  height: calc(100% - 10px);
  margin: 5px;
  border-radius: 22px;
  object-fit: cover;
  background: linear-gradient(160deg, #12206e, #091540);
}

.image-fallback {
  display: none;
  place-items: center;
  text-align: center;
  color: var(--light-blue);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.has-fallback > .image-fallback,
.hero-image-placeholder.has-fallback .image-fallback,
.about-image-placeholder.has-fallback .image-fallback,
.project-media.has-fallback .image-fallback {
  display: grid;
}

.has-fallback > img {
  display: none;
}

.hero-image-placeholder.has-fallback .image-fallback {
  position: absolute;
  inset: 5px;
  z-index: 1;
}

@keyframes float {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

/* About */
.about-grid,
.contact-grid {
  display: grid;
  gap: 2rem;
}

.about-copy p:last-child {
  margin-bottom: 0;
}

.metric-placeholder {
  color: var(--secondary);
  font-weight: 700;
}

.about-image-placeholder {
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  min-height: 280px;
  background: var(--card);
}

.about-image-placeholder img,
.about-image-placeholder .image-fallback {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  border-radius: inherit;
}

/* Timeline */
.timeline {
  list-style: none;
  display: grid;
  gap: 1.25rem;
  border-left: 2px solid rgba(118, 146, 255, 0.28);
  margin-left: 0.6rem;
  padding-left: 1.4rem;
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.82rem;
  top: 1.4rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--secondary);
  box-shadow: 0 0 0 6px rgba(118, 146, 255, 0.18);
}

.timeline-card,
.skill-card,
.project-card,
.service-card,
.contact-card,
.contact-form,
.testimonial-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.timeline-card {
  padding: 1.4rem 1.35rem;
}

.timeline-meta {
  color: var(--secondary);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.timeline-org {
  color: var(--light-blue);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.timeline-detail {
  margin-bottom: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(27, 44, 193, 0.45);
  border: 1px solid rgba(118, 146, 255, 0.35);
  font-size: 0.88rem;
  margin: 0;
}

.subhead {
  font-size: 0.95rem;
  margin: 1rem 0 0.6rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.chip-list li {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(118, 146, 255, 0.12);
  border: 1px solid var(--card-border);
  font-size: 0.85rem;
}

/* Skills */
.skills-grid,
.projects-grid,
.services-grid {
  display: grid;
  gap: 1.15rem;
}

.skill-card,
.service-card,
.project-card {
  padding: 1.4rem;
  transition: transform 0.25s var(--ease), border-color 0.25s;
}

.skill-card:hover,
.service-card:hover,
.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(118, 146, 255, 0.45);
}

.skill-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
}

.skill-ring svg {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.ring-bg,
.ring-fill {
  fill: none;
  stroke-width: 8;
}

.ring-bg {
  stroke: rgba(171, 210, 250, 0.16);
}

.ring-fill {
  stroke: var(--secondary);
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 1.2s var(--ease);
}

.skill-card.is-visible .ring-fill {
  stroke-dashoffset: var(--offset, 327);
}

.skill-percent {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--light-blue);
}

.skill-card h3,
.service-card h3,
.project-card h3 {
  font-size: 1.15rem;
}

.skill-card p,
.service-card p,
.project-card p {
  color: var(--text-muted);
  margin: 0;
}

/* Projects */
.project-media {
  margin: -1.4rem -1.4rem 1.1rem;
  aspect-ratio: 16 / 10;
  background: linear-gradient(160deg, #1b2cc1, #091540);
}

.project-media img,
.project-media .image-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 1rem 0;
}

.project-metrics div {
  background: rgba(9, 21, 64, 0.55);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}

.project-metrics dt {
  font-size: 0.72rem;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.project-metrics dd {
  margin: 0.15rem 0 0;
  font-weight: 700;
}

.project-result {
  margin-bottom: 1rem;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Carousel */
.carousel-viewport {
  overflow: hidden;
  border-radius: var(--radius);
}

.carousel-track {
  display: flex;
  transition: transform 0.5s var(--ease);
}

.testimonial-card {
  flex: 0 0 100%;
  padding: 1.6rem 1.4rem;
  min-height: 240px;
}

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

.stars {
  color: var(--secondary);
  letter-spacing: 0.12em;
  margin-bottom: 0.8rem;
}

.testimonial-meta {
  margin-top: 1.2rem;
}

.testimonial-meta strong {
  display: block;
}

.testimonial-meta span {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.carousel-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--white);
}

.carousel-btn:hover {
  background: var(--primary);
}

.carousel-dots {
  display: flex;
  gap: 0.45rem;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 0;
  background: rgba(171, 210, 250, 0.3);
  padding: 0;
}

.carousel-dot.is-active {
  background: var(--secondary);
  transform: scale(1.2);
}

/* Services */
.service-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  margin-bottom: 0.9rem;
  background: linear-gradient(145deg, var(--primary), var(--secondary));
  color: var(--white);
}

/* Contact */
.contact-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.contact-card:hover {
  color: var(--white);
  border-color: var(--secondary);
}

.contact-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
}

.contact-value {
  display: block;
  color: var(--text-muted);
  word-break: break-word;
}

.contact-form {
  padding: 1.3rem;
  display: grid;
  gap: 0.9rem;
}

.form-field {
  display: grid;
  gap: 0.35rem;
}

.form-field label {
  font-weight: 600;
  font-size: 0.92rem;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(9, 21, 64, 0.65);
  padding: 0.8rem 0.9rem;
}

.form-field input:focus-visible,
.form-field textarea:focus-visible {
  border-color: var(--secondary);
}

.form-field.is-invalid input,
.form-field.is-invalid textarea {
  border-color: var(--danger);
}

.field-error {
  min-height: 1.1em;
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
}

.form-status {
  margin: 0;
  min-height: 1.3em;
}

.form-status.is-success {
  color: var(--success);
}

.form-status.is-error {
  color: var(--danger);
}

.site-footer {
  border-top: 1px solid var(--card-border);
  padding: 1.4rem 0 2rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: space-between;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.reveal-right {
  transform: translateX(28px);
}

.reveal.reveal-left {
  transform: translateX(-28px);
}

.reveal.is-inview {
  opacity: 1;
  transform: none;
}

/* Breakpoints */
@media (min-width: 640px) {
  .skills-grid,
  .services-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 768px) {
  .hero-grid,
  .about-grid,
  .contact-grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 3rem;
    align-items: start;
  }

  .hero-grid {
    align-items: center;
  }

  .projects-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .section {
    padding: 6rem 0;
  }

  .nav-toggle {
    display: none;
  }

  .nav-menu {
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.15rem;
    padding: 0;
    background: transparent;
    border: 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    visibility: visible;
  }

  .nav-link {
    padding: 0.45rem 0.55rem;
    font-size: 0.82rem;
  }

  .nav-cta {
    margin-left: 0.35rem;
    padding-inline: 0.85rem;
  }

  .nav-link.is-active {
    background: transparent;
  }

  .nav-link.is-active::after {
    content: "";
    position: absolute;
    left: 0.55rem;
    right: 0.55rem;
    bottom: 0.18rem;
    height: 2px;
    background: var(--secondary);
    border-radius: 2px;
  }

  .nav-cta.is-active::after {
    display: none;
  }

  .nav-cta.is-active {
    background: var(--primary);
  }

  .skills-grid,
  .services-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-image-placeholder {
    width: 400px;
  }
}

@media (min-width: 1440px) {
  :root {
    --container: 1200px;
  }
}

@media (max-width: 374px) {
  .hero-title {
    font-size: 2rem;
  }

  .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
