/* =========================================================
   Mohammed Yousuf Al-Hasani – Portfolio
   style.css
   ---------------------------------------------------------
   1.  Variables (colors, fonts, background image)
   2.  Reset & base
   3.  Loader
   4.  Header / navigation
   5.  Buttons, ripple & glass cards
   6.  Hero
   7.  Sections (About, Skills, Experience, Projects,
       Education, Certifications, Contact)
   8.  Footer & back-to-top
   9.  Scroll animations
   10. Responsive
   11. Reduced motion
   ========================================================= */

/* ===================== 1. VARIABLES ===================== */
:root {
  /* 👉 To change the hero background, replace assets/background.jpg
        or point this variable at another image. */
  --hero-image: url("assets/background.jpg");
  /* Smaller copy used on phones/tablets for faster loading. If you change the
     background, replace this file too (or point it at the same image). */
  --hero-image-mobile: url("assets/background-mobile.jpg");

  /* Dark theme (default) */
  --bg: #0A192F;
  --bg-alt: #0D1F3A;
  --surface: rgba(17, 34, 64, 0.55);
  --surface-border: rgba(100, 255, 218, 0.12);
  --text: #CCD6F6;
  --text-muted: #8892B0;
  --heading: #E6F1FF;
  --accent: #64FFDA;
  --accent-2: #FF8C42; /* industrial orange */
  --accent-soft: rgba(100, 255, 218, 0.1);
  --shadow: 0 10px 30px -15px rgba(2, 12, 27, 0.7);
  --glow: 0 0 25px rgba(100, 255, 218, 0.25);
  --nav-bg: rgba(10, 25, 47, 0.85);
  --overlay: linear-gradient(180deg, rgba(10, 25, 47, 0.75) 0%, rgba(10, 25, 47, 0.85) 60%, #0A192F 100%);

  --font-heading: "Poppins", system-ui, sans-serif;
  --font-body: "Roboto", system-ui, sans-serif;

  --radius: 16px;
  --nav-h: 72px;
  --transition: 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Light theme */
[data-theme="light"] {
  --bg: #F5F7FA;
  --bg-alt: #E9EEF5;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-border: rgba(10, 25, 47, 0.08);
  --text: #334155;
  --text-muted: #5B6B82;
  --heading: #0A192F;
  --accent: #087A63; /* darker teal for contrast on light backgrounds */
  --accent-2: #D9601A;
  --accent-soft: rgba(8, 122, 99, 0.1);
  --shadow: 0 10px 30px -15px rgba(15, 23, 42, 0.25);
  --glow: 0 0 25px rgba(11, 143, 116, 0.2);
  --nav-bg: rgba(245, 247, 250, 0.88);
}

/* ===================== 2. RESET & BASE ===================== */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}
body.no-scroll { overflow: hidden; }

h1, h2, h3 { font-family: var(--font-heading); color: var(--heading); line-height: 1.2; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
strong { color: var(--heading); font-weight: 500; }
.accent { color: var(--accent); }

.container { width: min(1140px, 100% - 2.5rem); margin-inline: auto; }

/* Visible keyboard focus everywhere */
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 2000;
  background: var(--accent); color: #0A192F; padding: 0.6rem 1rem; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ===================== 3. LOADER ===================== */
.loader {
  position: fixed; inset: 0; z-index: 3000;
  display: grid; place-items: center;
  background: #0A192F;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader-logo { width: 180px; }
.loader-logo text {
  font-family: var(--font-heading); font-size: 72px; font-weight: 700;
  fill: transparent; stroke: #64FFDA; stroke-width: 1.5;
  stroke-dasharray: 400; stroke-dashoffset: 400;
  animation: draw 1.4s ease forwards, fill-in 0.5s ease 1.2s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fill-in { to { fill: #64FFDA; } }

/* ===================== 4. HEADER / NAV ===================== */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  height: var(--nav-h);
  transition: background var(--transition), box-shadow var(--transition), height var(--transition);
}
.header.scrolled {
  --nav-h: 62px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.nav { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.nav-logo { font-family: var(--font-heading); font-weight: 700; font-size: 1.4rem; color: var(--heading); }
.nav-logo .bracket { color: var(--accent); }

.nav-menu { display: flex; gap: 1.6rem; }
.nav-link {
  position: relative; font-family: var(--font-heading); font-size: 0.92rem; font-weight: 500;
  color: var(--text); padding: 0.3rem 0; transition: color var(--transition);
}
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--accent); }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); transform-origin: left; }

.nav-actions { display: flex; align-items: center; gap: 0.6rem; }

.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--surface-border); background: var(--surface);
  color: var(--heading); cursor: pointer; font-size: 1rem;
  display: grid; place-items: center; transition: transform var(--transition), color var(--transition);
}
.theme-toggle:hover { transform: rotate(20deg); color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: inline; }

.hamburger {
  display: none; width: 42px; height: 42px; background: none; border: 0; cursor: pointer;
  flex-direction: column; justify-content: center; align-items: center; gap: 6px;
}
.hamburger span {
  width: 26px; height: 2px; background: var(--accent); border-radius: 2px; transition: transform var(--transition), opacity var(--transition);
}
.hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ===================== 5. BUTTONS, RIPPLE, GLASS ===================== */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.7rem; border-radius: 10px;
  font-family: var(--font-heading); font-weight: 600; font-size: 0.95rem;
  border: 2px solid var(--accent); cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}
