/* Amsiyah mobile production layer — derived from the V3 interaction geometry,
   rebuilt with Amsiyah-owned visuals, Arabic-safe typography, and logical RTL. */
:root {
  --amsiyah-viewport-height: 100vh;
  --amsiyah-viewport-width: 100vw;
  --amsiyah-safe-top: env(safe-area-inset-top, 0px);
  --amsiyah-safe-end: env(safe-area-inset-left, 0px);
  --amsiyah-safe-bottom: env(safe-area-inset-bottom, 0px);
  --amsiyah-safe-start: env(safe-area-inset-right, 0px);
}

@supports (height: 100dvh) {
  :root { --amsiyah-viewport-height: 100dvh; }
}

.ams-skip-link {
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  transform: none;
}

.ams-skip-link:focus:not(:focus-visible) {
  width: 1px;
  height: 1px;
  padding: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.ams-skip-link:focus-visible {
  z-index: 2147483646;
  width: auto;
  height: auto;
  padding: 10px 16px;
  overflow: visible;
  clip: auto;
  clip-path: none;
}

/* The commercial opening and the 01–03 explanation are two real scenes. */
.ams-cinematic-background {
  --ams-hero-gap: 12px;
  --ams-hero-radius: 26px;
  position: sticky !important;
  z-index: 0 !important;
  top: 0;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: calc(100% - (var(--ams-hero-gap) * 2));
  height: calc(var(--amsiyah-viewport-height) - (var(--ams-hero-gap) * 2));
  margin: var(--ams-hero-gap);
  margin-bottom: calc((var(--amsiyah-viewport-height) - var(--ams-hero-gap)) * -1);
  overflow: hidden;
  border-radius: var(--ams-hero-radius);
  transform: translateZ(0);
  will-change: width, height, margin, border-radius;
}

body .ams-cinematic-shell > [data-ams-organic-hero] {
  position: relative !important;
  z-index: 2;
  width: 100% !important;
  height: var(--amsiyah-viewport-height) !important;
  margin: 0 !important;
  overflow: visible !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.ams-mobile-title-break { display: none; }

.ams-cinematic-scroller {
  position: relative;
  z-index: 2;
  width: 100%;
  height: var(--amsiyah-viewport-height);
  min-height: 0;
  overflow: hidden;
  color: #fff;
}

.ams-cinematic-scroller .ams-cinematic-story {
  border-radius: var(--ams-hero-radius, 26px);
}

.ams-cinematic-copy--invitation,
.ams-cinematic-copy--followup,
.ams-cinematic-copy--result {
  top: clamp(48px, 7svh, 88px);
  inset-inline-start: clamp(10px, 2.7vw, 44px);
  width: min(720px, 59vw);
}

@media (max-width: 1024px) {
  body .ams-opening__visual { clip-path: inset(50% 50% 50% 50% round 100px); }
  html body .ams-opening__brand { inset-inline-start: 12px !important; }
  html body [data-navwrap] { z-index: 2147483100 !important; }
  .ams-mobile-title-break { display: block; }
  html body [data-desk-only] { display: none !important; }
  html body [data-mob-only] { display: flex !important; }

  html body [data-navwrap],
  html body [data-navwrap][data-over-hero="0"],
  html body[data-page="home"] [data-navwrap][data-over-hero="1"] {
    padding-top: max(20px, calc(var(--amsiyah-safe-top) + 8px)) !important;
    padding-right: max(20px, calc(var(--amsiyah-safe-start) + 8px)) !important;
    padding-left: max(20px, calc(var(--amsiyah-safe-end) + 8px)) !important;
    padding-bottom: 0 !important;
    transition: padding .6s cubic-bezier(.22, .61, .36, 1) !important;
  }

  html body [data-navpill],
  html body [data-navwrap][data-over-hero="0"] [data-navpill],
  html body[data-page="home"] [data-navwrap][data-over-hero="1"] [data-navpill] {
    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    height: 64px !important;
    padding: 0 8px 0 12px !important;
    grid-template-columns: 1fr auto !important;
    gap: 12px !important;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, .42) !important;
    border-radius: 16px !important;
    background: rgba(255, 255, 255, .84) !important;
    box-shadow: 0 8px 30px rgba(2, 24, 20, .08) !important;
    backdrop-filter: blur(10px) saturate(1.18) !important;
    -webkit-backdrop-filter: blur(10px) saturate(1.18) !important;
    transition: background-color .6s ease, border-color .6s ease, box-shadow .6s ease !important;
  }

  html body [data-navwrap][data-over-hero="0"] [data-navpill] {
    background: rgba(255, 255, 255, .94) !important;
    box-shadow: 0 12px 34px rgba(2, 24, 20, .13) !important;
  }

  [data-navpill] > div:first-child {
    grid-column: 1;
    justify-self: start !important;
    padding-inline-start: 8px !important;
  }

  /* The homepage mark is the brand control, not an active navigation pill. */
  html body [data-navpill] > div:first-child > a[aria-current="page"] {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  [data-navpill] > div:last-child {
    grid-column: 2;
    justify-self: end !important;
  }

  html body [data-navpill] img[alt="أمسية"],
  html body [data-navwrap][data-over-hero="1"] [data-navpill] img[alt="أمسية"] {
    width: auto !important;
    height: 42px !important;
    filter: none !important;
  }

  html body button[data-mob-only] {
    position: relative;
    display: inline-flex !important;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0 !important;
    gap: 0 !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #223b38 !important;
    border-radius: 12px;
    background: #223b38 !important;
    -webkit-tap-highlight-color: transparent;
  }

  html body button[data-mob-only] span {
    position: absolute;
    inset: 0;
    width: 24px !important;
    height: 1px !important;
    margin: auto;
    border-radius: 0 !important;
    background: #b7ee83 !important;
    transform: translateY(-3px);
    transition: transform .6s cubic-bezier(.22, .61, .36, 1), background-color .3s ease;
  }

  html body button[data-mob-only] span:nth-child(2) {
    transform: translateY(3px);
  }

  html body button[data-mob-only] span:nth-child(3) { display: none !important; }

  html body button[data-mob-only][aria-expanded="true"] {
    border-color: #b7ee83 !important;
    background: transparent !important;
  }

  html body button[data-mob-only][aria-expanded="true"] span {
    background: #fff !important;
    transform: rotate(45deg);
  }

  html body button[data-mob-only][aria-expanded="true"] span:nth-child(2) {
    transform: rotate(-45deg);
  }

  [data-mob-root] {
    z-index: 2147483200 !important;
    inset: 0 !important;
    padding: 0;
    background: #f5f2ea;
  }

  [data-mob-ovl] {
    background: transparent !important;
    pointer-events: none;
  }

  html body [data-mob-panel] {
    isolation: isolate;
    top: max(8px, var(--amsiyah-safe-top)) !important;
    right: max(8px, var(--amsiyah-safe-start)) !important;
    bottom: max(8px, var(--amsiyah-safe-bottom)) !important;
    left: max(8px, var(--amsiyah-safe-end)) !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid rgba(179, 205, 207, .16);
    border-radius: 18px;
    background:
      radial-gradient(110% 75% at 4% 8%, transparent 55%, rgba(179, 205, 207, .11) 55.3%, transparent 55.8%),
      radial-gradient(95% 64% at 102% 45%, transparent 59%, rgba(179, 205, 207, .10) 59.3%, transparent 59.8%),
      radial-gradient(85% 58% at 12% 98%, transparent 61%, rgba(179, 205, 207, .09) 61.3%, transparent 61.8%),
      #1f3333 !important;
    opacity: 0;
    transform: translate3d(0, -10px, 0) scale(.985) !important;
    transform-origin: top center;
    transition: opacity .6s ease, transform .6s cubic-bezier(.16, 1, .3, 1) !important;
  }

  [data-mob-root][data-menu-state="opening"] [data-mob-panel],
  [data-mob-root][data-menu-state="open"] [data-mob-panel] {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) !important;
  }

  [data-mob-panel]::before,
  [data-mob-panel]::after {
    content: '';
    position: absolute;
    z-index: -1;
    width: 70vw;
    height: 70vw;
    border: 1px solid rgba(179, 205, 207, .08);
    border-radius: 42% 58% 61% 39% / 45% 37% 63% 55%;
    pointer-events: none;
  }

  [data-mob-panel]::before { top: 18%; inset-inline-start: -34%; transform: rotate(24deg); }
  [data-mob-panel]::after { bottom: -18%; inset-inline-end: -28%; transform: rotate(-31deg); }

  [data-mob-panel] > div:first-child {
    position: relative;
    z-index: 2;
    flex: 0 0 64px;
    min-height: 64px;
    margin: 12px;
    padding: 0 8px 0 12px !important;
    border: 1px solid rgba(255, 255, 255, .04) !important;
    border-radius: 16px;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  [data-mob-panel] img[alt="أمسية"] {
    width: auto !important;
    height: 42px !important;
    filter: brightness(0) invert(1);
  }

  [data-mob-panel] button[aria-label="إغلاق القائمة"] {
    position: relative;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid #b7ee83 !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: transparent !important;
    font-size: 0 !important;
  }

  [data-mob-panel] button[aria-label="إغلاق القائمة"]::before,
  [data-mob-panel] button[aria-label="إغلاق القائمة"]::after {
    content: '';
    position: absolute;
    inset: 0;
    width: 22px;
    height: 1px;
    margin: auto;
    background: #fff;
  }

  [data-mob-panel] button[aria-label="إغلاق القائمة"]::before { transform: rotate(45deg); }
  [data-mob-panel] button[aria-label="إغلاق القائمة"]::after { transform: rotate(-45deg); }

  [data-mob-panel] > div:nth-child(2) {
    position: relative;
    z-index: 1;
    min-height: 0;
    padding: 8px 24px max(28px, calc(var(--amsiyah-safe-bottom) + 18px)) !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  [data-mob-panel] > div:nth-child(2)::-webkit-scrollbar { display: none; }

  [data-mob-panel] > div:nth-child(2) > a {
    align-self: center;
    width: fit-content;
    padding: 5px 10px !important;
    border: 0 !important;
    color: #fff !important;
    font-family: var(--ams-font-display) !important;
    font-size: clamp(34px, 10.6vw, 54px) !important;
    font-weight: 400 !important;
    line-height: 1.06 !important;
    text-align: center;
    opacity: 0;
    transform: translateY(-105%);
    transition: color .3s ease, opacity .5s ease, transform .6s cubic-bezier(.25, 1, .5, 1) !important;
  }

  [data-mob-panel] > div:nth-child(2) > a[aria-current="page"] { color: #b7ee83 !important; }
  [data-mob-root][aria-hidden="false"] [data-mob-panel] > div:nth-child(2) > a { opacity: 1; transform: none; }
  [data-mob-root][aria-hidden="false"] [data-mob-panel] > div:nth-child(2) > a:nth-child(1) { transition-delay: .30s !important; }
  [data-mob-root][aria-hidden="false"] [data-mob-panel] > div:nth-child(2) > a:nth-child(2) { transition-delay: .40s !important; }
  [data-mob-root][aria-hidden="false"] [data-mob-panel] > div:nth-child(2) > a:nth-child(3) { transition-delay: .50s !important; }
  [data-mob-root][aria-hidden="false"] [data-mob-panel] > div:nth-child(2) > a:nth-child(4) { transition-delay: .60s !important; }
  [data-mob-root][aria-hidden="false"] [data-mob-panel] > div:nth-child(2) > a:nth-child(5) { transition-delay: .70s !important; }
  [data-mob-root][aria-hidden="false"] [data-mob-panel] > div:nth-child(2) > a:nth-child(6) { transition-delay: .78s !important; }

  [data-mob-panel] > div:nth-child(2) > div:last-child {
    width: 100%;
    margin-top: auto !important;
    padding-top: 20px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .5s ease .82s, transform .6s cubic-bezier(.25, 1, .5, 1) .82s;
  }

  [data-mob-root][aria-hidden="false"] [data-mob-panel] > div:nth-child(2) > div:last-child {
    opacity: 1;
    transform: none;
  }

  [data-mob-panel] > div:nth-child(2) > div:last-child a {
    min-height: 48px;
    box-sizing: border-box;
    border-radius: 12px !important;
  }

  [data-mob-panel] > div:nth-child(2) > div:last-child a[data-wa-link] {
    color: #b3cdcf !important;
    border-color: rgba(179, 205, 207, .34) !important;
    background: rgba(179, 205, 207, .045) !important;
  }

  .ams-cinematic-background {
    --ams-hero-gap: 8px;
    --ams-hero-radius: 20px;
  }

  body .ams-cinematic-shell > [data-ams-organic-hero] > div:not(.ams-hero-organic) {
    width: 100%;
    height: 100%;
    min-height: 0 !important;
    box-sizing: border-box;
    padding-top: max(116px, calc(var(--amsiyah-safe-top) + 96px)) !important;
    padding-right: max(22px, calc(var(--amsiyah-safe-start) + 16px)) !important;
    padding-bottom: max(26px, calc(var(--amsiyah-safe-bottom) + 18px)) !important;
    padding-left: max(22px, calc(var(--amsiyah-safe-end) + 16px)) !important;
    display: block !important;
  }

  body .ams-cinematic-shell [data-hero-copy] {
    width: 100%;
    height: 100%;
    min-height: 0 !important;
    padding-top: 0 !important;
    justify-content: space-between !important;
    gap: 28px !important;
  }

  body .ams-cinematic-shell [data-hero-copy] h1 {
    width: 100%;
    max-width: 14.5ch !important;
    margin: 0;
    font-size: clamp(40px, 11.4vw, 52px) !important;
    font-weight: 400 !important;
    line-height: 1.12 !important;
    letter-spacing: normal !important;
    overflow-wrap: normal;
    word-break: keep-all;
    text-wrap: balance;
  }

  body .ams-cinematic-shell [data-hero-bottom] {
    width: 100%;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px !important;
  }

  body .ams-cinematic-shell [data-hero-bottom] > p {
    max-width: 34ch !important;
    font-size: clamp(14px, 3.8vw, 16px) !important;
    line-height: 1.72 !important;
    color: rgba(255, 255, 255, .86) !important;
  }

  body .ams-cinematic-shell [data-hero-actions] { margin: 0 !important; }

  body .ams-cinematic-shell [data-hero-copy] [data-hero-actions] a:first-child {
    min-height: 48px;
    box-sizing: border-box;
    padding: 0 18px 0 6px !important;
    border-radius: 12px !important;
    background: #223131 !important;
    color: #fff !important;
    font-size: 13.5px !important;
    box-shadow: 0 12px 32px rgba(1, 23, 19, .22);
    -webkit-tap-highlight-color: transparent;
  }

  body .ams-cinematic-shell [data-hero-copy] [data-hero-actions] a:first-child::after {
    width: 40px;
    height: 40px;
    margin-inline-start: 16px;
    border-radius: 10px;
    background: #b7ee83;
    font-size: 16px;
  }

  body .ams-cinematic-shell [data-hero-copy] [data-hero-actions] a:first-child:active {
    transform: scale(.97) !important;
  }

  .ams-cinematic-background .ams-hero-organic__video {
    object-position: center;
    filter: saturate(.94) contrast(1.02) brightness(.94);
  }

  .ams-cinematic-background .ams-hero-organic__veil {
    background:
      radial-gradient(circle at 20% 28%, rgba(179, 205, 207, .14), transparent 42%),
      linear-gradient(to left, rgba(2, 24, 20, .46), rgba(2, 24, 20, .05) 80%),
      linear-gradient(to top, rgba(2, 24, 20, .44), rgba(2, 24, 20, 0) 58%);
  }

  .ams-cinematic-story {
    padding-top: max(116px, calc(var(--amsiyah-safe-top) + 96px));
    padding-right: max(24px, calc(var(--amsiyah-safe-start) + 16px));
    padding-bottom: max(72px, calc(var(--amsiyah-safe-bottom) + 52px));
    padding-left: max(24px, calc(var(--amsiyah-safe-end) + 16px));
  }

  .ams-cinematic-copy--invitation,
  .ams-cinematic-copy--followup,
  .ams-cinematic-copy--result {
    top: clamp(38px, 6svh, 64px);
    inset-inline: 0;
    width: auto;
    gap: 13px;
  }

  .ams-cinematic-copy h2 {
    max-width: 12ch;
    font-size: clamp(38px, 10.7vw, 50px);
    line-height: 1.14;
    overflow-wrap: normal;
    word-break: keep-all;
  }

  .ams-cinematic-copy p {
    max-width: 31ch;
    font-size: 14.5px;
    line-height: 1.75;
  }

  .ams-cinematic-meter {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 14px;
    direction: ltr;
    unicode-bidi: isolate;
  }

  html.ams-opening-pending .ams-cb-launch,
  body.ams-hero-initial .ams-cb-launch,
  body.ams-hero-initial .ams-mobile-conversion {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* The footer has its own up control; fixed assistants would cover its links. */
  body.ams-footer-in-view .ams-cb-launch,
  body.ams-footer-in-view .ams-mobile-conversion {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@media (max-width: 360px) {
  html body [data-navwrap],
  html body [data-navwrap][data-over-hero="0"],
  html body[data-page="home"] [data-navwrap][data-over-hero="1"] {
    padding-right: max(14px, calc(var(--amsiyah-safe-start) + 8px)) !important;
    padding-left: max(14px, calc(var(--amsiyah-safe-end) + 8px)) !important;
  }

  html body [data-navpill] img[alt="أمسية"],
  html body [data-navwrap][data-over-hero="1"] [data-navpill] img[alt="أمسية"] { height: 37px !important; }
  body .ams-cinematic-shell [data-hero-copy] h1 { font-size: clamp(36px, 11.5vw, 42px) !important; }
  [data-mob-panel] > div:nth-child(2) > a { font-size: clamp(31px, 10vw, 38px) !important; }
}

@media (max-width: 700px) {
  html body .ams-opening__inner { width: calc(100% - 32px) !important; }
  html body .ams-opening__title {
    font-size: clamp(42px, 13.4vw, 60px) !important;
    line-height: 1.08 !important;
    letter-spacing: normal !important;
  }
}

@media (orientation: landscape) and (max-height: 600px) and (max-width: 1024px) {
  html body [data-navwrap],
  html body [data-navwrap][data-over-hero="0"],
  html body[data-page="home"] [data-navwrap][data-over-hero="1"] {
    padding-top: max(8px, var(--amsiyah-safe-top)) !important;
  }

  html body [data-navpill],
  html body [data-navwrap][data-over-hero="0"] [data-navpill],
  html body[data-page="home"] [data-navwrap][data-over-hero="1"] [data-navpill] { height: 54px !important; }
  html body button[data-mob-only] { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  html body [data-navpill] img[alt="أمسية"] { height: 36px !important; }

  body .ams-cinematic-shell > [data-ams-organic-hero] > div:not(.ams-hero-organic) {
    padding-top: max(70px, calc(var(--amsiyah-safe-top) + 58px)) !important;
    padding-bottom: max(14px, calc(var(--amsiyah-safe-bottom) + 8px)) !important;
  }

  body .ams-cinematic-shell [data-hero-copy] { gap: 10px !important; }
  body .ams-cinematic-shell [data-hero-copy] h1 {
    max-width: 16ch !important;
    font-size: clamp(30px, 5.2vw, 40px) !important;
    line-height: 1.04 !important;
  }
  body .ams-cinematic-shell [data-hero-bottom] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 18px !important;
  }
  body .ams-cinematic-shell [data-hero-bottom] > p {
    max-width: 48ch !important;
    font-size: 12.5px !important;
    line-height: 1.5 !important;
  }

  .ams-cinematic-story {
    padding-top: max(70px, calc(var(--amsiyah-safe-top) + 58px));
    padding-bottom: max(20px, calc(var(--amsiyah-safe-bottom) + 12px));
  }
  .ams-cinematic-copy--invitation,
  .ams-cinematic-copy--followup,
  .ams-cinematic-copy--result { top: 14px; gap: 8px; }
  .ams-cinematic-copy h2 { max-width: 17ch; font-size: clamp(28px, 5.1vw, 40px); line-height: 1.08; }
  .ams-cinematic-copy p { max-width: 52ch; font-size: 12.5px; line-height: 1.5; }

  [data-mob-panel] > div:nth-child(2) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: center;
    gap: 2px 14px;
  }
  [data-mob-panel] > div:nth-child(2) > a { font-size: clamp(26px, 5vw, 38px) !important; }
  [data-mob-panel] > div:nth-child(2) > div:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .ams-cinematic-background {
    position: absolute !important;
    inset: 8px !important;
    width: auto !important;
    height: calc(var(--amsiyah-viewport-height) - 16px) !important;
    margin: 0 !important;
    border-radius: 20px !important;
  }
  .ams-cinematic-scroller { display: none !important; }
}
