/* Header menu CSS - cleaned */
:root{
  --yl-header-h: 88px;
  --yl-safe-top: 0px;
  --yl-safe-right: env(safe-area-inset-right, 0px);
  --yl-safe-bottom: env(safe-area-inset-bottom, 0px);
  --yl-safe-left: env(safe-area-inset-left, 0px);
  --yl-gold: #f3c969;
  --yl-blue: #1d77ff;
  --yl-ink: #061326;
  --yl-rose: #e65b91;
  --yl-green: #2fbf8f;
  --yl-violet: #7c5cff;
}

/* Official fixed header */
.topbar.yl-header-ready{
  position: sticky !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  z-index: 99999 !important;
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  grid-auto-rows: minmax(46px, auto) !important;
  align-items: stretch !important;
  gap: 10px !important;
  padding-top: calc(8px + var(--yl-safe-top)) !important;
  padding-right: calc(12px + var(--yl-safe-right)) !important;
  padding-bottom: 8px !important;
  padding-left: calc(12px + var(--yl-safe-left)) !important;
  min-height: calc(62px + var(--yl-safe-top)) !important;
  background: rgba(5, 12, 26, .96) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .22) !important;
  overflow: visible !important;
}

.topbar.yl-header-ready .brand{
  display: none !important;
}

.topbar.yl-header-ready .yl-header-shortcuts{
  display: contents !important;
}

.topbar.yl-header-ready .yl-header-link,
.topbar.yl-header-ready .yl-header-menu-btn{
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: 46px !important;
  padding: 0 10px !important;
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, .10) !important;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  text-align: center !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .12) !important;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease !important;
}

.topbar.yl-header-ready .yl-header-link:focus-visible,
.topbar.yl-header-ready .yl-header-menu-btn:focus-visible{
  outline: none !important;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .18) !important;
}

@media (hover: hover) and (pointer: fine) {
  .topbar.yl-header-ready .yl-header-link:hover,
  .topbar.yl-header-ready .yl-header-menu-btn:hover{
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .20) !important;
  }
}

.topbar.yl-header-ready .yl-header-link:active,
.topbar.yl-header-ready .yl-header-menu-btn:active{
  transform: scale(.97) !important;
}

