/* Paper & Ink — light-only design system */
:root {
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --ink: #1C2430;
  --muted: #5A6472;
  --accent: #2A9D8F;
  --accent-ink: #1F7A70;
  --hairline: #E5E2DC;
  --shadow: 0 1px 2px rgba(28, 36, 48, 0.06);
  --font-sans: "Manrope", "IBM Plex Sans Arabic", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  --maxw: 68rem;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Arabic font swap under RTL */
[dir="rtl"] body {
  font-family: "IBM Plex Sans Arabic", "Manrope", system-ui, sans-serif;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  line-height: 1.2;
  font-weight: 700;
}

p { margin: 0 0 1rem; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }
img { max-width: 100%; height: auto; display: block; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.container {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.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;
}

/* Focus visibility */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -100px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; color: #fff; }

/* Header / nav */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  line-height: 1;
}

.brand:hover {
  color: var(--ink);
}

.brand-logo {
  display: block;
  width: 210px;
  height: auto;
}

@media (max-width: 640px) {
  .brand-logo {
    width: 170px;
  }
}

.site-nav { display: flex; align-items: center; }
.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.nav-toggle-icon {
  width: 1rem;
  height: 2px;
  background: var(--ink);
  position: relative;
}
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  width: 1rem;
  height: 2px;
  background: var(--ink);
}
.nav-toggle-icon::before { top: -5px; }
.nav-toggle-icon::after { top: 5px; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.nav-menu a {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
}
.nav-menu a:hover { background: var(--surface); color: var(--accent-ink); }
.nav-lang a { font-weight: 700; color: var(--accent-ink); }

@media (max-width: 720px) {
  .brand-logo {
    width: 165px;
  }
  .nav-toggle { display: inline-flex; }
  .nav-menu {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 4rem;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface);
    border-bottom: 1px solid var(--hairline);
    box-shadow: var(--shadow);
    padding: 0.75rem var(--pad);
    gap: 0.25rem;
  }
  .nav-menu.is-open { display: flex; }
  .site-header { position: relative; }
}

/* Hero */
.hero { position: relative; overflow: hidden; }
.hero-banner {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.14;
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: center;
  padding-block: clamp(3rem, 8vw, 5.5rem);
}
.hero-avatar {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: var(--shadow);
}
.hero-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #fff;
  font-size: 2.5rem;
  font-weight: 700;
}
.hero-eyebrow { color: var(--muted); margin-bottom: 0.25rem; }
.hero-name { font-size: clamp(2.25rem, 6vw, 3.5rem); margin-bottom: 0.25rem; }
.hero-title { color: var(--accent-ink); font-weight: 700; font-size: 1.15rem; margin-bottom: 0.5rem; }
.hero-tagline { color: var(--muted); max-width: 40rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block: 1.25rem; }
.hero-location { color: var(--muted); font-size: 0.9rem; }
.hero-location .mono { color: var(--ink); }

@media (max-width: 640px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-avatar { width: 88px; height: 88px; border-radius: 18px; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.15rem;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--bg); color: var(--ink); }
.btn--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn--small { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* Sections */
.section { padding-block: clamp(3rem, 7vw, 5rem); border-bottom: 1px solid var(--hairline); }
.section:last-of-type { border-bottom: 0; }
.section-head { margin-bottom: 2rem; }
.section-label { color: var(--muted); text-transform: uppercase; margin-bottom: 0.4rem; }
.section-title { font-size: clamp(1.6rem, 4vw, 2.25rem); }

.about-body { max-width: 46rem; }
.about-summary { font-size: 1.08rem; color: var(--ink); }

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 2rem;
}
.skill-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--hairline);
}
.chip-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.82rem;
}
.chip-list--small .chip { font-size: 0.72rem; }

/* Timeline */
.timeline {
  border-inline-start: 2px solid var(--hairline);
  margin-inline-start: 0.4rem;
  padding-inline-start: 1.75rem;
}
.timeline-item { position: relative; padding-bottom: 2.25rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute;
  inset-inline-start: -2.05rem;
  top: 0.45rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}
.timeline-dates { color: var(--muted); margin-bottom: 0.35rem; }
.timeline-role { font-size: 1.1rem; margin-bottom: 0.15rem; }
.timeline-company { color: var(--muted); margin-bottom: 0.6rem; }

.bullets { list-style: disc; padding-inline-start: 1.25rem; margin-bottom: 1rem; }
.bullets li { margin-bottom: 0.4rem; }

/* Certificates */
.cert-list { display: grid; gap: 1rem; }
.cert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.cert-name { font-size: 1.05rem; margin-bottom: 0.2rem; }
.cert-meta { color: var(--muted); }

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.5rem;
}
.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.project-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg); }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.project-card:hover .project-thumb img { transform: scale(1.03); }
.project-body { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.15rem; flex: 1; }
.project-meta { min-height: 0; }
.project-title { font-size: 1.15rem; }
.project-title a { text-decoration: none; }
.project-summary { color: var(--muted); font-size: 0.94rem; flex: 1; }

.tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.tag--featured { background: var(--accent); color: var(--ink); }

/* Testimonials */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.5rem;
}
.testimonial {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.testimonial-text { margin: 0; font-size: 1rem; }
.testimonial-author { font-weight: 700; margin-bottom: 0.1rem; }
.testimonial-role { color: var(--muted); margin: 0; }

/* Contact */
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 2.5rem;
  align-items: start;
}
.contact-form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-weight: 600; font-size: 0.92rem; }
.field input,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.18);
}
.field .is-invalid { border-color: #B42318; }
.field-error { color: #B42318; font-size: 0.85rem; margin: 0; }

.contact-info { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 1.25rem; }
.contact-info-title { color: var(--muted); text-transform: uppercase; margin-bottom: 0.75rem; }
.contact-links { display: grid; gap: 0.5rem; }
.contact-links a { text-decoration: none; }

/* Alerts */
.alert { padding: 0.9rem 1.1rem; border-radius: 8px; margin-bottom: 1.5rem; }
.alert--success { background: #EAF5F3; border: 1px solid var(--accent); color: var(--ink); }
.alert--error { background: #FBEFED; border: 1px solid #B42318; color: var(--ink); }

/* Honeypot (hidden but present) */
.hp-field { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 860px) {
  .contact-layout { grid-template-columns: 1fr; }
}

/* Project detail */
.project-detail { padding-block: 3rem 5rem; }
.back-link { display: inline-block; margin-bottom: 1.5rem; text-decoration: none; color: var(--muted); }
.back-link:hover { color: var(--accent-ink); }
.project-header { margin-bottom: 2rem; }
.project-header .project-title { font-size: clamp(1.9rem, 5vw, 2.75rem); margin-bottom: 0.5rem; }
.project-header .project-summary { font-size: 1.1rem; color: var(--muted); max-width: 42rem; }
.project-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.project-gallery { display: grid; gap: 1.25rem; margin-bottom: 2rem; }
.project-figure { margin: 0; }
.project-figure img { border-radius: 12px; border: 1px solid var(--hairline); width: 100%; }
.project-description { max-width: 46rem; }

/* Error pages */
.error-page { padding-block: clamp(4rem, 10vw, 7rem); text-align: center; }
.error-title { font-size: clamp(1.8rem, 5vw, 2.75rem); margin-bottom: 0.75rem; }
.error-message { color: var(--muted); max-width: 32rem; margin-inline: auto; margin-bottom: 1.5rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--hairline); padding-block: 1.5rem; }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
}
.footer-note, .footer-built { margin: 0; }

/* Scroll reveal + reduced motion */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .project-thumb img { transition: none; }
}