.btn-primary { background: var(--accent); color: #0A192F; }
.btn-primary:hover { transform: translateY(-3px); box-shadow: var(--glow); }
.btn-outline { background: transparent; color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); transform: translateY(-3px); box-shadow: var(--glow); }
.btn-small { padding: 0.55rem 1.1rem; font-size: 0.85rem; background: transparent; color: var(--accent); }
.btn-small:hover { background: var(--accent); color: #0A192F; }
/* Light mode: white text on the darker teal for better contrast */
[data-theme="light"] .btn-primary,
[data-theme="light"] .btn-small:hover,
[data-theme="light"] .back-to-top { color: #FFFFFF; }

/* Ripple effect (span injected by script.js) */
.ripple { position: relative; overflow: hidden; }
.ripple-wave {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, 0.45); transform: scale(0);
  animation: ripple 0.65s ease-out forwards;
}
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* Glassmorphism card */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.35rem;
  color: var(--accent); background: var(--accent-soft); margin-bottom: 1rem;
}
.card-icon.big { width: 72px; height: 72px; font-size: 2rem; flex-shrink: 0; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-list li, .tech-tags li {
  font-size: 0.82rem; padding: 0.35rem 0.8rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--surface-border);
}

/* ===================== 6. HERO ===================== */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; overflow: hidden; color: var(--text);
}
.hero-bg {
  position: absolute; inset: -10% 0 -10% 0; z-index: -2;
  /* Fallback gradient is shown if the image is missing */
  background: var(--hero-image) center / cover no-repeat, linear-gradient(135deg, #0A192F 0%, #112240 50%, #1B3A5C 100%);
  will-change: transform;
}
.hero-overlay { position: absolute; inset: 0; z-index: -1; background: var(--overlay); }
[data-theme="light"] .hero-overlay {
  /* Light mode: soft white wash over the image so the hero matches the rest of the page */
  background: linear-gradient(180deg, rgba(245, 247, 250, 0.86) 0%, rgba(245, 247, 250, 0.92) 60%, var(--bg) 100%);
}

.hero-content { padding-top: var(--nav-h); }
.hero-greeting { font-family: var(--font-heading); color: var(--accent); font-size: 1.05rem; margin-bottom: 0.6rem; }
.hero-name { font-size: clamp(2.3rem, 6vw, 4.4rem); font-weight: 800; color: var(--heading); margin-bottom: 0.8rem; }
.hero-name .accent { color: var(--accent); }
.hero-typing {
  font-family: var(--font-heading); font-size: clamp(1.25rem, 3vw, 2rem); font-weight: 600;
  color: var(--text); min-height: 1.5em; margin-bottom: 1rem;
}
.cursor { color: var(--accent); animation: blink 0.9s step-end infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.hero-title { color: var(--text-muted); font-size: clamp(0.95rem, 1.8vw, 1.1rem); max-width: 640px; }
.hero-location { color: var(--text-muted); margin: 0.4rem 0 2rem; }
.hero-location i { color: #FF8C42; margin-right: 0.3rem; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }

/* Name / hero content fade and slide up */
.hero-anim { opacity: 0; transform: translateY(30px); }
body.loaded .hero-anim { animation: slide-up 0.8s ease forwards; animation-delay: var(--d, 0s); }
@keyframes slide-up { to { opacity: 1; transform: translateY(0); } }

.social-links { display: flex; gap: 0.9rem; }
.social-links a {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--accent); color: var(--accent); font-size: 1.05rem;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}
.social-links a:hover { transform: translateY(-4px); background: var(--accent-soft); box-shadow: var(--glow); }

.scroll-down { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); }
.mouse { display: block; width: 26px; height: 42px; border: 2px solid var(--accent); border-radius: 14px; position: relative; }
.wheel {
  position: absolute; top: 7px; left: 50%; width: 4px; height: 8px; margin-left: -2px;
  background: var(--accent); border-radius: 2px; animation: wheel 1.6s ease infinite;
}
@keyframes wheel { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(14px); } }

