/* ==========================================================================
   KOMA BUSINESS · global "Start Now" paid-plan modal
   Markup is injected once by assets/js/start-modal.js. Every selector is
   namespaced under .koma-start-modal so nothing here reaches page styles.

   The backdrop and the dialog are siblings, never ancestor/descendant: an
   element with backdrop-filter (or opacity < 1) becomes the backdrop root
   for its descendants, which would stop the dialog's glass from sampling
   the page behind it.
   ========================================================================== */

.koma-start-modal {
  --ksm-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ksm-green: #019b4e;
  --ksm-green-hover: #0bb862;
  --ksm-text: #f2f2f2;
  --ksm-muted: #9a9aa0;
  --ksm-pad: 44px;
  --ksm-gutter: 16px;

  position: fixed;
  inset: 0;
  z-index: 3000;
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.koma-start-modal[hidden] {
  display: none;
}

/* Page scroll lock (the viewport inherits body overflow, like .menu-open) */
body.koma-start-modal-open {
  overflow: hidden;
}

/* Backdrop
   ========================================================================== */

.koma-start-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 9, 8, 0.5);
  -webkit-backdrop-filter: blur(6px) saturate(115%);
  backdrop-filter: blur(6px) saturate(115%);
  opacity: 0;
  transition: opacity 280ms var(--ksm-ease);
}

.koma-start-modal.is-open .koma-start-modal__backdrop {
  opacity: 1;
  transition-duration: 320ms;
}

/* Centering layer: clicks that land here (outside the dialog) close it */
.koma-start-modal__viewport {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(12px + env(safe-area-inset-top, 0px))
    var(--ksm-gutter)
    calc(12px + env(safe-area-inset-bottom, 0px));
}

/* Dialog: dark translucent glass
   ========================================================================== */

.koma-start-modal__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  color: var(--ksm-text);
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(1, 155, 78, 0.1), rgba(1, 155, 78, 0) 62%),
    linear-gradient(180deg, rgba(22, 34, 31, 0.4) 0%, rgba(8, 14, 13, 0.52) 100%);
  -webkit-backdrop-filter: blur(32px) saturate(160%);
  backdrop-filter: blur(32px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 1px rgba(1, 155, 78, 0.05),
    0 30px 80px -12px rgba(0, 0, 0, 0.6),
    0 0 60px -20px rgba(1, 155, 78, 0.18);
  opacity: 0;
  transform: translateY(6px) scale(0.99);
  transition:
    opacity 260ms var(--ksm-ease),
    transform 300ms var(--ksm-ease);
}

.koma-start-modal.is-open .koma-start-modal__dialog {
  opacity: 1;
  transform: none;
  transition-duration: 440ms, 480ms;
}

.koma-start-modal__dialog:focus {
  outline: none;
}

/* Browsers without backdrop-filter get a denser surface instead of a
   see-through one that would hurt legibility. */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .koma-start-modal__backdrop {
    background: rgba(3, 9, 8, 0.78);
  }

  .koma-start-modal__dialog {
    background:
      radial-gradient(120% 70% at 50% -10%, rgba(1, 155, 78, 0.11), rgba(1, 155, 78, 0) 62%),
      linear-gradient(180deg, rgba(18, 26, 24, 0.95) 0%, rgba(8, 12, 11, 0.97) 100%);
  }
}

/* Scrolls internally only when a short screen needs it; the close button
   sits outside this layer so it never scrolls away. */
.koma-start-modal__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--ksm-pad);
}

.koma-start-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition:
    background-color 200ms var(--ksm-ease),
    color 200ms var(--ksm-ease),
    border-color 200ms var(--ksm-ease);
}

.koma-start-modal__close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  fill: none;
}

.koma-start-modal__title {
  margin: 0 0 32px;
  padding: 0 32px;
  font-size: 42px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-align: center;
  color: #ffffff;
  text-wrap: balance;
}

/* Plan cards: darker glass layers inside the parent glass
   ========================================================================== */

.koma-start-modal__plans {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.koma-start-modal__card {
  position: relative;
  padding: 24px 24px 22px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  background:
    radial-gradient(90% 120% at 0% 0%, rgba(1, 155, 78, 0.05), rgba(1, 155, 78, 0) 55%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.42) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 30px -18px rgba(0, 0, 0, 0.7);
}

.koma-start-modal__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.koma-start-modal__name {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.koma-start-modal__price {
  margin: 0;
  flex: none;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: #ffffff;
  white-space: nowrap;
}

.koma-start-modal__period {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ksm-muted);
}

.koma-start-modal__desc {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0.1px;
  color: var(--ksm-muted);
}

.koma-start-modal__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  padding: 0 24px;
  border: 0;
  border-radius: 9999px;
  background: var(--ksm-green);
  color: #0a0a0a;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 6px 20px -10px rgba(1, 155, 78, 0.45);
  transition:
    transform 300ms var(--ksm-ease),
    filter 300ms var(--ksm-ease),
    box-shadow 300ms var(--ksm-ease),
    opacity 200ms var(--ksm-ease);
}

