/* =================================
   Stack Package Modal
   Shell (overlay / wrapper / close) + Elementor content styles
   ================================= */

/* Page scroll lock while modal is open (beats html { overflow-y: auto !important }) */
html.stack-pkg-modal-open,
html.stack-pkg-modal-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

html.stack-pkg-modal-open body {
  position: fixed;
  inset: 0 auto auto 0;
  width: 100%;
  top: var(--stack-pkg-scroll-y, 0);
}

/* Modal overlay */
.stack-pkg-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: rgba(0, 0, 0, 0.7);
}

.stack-pkg-modal-overlay.active {
  display: flex;
}

/* Prefer HTML hidden attribute over .active if both are present */
.stack-pkg-modal-overlay[hidden] {
  display: none !important;
}

/* Modal wrapper */
.stack-pkg-modal-wrapper {
  background-color: var(--bs-primary-800);
  border-radius: var(--radius-2xl);
  padding: 0;
  max-width: 90rem;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  position: relative;
  z-index: 1001;
  box-shadow: 0 1.25rem 3.75rem rgba(0, 0, 0, 0.5);
  animation: stack-pkg-slide-up 0.3s ease-out;
  scrollbar-width: thin;
  scrollbar-color: #698f86 transparent;
}

.stack-pkg-modal-wrapper::-webkit-scrollbar {
  width: 0.5rem !important;
}

.stack-pkg-modal-wrapper::-webkit-scrollbar-track {
  background: transparent !important;
}

.stack-pkg-modal-wrapper::-webkit-scrollbar-thumb {
  background-color: #698f86 !important; /* client: #698F86 */
  border-radius: var(--radius-full);
}

.stack-pkg-modal-wrapper::-webkit-scrollbar-thumb:hover {
  background-color: #698f86 !important;
}

/* Nested scrollables inside modal */
.stack-pkg-modal-wrapper,
.stack-pkg-modal-wrapper * {
  scrollbar-color: #698f86 transparent;
}

.stack-pkg-modal-wrapper *::-webkit-scrollbar-thumb {
  background-color: #698f86 !important;
}

/* Close button */
.stack-pkg-modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bs-success);
  border: none;
  border-radius: var(--radius-full);
  color: var(--bs-primary-800);
  cursor: pointer;
  z-index: 1002;
  transition: background 0.3s ease;
  padding: 0;
}

.stack-pkg-modal-close:hover {
  background: var(--bs-success-100);
}

.stack-pkg-modal-close:focus {
  outline: 0.125rem solid var(--bs-primary-25);
  outline-offset: 0.125rem;
}

.stack-pkg-modal-close svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Plain text fallback (non-Elementor) */
.stack-pkg-modal-text {
  color: var(--bs-primary-25);
  font-size: var(--font-size-16);
  line-height: var(--line-height-body);
}

.stack-pkg-modal-text p {
  margin-bottom: var(--space-5);
  color: var(--bs-primary-25);
}

.stack-pkg-modal-text p:last-child {
  margin-bottom: 0;
}

/* =================================
 Elementor content
   ================================= */

.stack-pkg-modal {
  width: 100%;
  max-width: 90rem;
  background-color: var(--bs-primary-800);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  overflow: hidden;
  border-radius: var(--radius-2xl);
  box-shadow: none;
}

.stack-pkg-modal-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}

.stack-pkg-modal-header-image {
  width: 100%;
  height: 36.875rem;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  display: block;
  overflow: hidden;
  position: relative;
}

.stack-pkg-modal-header-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  object-position: center center;
}

.stack-pkg-modal-title-section {
  width: 100%;
  padding: var(--space-12) 0;
  background-color: var(--bs-primary-800);
  border-bottom: 0.0625rem solid rgba(219, 255, 246, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: var(--space-24);
}

.stack-pkg-modal-title-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: var(--space-9);
  padding: 0 var(--space-5);
}

.stack-pkg-modal-title h1,
.stack-pkg-modal-title h2,
.stack-pkg-modal-title h3,
.stack-pkg-modal-title h4,
.stack-pkg-modal-title h5,
.stack-pkg-modal-title h6 {
  text-align: center;
  color: var(--bs-primary-25) !important;
  font-size: 3rem;
  font-weight: var(--font-weight-normal) !important;
  font-family: var(--font-family-sans) !important;
  line-height: 1;
  margin: 0;
}

.stack-pkg-modal-title h1 strong,
.stack-pkg-modal-title h2 strong,
.stack-pkg-modal-title h3 strong,
.stack-pkg-modal-title h4 strong,
.stack-pkg-modal-title h5 strong,
.stack-pkg-modal-title h6 strong {
  font-weight: var(--font-weight-bold) !important;
}

