/* =========================================================
   WordPress + Elementor layer on top of the design styles
   ========================================================= */

/* ---------- 1. Elementor Site Settings -> design tokens ----------
   Global colours and fonts edited in Elementor (Site Settings) flow into the whole design.
   Elementor defines its variables on the body (.elementor-kit-N), so the bridge lives there too. */
body {
  --primary: var(--e-global-color-primary, #5b34b0);
  --accent: var(--e-global-color-secondary, #a64ca6);
  --text: var(--e-global-color-text, #f5f2fb);
  --lavender: var(--e-global-color-accent, #c9b0dc);
  --violet: var(--e-global-color-triviolet, #7b4fe0);
  --primary-deep: var(--e-global-color-trideep, #4b2a8a);
  --bg: var(--e-global-color-tribg, #07060b);
  --bg-2: var(--e-global-color-tribg2, #0d0a17);
  --muted: var(--e-global-color-trimuted, #a8a1bb);
  --faint: var(--e-global-color-trifaint, #6f6883);

  --grad: linear-gradient(120deg, var(--lavender) 0%, var(--accent) 45%, var(--violet) 100%);
  --grad-btn: linear-gradient(120deg, var(--violet), var(--accent));

  --font-ar: var(--e-global-typography-primary-font-family, "Alexandria"), "Segoe UI", Tahoma, sans-serif;
  --font-en: var(--e-global-typography-secondary-font-family, "Jost"), "Alexandria", sans-serif;
}

/* ---------- 2. Accessibility ---------- */
.skip-link {
  position: fixed; top: 12px; inset-inline-start: 12px; z-index: 1000;
  padding: 10px 18px; border-radius: 999px; background: var(--grad-btn); color: #fff;
  transform: translateY(-200%); transition: transform .3s var(--ease);
}
.skip-link:focus { transform: none; }

/* ---------- 3. Header offset for sticky parts ----------
   --sticky-top = how much of the top is covered (admin bar + header). main.js adds .header-hidden
   while the header slides away on scroll, so sticky bars move up with it. */
body { --bar-h: 0px; --sticky-top: calc(var(--bar-h) + var(--header-h)); }
body.header-hidden { --sticky-top: var(--bar-h); }
.admin-bar { --bar-h: 32px; }
@media (max-width: 782px) { .admin-bar { --bar-h: 46px; } }
@media (max-width: 600px) { .admin-bar { --bar-h: 0px; } } /* the admin bar scrolls away on phones */

/* ---------- 3b. Admin bar ---------- */
.admin-bar .header { top: 32px; }
.admin-bar .nav.open { top: calc(var(--header-h) + 32px); }
@media (max-width: 782px) {
  .admin-bar .header { top: 46px; }
  .admin-bar .nav.open { top: calc(var(--header-h) + 46px); }
}
@media (max-width: 600px) {
  .admin-bar .header { top: 0; }
}

/* ---------- 4. Menus ---------- */
.nav li { position: relative; }
.nav .sub-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-start: 0; z-index: 5; min-width: 230px;
  display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 16px;
  background: rgba(13, 10, 23, .96); border: 1px solid var(--border); backdrop-filter: blur(16px);
  opacity: 0; visibility: hidden; translate: 0 6px; transition: opacity .25s, translate .25s var(--ease), visibility .25s;
}
.nav .sub-menu::before { content: ""; position: absolute; inset: -10px 0 auto; height: 10px; }
.nav li:hover > .sub-menu, .nav li:focus-within > .sub-menu { opacity: 1; visibility: visible; translate: 0 0; }
.nav .sub-menu a { border-radius: 10px; white-space: nowrap; }
@media (max-width: 1080px) {
  .nav.open .sub-menu { position: static; opacity: 1; visibility: visible; translate: none; background: none; border: 0; backdrop-filter: none; }
  .nav.open .sub-menu a { color: var(--muted); }
}
.footer-links li.current-menu-item > a { color: var(--text); }

/* ---------- 5. Elementor wrappers ----------
   Theme Builder header/footer templates: the widget draws everything, so the wrappers stay out of the way. */
.elementor-location-header .e-con, .elementor-location-footer .e-con { --padding-top: 0; --padding-bottom: 0; --padding-left: 0; --padding-right: 0; --gap: 0; }
.elementor-location-header .elementor-widget-container, .elementor-location-footer .elementor-widget-container { display: contents; }
.elementor-widget-triasols-site-header, .elementor-widget-triasols-site-footer { width: 100%; }
.elementor-editor-active .preloader { display: none; }
/* Elementor's `.elementor img { height: auto }` would otherwise blow the logo up to its natural size. */
.elementor .logo img { height: 46px; width: auto; max-width: none; }
.elementor .footer .logo img { height: 56px; }
@media (max-width: 720px) { .elementor .logo img { height: 38px; } }

/* Fallback content (plain posts/pages without Elementor) */
.wp-content { padding-top: calc(var(--header-h) + 60px); }
.wp-content h1 { font-size: clamp(30px, 4vw, 48px); margin-bottom: 24px; }

/* Hints that only show inside the Elementor editor */
.tri-editor-note { margin: 20px auto; max-width: 720px; padding: 14px 20px; border-radius: 14px; border: 1px dashed rgba(245, 199, 126, .5); background: rgba(245, 199, 126, .08); color: #f5d9a8; font-size: 14px; text-align: center; }

/* Featured images in blog covers (the design draws an icon when there is none) */
.post-cover.has-img, .art-cover.has-img { position: relative; overflow: hidden; }
.post-cover.has-img img, .art-cover.has-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.p-thumb.has-img .p-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: scale .7s var(--ease); }
.p-thumb.has-img .p-name { display: none; }
.project:hover .p-thumb.has-img .p-img { scale: 1.05; }
.role h3 .badge { position: static; display: inline-block; vertical-align: middle; margin-inline-start: 8px; padding: 2px 10px; font-size: 11px; }

/* Forms: spam trap (hidden from people), sending state and error note */
.tri-hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn.is-loading { opacity: .65; pointer-events: none; }
.form-error { margin-top: 14px; padding: 12px 16px; border-radius: 12px; font-size: 14px; color: #ffb4c0; background: rgba(214, 54, 56, .1); border: 1px solid rgba(214, 54, 56, .35); }
.form-error a { color: #fff; text-decoration: underline; }
.form-error[hidden] { display: none; }

/* The story rings grow their box while spinning: keep that from becoming sideways scrolling
   on phones. `clip` (not `hidden`) so nothing becomes a scroll container. */
.container:has(> .story-visual) { overflow-x: clip; }

/* The article sidebar must be as tall as the article, or its sticky contents have no room to stick. */
.art-side { align-self: stretch; }

/* ---------- 4b. Mega menu (Triasols Core: المظهر ← القوائم ← «القائمة العريضة») ---------- */
.header .container { position: relative; }
.nav li.has-mega { position: static; }
.nav li.has-mega > .sub-menu, .mega-toggle { display: none; }
.mega {
  position: absolute; top: calc(100% - 4px); inset-inline: var(--gutter); z-index: 5;
  border-radius: 24px; background: rgba(13, 10, 23, .97); border: 1px solid var(--border-strong);
  backdrop-filter: blur(18px) saturate(140%); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(123, 79, 224, .08);
  max-height: calc(100dvh - var(--header-h) - 24px); overflow-y: auto;
  opacity: 0; visibility: hidden; translate: 0 10px;
  transition: opacity .25s, translate .3s var(--ease), visibility .25s; transition-delay: .12s; /* forgiving when the pointer slips off */
}
.mega::before { content: ""; position: absolute; inset: -14px 0 auto; height: 14px; }
.nav li.has-mega:hover > .mega, .nav li.has-mega:focus-within > .mega { opacity: 1; visibility: visible; translate: 0 0; transition-delay: 0s; }
@media (min-width: 1081px) {
  .nav li.has-mega:hover > a, .nav li.has-mega:focus-within > a { color: var(--text); background: var(--surface-2); }
}
.mega-inner { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.mega-main { padding: 26px 28px; }
.mega-eyebrow { font-size: 13px; font-weight: 600; color: var(--lavender); margin-bottom: 16px; }
.mega-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.nav .mega-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; font-size: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); transition: background .3s, border-color .3s, translate .3s var(--ease);
}
.nav .mega-card:hover { background: var(--surface-2); border-color: rgba(201, 176, 220, .35); translate: 0 -2px; }
.mega-ic {
  position: relative; flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: var(--lavender);
  background: linear-gradient(140deg, rgba(123, 79, 224, .25), rgba(166, 76, 166, .15)); border: 1px solid rgba(201, 176, 220, .2);
  transition: background .3s, color .3s;
}
.mega-ic .icon { width: 20px; height: 20px; }
.nav .mega-card:hover .mega-ic { background: var(--grad-btn); color: #fff; }
.mega-txt { display: grid; gap: 3px; min-width: 0; }
.mega-txt b { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.mega-txt em {
  font-style: normal; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--lavender); background: rgba(123, 79, 224, .14); border: 1px solid rgba(201, 176, 220, .18);
}
.mega-txt small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mega-card.is-live .mega-ic::after {
  content: ""; position: absolute; inset-block-start: -3px; inset-inline-end: -3px; width: 11px; height: 11px; border-radius: 50%;
  background: #22c55e; border: 2px solid var(--bg); animation: lapp-pulse 2.4s infinite;
}

.mega-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.mega-col-title { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 10px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.nav .mega-card.is-row { padding: 9px 10px; gap: 12px; background: none; border-color: transparent; }
.nav .mega-card.is-row:hover { background: var(--surface-2); border-color: var(--border); translate: none; }
.mega-card.is-row .mega-ic { width: 36px; height: 36px; border-radius: 11px; }
.mega-card.is-row .mega-ic .icon { width: 17px; height: 17px; }
.mega-card.is-row b { font-size: 14px; }
.mega-card.is-row small { display: none; }
.mega-card.is-live { grid-column: 1 / -1; background: linear-gradient(90deg, rgba(34, 197, 94, .07), transparent 60%), var(--surface); }

.mega-side {
  display: flex; flex-direction: column; gap: 10px; padding: 26px 24px; border-inline-start: 1px solid var(--border);
  background: radial-gradient(120% 70% at 50% 0%, rgba(123, 79, 224, .22), transparent 70%), rgba(255, 255, 255, .015);
}
.nav .mega-feature { display: grid; gap: 4px; padding: 0; margin-bottom: 8px; border-radius: 0; color: var(--text); font-size: inherit; }
.nav .mega-feature:hover { background: none; }
.mega-shot { display: block; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 8px; }
.mega-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 1.2s var(--ease); }
.mega-feature:hover .mega-shot img { transform: scale(1.04); }
.mega-feature small { font-size: 12px; color: var(--lavender); }
.mega-feature b { font-size: 15px; }
.mega-cta-title { font-size: 19px; font-weight: 800; line-height: 1.5; }
.mega-cta-text { font-size: 13.5px; line-height: 1.8; color: var(--muted); }
.nav .mega-btn { display: flex; align-items: center; gap: 8px; margin-top: auto; justify-content: center; color: #fff; padding: 12px 18px; border-radius: 999px; }
.nav .mega-btn:hover { color: #fff; background: var(--grad-btn); }
.nav .mega-wa { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 6px; font-size: 13.5px; color: var(--muted); }
.nav .mega-wa:hover { color: #25d366; background: none; }
.mega-wa .icon { width: 17px; height: 17px; }

.mega-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 28px;
  border-top: 1px solid var(--border); background: rgba(255, 255, 255, .02); font-size: 13px; color: var(--muted);
}
.nav .mega-all { display: inline-flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 14px; font-weight: 600; color: var(--lavender); }
.nav .mega-all:hover { background: none; color: var(--text); }
.mega-all .icon { width: 15px; height: 15px; transition: translate .3s var(--ease); }
.mega-all:hover .icon { translate: -4px 0; }

@media (max-width: 1280px) {
  .mega-inner { grid-template-columns: minmax(0, 1fr) 260px; }
  .mega-cols { gap: 12px; }
}
/* a small chevron after "خدماتنا" / "أعمالنا" on desktop: these open a mega menu */
.mega-caret { flex: none; width: 14px; height: 14px; margin-inline-start: 4px; opacity: .7; transition: rotate .3s var(--ease), opacity .3s; }
.nav li.has-mega:hover .mega-caret, .nav li.has-mega:focus-within .mega-caret { rotate: 180deg; opacity: 1; }
.nav li.has-mega > a { display: inline-flex; align-items: center; }
.nav-foot { display: none; }

/* ---------- 4c. Mobile menu: a full-screen panel with plain rows; mega menus fold into accordions ---------- */
@media (max-width: 1080px) {
  .nav.open {
    display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
    position: fixed; top: var(--header-h); inset-inline: 0; height: calc(100dvh - var(--header-h));
    padding: 8px var(--gutter) calc(20px + env(safe-area-inset-bottom));
    background: radial-gradient(90% 50% at 100% 0%, rgba(123, 79, 224, .16), transparent 70%), #0b0914;
    animation: navIn .35s var(--ease) both;
  }
  .nav.open > ul { display: block; }
  .nav.open > ul > li { border-bottom: 1px solid var(--border); animation: navItem .45s var(--ease) both; }
  .nav.open > ul > li:nth-child(2) { animation-delay: .03s; } .nav.open > ul > li:nth-child(3) { animation-delay: .06s; }
  .nav.open > ul > li:nth-child(4) { animation-delay: .09s; } .nav.open > ul > li:nth-child(5) { animation-delay: .12s; }
  .nav.open > ul > li:nth-child(6) { animation-delay: .15s; } .nav.open > ul > li:nth-child(n+7) { animation-delay: .18s; }
  .nav.open > ul > li > a {
    display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 0 2px;
    font-size: 18px; font-weight: 600; color: var(--text); background: none; border-radius: 0;
  }
  .nav.open > ul > li > a:hover, .nav.open > ul > li > a.active { background: none; }
  .nav.open > ul > li > a.active, .nav.open > ul > li.current-menu-item > a { color: var(--lavender); }
  .nav.open > ul > li > a.active::after, .nav.open > ul > li.current-menu-item > a::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lavender); }
  .nav.open .mega-caret { display: none; }

  /* items with a mega menu: the link, then the arrow that opens the list */
  .nav.open li.has-mega { display: grid; grid-template-columns: minmax(0, 1fr) 48px; align-items: center; }
  .nav.open .mega-toggle {
    display: grid; place-items: center; width: 48px; height: 48px; margin-inline-start: auto; border-radius: 50%;
    color: var(--muted); background: none; border: 0; transition: background .3s, color .3s;
  }
  .nav.open .mega-toggle:focus-visible { outline: 2px solid var(--lavender); outline-offset: -4px; }
  .nav.open .mega-toggle .icon { width: 20px; height: 20px; transition: rotate .35s var(--ease); }
  .nav.open .mega-open .mega-toggle { color: var(--text); background: var(--surface-2); }
  .nav.open .mega-open .mega-toggle .icon { rotate: 180deg; }
  .nav.open .mega {
    grid-column: 1 / -1; position: static; display: none; overflow: visible; max-height: none; margin: 0 0 14px;
    opacity: 1; visibility: visible; translate: none; border: 0; border-radius: 16px; box-shadow: none;
    background: rgba(255, 255, 255, .035); backdrop-filter: none;
  }
  .nav.open .mega-open > .mega { display: block; animation: navIn .3s var(--ease) both; }
  .nav.open .mega-inner { display: block; }
  .nav.open .mega-main { padding: 6px; }
  .nav.open .mega-eyebrow, .nav.open .mega-side, .nav.open .mega-foot > span, .nav.open .mega-txt small, .nav.open .mega-txt em { display: none; }
  .nav.open .mega-grid, .nav.open .mega-cols { display: block; }
  .nav.open .mega-col + .mega-col { margin-top: 4px; }
  .nav.open .mega-col-title { padding: 12px 10px 4px; margin: 0; border: 0; font-size: 12px; color: var(--faint); }
  .nav.open .mega-card, .nav.open .mega-card.is-row {
    display: flex; gap: 12px; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 12px; background: none; translate: none;
  }
  .nav.open .mega-card.is-live { background: none; }
  .nav.open .mega-card:active { background: var(--surface-2); }
  .nav.open .mega-ic, .nav.open .mega-card.is-row .mega-ic { width: 34px; height: 34px; border-radius: 10px; }
  .nav.open .mega-ic .icon { width: 16px; height: 16px; }
  .nav.open .mega-txt b { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .nav.open .mega-foot { padding: 4px 10px 8px; border: 0; background: none; justify-content: flex-start; }
  .nav.open .mega-all { font-size: 14px; }

  /* old-style submenus (any other item with children) */
  .nav.open .sub-menu { padding: 0 0 12px; }
  .nav.open .sub-menu a { padding: 10px 12px; font-size: 15px; }

  /* the call to action and quick contact at the bottom */
  .nav.open .nav-foot { display: grid; gap: 10px; margin-top: auto; padding-top: 24px; animation: navItem .5s .2s var(--ease) both; }
  .nav-foot .btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 22px; font-size: 16px; white-space: nowrap; }
  .nav-foot .btn .icon { width: 18px; height: 18px; }
  .nav-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .nav-quick a {
    display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 14px;
    font-size: 14.5px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  }
  .nav-quick .icon { width: 18px; height: 18px; }
  .nav-quick .is-wa .icon { color: #25d366; }
}
@keyframes navIn { from { opacity: 0; translate: 0 -8px; } }
@keyframes navItem { from { opacity: 0; translate: 0 10px; } }
@media (prefers-reduced-motion: reduce) {
  .mega-card.is-live .mega-ic::after, .nav.open, .nav.open > ul > li, .nav.open .nav-foot, .nav.open .mega-open > .mega { animation: none; }
}