.topbar.yl-header-ready .yl-header-link--site,
.topbar.yl-header-ready .yl-header-link--contracts{
  background: linear-gradient(180deg, #f8d46b, #c79210) !important;
  color: #3d2a00 !important;
}

.topbar.yl-header-ready .yl-header-link--library{
  background: linear-gradient(180deg, #42c8ff, #1d77ff) !important;
  color: #fff !important;
}

.topbar.yl-header-ready .yl-header-link--posts{
  background: linear-gradient(180deg, #34d399, #059669) !important;
  color: #052e1a !important;
}

.topbar.yl-header-ready .yl-header-link--services{
  background: linear-gradient(180deg, #fb7185, #e11d48) !important;
  color: #fff !important;
}

.topbar.yl-header-ready .yl-header-link--ai-search{
  position: relative !important;
  overflow: hidden !important;
  border-radius: 22px !important;
  border: 1px solid rgba(125, 211, 252, .72) !important;
  background:
    radial-gradient(circle at 16% 20%, rgba(255, 255, 255, .95) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 82% 28%, rgba(196, 181, 253, .9) 0 1.5px, transparent 2.5px),
    linear-gradient(135deg, #7c3aed 0%, #2563eb 45%, #06b6d4 100%) !important;
  color: #fff !important;
  font-weight: 800 !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .08),
    0 6px 18px rgba(79, 70, 229, .34) !important;
}

.topbar.yl-header-ready .yl-header-link--ai-search::before{
  content: "AI";
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 26px !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, .42) !important;
  background: rgba(255, 255, 255, .14) !important;
  color: #e0f2fe !important;
  font-size: .68rem !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  letter-spacing: .04em !important;
  box-shadow: inset 0 0 12px rgba(255,255,255,.08) !important;
}

.topbar.yl-header-ready .yl-header-menu-btn{
  background: linear-gradient(180deg, #16304d, #0f1f35) !important;
  color: #fff !important;
  cursor: pointer !important;
  font-family: inherit !important;
}

.topbar.yl-header-ready .yl-header-menu-btn__icon{
  flex: 0 0 24px !important;
  width: 24px !important;
  height: 24px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, .08) !important;
  line-height: 1 !important;
}

.topbar.yl-header-ready .main-nav{
  display: none !important;
  width: 100% !important;
  grid-column: 1 / -1 !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
  padding-top: 10px !important;
  margin-top: 2px !important;
}

.topbar.yl-header-ready .main-nav.is-open{
  display: flex !important;
}

.topbar.yl-header-ready .main-nav a{
  display: block !important;
  padding: 12px 14px !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, .05) !important;
  border: 1px solid rgba(255, 255, 255, .06) !important;
  color: #eef5ff !important;
  text-decoration: none !important;
}

/*
 * header-menu.min.js measures the rendered header (including the safe area)
 * and writes the final value into --yl-header-h, so the safe inset must
 * not be added a second time here.
 */
body.yl-header-active{
  padding-top: 0 !important;
}

/* Book author note */
.book-note.author-contact-ready{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-top: 18px !important;
  font-size: 16px !important;
  line-height: 1.9 !important;
  text-align: center !important;
}

.book-note.author-contact-ready::before,
.book-note.author-contact-ready br{
  display: none !important;
  content: none !important;
}

.author-name-button{
  background: linear-gradient(135deg, #173d6e, #2563eb) !important;
  border: 1px solid rgba(37, 99, 235, .35) !important;
  color: #fff !important;
}

/* Mobile header */
@media (max-width: 760px) {
  :root{
    --yl-header-h: 116px;
  }

  .topbar.yl-header-ready{
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(44px, auto) !important;
    gap: 8px !important;
    padding-top: calc(8px + var(--yl-safe-top)) !important;
    padding-right: calc(8px + var(--yl-safe-right)) !important;
    padding-bottom: 8px !important;
    padding-left: calc(8px + var(--yl-safe-left)) !important;
    min-height: calc(108px + var(--yl-safe-top)) !important;
  }

  .topbar.yl-header-ready .yl-header-link,
  .topbar.yl-header-ready .yl-header-menu-btn{
    min-height: 44px !important;
    padding: 5px 6px !important;
    border-radius: 14px !important;
    font-size: clamp(11px, 2.8vw, 13px) !important;
    line-height: 1.35 !important;
    gap: 6px !important;
  }

  .topbar.yl-header-ready .yl-header-link--ai-search{
    border-radius: 20px !important;
  }

  .topbar.yl-header-ready .yl-header-link--ai-search::before{
    flex-basis: 24px !important;
    width: 24px !important;
    height: 24px !important;
    font-size: .64rem !important;
  }

  .topbar.yl-header-ready .yl-header-menu-btn__icon{
    font-size: 1rem !important;
  }

  body.yl-header-active{
    padding-top: 0 !important;
  }
}

/*
 * iOS 26 can return safe-area-inset-top as 0 for installed Home Screen apps.
 * Keep a hard minimum guard in standalone mode so the first row of controls
 * always starts below the status bar even when WebKit reports a bad inset.
 */
@media (display-mode: standalone) and (max-width: 760px) {
  .topbar.yl-header-ready{
    padding-top: max(48px, calc(8px + var(--yl-safe-top))) !important;
    min-height: max(148px, calc(108px + var(--yl-safe-top))) !important;
  }
}

@media (max-width: 380px) {
  .topbar.yl-header-ready .yl-header-link,
  .topbar.yl-header-ready .yl-header-menu-btn{
    font-size: clamp(10px, 2.6vw, 12px) !important;
    padding-inline: 4px !important;
  }
}

/* Hide closed consultation request buttons */
a[href*="/services/legal-consultation"],
button[aria-label*="طلب استشارة قانونية"],
[role="button"][aria-label*="طلب استشارة قانونية"]{
  display: none !important;
}

.case-card:has(a[href*="/services/legal-consultation"]),
.service-item[href*="/services/legal-consultation"],
.service-card:has(a[href*="/services/legal-consultation"]),
.library-item:has(a[href*="/services/legal-consultation"]),
.ai-result:has(a[href*="/services/legal-consultation"]),
article:has(a[href*="/services/legal-consultation"]){
  display: none !important;
}

/* Footer links spacing */
.site-footer .yl-trust-footer-links{
  display: block !important;
  text-align: center !important;
  line-height: 2 !important;
  white-space: normal !important;
  word-spacing: normal !important;
}

.site-footer .yl-trust-footer-links a{
  display: inline !important;
  color: inherit !important;
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  white-space: nowrap !important;
  margin: 0 !important;
  padding: 0 !important;
}

.site-footer .yl-trust-footer-links a + a::before{
  content: " " !important;
  white-space: pre !important;
}

/* CLS stable header geometry v6:start */
/*
 * A single, deterministic header box is reserved from the first paint.
 * Do not use env(safe-area-inset-top) in header geometry: iOS/Safari may
 * resolve it after the first frame and move the whole page.
 */
:root{--yl-safe-top:0px!important}
html{--yl-header-h:0px!important}
body,body.yl-header-active{padding-top:0!important;padding-block-start:0!important;margin-top:0!important;margin-block-start:0!important}
header.topbar,header.topbar.yl-header-ready,.topbar.yl-header-ready{
  box-sizing:border-box!important;
  position:sticky!important;
  top:0!important;
  right:auto!important;
  left:auto!important;
  inset-inline:auto!important;
  width:100%!important;
  height:62px!important;
  min-height:62px!important;
  max-height:62px!important;
  display:grid!important;
  grid-template-columns:repeat(6,minmax(0,1fr))!important;
  grid-auto-rows:46px!important;
  align-items:stretch!important;
  align-content:start!important;
  gap:10px!important;
  padding:8px 12px!important;
  margin:0!important;
  overflow:visible!important;
  font-synthesis:none!important;
  transform:none!important;
  translate:none!important;
  transition:none!important;
  animation:none!important;
}
header.topbar>.yl-header-shortcuts,.topbar.yl-header-ready>.yl-header-shortcuts{display:contents!important}
header.topbar .yl-header-link,header.topbar .yl-header-menu-btn,header.topbar .nav-toggle{
  box-sizing:border-box!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  width:100%!important;
  height:46px!important;
  min-height:46px!important;
  max-height:46px!important;
  padding:0 10px!important;
  margin:0!important;
  line-height:1.35!important;
  overflow:hidden!important;
  font-synthesis:none!important;
  transform:none!important;
  translate:none!important;
  transition:none!important;
  animation:none!important;
}
header.topbar .yl-header-link>span{display:inline-flex!important;align-items:center!important;justify-content:center!important;max-height:40px!important;overflow:hidden!important;line-height:1.35!important}
header.topbar>.main-nav{min-height:0!important;transition:none!important;animation:none!important}
nav.breadcrumb,nav[class*="breadcrumb"]{box-sizing:border-box;min-block-size:48px;font-synthesis:none;transition:none!important;animation:none!important}
nav.breadcrumb>a,nav.breadcrumb>span,nav[class*="breadcrumb"]>a,nav[class*="breadcrumb"]>span{box-sizing:border-box;display:inline-flex;align-items:center;min-block-size:32px;line-height:1.5;transition:none!important;animation:none!important}
#copyToast,.copy-toast{position:fixed!important;z-index:2147483000;top:auto!important;right:auto!important;bottom:20px!important;left:50%!important;box-sizing:border-box;inline-size:min(92vw,220px)!important;block-size:44px!important;min-block-size:44px!important;padding:0 16px!important;margin:0!important;line-height:44px!important;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-synthesis:none;transform:translateX(-50%)!important;translate:none!important;scale:none!important;rotate:none!important;contain:layout paint;will-change:opacity;pointer-events:none;animation:none!important;transition:opacity .15s ease,visibility .15s linear!important}
@media(max-width:760px){
  header.topbar,header.topbar.yl-header-ready,.topbar.yl-header-ready{
    height:116px!important;
    min-height:116px!important;
    max-height:116px!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    grid-auto-rows:46px!important;
    gap:8px!important;
    padding:8px!important;
  }
  header.topbar .yl-header-link,header.topbar .yl-header-menu-btn,header.topbar .nav-toggle{
    height:46px!important;
    min-height:46px!important;
    max-height:46px!important;
    padding:4px 6px!important;
    line-height:1.35!important;
  }
  nav.breadcrumb,nav[class*="breadcrumb"]{min-block-size:52px}
}
@media(display-mode:standalone) and (max-width:760px){
  header.topbar,header.topbar.yl-header-ready,.topbar.yl-header-ready{
    height:156px!important;
    min-height:156px!important;
    max-height:156px!important;
    padding-top:48px!important;
    padding-right:8px!important;
    padding-bottom:8px!important;
    padding-left:8px!important;
  }
}
/* CLS stable header geometry v6:end */

/* Mobile header pre-compact restore v1:start */
@media (max-width: 760px) {
  html body header.topbar,
  html body header.topbar.yl-header-ready,
  html body .topbar.yl-header-ready {
    box-sizing: border-box !important;
    height: 116px !important;
    min-height: 116px !important;
    max-height: 116px !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: 46px !important;
    gap: 8px !important;
    padding: 8px !important;
  }

  html body header.topbar .yl-header-link,
  html body header.topbar .yl-header-menu-btn,
  html body header.topbar .nav-toggle {
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    padding: 4px 6px !important;
    font-size: clamp(11px, 2.8vw, 13px) !important;
    line-height: 1.35 !important;
  }
}

@media (display-mode: standalone) and (max-width: 760px) {
  html body header.topbar,
  html body header.topbar.yl-header-ready,
  html body .topbar.yl-header-ready {
    height: 156px !important;
    min-height: 156px !important;
    max-height: 156px !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: 46px !important;
    padding: 48px 8px 8px !important;
  }
}
/* Mobile header pre-compact restore v1:end */
