/* ============================================================
   Ahmed Elbashaar — Portfolio
   Plain-CSS port of the Claude Design system + page styles.
   Shared by index.html (EN) and ar.html (AR).
   ============================================================ */

/* ===================== TOKENS ===================== */

:root {
  /* ---- Brand blue scale ---- */
  --blue-50:  #eef3ff;
  --blue-100: #dce6ff;
  --blue-200: #bccfff;
  --blue-300: #92afff;
  --blue-400: #5f86fb;
  --blue-500: #3b66f5;
  --blue-600: #2450e0;   /* primary */
  --blue-700: #1c3fbe;
  --blue-800: #1c3799;
  --blue-900: #1c3379;
  --blue-950: #141f4a;

  /* ---- Cool neutral scale ---- */
  --gray-0:   #ffffff;
  --gray-50:  #f5f7fa;
  --gray-100: #eef1f6;
  --gray-200: #e2e7ee;
  --gray-300: #cdd4df;
  --gray-400: #9aa4b4;
  --gray-500: #6b7688;
  --gray-600: #4d5768;
  --gray-700: #364052;
  --gray-800: #232a38;
  --gray-900: #171a21;
  --gray-950: #0f1116;

  /* ---- Semantic hues ---- */
  --green-100: #d7f4e3;
  --green-500: #12a150;
  --green-600: #0e8a44;
  --amber-100: #fdeecb;
  --amber-500: #e0940a;
  --amber-600: #bd7b06;
  --red-100:   #fde3e4;
  --red-500:   #e0454a;
  --red-600:   #c8353a;

  /* ============ Semantic aliases (LIGHT) ============ */
  --brand:            var(--blue-600);
  --brand-hover:      var(--blue-700);
  --brand-active:     var(--blue-800);
  --brand-subtle:     var(--blue-50);
  --brand-subtle-fg:  var(--blue-700);
  --brand-ring:       color-mix(in oklab, var(--blue-600) 40%, transparent);

  --bg:               var(--gray-50);
  --bg-elevated:      var(--gray-0);
  --surface-card:     var(--gray-0);
  --surface-sunken:   var(--gray-100);
  --surface-hover:    var(--gray-100);

  --text-strong:      var(--gray-900);
  --text-body:        var(--gray-700);
  --text-muted:       var(--gray-500);
  --text-faint:       var(--gray-400);
  --text-on-brand:    #ffffff;

  --border:           var(--gray-200);
  --border-strong:    var(--gray-300);
  --border-focus:     var(--blue-600);

  --success:          var(--green-600);
  --success-subtle:   var(--green-100);
  --warning:          var(--amber-600);
  --warning-subtle:   var(--amber-100);
  --danger:           var(--red-600);
  --danger-subtle:    var(--red-100);

  /* ---- Typography ---- */
  --font-display: "Space Grotesk", "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-sans:    "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;
  --text-3xl:  2.25rem;
  --text-4xl:  3rem;
  --text-5xl:  4rem;

  --leading-tight:   1.1;
  --leading-snug:    1.25;
  --leading-normal:  1.5;
  --leading-relaxed: 1.7;

  --tracking-tight:  -0.02em;
  --tracking-snug:   -0.01em;
  --tracking-normal: 0em;
  --tracking-wide:   0.04em;
  --tracking-caps:   0.08em;

  /* ---- Spacing ---- */
  --space-0:  0;
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  --container-lg: 1080px;

  /* ---- Radii ---- */
  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-2xl:  28px;
  --radius-full: 999px;

  /* ---- Shadows ---- */
  --shadow-xs:  0 1px 2px rgba(23, 26, 33, 0.06);
  --shadow-sm:  0 1px 3px rgba(23, 26, 33, 0.08), 0 1px 2px rgba(23, 26, 33, 0.04);
  --shadow-md:  0 4px 12px rgba(23, 26, 33, 0.08), 0 2px 4px rgba(23, 26, 33, 0.05);
  --shadow-lg:  0 12px 28px rgba(23, 26, 33, 0.12), 0 4px 10px rgba(23, 26, 33, 0.06);
  --shadow-xl:  0 24px 56px rgba(23, 26, 33, 0.16), 0 8px 18px rgba(23, 26, 33, 0.08);
  --shadow-brand: 0 6px 18px color-mix(in oklab, var(--blue-600) 28%, transparent);
  --ring:        0 0 0 3px var(--brand-ring);

  /* ---- Motion ---- */
  --dur-instant: 80ms;
  --dur-fast:    140ms;
  --dur-base:    220ms;
  --dur-slow:    360ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.65, 0, 0.35, 1);
}

