:root {
  --bg: #0e1220;
  --bg2: #141a2e;
  --card: #171f36;
  --card-hover: #1e2846;
  --border: #283456;
  --text: #f5f1e8;
  --muted: #9aa7c0;
  --amber: #f0b35c;
  --teal: #43c6b8;
  --violet: #8b7cf0;
  --rose: #ef7fa8;
  --grad-brand: linear-gradient(92deg, var(--amber), var(--rose) 48%, var(--violet));
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Tajawal', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
body.en { font-family: 'Inter', 'Tajawal', sans-serif; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14,18,32,.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
}
.brand {
  font-weight: 800; font-size: 17px;
  background: var(--grad-brand);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 14.5px; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.lang-toggle {
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: border-color .2s, transform .2s;
}
.lang-toggle:hover { border-color: var(--amber); transform: translateY(-1px); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 84px 20px 70px;
  overflow: hidden;
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: .5; pointer-events: none;
}
.orb-a { width: 340px; height: 340px; background: rgba(240,179,92,.28); top: -120px; inset-inline-start: 8%; animation: drift1 14s ease-in-out infinite; }
.orb-b { width: 300px; height: 300px; background: rgba(139,124,240,.26); top: -60px; inset-inline-end: 6%; animation: drift2 17s ease-in-out infinite; }
.orb-c { width: 220px; height: 220px; background: rgba(67,198,184,.2); top: 160px; inset-inline-start: 38%; animation: drift3 20s ease-in-out infinite; }
@keyframes drift1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(40px,30px); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-46px,24px); } }
@keyframes drift3 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(24px,-28px); } }

.hero-avatar {
  width: 132px; height: 132px; border-radius: 50%;
  padding: 4px; object-fit: cover; position: relative;
  border: 3px solid transparent;
  background: var(--grad-brand) border-box;
  box-shadow: 0 14px 48px rgba(0,0,0,.5);
  animation: pop-in .7s cubic-bezier(.2,.9,.3,1.3) both, float-y 5s ease-in-out 1s infinite;
}
@keyframes pop-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes float-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.hero-name {
  font-size: 36px; font-weight: 800; margin-top: 24px; letter-spacing: .2px;
  animation: rise .6s .15s ease both;
}
.hero-tag {
  font-weight: 700; font-size: 16.5px; margin-top: 8px; letter-spacing: .8px;
  background: var(--grad-brand);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: rise .6s .3s ease both;
}
.hero-bio { color: var(--muted); font-size: 16.5px; line-height: 1.9; max-width: 500px; margin: 16px auto 0; animation: rise .6s .45s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.hero-cta { margin-top: 32px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; animation: rise .6s .6s ease both; }
.btn {
  position: relative; overflow: hidden;
  display: inline-block; text-decoration: none;
  padding: 13px 28px; border-radius: 14px;
  font-size: 15px; font-weight: 700;
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-3px); }
.btn-primary {
  background: linear-gradient(92deg, var(--amber), var(--rose));
  color: #201204;
  box-shadow: 0 8px 26px rgba(240,179,92,.35);
}
.btn-primary:hover { box-shadow: 0 12px 34px rgba(240,179,92,.5); }
.btn-primary::after {
  content: ''; position: absolute; top: 0; height: 100%; width: 40%;
  inset-inline-start: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent);
  transform: skewX(-20deg);
  animation: shine 3.4s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { inset-inline-start: -60%; } 100% { inset-inline-start: 130%; } }
.btn-ghost { border: 1px solid var(--border); color: var(--text); background: var(--card); }
.btn-ghost:hover { border-color: var(--violet); box-shadow: 0 8px 24px rgba(139,124,240,.25); }

/* ---------- Sections & reveal ---------- */
.section { max-width: 960px; margin: 0 auto; padding: 56px 20px 8px; }
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