.koma-start-modal__cta:active {
  transform: translateY(0) scale(0.99);
}

.koma-start-modal__cta:focus-visible,
.koma-start-modal__close:focus-visible {
  outline: 2px solid #0aa859;
  outline-offset: 3px;
}

.koma-start-modal__cta[aria-busy="true"] {
  cursor: progress;
  opacity: 0.86;
  transform: none;
  filter: none;
}

.koma-start-modal__spinner {
  display: none;
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid rgba(10, 10, 10, 0.25);
  border-top-color: #0a0a0a;
  border-radius: 50%;
  animation: koma-start-modal-spin 800ms linear infinite;
}

.koma-start-modal__cta[aria-busy="true"] .koma-start-modal__spinner {
  display: block;
}

@keyframes koma-start-modal-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Foundation stays available but visually secondary to Operator. */
.koma-start-modal__card:not(.is-primary) .koma-start-modal__cta {
  background: transparent;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.koma-start-modal__card:not(.is-primary) .koma-start-modal__spinner {
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
}

.koma-start-modal__free {
  margin: 18px 0 0;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  color: var(--ksm-muted);
}

.koma-start-modal__free a {
  color: var(--ksm-muted);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.25);
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.koma-start-modal__free a:hover,
.koma-start-modal__free a:focus-visible {
  color: #ffffff;
  text-decoration-color: currentColor;
}

/* Payment reassurance under each plan CTA */
.koma-start-modal__assure {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 10px 0 0;
  text-align: center;
}

.koma-start-modal__assure-terms {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.1px;
  color: rgba(255, 255, 255, 0.78);
}

.koma-start-modal__assure-secure {
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.1px;
  color: var(--ksm-muted);
  opacity: 0.8;
}

.koma-start-modal__error {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0.1px;
  color: #ff8f8f;
  text-align: center;
}

.koma-start-modal__error:empty {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .koma-start-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.14);
    color: #ffffff;
  }

  .koma-start-modal__cta:not([aria-busy="true"]):hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      0 10px 30px -10px rgba(1, 155, 78, 0.55);
  }

  .koma-start-modal__card:not(.is-primary) .koma-start-modal__cta:not([aria-busy="true"]):hover {
    filter: none;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
  }
}

/* Mobile: tuned separately, not a scaled-down desktop
   ========================================================================== */

@media (max-width: 600px) {
  .koma-start-modal {
    --ksm-pad: 20px;
    --ksm-gutter: 12px;
  }

  .koma-start-modal__dialog {
    border-radius: 22px;
  }

  .koma-start-modal__body {
    padding: 26px 18px 18px;
  }

  .koma-start-modal__close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
  }

  .koma-start-modal__title {
    margin-bottom: 24px;
    padding: 0 40px;
    font-size: 32px;
    line-height: 1.12;
  }

  .koma-start-modal__plans {
    gap: 12px;
  }

  .koma-start-modal__card {
    padding: 18px 18px 18px;
    border-radius: 16px;
  }

  .koma-start-modal__name {
    font-size: 19px;
  }

  .koma-start-modal__price {
    font-size: 18px;
  }

  .koma-start-modal__period {
    font-size: 13px;
  }

  .koma-start-modal__desc {
    margin-top: 4px;
    font-size: 14.5px;
    line-height: 1.5;
  }

  .koma-start-modal__cta {
    min-height: 46px;
    margin-top: 14px;
  }

  .koma-start-modal__assure {
    margin-top: 8px;
  }

  .koma-start-modal__assure-terms {
    font-size: 12.5px;
  }

  .koma-start-modal__assure-secure {
    font-size: 11px;
  }

  .koma-start-modal__free {
    margin-top: 14px;
    font-size: 13.5px;
  }
}

/* Short phones (e.g. 375×667): tighten vertical rhythm a little more */
@media (max-width: 600px) and (max-height: 700px) {
  .koma-start-modal__body {
    padding-top: 22px;
  }

  .koma-start-modal__title {
    margin-bottom: 20px;
    font-size: 30px;
  }
}

/* Reduced motion: appear/disappear without movement
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .koma-start-modal__backdrop,
  .koma-start-modal__dialog,
  .koma-start-modal.is-open .koma-start-modal__backdrop,
  .koma-start-modal.is-open .koma-start-modal__dialog {
    transform: none;
    transition: none;
  }

  .koma-start-modal__cta,
  .koma-start-modal__close {
    transition: none;
  }

  .koma-start-modal__cta:not([aria-busy="true"]):hover,
  .koma-start-modal__cta:active {
    transform: none;
  }

  .koma-start-modal__spinner {
    animation: none;
    border-color: rgba(10, 10, 10, 0.45);
  }
}