/* ===================== 7. SECTIONS ===================== */
.section { padding: 6.5rem 0; overflow-x: clip; /* stops slide-in animations from widening the page on mobile */ }
.section-alt { background: var(--bg-alt); transition: background var(--transition); }

.section-title {
  display: flex; align-items: center; gap: 0.7rem;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin-bottom: 3rem; white-space: nowrap;
}
.section-title .num { color: var(--accent); font-size: 0.75em; font-weight: 500; }
.section-title::after {
  content: ""; flex: 1; max-width: 300px; height: 1px; background: var(--surface-border); margin-left: 1rem;
}
.section-sub { color: var(--text-muted); margin: -2rem 0 2.5rem; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3.5rem; align-items: center; }
.about-text p { margin-bottom: 1.2rem; font-size: 1.05rem; }
.about-highlights { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8rem; margin-top: 1.5rem; }
.about-highlights li { display: flex; align-items: center; gap: 0.6rem; font-size: 0.95rem; }
.about-highlights i { color: var(--accent); width: 18px; }

.about-photo { display: flex; justify-content: center; }
.photo-frame {
  position: relative; width: min(300px, 80vw); aspect-ratio: 1; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 140, 66, 0.12));
  border: 2px solid var(--accent); display: grid; place-items: center; overflow: visible;
}
.photo-frame::before {
  content: ""; position: absolute; inset: 0; border: 2px solid var(--accent); border-radius: var(--radius);
  transform: translate(16px, 16px); z-index: -1; transition: transform var(--transition);
}
.photo-frame:hover::before { transform: translate(10px, 10px); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; border-radius: calc(var(--radius) - 2px); position: relative; z-index: 1; }
.photo-fallback { position: absolute; font-family: var(--font-heading); font-size: 5rem; font-weight: 800; color: var(--accent); }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.skill-card { padding: 1.8rem; }
.skill-card h3 { font-size: 1.15rem; margin-bottom: 1rem; }
.skill-card p { font-size: 0.93rem; margin-bottom: 1rem; }
.skill-card:hover { transform: translateY(-8px); border-color: var(--accent); box-shadow: var(--shadow), var(--glow); }
.skill-card-wide { grid-column: span 2; }

.skill-bar { margin-bottom: 1rem; }
.skill-info { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.35rem; }
.skill-info .pct { color: var(--accent); font-weight: 500; }
/* Small "In training" label next to skills still being learned */
.training-badge {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.45rem; border-radius: 99px;
  font-size: 0.68rem; font-weight: 500; line-height: 1.5; vertical-align: 1px; white-space: nowrap;
  color: var(--accent-2); background: rgba(255, 140, 66, 0.12); border: 1px solid rgba(255, 140, 66, 0.3);
}
.bar { height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.fill {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.circles { display: flex; flex-wrap: wrap; gap: 3rem; justify-content: center; }
.circle { position: relative; width: 140px; height: 140px; }
/* Languages card is a normal-width card: keep both circles side by side */
.skill-card-languages .circles { gap: 1.5rem; margin-top: 0.5rem; }
.skill-card-languages .circle { width: 124px; height: 124px; }
.circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.circle circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.circle .track { stroke: var(--accent-soft); }
.circle .progress {
  stroke: var(--accent); stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.circle-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.3; }
.circle-label strong { font-family: var(--font-heading); }
.circle-label span { font-size: 0.82rem; color: var(--text-muted); }

/* ---------- Experience timeline ---------- */
.timeline { position: relative; max-width: 960px; margin: 0 auto; }
.timeline::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-50%);
  background: linear-gradient(var(--accent), var(--accent-2));
}
.timeline-item { position: relative; width: 50%; padding: 0 2.8rem 3rem; }
.timeline-item.left { left: 0; }
.timeline-item.right { left: 50%; }
.timeline-dot {
  position: absolute; top: 1.4rem; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg); color: var(--accent);
  border: 2px solid var(--accent); box-shadow: var(--glow); z-index: 1;
}
.timeline-item.left .timeline-dot { right: -22px; }
.timeline-item.right .timeline-dot { left: -22px; }
.timeline-card { padding: 1.7rem; }
.timeline-card:hover { transform: translateY(-5px); border-color: var(--accent); }
.timeline-date {
  display: inline-block; font-size: 0.8rem; font-weight: 500; color: var(--accent-2);
  background: rgba(255, 140, 66, 0.1); padding: 0.25rem 0.7rem; border-radius: 99px; margin-bottom: 0.7rem;
}
.timeline-card h3 { font-size: 1.15rem; }
.timeline-org { color: var(--accent); margin-bottom: 0.8rem; font-weight: 500; }
.timeline-card ul li { position: relative; padding-left: 1.3rem; margin-bottom: 0.5rem; font-size: 0.94rem; }
.timeline-card ul li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

