/* Amsiyah motion system — local, Arabic-safe and conversion-first. */
:root {
  --ams-motion-ease: cubic-bezier(.22, .61, .36, 1);
  --ams-motion-expo: cubic-bezier(.87, 0, .13, 1);
}

@view-transition {
  /* Cross-document auto transitions can reject with AbortError in embedded
     WebViews when History API access is restricted. Amsiyah owns its opening,
     menu and in-page transitions, so keep this experimental UA path disabled. */
  navigation: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .8s;
  animation-timing-function: var(--ams-motion-ease);
}

html.ams-opening-pending,
html.ams-opening-pending body,
html.ams-menu-open,
html.ams-menu-open body,
html.lenis.lenis-stopped,
html.lenis.lenis-stopped body {
  overflow: hidden !important;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* Opening: the reference's expanding mask, rebuilt in Amsiyah's own scene. */
body .ams-opening {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  overflow: hidden;
  background: #f5f2ea;
  opacity: 1;
  animation: none !important;
  will-change: opacity;
}

body .ams-opening__visual {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: #092e27 url('../assets/media/hero/amsiyah-hero-poster.webp') center / cover no-repeat;
  clip-path: inset(50% 50% 50% 50% round 200px);
  will-change: clip-path;
}

body .ams-opening__video,
body .ams-opening__veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

body .ams-opening__video {
  object-fit: cover;
  object-position: center;
  opacity: .875;
  transform: translateZ(0) scale(1.002);
  filter: saturate(.94) contrast(1.04) brightness(.92);
}

body .ams-opening__veil {
  background:
    radial-gradient(circle at 18% 30%, rgba(179, 205, 207, .18), transparent 38%),
    linear-gradient(90deg, rgba(1, 23, 19, .08), rgba(1, 23, 19, .54)),
    linear-gradient(180deg, rgba(1, 24, 20, .05), rgba(1, 24, 20, .32));
}

body .ams-opening__pattern,
body .ams-opening__glow {
  animation: none !important;
}

body .ams-opening__inner {
  z-index: 2;
  pointer-events: none;
}

body .ams-opening__brand,
body .ams-opening__caption,
body .ams-opening__cta {
  opacity: 0;
}

body .ams-opening__line > span {
  display: block;
  transform: translateY(110%);
  animation: none !important;
  will-change: transform;
}

body .ams-opening.ams-opening--gsap .ams-opening__line > span {
  transform: none;
}

body .ams-opening__progress {
  transform: scaleX(0);
  transform-origin: right center;
}

body .ams-opening__progress::after {
  transform: scaleX(1) !important;
  animation: none !important;
}

body .ams-opening__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 11px 14px 10px 16px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-family: var(--ams-font-ui) !important;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body .ams-opening__cta::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b3cdcf;
  box-shadow: 0 0 0 5px rgba(179, 205, 207, .12);
}

/* The homepage remains the pinned opening stage; the phone demo now lives in the journey section. */
.ams-cinematic-shell {
  position: relative;
  display: flow-root;
  min-height: 0;
  background: #092e27;
}

body .ams-cinematic-shell > [data-ams-organic-hero] {
  position: relative;
  top: auto;
  z-index: 1;
  width: calc(100% - (var(--ams-hero-gap, 12px) * 2)) !important;
  height: calc(100svh - (var(--ams-hero-gap, 12px) * 2)) !important;
  min-height: 0 !important;
  margin: var(--ams-hero-gap, 12px) !important;
  border-radius: var(--ams-hero-radius, 26px) !important;
  transform: translateZ(0);
  will-change: margin, width, height, border-radius;
}

.ams-cinematic-shell .ams-hero-organic__video {
  will-change: transform, opacity;
}

.ams-cinematic-shell [data-hero-copy] {
  box-sizing: border-box;
  padding-top: clamp(58px, 8svh, 100px);
  will-change: transform, opacity;
}

.ams-cinematic-story {
  position: absolute;
  z-index: 6;
  inset: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  padding: clamp(124px, 16svh, 180px) clamp(30px, 4vw, 64px) max(78px, calc(54px + env(safe-area-inset-bottom, 0px)));
  overflow: hidden;
  border-radius: inherit;
  color: #fff;
  pointer-events: none;
}

.ams-cinematic-stage {
  position: relative;
  z-index: 2;
  min-width: 0;
  min-height: 0;
}

.ams-cinematic-copy {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  text-align: start;
  opacity: 0;
  will-change: opacity, transform;
}