/* ============ Semantic aliases (DARK) ============ */
[data-theme="dark"] {
  --brand:            var(--blue-500);
  --brand-hover:      var(--blue-400);
  --brand-active:     var(--blue-300);
  --brand-subtle:     color-mix(in oklab, var(--blue-500) 16%, var(--gray-900));
  --brand-subtle-fg:  var(--blue-300);
  --brand-ring:       color-mix(in oklab, var(--blue-500) 50%, transparent);

  --bg:               var(--gray-900);
  --bg-elevated:      var(--gray-800);
  --surface-card:     #1c212b;
  --surface-sunken:   var(--gray-950);
  --surface-hover:    color-mix(in oklab, var(--gray-0) 6%, var(--gray-800));

  --text-strong:      #f3f5f9;
  --text-body:        #c4ccd8;
  --text-muted:       #8b95a6;
  --text-faint:       #616b7d;
  --text-on-brand:    #ffffff;

  --border:           color-mix(in oklab, var(--gray-0) 10%, var(--gray-800));
  --border-strong:    color-mix(in oklab, var(--gray-0) 18%, var(--gray-800));
  --border-focus:     var(--blue-400);

  --success:          #35c46e;
  --success-subtle:   color-mix(in oklab, var(--green-500) 20%, var(--gray-900));
  --warning:          #f0ad33;
  --warning-subtle:   color-mix(in oklab, var(--amber-500) 20%, var(--gray-900));
  --danger:           #f26569;
  --danger-subtle:    color-mix(in oklab, var(--red-500) 22%, var(--gray-900));

  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.35);
  --shadow-lg:  0 12px 28px rgba(0, 0, 0, 0.55), 0 4px 10px rgba(0, 0, 0, 0.4);
  --shadow-xl:  0 24px 56px rgba(0, 0, 0, 0.6), 0 8px 18px rgba(0, 0, 0, 0.45);
  --shadow-brand: 0 6px 20px color-mix(in oklab, var(--blue-500) 40%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-instant: 0ms;
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
  }
}

/* ===================== BASE ===================== */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--text-strong);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}

code, kbd, pre, samp { font-family: var(--font-mono); }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

::selection { background: color-mix(in oklab, var(--brand) 24%, transparent); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* Arabic typography */
html[lang="ar"] {
  --font-sans: "Cairo", "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Cairo", "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --tracking-tight: 0em;
  --tracking-snug: 0em;
}

/* ===================== COMPONENTS ===================== */

/* ---- Button ---- */
.aeb-btn {
  --_h: 40px; --_px: 16px; --_fs: var(--text-sm);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); height: var(--_h); padding: 0 var(--_px);
  font-family: var(--font-sans); font-size: var(--_fs); font-weight: var(--fw-semibold);
  line-height: 1; letter-spacing: var(--tracking-snug);
  border: 1px solid transparent; border-radius: var(--radius-md);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              transform var(--dur-instant) var(--ease-standard);
}
.aeb-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.aeb-btn:active:not(:disabled) { transform: translateY(0.5px) scale(0.99); }
.aeb-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.aeb-btn--sm { --_h: 32px; --_px: 12px; --_fs: var(--text-xs); }
.aeb-btn--lg { --_h: 48px; --_px: 22px; --_fs: var(--text-base); }
.aeb-btn--block { display: flex; width: 100%; }
.aeb-btn--primary { background: var(--brand); color: var(--text-on-brand); box-shadow: var(--shadow-brand); }
.aeb-btn--primary:hover:not(:disabled) { background: var(--brand-hover); color: var(--text-on-brand); }
.aeb-btn--primary:active:not(:disabled) { background: var(--brand-active); }
.aeb-btn--secondary { background: var(--surface-card); color: var(--text-strong); border-color: var(--border-strong); }
.aeb-btn--secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--gray-400); color: var(--text-strong); }
.aeb-btn--ghost { background: transparent; color: var(--text-body); }
.aeb-btn--ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text-strong); }
.aeb-btn svg { width: 1.15em; height: 1.15em; flex: none; }