/* ---------- Projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.8rem; }
.project-card { overflow: hidden; display: flex; flex-direction: column; }
.project-card:hover { transform: translateY(-8px); border-color: var(--accent); box-shadow: var(--shadow), var(--glow); }
.project-img { aspect-ratio: 16 / 9; overflow: hidden; }
.project-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.project-card:hover .project-img img,
.project-card:hover .project-placeholder i { transform: scale(1.08); }
.project-placeholder {
  width: 100%; height: 100%; display: grid; place-items: center; font-size: 3.5rem; color: var(--accent);
  background:
    linear-gradient(135deg, rgba(100, 255, 218, 0.12), rgba(255, 140, 66, 0.12)),
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(100, 255, 218, 0.05) 14px 15px);
}
.project-placeholder i { transition: transform 0.6s ease; }
.project-body { padding: 1.6rem; display: flex; flex-direction: column; gap: 0.9rem; flex: 1; }
.project-body h3 { font-size: 1.15rem; }
.project-body p { font-size: 0.93rem; flex: 1; }
.tech-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.project-body .btn { align-self: flex-start; }

/* ---------- Education ---------- */
.edu-card {
  display: flex; align-items: center; justify-content: space-between; gap: 2rem;
  padding: 2.4rem; max-width: 960px; margin: 0 auto;
}
.edu-card:hover { border-color: var(--accent); box-shadow: var(--shadow), var(--glow); }
.edu-main { display: flex; gap: 1.5rem; align-items: flex-start; }
.edu-main h3 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.edu-school { color: var(--accent); font-weight: 500; }
.edu-year, .edu-honor { font-size: 0.95rem; margin-top: 0.3rem; }
.edu-year i, .edu-honor i { color: var(--accent-2); margin-right: 0.4rem; }
.edu-course-title { margin: 1rem 0 0.6rem; font-family: var(--font-heading); font-weight: 600; color: var(--heading); }
.gpa {
  flex-shrink: 0; width: 170px; height: 170px; border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  border: 3px solid var(--accent); box-shadow: var(--glow), inset var(--glow);
}
.gpa-value { font-family: var(--font-heading); font-size: 2.8rem; font-weight: 800; color: var(--accent); line-height: 1; }
.gpa-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ---------- Certifications ---------- */
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; perspective: 1200px; }
.cert-card { padding: 1.8rem; }
.cert-card:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: var(--shadow), var(--glow); }
.cert-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.cert-org { color: var(--accent); font-size: 0.92rem; font-weight: 500; }
.cert-date { color: var(--accent-2); font-size: 0.85rem; margin-top: 0.3rem; }
.cert-note { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.5rem; font-style: italic; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 2rem; align-items: start; }
.contact-info { display: grid; gap: 1rem; }
.contact-item { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.3rem; }
a.contact-item:hover { transform: translateX(6px); border-color: var(--accent); box-shadow: var(--shadow), var(--glow); }
.contact-item > i {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.15rem; color: var(--accent); background: var(--accent-soft); flex-shrink: 0;
}
.contact-item span { display: block; font-size: 0.8rem; color: var(--text-muted); }
.contact-item strong { font-size: 0.95rem; word-break: break-word; }