.stack-pkg-modal-description {
  text-align: center;
  color: var(--bs-primary-25) !important;
  font-size: var(--font-size-16);
  font-weight: var(--font-weight-normal) !important;
  font-family: var(--font-family-sans) !important;
  line-height: var(--line-height-body);
  margin: 0 auto;
  max-width: 40.625rem !important;
}

.stack-pkg-modal-content {
  width: 100%;
  background-color: var(--bs-primary-800);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0.3125rem;
  overflow: hidden;
}

.stack-pkg-modal-section-label h1,
.stack-pkg-modal-section-label h2,
.stack-pkg-modal-section-label h3,
.stack-pkg-modal-section-label h4,
.stack-pkg-modal-section-label h5,
.stack-pkg-modal-section-label h6,
.stack-pkg-modal-section-label p {
  color: var(--bs-success) !important;
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-medium) !important;
  font-family: var(--font-family-mono) !important;
  text-transform: uppercase;
  margin: 0;
}

.stack-pkg-modal-list {
  color: var(--bs-primary-25) !important;
  font-size: var(--font-size-14);
  font-family: var(--font-family-sans) !important;
  font-weight: var(--font-weight-regular) !important;
}

.stack-pkg-modal-list ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-left: 0;
  padding-left: 1.25rem;
  line-height: var(--space-11);
}

.stack-pkg-modal-img-section div {
  width: 100%;
  height: 100%;
}

.stack-pkg-modal-img-section img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  object-position: top left;
}

.stack-pkg-ipad,
.stack-pkg-ipad2 {
  position: absolute !important;
  z-index: 999;
}

.stack-pkg-ipad img {
  max-width: initial !important;
}