.section-title { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.section-title::after {
  content: ''; height: 4px; width: 64px; border-radius: 2px;
  background: var(--grad-brand);
}
.section-sub { color: var(--muted); font-size: 14.5px; margin-top: 10px; }

.tools-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 6px;
  transition: transform .22s ease, background .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.tool-card:hover {
  background: var(--card-hover);
  border-color: var(--amber);
  transform: translateY(-5px);
  box-shadow: 0 14px 34px rgba(0,0,0,.35), 0 0 0 1px rgba(240,179,92,.25);
}
.tool-card:nth-child(3n+2):hover { border-color: var(--teal); box-shadow: 0 14px 34px rgba(0,0,0,.35), 0 0 0 1px rgba(67,198,184,.25); }
.tool-card:nth-child(3n):hover { border-color: var(--violet); box-shadow: 0 14px 34px rgba(0,0,0,.35), 0 0 0 1px rgba(139,124,240,.25); }
.tool-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; background: var(--bg2); border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: transform .25s ease;
}
.tool-card:hover .tool-icon { transform: scale(1.12) rotate(-4deg); }
.tool-name { font-size: 16px; font-weight: 700; }
.tool-badge {
  display: inline-block; vertical-align: middle;
  font-size: 10.5px; font-weight: 700; color: var(--teal);
  border: 1px solid var(--teal); border-radius: 6px;
  padding: 0 6px; margin-inline-start: 6px;
}
.tool-desc { font-size: 13px; color: var(--muted); line-height: 1.7; flex: 1; }
.tool-open { font-size: 12.5px; color: var(--amber); font-weight: 600; margin-top: 8px; }
.more-note { margin-top: 16px; color: var(--teal); font-size: 13.5px; }

.about-card {
  margin-top: 22px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 26px;
  font-size: 15.5px; line-height: 2; color: #cfd6e4;
}

.contact-cards { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contact-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 20px 22px;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .2s, background .2s, transform .2s;
}
.contact-card:hover { border-color: var(--rose); background: var(--card-hover); transform: translateY(-3px); }
.contact-name { font-weight: 700; font-size: 15.5px; }
.contact-handle { color: var(--muted); font-size: 13px; }
.contact-note { color: var(--muted); font-size: 13.5px; margin-top: 16px; }

.footer {
  margin-top: 72px;
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 26px 20px;
  color: #5d6880; font-size: 12.5px;
}

/* ---------- AI chat widget ---------- */
.chat-fab {
  position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 30;
  width: 58px; height: 58px; border-radius: 50%;
  border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--violet), var(--rose));
  color: #fff; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(139,124,240,.45);
  transition: transform .2s;
  animation: fab-pulse 3s ease-in-out infinite;
}
.chat-fab:hover { transform: scale(1.08); }
@keyframes fab-pulse {
  0%,100% { box-shadow: 0 10px 30px rgba(139,124,240,.45), 0 0 0 0 rgba(139,124,240,.4); }
  50% { box-shadow: 0 10px 30px rgba(139,124,240,.45), 0 0 0 12px rgba(139,124,240,0); }
}
.chat-panel {
  position: fixed; bottom: 92px; inset-inline-end: 22px; z-index: 30;
  width: min(360px, calc(100vw - 44px));
  height: 440px; max-height: calc(100vh - 130px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(16px) scale(.96);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.chat-head {
  padding: 14px 16px;
  background: linear-gradient(92deg, rgba(139,124,240,.2), rgba(239,127,168,.18));
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.chat-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.chat-head b { font-size: 14.5px; }
.chat-head span { font-size: 11.5px; color: var(--muted); display: block; }
.chat-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 84%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.7; animation: rise .3s ease both; }
.chat-msg.bot { background: var(--card); border: 1px solid var(--border); align-self: flex-start; border-start-start-radius: 4px; }
.chat-msg.me { background: linear-gradient(92deg, var(--violet), var(--rose)); color: #fff; align-self: flex-end; border-start-end-radius: 4px; }
.chat-msg.typing { color: var(--muted); font-style: italic; }
.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input-row input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 13px; color: var(--text); font-size: 13.5px; font-family: inherit;
}
.chat-input-row input:focus { outline: none; border-color: var(--violet); }
.chat-input-row button {
  background: linear-gradient(92deg, var(--violet), var(--rose)); color: #fff;
  border: none; border-radius: 11px; padding: 0 16px; font-size: 16px; cursor: pointer;
  font-family: inherit;
}
.chat-input-row button:disabled { opacity: .5; cursor: wait; }

@media (max-width: 560px) {
  .hero-name { font-size: 28px; }
  .contact-cards { grid-template-columns: 1fr; }
  .nav-links { gap: 13px; }
  .nav-links a { font-size: 13.5px; }
}

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