.contact-form { padding: 2rem; display: grid; gap: 1.3rem; }
.form-group { position: relative; }
.form-group input, .form-group textarea {
  width: 100%; padding: 1.1rem 1rem 0.6rem; border-radius: 10px;
  border: 1px solid var(--surface-border); background: var(--accent-soft);
  color: var(--heading); font: inherit; resize: vertical; transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.form-group label {
  position: absolute; left: 1rem; top: 0.95rem; color: var(--text-muted); pointer-events: none;
  transition: all 0.2s ease; font-size: 0.95rem;
}
/* Floating label */
.form-group input:focus + label, .form-group input:not(:placeholder-shown) + label,
.form-group textarea:focus + label, .form-group textarea:not(:placeholder-shown) + label {
  top: 0.25rem; font-size: 0.72rem; color: var(--accent);
}
.hp { position: absolute; left: -9999px; }
.contact-form .btn { justify-self: start; }
.form-status { font-size: 0.92rem; min-height: 1.2em; }
.form-status.success { color: var(--accent); }
.form-status.error { color: #FF6B6B; }

/* ===================== 8. FOOTER & BACK TO TOP ===================== */
.footer { padding: 2.5rem 0; border-top: 1px solid var(--surface-border); text-align: center; }
.footer-inner { display: grid; justify-items: center; gap: 1rem; }
.footer p { font-size: 0.88rem; color: var(--text-muted); }
.footer .social-links a { color: var(--accent); border-color: var(--surface-border); }

.back-to-top {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 900;
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #0A192F; box-shadow: var(--glow);
  opacity: 0; visibility: hidden; transform: translateY(20px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-4px); }

/* ===================== 9. SCROLL ANIMATIONS ===================== */
/* Elements start hidden only when JS is running (html.js) */
.js [data-anim] {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--delay, 0s);
}
.js [data-anim="fade-up"] { transform: translateY(40px); }
.js [data-anim="fade-left"] { transform: translateX(-60px); }
.js [data-anim="slide-left"] { transform: translateX(-80px); }
.js [data-anim="slide-right"] { transform: translateX(80px); }
.js [data-anim="zoom-in"] { transform: scale(0.85); }
.js [data-anim="flip"] { transform: none; }
.js [data-anim="flip"].in-view { animation: flip-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) var(--delay, 0s) backwards; }
@keyframes flip-in {
  from { opacity: 0; transform: perspective(1000px) rotateY(-90deg); transform-origin: left center; }
  to { opacity: 1; transform: none; transform-origin: left center; }
}
.js [data-anim].in-view { opacity: 1; transform: none; }
/* After the entrance finishes, restore normal hover transitions */
.js [data-anim].anim-done { transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); transition-delay: 0s; }

/* ===================== 10. RESPONSIVE ===================== */
@media (max-width: 1024px) {
  .skills-grid, .cert-grid { grid-template-columns: repeat(2, 1fr); }
  .skill-card-wide { grid-column: auto; }
  .nav-menu { gap: 1.1rem; }
}