@keyframes stack-pkg-slide-up {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================
   Mobile (max-width: 767px)
   Light theme shell + Elementor content
   ======================== */
@media (max-width: 767px) {
  .stack-pkg-modal-overlay {
    padding: 20px;
  }

  .stack-pkg-modal-wrapper {
    max-width: 100%;
    background-color: var(--bs-primary-100);
    border-radius: 20px;
  }

  .stack-pkg-modal,
  .stack-pkg-modal-content,
  .stack-pkg-modal-title-section {
    background-color: transparent;
  }

  .stack-pkg-modal {
    border-radius: 20px;
  }

  .stack-pkg-modal-header-image {
    height: 15rem;
    border-radius: 20px 20px 0 0;
  }

  .stack-pkg-modal-close {
    width: 32px;
    height: 32px;
    top: 10px;
    right: 10px;
  }

  .stack-pkg-modal-close:hover {
    background: var(--bs-success);
  }

  .stack-pkg-modal-close svg {
    width: 22px;
    height: 22px;
    color: #fff;
  }

  .stack-pkg-modal-title-section {
    padding: var(--space-8) 0;
    gap: var(--space-12);
    border-bottom-color: rgba(10, 31, 31, 0.12);
  }

  .stack-pkg-modal-title-wrapper {
    padding: 0 var(--space-3);
    gap: var(--space-6);
    align-items: flex-start;
  }

  .stack-pkg-modal-title h1,
  .stack-pkg-modal-title h2,
  .stack-pkg-modal-title h3,
  .stack-pkg-modal-title h4,
  .stack-pkg-modal-title h5,
  .stack-pkg-modal-title h6 {
    font-size: 24px;
    line-height: 1.2;
    color: var(--bs-primary-700) !important;
    text-align: left !important;
  }

  .stack-pkg-modal-description {
    font-size: var(--font-size-14);
    max-width: 100% !important;
    text-align: left;
    color: var(--bs-primary-700) !important;
  }

  .stack-pkg-modal-section-label h1,
  .stack-pkg-modal-section-label h2,
  .stack-pkg-modal-section-label h3,
  .stack-pkg-modal-section-label h4,
  .stack-pkg-modal-section-label h5,
  .stack-pkg-modal-section-label h6,
  .stack-pkg-modal-section-label p {
    font-size: var(--font-size-12);
  }

  .stack-pkg-modal-list,
  .stack-pkg-modal-section-label p,
  .stack-pkg-modal-list ul span,
  .stack-pkg-modal-text,
  .stack-pkg-modal-text p {
    color: var(--bs-primary-700) !important;
  }

  .stack-pkg-modal-list {
    font-size: 14px;
  }

  .stack-pkg-modal-list ul {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 5px;
    padding-left: 20px;
    gap: 0;
  }

  .stack-pkg-modal-list ul li {
    margin-top: 10px;
  }

  .stack-pkg-modal-list ul span {
    display: block;
    font-weight: 600;
  }

  .stack-pkg-ipad,
  .stack-pkg-ipad2 {
    display: none !important;
  }

  /* Elementor image carousel peek inside modal */
  .stack-pkg-modal-wrapper .elementor-widget-image-carousel .swiper {
    padding-right: 70px;
  }

  .stack-pkg-modal-wrapper .elementor-widget-image-carousel .swiper-slide {
    padding: 0 5px 20px;
  }
}

/* ========================
   Tablet (768px+)
   ======================== */
@media (min-width: 768px) {
  .stack-pkg-modal-overlay {
    padding: var(--space-4);
  }

  .stack-pkg-modal-wrapper {
    max-width: 95%;
  }

  .stack-pkg-modal-header-image {
    height: 22rem;
  }

  .stack-pkg-modal-close {
    width: 2.25rem;
    height: 2.25rem;
  }

  .stack-pkg-modal-close svg {
    width: 1.125rem;
    height: 1.125rem;
  }

  .stack-pkg-modal-title-section {
    padding: var(--space-10) 0;
    gap: var(--space-18);
  }

  .stack-pkg-modal-title-wrapper {
    padding: 0 var(--space-4);
    gap: var(--space-8);
  }

  .stack-pkg-modal-title h1,
  .stack-pkg-modal-title h2,
  .stack-pkg-modal-title h3,
  .stack-pkg-modal-title h4,
  .stack-pkg-modal-title h5,
  .stack-pkg-modal-title h6 {
    font-size: 2rem;
  }

  .stack-pkg-modal-description {
    font-size: var(--font-size-14);
    max-width: 35rem !important;
  }

  .stack-pkg-modal-section-label h1,
  .stack-pkg-modal-section-label h2,
  .stack-pkg-modal-section-label h3,
  .stack-pkg-modal-section-label h4,
  .stack-pkg-modal-section-label h5,
  .stack-pkg-modal-section-label h6,
  .stack-pkg-modal-section-label p {
    font-size: var(--font-size-13);
  }

  .stack-pkg-modal-list ul {
    gap: var(--space-4);
    padding-left: 1.125rem;
    line-height: var(--space-10);
  }

  .stack-pkg-ipad {
    bottom: -11.25rem !important;
    left: 1rem !important;
  }

  .stack-pkg-ipad img {
    max-width: 100% !important;
  }

  .stack-pkg-ipad2 {
    top: -3rem !important;
    right: -0.5rem !important;
    max-width: 16rem !important;
  }
}

/* ========================
   Desktop (992px+)
   ======================== */
@media (min-width: 992px) {
  .stack-pkg-modal-overlay {
    padding: var(--space-6);
  }

  .stack-pkg-modal-wrapper {
    max-width: 90rem;
  }

  .stack-pkg-modal-header-image {
    height: 36.875rem;
  }

  .stack-pkg-modal-close {
    width: 2.5rem;
    height: 2.5rem;
  }

  .stack-pkg-modal-close svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  .stack-pkg-modal-title-section {
    padding: var(--space-12) 0;
    gap: var(--space-24);
  }

  .stack-pkg-modal-title-wrapper {
    padding: 0 var(--space-5);
    gap: var(--space-9);
  }

  .stack-pkg-modal-title h1,
  .stack-pkg-modal-title h2,
  .stack-pkg-modal-title h3,
  .stack-pkg-modal-title h4,
  .stack-pkg-modal-title h5,
  .stack-pkg-modal-title h6 {
    font-size: 3rem;
  }

  .stack-pkg-modal-description {
    font-size: var(--font-size-16);
    max-width: 40.625rem !important;
  }

  .stack-pkg-modal-section-label h1,
  .stack-pkg-modal-section-label h2,
  .stack-pkg-modal-section-label h3,
  .stack-pkg-modal-section-label h4,
  .stack-pkg-modal-section-label h5,
  .stack-pkg-modal-section-label h6,
  .stack-pkg-modal-section-label p {
    font-size: var(--font-size-14);
  }

  .stack-pkg-modal-list ul {
    gap: var(--space-4);
    padding-left: 1.25rem;
    line-height: var(--space-11);
  }

  .stack-pkg-ipad {
    bottom: -22.125rem !important;
    left: 2.125rem !important;
    max-width: 27.9375rem !important;
  }

  .stack-pkg-ipad img {
    max-width: initial !important;
  }

  .stack-pkg-ipad2 {
    top: -6.5rem !important;
    right: 0;
    max-width: 25rem !important;
  }
}

@media (min-width: 1400px) {
  .stack-pkg-ipad {
    bottom: -18.125rem !important;
    left: 2.125rem !important;
    max-width: 27.9375rem !important;
  }
}

@media (min-width: 1930px) {
  .stack-pkg-ipad {
    bottom: -22.125rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stack-pkg-modal-wrapper {
    animation: none;
  }

  .stack-pkg-modal-close {
    transition: none;
  }
}
