:root {
  --bg: #0b1220;
  --bg-alt: #0f1829;
  --surface: #131d31;
  --border: #22314d;
  --text: #e8eefb;
  --muted: #b3c4de;
  --accent: #39d3bb;
  --accent-ink: #5fe3cd;
  --accent-2: #5b8cff;
  --danger: #ff9b9b;
  --shadow: 0 18px 40px rgba(0, 0, 0, .35);
  --radius: 16px;
}

html[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-alt: #eef2f9;
  --surface: #ffffff;
  --border: #dde5f1;
  --text: #121a2b;
  --muted: #44556f;
  --accent: #0ea68f;
  --accent-ink: #0a6657;
  --accent-2: #3760d8;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(16, 30, 60, .10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

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

.skip {
  position: absolute;
  inset-inline-start: -9999px;
  top: .5rem;
  background: var(--accent);
  color: #04221d;
  padding: .5rem 1rem;
  border-radius: 10px;
  z-index: 50;
}
.skip:focus { inset-inline-start: 1rem; }

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-weight: 700; text-decoration: none; white-space: nowrap;
  color: var(--text); background: var(--bg);
}
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 11px; color: #04221d; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: none;
}
.nav { display: flex; gap: 1.1rem; margin-inline-start: auto; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--text); font-size: .95rem;
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: .25rem;
}
.nav a:hover, .nav a:focus-visible { color: var(--text); }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 1.05rem; line-height: 1;
  display: grid; place-items: center;
  transition: transform .15s ease, border-color .15s ease;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.spin span { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* hero */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0; position: relative; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(60% 70% at 85% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(50% 60% at 10% 20%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 70%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
.eyebrow { color: var(--accent-ink); margin: 0 0 .25rem; font-weight: 600; letter-spacing: .02em; }
.hero h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.25; }
.role { margin: .4rem 0 1rem; color: var(--accent-2); font-weight: 600; font-size: clamp(1rem, 3vw, 1.25rem); }
.lede { margin: 0 0 1.6rem; color: var(--muted); max-width: 52ch; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; padding: .7rem 1.4rem; border-radius: 999px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04221d; }
html[data-theme="light"] .btn-primary { color: #fff; }
.btn-ghost { border-color: var(--border); background: var(--surface); color: var(--text); }
.btn-sm { padding: .45rem 1rem; font-size: .9rem; }
.btn[disabled] { opacity: .65; cursor: progress; }

.hero-card { position: relative; display: grid; place-items: center; min-height: 220px; }
.avatar {
  width: clamp(140px, 36vw, 200px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04221d; font-size: clamp(3.5rem, 10vw, 5rem); font-weight: 700;
  box-shadow: var(--shadow); position: relative; z-index: 2;
}
html[data-theme="light"] .avatar { color: #fff; }
.orb { position: absolute; border-radius: 50%; filter: blur(28px); opacity: .5; }
.orb-1 { width: 150px; height: 150px; background: var(--accent); inset-block-start: -10px; inset-inline-end: 0; }
.orb-2 { width: 130px; height: 130px; background: var(--accent-2); inset-block-end: 0; inset-inline-start: 10px; }

/* sections */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; scroll-margin-top: 80px; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-title { font-size: clamp(1.4rem, 4vw, 2rem); margin: 0 0 .25rem; }
.section-sub { color: var(--muted); margin: 0 0 1.5rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-head .section-title { margin: 0; }

.about-grid { display: grid; grid-template-columns: 1.4fr .9fr; gap: 1.5rem; align-items: start; margin-top: 1rem; }
.about-text { margin: 0; color: var(--muted); font-size: 1.03rem; }
.facts { list-style: none; margin: 0; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.facts li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.facts li:last-child { border-bottom: 0; }
.facts-label { color: var(--muted); font-size: .92rem; }
.chip { padding: .15rem .7rem; border-radius: 999px; font-size: .85rem; }
.chip-ok { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-ink); font-weight: 600; }

.skills { list-style: none; display: flex; flex-wrap: wrap; gap: .6rem; padding: 0; margin: 1rem 0 0; }
.skills li {
  padding: .5rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: .95rem;
}

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
  display: flex; flex-direction: column; gap: .6rem; min-width: 0;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.card h3 { margin: 0; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; }
.card-tags span { font-size: .8rem; color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: .1rem .6rem; border-radius: 999px; }

.skeleton span {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--border), color-mix(in srgb, var(--border) 40%, transparent), var(--border));
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
.skeleton span:first-child { height: 18px; width: 60%; }
.skeleton span:nth-child(2) { width: 100%; }
.skeleton span:nth-child(3) { width: 80%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty, .error-box {
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 1.5rem; text-align: center; color: var(--muted);
}
.empty p, .error-box p { margin: 0 0 .75rem; }
.error-box p { color: var(--danger); }

.status { min-height: 1.4rem; margin: .5rem 0 0; font-size: .92rem; color: var(--muted); }
.status.ok { color: var(--accent-ink); }
.status.bad { color: var(--danger); }

/* form */
.contact-wrap { max-width: 620px; }
.form { display: grid; gap: 1rem; margin-top: 1rem; }
.field { display: grid; gap: .4rem; }
.field label { font-size: .93rem; color: var(--muted); }
input, textarea {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: .75rem .9rem; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
textarea { resize: vertical; min-height: 120px; }
.form .btn { justify-self: start; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* footer */
.site-footer { border-top: 1px solid var(--border); padding: 1.6rem 0; background: var(--bg); }
.footer-inner { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; align-items: center; }
.site-footer p { margin: 0; font-size: .9rem; }
.muted { color: var(--muted); }

@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-card { order: -1; min-height: 0; }
  .about-grid { grid-template-columns: 1fr; }
  .nav { gap: .85rem; font-size: .9rem; }
  .brand span:not(.brand-mark) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
