/* Shared header (mega menu + mobile drawer) and rich footer. Loaded on every page after the page's own styles.
   Self-contained: uses site tokens when present, with fallbacks, so blog pages without pages.css render it too.
   Colour rule: --tone is the bright brand colour, --ink is the same colour made readable on the current theme. */

.site-header, .mdrawer, .footer--rich {
  --mn-text: var(--brand-text, #eef2ff);
  --mn-muted: var(--brand-muted, #aab2c8);
  --mn-line: rgba(255, 255, 255, 0.11);
  --mn-panel: radial-gradient(620px 340px at 0% 0%, rgba(53, 212, 234, 0.13), transparent 62%), radial-gradient(620px 360px at 100% 100%, rgba(171, 84, 236, 0.18), transparent 62%), radial-gradient(420px 260px at 55% 100%, rgba(255, 153, 102, 0.08), transparent 65%);
  --mn-panel-base: #181e38;
  --mn-font: var(--font-display, "Space Grotesk", "Segoe UI", sans-serif);
  --mn-body: var(--font-body, "IBM Plex Sans", "Segoe UI", sans-serif);
  --tone: #35d4ea; --ink: #35d4ea;
}
[data-theme="light"] .site-header, [data-theme="light"] .mdrawer, [data-theme="light"] .footer--rich {
  --mn-line: rgba(40, 60, 110, 0.12);
  --mn-panel: radial-gradient(620px 340px at 0% 0%, rgba(53, 212, 234, 0.16), transparent 62%), radial-gradient(620px 360px at 100% 100%, rgba(171, 84, 236, 0.13), transparent 62%), radial-gradient(420px 260px at 55% 100%, rgba(255, 200, 87, 0.14), transparent 65%);
  --mn-panel-base: #ffffff;
  --tone: #35d4ea; --ink: #0b8297;
}

/* tones */
.t-cyan   { --tone: #35d4ea; --ink: #35d4ea; }
.t-violet { --tone: #b38bff; --ink: #bb98ff; }
.t-sky    { --tone: #5ac8fa; --ink: #5ac8fa; }
.t-mint   { --tone: #46d69a; --ink: #46d69a; }
.t-coral  { --tone: #ff9966; --ink: #ff9966; }
.t-amber  { --tone: #ffc857; --ink: #ffc857; }
.t-green  { --tone: #6aa629; --ink: #8ccb45; } /* Taaweel brand (taaweel.snapkodex.com) */
[data-theme="light"] .t-cyan   { --ink: #0b8297; }
[data-theme="light"] .t-green  { --ink: #43731a; }
[data-theme="light"] .t-violet { --ink: #6d3fd1; }
[data-theme="light"] .t-sky    { --ink: #1274b5; }
[data-theme="light"] .t-mint   { --ink: #0f7f58; }
[data-theme="light"] .t-coral  { --ink: #c44d17; }
[data-theme="light"] .t-amber  { --ink: #946300; }

/* icon tile: the one way icons appear in the menu, drawer and footer */
.tile { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--ink); background: color-mix(in srgb, var(--tone) 17%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent); transition: background 0.2s, color 0.2s, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s; }
.tile .ico { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tile .ico .fill { fill: currentColor; fill-opacity: 0.2; stroke: none; }
.tile .ico .dot { fill: currentColor; stroke: none; }
.tile--solid { width: 44px; height: 44px; border-radius: 14px; color: #10131c; background: var(--tone); border-color: transparent; box-shadow: 0 8px 20px color-mix(in srgb, var(--tone) 30%, transparent); }
.tile--solid .ico { width: 24px; height: 24px; }
.tile--solid .ico .fill { fill-opacity: 0.28; }

/* ---------- top bar ---------- */
.site-header { z-index: 50; }
body.nav-open .site-header { z-index: 50; }
.site-header .nav { position: static; gap: 14px; }
.mnav { display: flex; align-items: stretch; justify-content: center; gap: clamp(2px, 0.5vw, 8px); flex: 1 1 auto; align-self: stretch; margin: 0; padding: 0; list-style: none; min-width: 0; }
.mnav__item { display: flex; align-items: center; position: static; }
.mnav__item--sm { position: relative; }
.mnav__pill { display: inline-flex; align-items: center; border-radius: 999px; transition: background 0.2s, box-shadow 0.2s; }
.mnav__link, .mnav__caret { font-family: var(--mn-body); font-size: 0.95rem; line-height: 1.2; font-weight: 500; color: var(--mn-muted); text-decoration: none; background: none; border: 0; cursor: pointer; transition: color 0.2s; }
.mnav__link { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 999px; white-space: nowrap; }
[data-mega] .mnav__link:not(.mnav__link--btn) { padding-right: 2px; }
.mnav__caret { display: grid; place-items: center; width: 28px; height: 34px; padding: 0 4px 0 0; border-radius: 999px; }
.mnav__caret svg, .mnav__chev svg { transition: transform 0.25s ease; }
.mnav__chev { display: inline-grid; }
.mnav__item.is-open .mnav__caret svg, .mnav__item.is-open .mnav__chev svg { transform: rotate(180deg); }
.mnav__item:hover .mnav__pill, .mnav__item.is-open .mnav__pill { background: color-mix(in srgb, var(--tone) 18%, transparent); }
.mnav__item:hover .mnav__link, .mnav__item:hover .mnav__caret, .mnav__item.is-open .mnav__link, .mnav__item.is-open .mnav__caret { color: var(--mn-text); }
.mnav__item.is-current .mnav__pill, .mnav__link[aria-current="page"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 55%, transparent); }
.mnav__item.is-current .mnav__link { color: var(--mn-text); }
.mnav__link:focus-visible, .mnav__caret:focus-visible, .mega a:focus-visible, .mdrawer a:focus-visible, .mdrawer summary:focus-visible, .mdrawer button:focus-visible, .mnav__burger:focus-visible, .footer--rich a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 12px; }
.nav__actions { flex: 0 0 auto; }

/* ---------- mega panels ---------- */
.mega { position: absolute; left: 0; right: 0; top: 100%; padding: 0 24px; pointer-events: none; visibility: hidden; opacity: 0; transform: translateY(-8px) scale(0.99); transform-origin: top center; transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.25s; }
.mnav__item.is-open > .mega { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.mega__panel { pointer-events: auto; display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 32px; max-width: 1280px; margin: 10px auto 0; padding: 30px; border-radius: 28px; background-color: var(--mn-panel-base); background-image: var(--mn-panel); border: 1px solid var(--mn-line); box-shadow: 0 30px 70px rgba(4, 6, 20, 0.5); max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px); overflow-y: auto; }
[data-theme="light"] .mega__panel { box-shadow: 0 28px 64px rgba(40, 70, 130, 0.18); }
.mega__panel--narrow { max-width: 1080px; }
.mega__grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 12px 30px; align-items: start; }
.mega__col { min-width: 0; display: grid; gap: 22px; }
.mg { min-width: 0; }
.mg__head { display: flex; align-items: center; gap: 13px; min-height: 62px; padding: 8px 10px; margin-bottom: 10px; border-radius: 16px; text-decoration: none; color: var(--mn-text); transition: background 0.2s; }
.mg__head:hover { background: color-mix(in srgb, var(--tone) 12%, transparent); }
.mg__head:hover .tile { transform: rotate(-4deg) scale(1.05); }
.mg__title { display: grid; gap: 3px; min-width: 0; }
.mg__title b { font-family: var(--mn-font); font-weight: 600; font-size: 1.03rem; line-height: 1.25; }
.mg__title small { color: var(--mn-muted); font-size: 0.79rem; line-height: 1.35; }
.mg__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mi { display: flex; align-items: center; gap: 13px; padding: 9px 10px; border-radius: 16px; color: var(--mn-text); text-decoration: none; transition: background 0.2s; }
.mi:hover { background: color-mix(in srgb, var(--tone) 13%, transparent); }
.mi:hover .tile { background: var(--tone); color: #10131c; transform: scale(1.06); box-shadow: 0 6px 16px color-mix(in srgb, var(--tone) 35%, transparent); }
.mi__txt { display: grid; gap: 2px; min-width: 0; }
.mi__txt b { font-weight: 500; font-size: 0.93rem; line-height: 1.3; }
.mi__txt small { color: var(--mn-muted); font-size: 0.79rem; line-height: 1.35; }
.mi__ext { font-style: normal; font-size: 0.8em; margin-left: 5px; opacity: 0.7; }

/* welcome card */
.mside { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; align-self: stretch; padding: 26px 24px; border-radius: 22px; color: #10131c; background: linear-gradient(155deg, color-mix(in srgb, var(--tone) 92%, #fff), color-mix(in srgb, var(--tone) 62%, #b38bff)); }
.mside::before, .mside::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.24); pointer-events: none; }
.mside::before { width: 170px; height: 170px; right: -56px; top: -52px; }
.mside::after { width: 74px; height: 74px; right: 34px; bottom: -22px; background: rgba(255, 255, 255, 0.18); }
.mside__ico { position: relative; display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 18px; border-radius: 16px; background: rgba(255, 255, 255, 0.55); color: #10131c; }
.mside__ico .ico { display: block; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mside__ico .ico .fill { fill: currentColor; fill-opacity: 0.2; stroke: none; }
.mside__ico .ico .dot { fill: currentColor; stroke: none; }
.mside h3 { position: relative; margin: 0 0 8px; font-family: var(--mn-font); font-size: 1.22rem; font-weight: 600; line-height: 1.22; color: #10131c; }
.mside p { position: relative; margin: 0 0 20px; font-size: 0.89rem; line-height: 1.5; color: #1d2230; }
.mside__cta { position: relative; display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding: 11px 18px; border-radius: 999px; background: #10131c; color: #fff; font-weight: 600; font-size: 0.9rem; text-decoration: none; transition: transform 0.2s; }
.mside__cta:hover { transform: translateY(-2px); }
.mside__cta svg, .footer__cta svg, .md__all svg { transition: transform 0.2s; }
.mside__cta:hover svg, .footer__cta:hover svg, .md__all:hover svg { transform: translateX(3px); }
.mside__more { position: relative; margin-top: 12px; color: #10131c; font-size: 0.86rem; font-weight: 600; text-underline-offset: 3px; }

/* small dropdown */
.mega--sm { left: 0; right: auto; padding: 0; width: 330px; }
.mega--sm .mega__panel { display: block; padding: 12px; margin: 10px 0 0; border-radius: 22px; }

/* ---------- burger + drawer ---------- */
.mnav__burger { display: none; position: relative; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--surface-control-border, rgba(255, 255, 255, 0.12)); background: var(--surface-control, rgba(12, 16, 28, 0.75)); color: var(--mn-text); cursor: pointer; }
.mnav__burger span { position: absolute; left: 13px; right: 13px; height: 2px; border-radius: 2px; background: currentColor; transition: transform 0.25s ease, opacity 0.2s; }
.mnav__burger span:nth-child(1) { top: 15px; }
.mnav__burger span:nth-child(2) { top: 21px; }
.mnav__burger span:nth-child(3) { top: 27px; }
.mnav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mnav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.mnav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mdrawer { position: fixed; inset: 0; z-index: 80; visibility: hidden; pointer-events: none; transition: visibility 0s linear 0.3s; }
.mdrawer.is-open { visibility: visible; pointer-events: auto; transition-delay: 0s; }
.mdrawer__backdrop { position: absolute; inset: 0; background: var(--surface-drawer-backdrop, rgba(4, 6, 12, 0.6)); opacity: 0; transition: opacity 0.3s ease; }
.mdrawer.is-open .mdrawer__backdrop { opacity: 1; }
.mdrawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); display: flex; flex-direction: column; background-color: var(--mn-panel-base); background-image: var(--mn-panel); border-left: 1px solid var(--mn-line); box-shadow: -24px 0 64px rgba(4, 6, 20, 0.45); transform: translateX(100%); transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1); color: var(--mn-text); padding-bottom: env(safe-area-inset-bottom); }
.mdrawer.is-open .mdrawer__panel { transform: none; }
.mdrawer__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; font-family: var(--mn-font); font-size: 1.15rem; font-weight: 600; flex: 0 0 auto; }
.mdrawer__close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--mn-line); background: transparent; color: inherit; cursor: pointer; }
.mdrawer__links { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 20px; display: grid; gap: 8px; align-content: start; }
.md__link { display: flex; align-items: center; min-height: 52px; padding: 12px 14px; border-radius: 18px; font-family: var(--mn-font); font-size: 1.05rem; color: var(--mn-text); text-decoration: none; background: color-mix(in srgb, var(--mn-text) 5%, transparent); }
.md__group { border-radius: 20px; background: color-mix(in srgb, var(--mn-text) 5%, transparent); }
.md__group[open] { background: color-mix(in srgb, var(--tone) 9%, transparent); }
.md__group > summary { display: flex; align-items: center; gap: 13px; padding: 10px 14px 10px 10px; font-family: var(--mn-font); font-size: 1.08rem; font-weight: 500; cursor: pointer; list-style: none; border-radius: 20px; }
.md__group > summary::-webkit-details-marker { display: none; }
.md__label { flex: 1 1 auto; }
.md__group > summary > svg { transition: transform 0.25s; flex: 0 0 auto; }
.md__group[open] > summary > svg { transform: rotate(180deg); }
.md__body { padding: 4px 10px 14px; }
.md__all { display: inline-flex; align-items: center; gap: 8px; padding: 8px 6px; color: var(--ink); font-weight: 600; font-size: 0.92rem; text-decoration: none; }
.md__sub { margin-top: 12px; }
.md__subhead { display: flex; align-items: center; gap: 12px; padding: 6px; border-radius: 14px; color: var(--mn-text); text-decoration: none; font-family: var(--mn-font); font-weight: 600; font-size: 0.98rem; }
.md__subhead .tile--solid { width: 34px; height: 34px; border-radius: 11px; }
.md__subhead .tile--solid .ico { width: 19px; height: 19px; }
.md__body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.md__item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px; border-radius: 14px; color: var(--mn-text); text-decoration: none; font-size: 0.95rem; line-height: 1.3; }
.md__item:hover { background: color-mix(in srgb, var(--tone) 13%, transparent); }
.md__item .tile { width: 34px; height: 34px; border-radius: 11px; }
.md__item .tile .ico { width: 19px; height: 19px; }
.mdrawer__actions { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 14px 18px 18px; border-top: 1px solid var(--mn-line); }
.mdrawer__actions .nav__cta { flex: 1; text-align: center; display: block; }
body.nav-open { overflow: hidden; }

/* ---------- breakpoints ---------- */
@media (max-width: 1239px) {
  .mside { display: none; }
  .mega__panel { display: block; padding: 24px; }
  .mega--sm .mega__panel { padding: 12px; }
}
@media (max-width: 1180px) {
  .mnav__link { font-size: 0.9rem; padding-left: 11px; padding-right: 11px; }
  .mega__grid { gap: 12px 14px; }
}
@media (max-width: 999px) {
  .mnav { display: none; }
  .mnav__burger { display: block; }
  .site-header .nav { justify-content: space-between; }
  .nav__actions { margin-left: auto; }
  .mega { display: none; }
}
@media (max-width: 560px) {
  .nav__actions .nav__cta { display: none; }
  .mdrawer__actions .nav__cta { display: block; }
  .site-header .nav { gap: 10px; }
}
@media (min-width: 1000px) {
  .mdrawer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mega, .mdrawer__panel, .mdrawer__backdrop, .mnav__burger span, .mnav__caret svg, .mnav__chev svg, .tile, .mside__cta { transition: none; }
}

/* ---------- rich footer ---------- */
.footer--rich { position: relative; padding: 60px 24px 28px; }
.footer--rich::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; width: 100%; max-width: none; height: 3px; transform: none; opacity: 1; border-radius: 0; background: linear-gradient(90deg, #35d4ea, #46d69a, #ffc857, #ff9966, #b38bff, #ab54ec); }
.footer--rich .footer__cols { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 1.5fr repeat(4, minmax(0, 1fr)); gap: 36px 30px; padding-bottom: 36px; }
.footer--product .footer__cols { grid-template-columns: 1.5fr repeat(2, minmax(0, 1fr)); }
.footer--rich .footer__logo { display: block; width: 160px; height: auto; margin-bottom: 16px; }
.footer--rich .footer__brand p { color: var(--mn-muted); font-size: 0.92rem; line-height: 1.6; max-width: 320px; margin: 0 0 18px; }
.footer--rich .footer__brand .pbrand { margin-bottom: 14px; }
.footer--rich .footer__cta { display: inline-flex; width: fit-content; align-self: flex-start; justify-self: start; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; color: #10131c; text-decoration: none; padding: 10px 18px; border-radius: 999px; background: linear-gradient(110deg, #35d4ea, #b38bff); transition: transform 0.2s; }
.footer--rich .footer__cta:hover { transform: translateY(-2px); }
.footer--rich h4 { display: flex; align-items: center; gap: 9px; font-family: var(--mn-font); font-weight: 600; font-size: 0.98rem; margin: 0 0 14px; color: var(--mn-text); }
.footer--rich h4::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--tone); }
.footer--rich ul { list-style: none; margin: 0; padding: 0; }
.footer--rich .footer__col a { display: block; padding: 6px 0; color: var(--mn-muted); text-decoration: none; font-size: 0.9rem; line-height: 1.4; overflow-wrap: anywhere; transition: color 0.2s; }
.footer--rich .footer__col a:hover { color: var(--ink); }
.footer--rich .footer__bar { max-width: 1240px; margin: 0 auto; padding-top: 22px; border-top: 1px solid var(--mn-line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; color: var(--mn-muted); font-size: 0.85rem; }
.footer--rich .footer__attrib a { color: var(--mn-text); }
@media (max-width: 1060px) {
  .footer--rich .footer__cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer--rich .footer__brand { grid-column: 1 / -1; }
  .footer--product .footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .footer--rich .footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 20px; }
}
@media (max-width: 640px) {
  .footer--rich { padding: 44px 18px 22px; }
}
@media (max-width: 340px) {
  .footer--rich .footer__cols { grid-template-columns: 1fr; }
}
