/* ==========================================================
   Khalil Alasfoor: portfolio styles
   Colors live in :root. Change them there to retheme the site.
   ========================================================== */
:root {
  --navy-950: #07121F;
  --navy-900: #0B1B2B;
  --navy-800: #11263B;
  --navy-700: #1A3550;
  --line: #24425F;
  --text: #EAF0F6;
  --muted: #A9B8C8;
  --accent: #FF7A1A;        /* safety orange */
  --accent-strong: #FF8F3D;
  --accent-red: #E5372B;    /* fire red, used sparingly */
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
  --font-en: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --header-h: 68px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

body {
  margin: 0;
  background: var(--navy-900);
  color: var(--text);
  font-family: var(--font-en);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="ar"] body { font-family: var(--font-ar); line-height: 1.85; }

img, svg { display: block; max-width: 100%; }
a { color: var(--accent-strong); text-underline-offset: 3px; }
a:hover { color: #FFB27A; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { letter-spacing: 0; line-height: 1.4; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
p { margin: 0 0 1em; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(780px, 100% - 32px); }
.center { text-align: center; }

.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; inset-inline-start: 12px; top: -60px; background: var(--accent); color: var(--navy-950); padding: 10px 14px; border-radius: 8px; font-weight: 600; z-index: 100; }
.skip-link:focus { top: 12px; }

.placeholder { color: #FFC48F; font-style: italic; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 18, 31, .88);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; margin-inline-end: auto; }
.brand:hover { color: var(--text); }
.nav-menu { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-menu a { display: block; padding: 8px 12px; color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 500; border-radius: 8px; }
.nav-menu a:hover { color: var(--text); background: var(--navy-800); }
.nav-toggle { display: none; }
.lang-toggle {
  font: 600 .95rem var(--font-ar);
  color: var(--text); background: transparent;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; min-height: 40px;
}
html[lang="ar"] .lang-toggle { font-family: var(--font-en); }
.lang-toggle:hover { border-color: var(--accent); color: var(--accent-strong); }

@media (max-width: 860px) {
  .nav { order: 3; }
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0 11px;
    background: transparent; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  }
  .nav-toggle .bar { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
  .nav-toggle[aria-expanded="true"] .bar:nth-child(2) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .bar:nth-child(3) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] .bar:nth-child(4) { transform: translateY(-7px) rotate(-45deg); }
  .nav-menu {
    display: none; position: absolute; inset-inline: 0; top: var(--header-h);
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: var(--navy-950); border-bottom: 1px solid var(--line);
  }
  .nav-menu.open { display: flex; }
  .nav-menu a { padding: 12px; font-size: 1.05rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 10px;
  font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--navy-950); }
.btn-primary:hover { background: var(--accent-strong); color: var(--navy-950); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(56px, 9vw, 112px) 0 clamp(48px, 7vw, 88px);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(255, 122, 26, .16), transparent 60%),
    linear-gradient(180deg, var(--navy-950), var(--navy-900));
  border-bottom: 1px solid var(--line);
}
.hero::after { /* hazard stripe accent */
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 4px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 14px, var(--navy-950) 14px 28px);
  opacity: .8;
}
.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(32px, 6vw, 72px); align-items: center; }
.eyebrow, .section-kicker {
  color: var(--accent-strong); font-weight: 600; font-size: .85rem;
  text-transform: uppercase; letter-spacing: .12em; margin-bottom: .9em;
}
html[lang="ar"] .eyebrow, html[lang="ar"] .section-kicker { text-transform: none; letter-spacing: 0; font-size: .95rem; }
.hero-role { color: var(--text); font-size: 1.15rem; font-weight: 500; }
.hero-lead { color: var(--muted); max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 32px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 12px 28px; list-style: none; padding: 0; margin: 0; color: var(--muted); font-size: .95rem; }
.hero-facts li { display: flex; flex-direction: column; padding-inline-start: 14px; border-inline-start: 3px solid var(--accent); }
.hero-facts strong { color: var(--text); font-size: 1.1rem; }
.hero-photo img {
  width: 100%; height: auto; max-width: 360px; aspect-ratio: 1; object-fit: cover; margin-inline: auto;
  border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow);
  background: var(--navy-800);
}
@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-photo { order: -1; }
  .hero-photo img { max-width: 200px; margin-inline: 0; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 104px) 0; }
.section-alt { background: var(--navy-950); border-block: 1px solid var(--line); }
.section h2 { margin-bottom: .8em; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding-inline-start: 40px; padding-bottom: 36px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--navy-950); border: 3px solid var(--line);
}
.timeline-item.current::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px rgba(255, 122, 26, .2); }
.timeline-date { font-size: .9rem; font-weight: 600; color: var(--accent-strong); margin-bottom: .3em; }
.timeline-org { color: var(--muted); font-weight: 500; }

/* ---------- Cards ---------- */
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.skills-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.projects-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  background: var(--navy-800); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; transition: border-color .2s, transform .2s;
}
.card:hover { border-color: rgba(255, 122, 26, .6); transform: translateY(-2px); }
.card p { color: var(--muted); margin: 0; font-size: .98rem; }
.card-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: rgba(255, 122, 26, .12); margin-bottom: 14px; }
.card-icon svg { width: 24px; height: 24px; fill: var(--accent); }
.project { border-top: 3px solid var(--accent); }
.project-tag { font-size: .8rem !important; font-weight: 600; color: var(--accent-strong) !important; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px !important; }
html[lang="ar"] .project-tag { text-transform: none; letter-spacing: 0; }

/* ---------- Certifications ---------- */
.cert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.cert {
  display: flex; align-items: center; gap: 16px;
  background: var(--navy-800); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
}
.cert-issuer {
  flex: 0 0 auto; min-width: 92px; text-align: center;
  font-weight: 700; font-size: .85rem; letter-spacing: .04em;
  color: var(--navy-950); background: var(--accent); border-radius: 8px; padding: 6px 10px;
  font-family: var(--font-en);
}
.cert-name { font-weight: 500; }
@media (max-width: 400px) { .cert-list { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact-list { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); text-align: start; }
.contact-item {
  display: flex; align-items: center; gap: 14px; height: 100%;
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--navy-800); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; transition: border-color .2s, transform .2s;
}
.contact-item:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.contact-item svg { flex: 0 0 auto; width: 26px; height: 26px; fill: var(--accent); }
.contact-item.whatsapp svg { fill: #25D366; }
.contact-label { display: block; font-size: .85rem; color: var(--muted); }
.contact-value { display: block; font-weight: 600; word-break: break-word; }
html[dir="rtl"] .contact-value[dir="ltr"] { text-align: end; }

/* ---------- Footer ---------- */
.site-footer { padding: 28px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent-strong); }

/* ---------- 404 ---------- */
.notfound { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 32px 16px; }
.notfound .code { font-size: clamp(5rem, 18vw, 9rem); font-weight: 700; line-height: 1; color: var(--accent); margin: 0 0 .2em; }
.notfound .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
