:root {
  --bg: #f4efe6;
  --ink: #12302f;
  --muted: #4d6664;
  --accent: #0f7c78;
  --accent-ink: #ffffff;
  --card: rgba(255, 255, 255, 0.6);
  --line: rgba(18, 48, 47, 0.14);
  --ripple: rgba(15, 124, 120, 0.18);
  --shadow: 0 16px 40px rgba(18, 48, 47, 0.08);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1f20;
  --ink: #e9f1ef;
  --muted: #9fb7b4;
  --accent: #4fd1c5;
  --accent-ink: #062322;
  --card: rgba(255, 255, 255, 0.04);
  --line: rgba(233, 241, 239, 0.12);
  --ripple: rgba(79, 209, 197, 0.16);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  color-scheme: dark;
}

html[dir="rtl"] {
  --serif: "Amiri", "Times New Roman", serif;
  --sans: "IBM Plex Sans Arabic", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* water ripples */
.water { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ripple {
  position: absolute;
  top: 38%;
  inset-inline-end: -10vmax;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  border: 1px solid var(--ripple);
  transform: translate(0, -50%) scale(0.3);
  opacity: 0;
  animation: ripple 9s ease-out infinite;
}
.r2 { animation-delay: 3s; }
.r3 { animation-delay: 6s; }
@keyframes ripple {
  0%   { transform: translate(0, -50%) scale(0.2); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translate(0, -50%) scale(1.3); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ripple { animation: none; opacity: 1; transform: translate(0, -50%) scale(0.8); }
  .r2 { transform: translate(0, -50%) scale(0.55); }
  .r3 { transform: translate(0, -50%) scale(1.05); }
}

header, main, section, footer { position: relative; z-index: 1; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
  padding: 24px clamp(16px, 5vw, 64px);
}
.mark {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font: 600 1.15rem var(--serif);
}
.lang {
  font: 500 0.9rem var(--sans);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}
.lang:hover { border-color: var(--accent); color: var(--accent); }
html[dir="ltr"] .lang { font-family: "IBM Plex Sans Arabic", sans-serif; }
html[dir="rtl"] .lang { font-family: "Inter", sans-serif; }
.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.8vw, 24px);
  margin-inline: auto;
}
.site-nav a {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s;
}
.site-nav a:hover { color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); transform: rotate(8deg); }
.theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.moon-icon { display: none; }
:root[data-theme="dark"] .sun-icon { display: none; }
:root[data-theme="dark"] .moon-icon { display: block; }
.theme-toggle:focus-visible, .site-nav a:focus-visible, .back-to-top:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}

.hero {
  flex: 1;
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 1280px;
  min-height: clamp(540px, 72vh, 760px);
  margin-inline: auto;
  padding: clamp(72px, 12vh, 140px) clamp(16px, 5vw, 64px) 72px;
}
.hero::after {
  position: absolute;
  z-index: 0;
  inset-block: 9%;
  inset-inline-end: clamp(16px, 5vw, 64px);
  width: min(36%, 430px);
  border: 1px solid var(--line);
  border-radius: 46% 46% 28px 28px;
  background: url("about-portrait.svg") center 35% / cover no-repeat;
  box-shadow: var(--shadow);
  content: "";
  animation: rise .9s cubic-bezier(.2,.7,.2,1) both;
}
.hero > * {
  position: relative;
  z-index: 1;
  max-width: 56%;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.78rem; color: var(--accent); font-weight: 500;
  margin-bottom: 20px;
}
html[dir="rtl"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: 0.95rem; }

h1 {
  font: 300 clamp(2.8rem, 9vw, 6.5rem)/1.02 var(--serif);
  letter-spacing: -0.02em;
}
h1 span { display: block; }
h1 em {
  display: block; font-style: italic; font-weight: 600; color: var(--accent);
}
html[dir="rtl"] h1 { letter-spacing: 0; line-height: 1.3; }
html[dir="rtl"] h1 em { font-style: normal; font-weight: 700; }

.lede {
  margin-top: 28px; max-width: 54ch;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--muted);
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.btn {
  display: inline-block; padding: 14px 26px; border-radius: 999px;
  font-weight: 500; text-decoration: none; transition: transform .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.primary { background: var(--accent); color: var(--accent-ink); }
.ghost { color: var(--ink); border: 1px solid var(--line); }
.ghost:hover { border-color: var(--accent); }
.btn:focus-visible, .lang:focus-visible, .mark:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}

.about {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(32px, 7vw, 96px);
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px clamp(16px, 5vw, 64px) 80px;
  scroll-margin-top: 24px;
}
.about-portrait {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  line-height: 0;
}
.about-portrait img {
  display: block;
  width: 100%;
  height: auto;
  animation: portraitFloat 7s ease-in-out infinite alternate;
}
.portrait-mark {
  position: absolute;
  inset-inline-end: 20px;
  bottom: 20px;
  display: grid;
  width: 48px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  font: 600 1.3rem var(--serif);
}
.about-copy { max-width: 560px; }
.about-copy h2 {
  font: 600 clamp(2.2rem, 5vw, 4rem)/1.15 var(--serif);
  letter-spacing: -0.02em;
}
.about-text {
  max-width: 48ch;
  margin-top: 12px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.85;
}
html[dir="rtl"] .about-copy h2 { letter-spacing: 0; line-height: 1.4; }

.foot {
  padding: 24px clamp(16px, 5vw, 64px);
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.9rem;
}