/* ---- IconButton ---- */
.aeb-iconbtn {
  --_s: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--_s); height: var(--_s); padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-md);
  color: var(--text-body); background: transparent; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}
.aeb-iconbtn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text-strong); }
.aeb-iconbtn:focus-visible { outline: none; box-shadow: var(--ring); }
.aeb-iconbtn:active:not(:disabled) { transform: scale(0.94); }
.aeb-iconbtn svg { width: 1.2em; height: 1.2em; }

/* ---- Avatar ---- */
.aeb-avatar {
  --_s: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--_s); height: var(--_s); border-radius: var(--radius-full);
  overflow: hidden; flex: none; font-family: var(--font-display);
  font-weight: var(--fw-semibold); font-size: calc(var(--_s) * 0.4);
  color: var(--brand-subtle-fg); background: var(--brand-subtle);
  letter-spacing: 0; user-select: none;
}
.aeb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.aeb-avatar--sm { --_s: 28px; }
.aeb-avatar--xl { --_s: 88px; }
.aeb-avatar--ring { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand); }

/* ---- Badge ---- */
.aeb-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; font-family: var(--font-sans);
  font-size: var(--text-xs); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-snug); border-radius: var(--radius-full);
  white-space: nowrap; border: 1px solid transparent;
}
.aeb-badge--dot::before { content:""; width:6px; height:6px; border-radius:999px; background: currentColor; }
.aeb-badge--success { background: var(--success-subtle); color: var(--success); }

/* ---- Tag ---- */
.aeb-tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; font-family: var(--font-mono);
  font-size: var(--text-xs); font-weight: var(--fw-medium); color: var(--text-body);
  background: var(--surface-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); white-space: nowrap;
}
.aeb-tag--brand { color: var(--brand-subtle-fg); background: var(--brand-subtle); border-color: transparent; }

/* ---- Alert ---- */
.aeb-alert {
  display: flex; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-card); font-family: var(--font-sans);
  border-left-width: 3px;
}
.aeb-alert__icon { flex: none; margin-top: 1px; }
.aeb-alert__icon svg { width: 18px; height: 18px; }
.aeb-alert__body { display: flex; flex-direction: column; gap: 2px; }
.aeb-alert__title { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.aeb-alert__msg { font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-normal); }
.aeb-alert--success { border-left-color: var(--success); }
.aeb-alert--success .aeb-alert__icon { color: var(--success); }
[dir="rtl"] .aeb-alert { border-left-width: 1px; border-right-width: 3px; }
[dir="rtl"] .aeb-alert--success { border-right-color: var(--success); }

/* ---- Fields: Input / Textarea ---- */
.aeb-field { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-sans); }
.aeb-field__label { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-strong); }
.aeb-field__hint { font-size: var(--text-xs); color: var(--text-muted); }
.aeb-field__hint--error { color: var(--danger); }

.aeb-input, .aeb-textarea {
  width: 100%; font-family: var(--font-sans); font-size: var(--text-sm);
  color: var(--text-strong); background: var(--surface-card);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}