@media (max-width: 900px) {
  /* Mobile menu */
  .hamburger { display: flex; }
  .nav-menu {
    position: fixed; top: 0; right: 0; height: 100vh; width: min(300px, 80vw);
    flex-direction: column; justify-content: center; align-items: center; gap: 2rem;
    background: var(--bg-alt); box-shadow: -10px 0 30px rgba(2, 12, 27, 0.5);
    transform: translateX(100%); visibility: hidden; transition: transform var(--transition), visibility var(--transition);
  }
  .nav-menu.open { transform: translateX(0); visibility: visible; }
  .nav-link { font-size: 1.1rem; }
  .hamburger { position: relative; z-index: 1001; }

  .about-grid { grid-template-columns: 1fr; }
  .about-photo { order: -1; }

  /* Timeline becomes single column */
  .timeline::before { left: 22px; }
  .timeline-item, .timeline-item.left, .timeline-item.right { width: 100%; left: 0; padding: 0 0 2.5rem 4rem; }
  .timeline-item.left .timeline-dot, .timeline-item.right .timeline-dot { left: 0; right: auto; }
  .js [data-anim="slide-right"] { transform: translateX(60px); }

  .edu-card { flex-direction: column; text-align: left; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .section { padding: 4.5rem 0; }
  .skills-grid, .cert-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .about-highlights { grid-template-columns: 1fr; }
  .edu-main { flex-direction: column; }
  .section-title { white-space: normal; }
  .section-title::after { display: none; }
  .hero-buttons .btn { flex: 1 1 100%; justify-content: center; }
  .contact-form { padding: 1.4rem; }
  .scroll-down { display: none; }
}

/* ---------- Phone polish ---------- */
/* Keep "Al-Hasani" together instead of breaking at the hyphen */
.hero-name .accent { white-space: nowrap; }

/* Dim the page behind the open mobile menu */
.menu-backdrop {
  position: fixed; inset: 0; z-index: 999; background: rgba(2, 12, 27, 0.6);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity var(--transition), visibility var(--transition);
}
.menu-backdrop.show { opacity: 1; visibility: visible; }

/* Touch screens: no "stuck" hover lift after tapping a card */
@media (hover: none) {
  .skill-card:hover, .project-card:hover, .cert-card:hover, .timeline-card:hover,
  .edu-card:hover, a.contact-item:hover, .btn:hover, .social-links a:hover {
    transform: none;
  }
}

@media (max-width: 600px) {
  .container { width: calc(100% - 2rem); }
  .section { padding: 4rem 0; }
  .section-title { align-items: baseline; margin-bottom: 2rem; }

  /* Hero */
  .hero-name { font-size: clamp(2rem, 9.5vw, 2.6rem); }
  .hero-typing { font-size: 1.2rem; }
  .hero-buttons { gap: 0.75rem; }

  /* About photo smaller */
  .photo-frame { width: min(220px, 62vw); }
  .photo-frame::before { transform: translate(10px, 10px); }
  .photo-fallback { font-size: 3.8rem; }
  .about-grid { gap: 2.5rem; }

  /* Cards: a little less padding so text has room */
  .skill-card, .cert-card { padding: 1.4rem; }
  .project-body { padding: 1.3rem; }

  /* Language circles side by side */
  .circles { gap: 1.2rem; }
  .circle { width: 118px; height: 118px; }

  /* Timeline: thinner left gutter */
  .timeline::before { left: 17px; }
  .timeline-item, .timeline-item.left, .timeline-item.right { padding: 0 0 2rem 3.1rem; }
  .timeline-dot { width: 36px; height: 36px; font-size: 0.85rem; }
  .timeline-card { padding: 1.3rem; }

  /* Education */
  .edu-card { padding: 1.5rem; gap: 1.5rem; }
  .edu-main > div { width: 100%; }
  .card-icon.big { width: 58px; height: 58px; font-size: 1.6rem; }
  .gpa { width: 140px; height: 140px; align-self: center; }
  .gpa-value { font-size: 2.3rem; }

  /* Contact & footer */
  .contact-item { padding: 0.95rem 1.1rem; }
  .footer { padding-bottom: 5.5rem; } /* room for the back-to-top button */
  .back-to-top { right: 1rem; bottom: 1rem; width: 44px; height: 44px; }
}

/* ---------- Phones & tablets only: faster loading & smoother scrolling ---------- */
@media (max-width: 900px) {
  /* Lighter background image */
  .hero-bg { background-image: var(--hero-image-mobile), linear-gradient(135deg, #0A192F 0%, #112240 50%, #1B3A5C 100%); }
  /* Shorter "MH" intro */
  .loader-logo text { animation: draw 0.8s ease forwards, fill-in 0.3s ease 0.6s forwards; }
  /* No blur on cards: expensive for phone graphics chips, invisible on the dark background */
  .glass-card { backdrop-filter: none; -webkit-backdrop-filter: none; }
  :root { --surface: rgba(17, 34, 64, 0.85); }
  [data-theme="light"] { --surface: rgba(255, 255, 255, 0.92); }
}

/* Very small phones (e.g. iPhone SE 1st gen, 320px) */
@media (max-width: 360px) {
  .hero-name { font-size: 1.85rem; }
  .circle, .skill-card-languages .circle { width: 104px; height: 104px; }
  .skill-card-languages .circles { gap: 1rem; }
  .nav-logo { font-size: 1.2rem; }
}

/* ===================== 11. 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; transition-delay: 0s !important;
  }
  .js [data-anim], .hero-anim { opacity: 1 !important; transform: none !important; }
  .cursor { animation: none; }
}