.ams-cinematic-copy::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -34px -40px -40px;
  border-radius: 42px;
  background: radial-gradient(ellipse at 72% 45%, rgba(2, 25, 21, .72), rgba(2, 25, 21, .42) 48%, transparent 76%);
  pointer-events: none;
}

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

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

.ams-cinematic-copy__label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, .68);
  font-family: var(--ams-font-ui) !important;
  font-size: 12px;
  font-weight: 700;
}

.ams-cinematic-copy__label::before {
  content: '';
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 255, 255, .62);
  transform: rotate(45deg);
}

.ams-cinematic-copy h2 {
  max-width: 14ch;
  margin: 0;
  color: #fff;
  font-family: var(--ams-font-display) !important;
  font-size: clamp(48px, 6.2vw, 88px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: normal;
  text-wrap: balance;
  text-shadow: 0 12px 42px rgba(0, 0, 0, .14);
}

.ams-cinematic-copy p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, .72);
  font-family: var(--ams-font-text) !important;
  font-size: clamp(15px, 1.35vw, 18px);
  line-height: 1.85;
  text-wrap: pretty;
}

.ams-word-progress {
  opacity: .4;
  transition: opacity .12s linear;
}

.ams-cinematic-meter {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
  transform: none !important;
  direction: ltr;
  color: rgba(255, 255, 255, .68);
  pointer-events: none;
}

.ams-cinematic-meter__count {
  min-width: 52px;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--ams-font-ui) !important;
  font-size: 10px;
  font-style: normal;
  letter-spacing: .03em;
}

.ams-cinematic-meter__count b {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.ams-cinematic-meter__count i {
  opacity: .35;
  font-style: normal;
}

.ams-cinematic-meter__track {
  position: relative;
  display: block;
  width: 100%;
  height: 1px;
  min-width: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, .2);
}

.ams-cinematic-meter__track > span {
  position: absolute;
  inset: 0;
  background: #fff;
  transform: scaleX(0);
  transform-origin: right center;
  will-change: transform;
}

.ams-motion-sheet {
  position: relative;
  z-index: 3;
  margin-top: -42px;
  border-radius: 34px 34px 0 0;
  box-shadow: 0 -18px 54px rgba(3, 30, 25, .08);
}

.ams-motion-section {
  transform-origin: center top;
}

[data-ams-motion-heading],
[data-ams-motion-card] {
  will-change: transform, opacity, clip-path;
}

[data-ams-motion-card] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.ams-directional-hover {
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(179, 205, 207, .18), rgba(179, 205, 207, .035));
  pointer-events: none;
  transform: translate3d(0, -102%, 0);
  transition: transform .5s cubic-bezier(.16, 1, .3, 1);
}

[data-ams-motion-card] > :not(.ams-directional-hover) {
  position: relative;
  z-index: 1;
}

.ams-journey-marquee {
  position: relative;
  z-index: 4;
  overflow: hidden;
  padding: 17px 0 16px;
  border-top: 1px solid rgba(5, 50, 43, .08);
  border-bottom: 1px solid rgba(5, 50, 43, .08);
  background: #f8faf7;
  color: #05322b;
  direction: ltr;
}

.ams-journey-marquee__scroll {
  width: 120%;
  margin-inline-start: -10%;
  will-change: transform;
}

.ams-journey-marquee__track {
  display: flex;
  width: max-content;
  will-change: transform;
}

.ams-journey-marquee__collection {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: clamp(20px, 2.3vw, 38px);
  padding-inline-end: clamp(20px, 2.3vw, 38px);
  direction: rtl;
  white-space: nowrap;
}

.ams-journey-marquee__collection span {
  font-family: var(--ams-font-display) !important;
  font-size: clamp(22px, 2.3vw, 36px);
  font-weight: 400;
  line-height: 1.2;
}

.ams-journey-marquee__collection i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 1px solid rgba(5, 50, 43, .48);
  background: #b3cdcf;
  transform: rotate(45deg);
}

nav[data-navpill] {
  transition:
    height .42s var(--ams-motion-ease),
    background-color .42s ease,
    border-color .42s ease,
    box-shadow .42s ease,
    backdrop-filter .42s ease !important;
}

.ams-motion-button {
  -webkit-tap-highlight-color: transparent;
  transform: translateZ(0);
}

.ams-motion-button:focus-visible {
  outline: 3px solid rgba(37, 137, 122, .42) !important;
  outline-offset: 4px !important;
}