.aeb-input { height: 40px; padding: 0 12px; }
.aeb-textarea { padding: 10px 12px; min-height: 96px; resize: vertical; line-height: var(--leading-normal); }
.aeb-input::placeholder, .aeb-textarea::placeholder { color: var(--text-faint); }
.aeb-input:hover, .aeb-textarea:hover { border-color: var(--gray-400); }
.aeb-input:focus, .aeb-textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--ring); }
.aeb-input--error, .aeb-textarea--error { border-color: var(--danger); }
.aeb-input--error:focus, .aeb-textarea--error:focus { box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 30%, transparent); }

/* ---- Select ---- */
.aeb-select-wrap { position: relative; display: inline-flex; width: 100%; }
.aeb-select {
  appearance: none; width: 100%; height: 40px; padding: 0 38px 0 12px;
  font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-strong);
  background: var(--surface-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.aeb-select:hover { border-color: var(--gray-400); }
.aeb-select:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--ring); }
.aeb-select-wrap__chev {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; pointer-events: none; color: var(--text-muted);
}
[dir="rtl"] .aeb-select { padding: 0 12px 0 38px; }
[dir="rtl"] .aeb-select-wrap__chev { right: auto; left: 12px; }

/* ===================== PAGE HELPERS ===================== */

/* hover states ported from the design's style-hover attributes */
.nav-link:hover { color: var(--text-strong) !important; }
.lift-card { transition: box-shadow var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-out); }
.lift-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.lift-card-lg { transition: box-shadow var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-out); }
.lift-card-lg:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.proj-link:hover, .proj-link:hover h3 { color: var(--brand); }
.contact-link:hover { background: var(--surface-hover); color: var(--text-strong) !important; }
.social-btn:hover { border-color: var(--border-strong); color: var(--text-strong) !important; }
.footer-social:hover { background: var(--surface-hover); color: var(--text-strong) !important; }

/* ---- Alternating section bands ----
   Every other content section sits on the sunken surface with hairline
   borders. This is driven by the section's position (nth-of-type), not
   hard-coded per section, so adding or removing a section — e.g. disabling
   the testimonials — keeps the bg / sunken rhythm intact automatically.
   All page sections carry the .r-sect class, so they count 1..N in order:
   hero(1)=bg, services(2)=sunken, work(3)=bg, about(4)=sunken, … */
.r-sect:nth-of-type(even) {
  background: var(--surface-sunken);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Language switch */
.lang-btn {
  appearance: none; border: none; cursor: pointer; text-decoration: none;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; line-height: 1;
  min-width: 26px; height: 24px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
  background: transparent; color: var(--text-muted);
}
.lang-btn:hover { color: var(--text-strong); }
.lang-btn.is-active { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.lang-btn.is-active:hover { color: #fff; }

/* ===================== RESPONSIVE ===================== */

/* Tablet / small laptop */
@media (max-width: 900px) {
  .r-sect { padding-left: 20px !important; padding-right: 20px !important; }
  .r-hero { grid-template-columns: 1fr !important; gap: 40px !important; }
  .r-hero-visual { order: 2; }
  .r-2col { grid-template-columns: 1fr !important; gap: 40px !important; }
  .r-grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
  .r-navlinks { display: none !important; }
}
/* Phone */
@media (max-width: 560px) {
  .r-pad-y { padding-top: 64px !important; padding-bottom: 64px !important; }
  .r-hero-pad { padding-top: 56px !important; padding-bottom: 52px !important; }
  .r-grid-3 { grid-template-columns: 1fr !important; }
  .r-stats { grid-template-columns: repeat(3, 1fr) !important; gap: 10px !important; }
  .r-form2 { grid-template-columns: 1fr !important; }
  .r-cta-label { display: none; }
  .r-footer { flex-direction: column !important; align-items: flex-start !important; gap: 16px !important; }
  .r-h2 { font-size: var(--text-2xl) !important; }
}
