.ams-scene-footer {
  --footer-ink: #ffffff;
  --footer-mint: #b3cdcf;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 0;
  padding: 0;
  background: #092e27 !important;
  color: var(--footer-mint) !important;
}

.ams-scene-footer::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to left, rgba(2,24,20,.5) 0%, rgba(2,24,20,.16) 38%, rgba(2,24,20,0) 64%),
    linear-gradient(to top, rgba(2,24,20,.5) 0%, rgba(2,24,20,.02) 42%);
}

.ams-scene-footer::after {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(112deg, rgba(255,255,255,.035), transparent 31%, transparent 72%, rgba(179,205,207,.025));
}

.ams-footer-scene__visual {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: #092e27 url('../assets/scenes/amsiyah-footer-background.jpg') center 58% / cover no-repeat;
  transform: translateZ(0);
  will-change: transform, opacity;
}

.ams-footer-scene__fallback,
.ams-footer-scene__webgl,
.ams-footer-scene__webgl canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ams-footer-scene__fallback {
  object-fit: cover;
  object-position: 50% 58%;
  opacity: 1;
  transform: translateZ(0) scale(1.01);
  filter: saturate(.9) contrast(1.04) brightness(.9);
  backface-visibility: hidden;
}

.ams-footer-scene__webgl {
  z-index: 1;
  opacity: 0;
  transition: opacity .7s ease;
}

.ams-footer-scene__visual.is-webgl-ready .ams-footer-scene__webgl {
  opacity: 1;
}

.ams-footer-scene__webgl canvas {
  display: block;
  object-fit: cover;
}

.ams-footer-scene__veil {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  background:
    linear-gradient(to left, rgba(2,24,20,.42), rgba(2,24,20,.08) 58%, rgba(2,24,20,.2)),
    linear-gradient(to top, rgba(2,24,20,.5), rgba(2,24,20,0) 52%);
}

.ams-footer-composition {
  position: relative;
  z-index: 4;
  width: min(1280px, calc(100% - 48px));
  min-height: clamp(470px, 39vw, 570px);
  margin: 0 auto;
  padding: clamp(62px, 6vw, 82px) 0 clamp(30px, 3vw, 40px);
  display: grid;
  grid-template-columns: minmax(300px, .86fr) minmax(560px, 1.45fr);
  grid-template-areas: 'brand info';
  align-items: center;
  gap: clamp(34px, 5vw, 76px);
  direction: ltr;
  box-sizing: border-box;
}

.ams-footer-composition__content {
  grid-area: info;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  direction: rtl;
}

.ams-footer-cta { display: none; }

.ams-footer-panel {
  width: 100%;
  max-width: none !important;
  margin: 0 !important;
  box-sizing: border-box;
}

.ams-footer-panel:first-child {
  padding: 22px 24px !important;
  grid-template-columns: minmax(220px, 1.25fr) minmax(105px, .58fr) minmax(180px, .9fr) !important;
  gap: 20px 24px !important;
  border: 1px solid rgba(179,205,207,.14) !important;
  border-radius: 24px;
  background: rgba(3,34,29,.34);
  box-shadow: 0 24px 70px rgba(0,0,0,.12);
  backdrop-filter: blur(15px) saturate(1.08);
  -webkit-backdrop-filter: blur(15px) saturate(1.08);
}

.ams-footer-panel:first-child > div {
  gap: 10px !important;
}

.ams-footer-panel:first-child > div:first-child {
  gap: 12px !important;
}

.ams-footer-panel + .ams-footer-panel {
  margin-top: 12px !important;
  overflow: hidden;
  border: 1px solid rgba(179,205,207,.12) !important;
  border-radius: 18px;
  background: rgba(3,34,29,.29);
  backdrop-filter: blur(13px) saturate(1.06);
  -webkit-backdrop-filter: blur(13px) saturate(1.06);
}

.ams-footer-panel + .ams-footer-panel > div:first-child {
  padding: 11px 16px !important;
}

.ams-footer-panel + .ams-footer-panel > div:last-child {
  padding: 5px 16px 12px !important;
  gap: 10px 20px !important;
}

.ams-footer-brand {
  grid-area: brand;
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 22px;
  padding: 26px 0 8px clamp(4px, 1vw, 14px);
  direction: ltr;
}

.ams-footer-word {
  position: relative;
  z-index: 5;
  width: auto;
  margin: 0;
  padding: 0;
  color: var(--footer-ink);
  font-family: var(--ams-font-display) !important;
  font-size: clamp(112px, 12.8vw, 202px);
  font-weight: 400;
  font-feature-settings: 'salt' 1, 'liga' 1, 'kern' 1;
  line-height: .72;
  letter-spacing: normal;
  text-align: left;
  white-space: nowrap;
  text-shadow: 0 18px 48px rgba(0,0,0,.16);
  transform: none;
}