@media (hover: hover) and (pointer: fine) {
  .ams-motion-button {
    transition: transform .3s var(--ams-motion-ease), box-shadow .3s ease, background-color .3s ease !important;
  }

  .ams-motion-button:hover {
    transform: translate3d(0, -2px, 0);
  }

  .ams-motion-button svg {
    transition: transform .3s var(--ams-motion-ease);
  }

  .ams-motion-button:hover svg {
    transform: translate3d(-3px, 0, 0);
  }
}

.ams-motion-button:active {
  transform: translate3d(0, 0, 0) scale(.98) !important;
}

@media (max-width: 1000px) {
  body .ams-cinematic-shell > [data-ams-organic-hero] {
    --ams-hero-gap: 8px;
    --ams-hero-radius: 22px;
    min-height: 0 !important;
  }

  .ams-cinematic-story {
    padding-top: clamp(116px, 14svh, 164px);
    padding-inline: 36px;
  }

  .ams-cinematic-copy--followup,
  .ams-cinematic-copy--result {
    top: clamp(44px, 6svh, 72px);
    inset-inline: 0;
    width: auto;
  }

  .ams-cinematic-copy h2 {
    max-width: 12ch;
    font-size: clamp(44px, 8.2vw, 72px);
  }
}

@media (max-width: 640px) {
  body .ams-opening__visual {
    clip-path: inset(50% 50% 50% 50% round 100px);
  }

  body .ams-opening__cta {
    margin-top: 19px;
    font-size: 11px;
  }

  body .ams-cinematic-shell > [data-ams-organic-hero] {
    min-height: 0 !important;
  }

  .ams-cinematic-shell [data-hero-copy] {
    padding-top: clamp(54px, 8svh, 78px);
  }

  .ams-cinematic-story {
    padding-top: max(116px, calc(94px + env(safe-area-inset-top, 0px)));
    padding-inline: 24px;
    padding-bottom: max(72px, calc(48px + env(safe-area-inset-bottom, 0px)));
  }

  .ams-cinematic-copy--followup,
  .ams-cinematic-copy--result {
    top: clamp(42px, 6svh, 58px);
    inset-inline: 0;
    gap: 13px;
  }

  .ams-cinematic-copy h2 {
    max-width: 11ch;
    font-size: clamp(38px, 11vw, 50px);
    line-height: 1.12;
  }

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

  .ams-cinematic-meter {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
  }

  .ams-motion-sheet {
    margin-top: -24px;
    border-radius: 24px 24px 0 0;
  }

  .ams-journey-marquee {
    padding-block: 13px;
  }
}

@media (orientation: landscape) and (max-height: 600px) and (max-width: 1000px) {
  body .ams-cinematic-shell > [data-ams-organic-hero] {
    width: calc(100% - 16px) !important;
    height: calc(100svh - 16px) !important;
    min-height: 0 !important;
    margin: 8px !important;
    border-radius: 20px !important;
  }

  .ams-cinematic-shell [data-hero-copy] {
    padding-top: 34px;
  }

  .ams-cinematic-story {
    padding: max(76px, calc(60px + env(safe-area-inset-top, 0px))) 26px 22px;
  }

  .ams-cinematic-copy--followup,
  .ams-cinematic-copy--result {
    top: 18px;
    inset-inline: 0;
    gap: 8px;
  }

  .ams-cinematic-copy h2 {
    max-width: 17ch;
    font-size: clamp(28px, 5.2vw, 40px);
    line-height: 1.08;
  }

  .ams-cinematic-copy p {
    max-width: 48ch;
    font-size: 13px;
    line-height: 1.55;
  }

  .ams-cinematic-copy__label {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }

  html {
    scroll-behavior: auto !important;
  }

  .ams-opening {
    display: none !important;
  }

  .ams-cinematic-shell {
    height: auto;
    min-height: 0;
    background: transparent;
  }

  body .ams-cinematic-shell > [data-ams-organic-hero] {
    position: relative !important;
    top: auto;
    width: calc(100% - 16px) !important;
    height: auto !important;
    min-height: calc(100svh - 16px) !important;
    margin: 8px !important;
    border-radius: 22px !important;
  }

  .ams-cinematic-story,
  .ams-cinematic-meter {
    display: none !important;
  }

  .ams-cinematic-shell [data-hero-copy],
  [data-navwrap],
  [data-journey-phone],
  .ams-motion-section,
  .ams-motion-section > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .ams-journey-marquee__track,
  .ams-journey-marquee__scroll {
    transform: none !important;
  }
}
