:root {
      --red: #8b0000;
      --red-bright: #c0392b;
      --red-glow: rgba(139,0,0,0.7);
      --white: #f5f0eb;
      --black: #0a0a0a;
      --gray: #888;
      --card-bg-dark: #111;
      --card-bg-light: #ede8e2;
    }

    [data-theme="dark"] {
      --bg: #0a0a0a;
      --surface: #111111;
      --text: #f5f0eb;
      --text-muted: #777;
      --border: rgba(255,255,255,0.06);
      --nav-bg: rgba(10,10,10,0.85);
    }
    [data-theme="light"] {
      --bg: #f5f0eb;
      --surface: #ede8e0;
      --text: #0a0a0a;
      --text-muted: #555;
      --border: rgba(0,0,0,0.08);
      --nav-bg: rgba(245,240,235,0.88);
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html { scroll-behavior: smooth; }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'Cormorant Garamond', Georgia, serif;
      transition: background 0.4s, color 0.4s;
      overflow-x: hidden;
    }

    /* NAV (FIXED LAYOUT - IMMUNE TO RTL/LANGUAGE CHANGES) */
    nav {
      position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      background: var(--nav-bg);
      backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--border);
      transition: background 0.4s;
    }
    /* Desktop nav links - always absolutely centered */
    .nav-links {
      display: flex; gap: 2.5rem; list-style: none;
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      margin: 0;
      direction: ltr;
    }
    /* Hamburger button (mobile only) */
    .hamburger {
      background: none; border: none;
      font-size: 1.8rem;
      cursor: pointer;
      color: var(--text);
      display: none;
      line-height: 1;
      padding: 0;
      width: 36px;
      height: 36px;
      align-items: center;
      justify-content: center;
      transition: transform 0.2s;
      position: absolute;
      left: 1.2rem;
      z-index: 1002;
    }
    .hamburger:hover { color: var(--red-bright); }
    
    /* Nav controls - always fixed to the right edge of nav */
    .nav-controls {
      display: flex;
      gap: 1rem;
      align-items: center;
      direction: ltr;
      flex-direction: row;
      position: absolute;
      right: 2rem;
    }
    /* Prevent RTL from flipping anything in nav */
    [dir="rtl"] .nav-controls {
      flex-direction: row;
      direction: ltr;
      right: 2rem;
      left: auto;
    }
    [dir="rtl"] .nav-links {
      direction: ltr;
    }
    /* Hero wordmark: never reversed */
    [dir="rtl"] .wordmark {
      direction: ltr;
      flex-direction: row;
    }

    .nav-links a {
      font-family: 'Bebas Neue', sans-serif;
      font-size: 0.85rem;
      letter-spacing: 0.15em;
      color: var(--text-muted);
      text-decoration: none;
      transition: color 0.2s;
    }
    .nav-links a:hover { color: var(--red-bright); }

    .toggle-btn {
      background: none; border: 1px solid var(--border);
      color: var(--text-muted); cursor: pointer;
      padding: 0.3rem 0.7rem; border-radius: 3px;
      font-family: 'Bebas Neue', sans-serif;
      font-size: 0.75rem; letter-spacing: 0.1em;
      transition: all 0.2s;
    }
    .toggle-btn:hover { border-color: var(--red); color: var(--red); }

    /* MOBILE SIDEBAR (OVERLAY) */
    .mobile-sidebar {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: var(--bg);
      backdrop-filter: blur(20px);
      z-index: 998;
      transform: translateX(-100%);
      transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 2rem;
      visibility: hidden;
    }
    .mobile-sidebar.open {
      transform: translateX(0);
      visibility: visible;
    }
    .sidebar-links {
      list-style: none;
      text-align: center;
      display: flex;
      flex-direction: column;
      gap: 2rem;
    }
    .sidebar-links a {
      font-family: 'Bebas Neue', sans-serif;
      font-size: 2rem;
      letter-spacing: 0.1em;
      color: var(--text);
      text-decoration: none;
      transition: color 0.2s;
    }
    .sidebar-links a:hover { color: var(--red-bright); }
    .sidebar-close-overlay {
      position: absolute;
      inset: 0;
      z-index: -1;
    }
    /* prevent body scroll when sidebar open */
    body.sidebar-open {
      overflow: hidden;
    }

    /* Responsive */
    @media (max-width: 768px) {
      nav {
        padding: 0;
      }
      .hamburger {
        display: flex;
      }
      .nav-links {
        display: none;
      }
      .nav-controls {
        gap: 0.8rem;
        right: 1.2rem;
      }
    }
    @media (min-width: 769px) {
      .hamburger {
        display: none;
      }
      .mobile-sidebar {
        display: none;
      }
    }

    /* HERO, SECTIONS, REMAIN SAME (existing styles untouched) */
    #hero {
      min-height: 100vh;
      display: flex; flex-direction: column;
      justify-content: center; align-items: center;
      text-align: center;
      padding: 0 8vw;
      position: relative; overflow: hidden;
    }

    .hero-bg-text {
      position: absolute;
      bottom: -0.1em; right: -0.05em;
      font-family: 'Bebas Neue', sans-serif;
      font-size: 28vw;
      color: transparent;
      -webkit-text-stroke: 1px rgba(139,0,0,0.08);
      user-select: none; pointer-events: none;
      line-height: 1;
    }

    .wordmark {
      font-family: 'Bebas Neue', sans-serif;
      font-size: clamp(4rem, 12vw, 10rem);
      letter-spacing: 0.04em;
      line-height: 1;
      position: relative; z-index: 1;
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 0;
    }

    .wordmark-logo {
      /* Match the cap-height of the surrounding text exactly */
      width: 1em;
      height: 1em;
      position: relative;
      bottom: 6px;
      display: inline-flex; align-items: center; justify-content: center;
      margin: 0 0.01em;
      vertical-align: middle;
    }

    .wordmark-logo svg {
      width: 100%; height: 100%;
      overflow: visible;
    }

    .hero-tagline {
      font-size: clamp(1rem, 2vw, 1.4rem);
      font-style: italic;
      color: var(--text-muted);
      margin-top: 1.5rem;
      letter-spacing: 0.02em;
      position: relative; z-index: 1;
    }

    .hero-cta {
      margin-top: 2.5rem;
      display: flex; gap: 1rem; position: relative; z-index: 1;
    }
    .btn-primary {
      background: var(--red);
      color: var(--white);
      border: none; cursor: pointer;
      font-family: 'Bebas Neue', sans-serif;
      font-size: 1rem; letter-spacing: 0.15em;
      padding: 0.85rem 2.2rem;
      transition: background 0.2s, transform 0.15s;
      text-decoration: none;
    }
    .btn-primary:hover { background: var(--red-bright); transform: translateY(-2px); }
    .btn-outline {
      background: none;
      color: var(--text);
      border: 1px solid var(--border);
      cursor: pointer;
      font-family: 'Bebas Neue', sans-serif;
      font-size: 1rem; letter-spacing: 0.15em;
      padding: 0.85rem 2.2rem;
      transition: border-color 0.2s, color 0.2s, transform 0.15s;
      text-decoration: none;
    }
    .btn-outline:hover { border-color: var(--red); color: var(--red); transform: translateY(-2px); }

    section { padding: 7rem 8vw; }
    .section-label {
      font-family: 'Bebas Neue', sans-serif;
      font-size: 0.75rem;
      letter-spacing: 0.3em;
      color: var(--red);
      margin-bottom: 1rem;
    }
    .section-title {
      font-family: 'Bebas Neue', sans-serif;
      font-size: clamp(2.5rem, 6vw, 5rem);
      letter-spacing: 0.03em;
      line-height: 1;
      margin-bottom: 3rem;
    }

    #work { background: var(--surface); }
    .work-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
      gap: 1.5rem;
    }
    .work-item {
      position: relative;
      aspect-ratio: 4/3;
      overflow: hidden;
      cursor: pointer;
      background: #111;
    }
    .ba-container {
      position: relative; width: 100%; height: 100%;
      user-select: none;
    }
    .ba-after, .ba-before {
      position: absolute; inset: 0;
      background-size: contain;
      background-position: center;
      background-repeat: no-repeat;
    }
    .ba-before img,
    .ba-after img {
      width: 100%; height: 100%;
      object-fit: contain;
      object-position: center;
      display: block;
      pointer-events: none;
      user-select: none;
    }
    .ba-before {
      background: #111;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    /* Text content inside ba-before (e.g. Website Identity description) */
    .ba-before p {
      position: absolute;
      /* sits in the right half, safely away from the divider */
      left: 55%;
      right: 4%;
      top: 50%;
      transform: translateY(-50%);
      font-family: 'Cormorant Garamond', Georgia, serif;
      font-size: clamp(0.75rem, 1.4vw, 1rem);
      font-style: italic;
      color: rgba(245, 240, 235, 0.75);
      line-height: 1.6;
      letter-spacing: 0.02em;
      text-align: left;
      z-index: 2;
      pointer-events: none;
    }
    [dir="rtl"] .ba-before p {
      font-family: 'Markazi Text', serif;
      font-style: normal;
      left: 4%;
      right: 55%;
      text-align: right;
    }
    @media (max-width: 768px) {
      .ba-before p {
        font-size: 0.72rem;
        left: 52%;
        right: 3%;
        line-height: 1.5;
      }
    }
    .ba-after {
      background: #1a0000;
      clip-path: inset(0 50% 0 0);
    }
    .ba-divider {
      position: absolute; top: 0; bottom: 0;
      width: 2px; background: var(--white);
      left: 50%;
      transform: translateX(-50%);
      display: flex; align-items: center; justify-content: center;
      z-index: 3; cursor: ew-resize;
    }
    .ba-divider::after {
      content: '◀ ▶';
      background: var(--white);
      color: var(--black);
      font-size: 0.55rem;
      padding: 0.4rem 0.3rem;
      white-space: nowrap;
      border-radius: 2px;
    }
    .work-label {
      position: absolute; bottom: 0; left: 0; right: 0;
      padding: 1rem 1.2rem;
      background: linear-gradient(transparent, rgba(0,0,0,0.8));
      font-family: 'Bebas Neue', sans-serif;
      font-size: 1rem; letter-spacing: 0.15em;
      color: var(--white); z-index: 4;
    }

    .portfolio-disclaimer {
      margin-top: 2rem;
      font-size: 0.78rem;
      color: var(--text-muted);
      font-style: italic;
      letter-spacing: 0.02em;
      line-height: 1.6;
      opacity: 0.92;
    }
    [dir="rtl"] .portfolio-disclaimer {
      font-family: 'Markazi Text', serif;
      font-size: 1rem;
      font-style: normal;
      text-align: right;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 1.5px;
    }

    .cards-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 1.5px;
    }
    .service-card {
      background: var(--surface);
      border: 1px solid var(--border);
      padding: 2.5rem 2rem;
      transition: border-color 0.25s, transform 0.2s;
      position: relative; overflow: hidden;
    }
    .service-card::before {
      content: '';
      position: absolute; top: 0; left: 0; right: 0;
      height: 2px;
      background: var(--red);
      transform: scaleX(0); transform-origin: left;
      transition: transform 0.3s;
    }
    .service-card:hover::before { transform: scaleX(1); }
    .service-card:hover { transform: translateY(-4px); border-color: rgba(139,0,0,0.3); }
    .card-num {
      font-family: 'Bebas Neue', sans-serif;
      font-size: 3rem; color: rgba(139,0,0,0.12);
      line-height: 1; margin-bottom: 1rem;
    }
    .card-title {
      font-family: 'Bebas Neue', sans-serif;
      font-size: 1.4rem; letter-spacing: 0.08em;
      margin-bottom: 0.8rem;
    }
    .card-desc {
      font-size: 0.95rem; line-height: 1.7;
      color: var(--text-muted);
    }

    #about {
      background: var(--surface);
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 5rem;
      align-items: start;
    }
    @media (max-width: 768px) { #about { grid-template-columns: 1fr; gap: 3rem; } }

    .about-text p {
      font-size: 1.15rem; line-height: 1.9;
      color: var(--text-muted);
      margin-bottom: 1.2rem;
    }
    .contact-form { display: flex; flex-direction: column; gap: 1rem; }
    .form-field {
      background: none;
      border: none; border-bottom: 1px solid var(--border);
      color: var(--text);
      font-family: 'Cormorant Garamond', serif;
      font-size: 1rem; padding: 0.8rem 0;
      outline: none; transition: border-color 0.2s;
      width: 100%;
    }
    .form-field:focus { border-color: var(--red); }
    .form-field::placeholder { color: var(--text-muted); }

    footer {
      padding: 2.5rem 8vw;
      border-top: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-between;
      flex-wrap: wrap; gap: 1rem;
    }
    .footer-brand {
      font-family: 'Bebas Neue', sans-serif;
      font-size: 1.2rem; letter-spacing: 0.15em;
      color: var(--text-muted);
    }
    .footer-info {
      font-size: 0.8rem; color: var(--text-muted);
      line-height: 1.6;
    }
    .footer-copy { font-size: 0.75rem; color: #444; }

    .reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.7s, transform 0.7s; }
    .reveal.visible { opacity: 1; transform: none; }
    #glow-canvas {
      position: absolute; inset: 0;
      pointer-events: none; z-index: 2;
    }

    /* ── ARABIC TYPOGRAPHY ── */
    /* Display / headings: Tajawal — geometric, refined, pairs beautifully with Bebas Neue */
    [dir="rtl"] body {
      font-family: 'Markazi Text', 'Cormorant Garamond', Georgia, serif;
    }
    [dir="rtl"] .nav-links a,
    [dir="rtl"] .sidebar-links a,
    [dir="rtl"] .toggle-btn,
    [dir="rtl"] .section-label,
    [dir="rtl"] .section-title,
    [dir="rtl"] .card-num,
    [dir="rtl"] .card-title,
    [dir="rtl"] .work-label,
    [dir="rtl"] .footer-brand,
    [dir="rtl"] .btn-primary,
    [dir="rtl"] .btn-outline {
      font-family: 'Tajawal', sans-serif;
      font-weight: 500;
      letter-spacing: 0.04em;
    }
    /* Body / paragraph text: Markazi Text — editorial serif, elegant for Arabic prose */
    [dir="rtl"] p,
    [dir="rtl"] .card-desc,
    [dir="rtl"] .hero-tagline,
    [dir="rtl"] .about-text p,
    [dir="rtl"] .footer-info,
    [dir="rtl"] .footer-copy,
    [dir="rtl"] .form-field {
      font-family: 'Markazi Text', Georgia, serif;
      font-size: 1.15em;
      line-height: 2;
      font-weight: 400;
    }
    /* Hero tagline: italic feel via weight contrast in Markazi */
    [dir="rtl"] .hero-tagline {
      font-style: normal;
      font-weight: 500;
      font-size: clamp(1.1rem, 2.2vw, 1.55rem);
      letter-spacing: 0.01em;
    }
    /* Section titles slightly larger to compensate for Arabic letterform density */
    [dir="rtl"] .section-title {
      font-size: clamp(2.8rem, 6.5vw, 5.5rem);
      line-height: 1.1;
    }