/* entrance */
.hero > * { animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
.hero > :nth-child(2) { animation-delay: .08s; }
.hero > :nth-child(3) { animation-delay: .16s; }
.hero > :nth-child(4) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes portraitFloat { from { transform: scale(1); } to { transform: scale(1.025); } }
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .65s ease, transform .65s cubic-bezier(.2,.7,.2,1);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

.content-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px clamp(16px, 5vw, 64px) 64px;
  scroll-margin-top: 24px;
}
.project-grid { display: grid; grid-template-columns: minmax(0, 760px); }
.project-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform .25s ease, border-color .25s ease;
}
.project-cover { position: relative; overflow: hidden; background: var(--ripple); line-height: 0; }
.project-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform .45s ease;
}
.project-content { padding: clamp(20px, 4vw, 32px); }
.project-category { color: var(--accent); font-size: .85rem; font-weight: 500; }
.project-content h3 { margin: 8px 0; font: 600 clamp(1.35rem, 3vw, 1.8rem)/1.3 var(--serif); }
.project-content > p:not(.project-category) { max-width: 58ch; color: var(--muted); }
.project-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding: 0; list-style: none; }
.project-tags li {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .8rem;
}
.certificate-card, .education-note {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 760px;
  padding: clamp(22px, 4vw, 32px);
  border: 1px dashed var(--line);
  border-radius: 22px;
  background: var(--card);
}
.certificate-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  padding: 12px;
  border-radius: 15px;
  background: var(--ripple);
  color: var(--accent);
}
.certificate-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.certificate-card p, .education-note p { color: var(--muted); font-size: 1rem; }
.section-heading { max-width: 620px; margin-bottom: 30px; }
.section-kicker {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.section-heading h2, .contact-panel h2 {
  font: 600 clamp(2rem, 4.5vw, 3.2rem)/1.2 var(--serif);
  letter-spacing: -0.02em;
}
.section-heading > p:last-child, .contact-panel > div:first-child > p:last-child {
  margin-top: 10px;
  color: var(--muted);
  font-size: 1.05rem;
}
html[dir="rtl"] .section-heading h2, html[dir="rtl"] .contact-panel h2 { letter-spacing: 0; line-height: 1.45; }
html[dir="rtl"] .section-kicker { letter-spacing: 0; text-transform: none; font-size: 0.95rem; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}
.feature-card {
  min-height: 180px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  backdrop-filter: blur(6px);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.feature-card h3 {
  margin: 14px 0 6px;
  font: 600 1.25rem/1.35 var(--serif);
}
.feature-card p { color: var(--muted); font-size: 0.95rem; }
.skill-mark {
  display: inline-flex;
  min-width: 48px;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--ripple);
  color: var(--accent);
  font: 600 0.85rem var(--sans);
}
.skill-mark-icon { width: 44px; min-width: 44px; padding: 10px; }
.skill-mark svg, .feature-icon svg, .contact-btn svg, .back-to-top svg {
  width: 100%; height: 100%; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.feature-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 10px;
  border-radius: 13px;
  background: var(--ripple);
  color: var(--accent);
}
.goal-card { position: relative; padding-top: 58px; }
.goal-number { position: absolute; inset-block-start: 22px; inset-inline-start: 24px; color: var(--accent); font: 600 .9rem var(--serif); }
.goal-card h3 { margin-top: 0; }
.contact-section { padding-top: 32px; padding-bottom: 80px; }
.contact-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.contact-panel > div:first-child { max-width: 560px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.contact-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.contact-btn svg { width: 20px; height: 20px; }
.contact-phone {
  display: inline-flex;
  align-items: center;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  text-decoration: none;
  unicode-bidi: isolate;
  transition: border-color .2s, color .2s;
}
.contact-phone:hover { border-color: var(--accent); color: var(--accent); }
.back-to-top {
  position: fixed;
  z-index: 5;
  inset-inline-end: 24px;
  bottom: 24px;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
  transition: transform .2s, opacity .2s;
}
.back-to-top:hover { transform: translateY(-3px); }
.back-to-top svg { width: 22px; height: 22px; }
.back-to-top[hidden] { display: none; }

@media (hover: hover) {
  .feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
  }
  .project-card:hover { transform: translateY(-4px); border-color: var(--accent); }
  .project-card:hover .project-cover img { transform: scale(1.025); }
}
@media (max-width: 900px) {
  .top { flex-wrap: wrap; }
  .site-nav { order: 3; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; padding: 4px 0 8px; }
  .top-actions { margin-inline-start: auto; }
  .contact-panel { align-items: flex-start; flex-direction: column; }
  .hero::after { width: 34%; }
}
@media (max-width: 700px) {
  .hero { min-height: 0; padding-top: 56px; padding-bottom: 52px; }
  .hero::after { display: none; }
  .hero > * { max-width: 100%; }
  .about {
    grid-template-columns: 1fr;
    gap: 30px;
    padding-top: 24px;
    padding-bottom: 56px;
  }
  .about-portrait { max-width: 440px; }
  .about-text { margin-top: 14px; }
  .content-section { padding-top: 36px; padding-bottom: 48px; }
  .education-note { align-items: flex-start; }
  .contact-section { padding-bottom: 56px; }
  .back-to-top { inset-inline-end: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero > *, .about-portrait img, .reveal { animation: none; transition: none; }
  .reveal { opacity: 1; transform: none; }
}