.ams-footer-final {
  position: relative;
  z-index: 7;
  width: min(100%, 350px);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  color: rgba(198,220,215,.7);
  font-family: var(--ams-font-ui) !important;
  font-size: 11px;
  line-height: 1.7;
  text-align: left;
  direction: rtl;
}

.ams-footer-final__line {
  width: 54px;
  height: 1px;
  order: -1;
  background: rgba(198,220,215,.28);
}

.ams-footer-up {
  position: absolute;
  z-index: 7;
  top: 28px;
  left: max(24px, calc((100% - 1280px) / 2));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217,235,231,.25);
  border-radius: 14px;
  background: rgba(4,42,36,.38);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .3s ease, border-color .3s ease, background .3s ease;
}

.ams-footer-up:hover {
  transform: translateY(-4px);
  border-color: rgba(217,235,231,.62);
  background: rgba(37,137,122,.66);
}

.ams-footer-up:focus-visible {
  outline: 3px solid rgba(143,210,199,.72);
  outline-offset: 4px;
}

.ams-footer-up svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 1080px) {
  .ams-footer-composition {
    width: min(940px, calc(100% - 36px));
    grid-template-columns: minmax(245px, .7fr) minmax(530px, 1.4fr);
    gap: 30px;
  }

  .ams-footer-word {
    font-size: clamp(96px, 12vw, 138px);
  }
}

@media (max-width: 900px) {
  .ams-footer-scene__fallback {
    object-position: 58% center;
  }

  .ams-scene-footer::before {
    background:
      linear-gradient(to left, rgba(2,24,20,.62), rgba(2,24,20,.08) 80%),
      linear-gradient(to top, rgba(2,24,20,.52), rgba(2,24,20,0) 55%);
  }

  .ams-footer-composition {
    width: min(680px, calc(100% - 28px));
    min-height: 0;
    padding: 82px 0 26px;
    grid-template-columns: 1fr;
    grid-template-areas:
      'info'
      'brand';
    gap: 38px;
  }

  .ams-footer-brand {
    min-height: 190px;
    padding: 10px 0 0;
  }

  .ams-footer-word {
    font-size: clamp(98px, 24vw, 166px);
  }
}

@media (max-width: 640px) {
  .ams-scene-footer {
    width: calc(100% - 16px);
    margin: 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-radius: 20px;
  }

  .ams-footer-composition {
    width: 100%;
    padding: 76px max(20px, calc(env(safe-area-inset-right, 0px) + 14px)) 24px max(20px, calc(env(safe-area-inset-left, 0px) + 14px));
    gap: 40px;
  }

  .ams-footer-composition__content { gap: 34px; }

  .ams-footer-cta {
    display: grid;
    gap: 20px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(179,205,207,.2);
  }

  .ams-footer-cta p {
    max-width: 10ch;
    margin: 0;
    color: #fff;
    font-family: var(--ams-font-display) !important;
    font-size: clamp(38px, 11vw, 50px);
    font-weight: 400;
    line-height: 1.12;
  }

  .ams-footer-cta a {
    width: fit-content;
    min-height: 48px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    border-radius: 12px;
    background: #b7ee83;
    color: #092e27;
    font-weight: 700;
  }

  .ams-footer-panel:first-child {
    padding: 0 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 34px 22px !important;
    border: 0 !important;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .ams-footer-panel:first-child > div:first-child {
    grid-column: 1 / -1;
    max-width: none !important;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(179,205,207,.18);
  }

  .ams-footer-panel:first-child > div:nth-child(2) a,
  .ams-footer-panel:first-child > div:nth-child(3) a {
    min-height: 30px;
    font-size: 16px !important;
  }

  .ams-footer-panel + .ams-footer-panel {
    margin-top: 0 !important;
    border: 0 !important;
    border-top: 1px solid rgba(179,205,207,.18) !important;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .ams-footer-panel + .ams-footer-panel > div:first-child,
  .ams-footer-panel + .ams-footer-panel > div:last-child {
    justify-content: flex-start !important;
  }

  .ams-footer-up {
    top: max(20px, calc(env(safe-area-inset-top, 0px) + 12px));
    left: max(20px, calc(env(safe-area-inset-left, 0px) + 12px));
    width: 48px;
    height: 48px;
  }

  .ams-footer-brand {
    min-height: 160px;
    gap: 18px;
  }

  .ams-footer-word {
    font-size: clamp(92px, 30vw, 142px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ams-footer-scene__webgl {
    display: none !important;
  }
}
