/* How Bookme Works — homepage step slider */

.bm-how {
  /* Match primary CTA brand blue (--blue-brand-dark / --sky-brand-dark) */
  --bm-navy: #0e1726;
  --bm-blue: #0165a3;
  --bm-muted: rgba(14, 23, 38, 0.62);
  position: relative;
  background: #ebf8ff; /* sky-50 — same band as Features / 3-steps */
  padding: 3.5rem 1rem 4rem;
  /* visible so overhanging phone cards aren't clipped */
  overflow: visible;
}

@media (min-width: 1024px) {
  .bm-how {
    padding: 5rem 1.5rem 5.5rem;
  }
}

.bm-how__inner {
  max-width: 1120px;
  margin: 0 auto;
}

.bm-how__header {
  text-align: center;
  margin-bottom: 2rem;
}

@media (min-width: 1024px) {
  .bm-how__header {
    margin-bottom: 2.75rem;
  }
}

.bm-how__title {
  margin: 0 auto 0.65rem;
  max-width: 18ch;
  text-wrap: balance;
}

.bm-how__subtitle {
  margin: 0 auto;
  max-width: 36rem;
  color: var(--bm-muted);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.5;
}

/* Step tabs — always one horizontal row; shrink type/spacing on narrow screens */
.bm-how__tabs {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  gap: clamp(0.28rem, 1.2vw, 0.55rem);
  margin: 0 auto 1.75rem;
  max-width: 56rem;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
}

.bm-how__tab {
  appearance: none;
  border: 1px solid rgba(14, 23, 38, 0.1);
  background: #f4f7fa;
  color: var(--bm-navy);
  border-radius: 999px;
  padding: clamp(0.35rem, 1.2vw, 0.5rem) clamp(0.4rem, 1.4vw, 0.85rem);
  font-size: clamp(0.62rem, 1.55vw, 0.8rem);
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 14rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  white-space: nowrap;
  overflow: hidden;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    transform 0.2s ease;
}

.bm-how__tab span {
  color: var(--bm-blue);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.bm-how__tab em {
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.bm-how__tab.is-active {
  background: var(--bm-navy);
  border-color: var(--bm-navy);
  color: #fff;
}

.bm-how__tab.is-active span {
  /* Keep brand blue readable on navy */
  color: #7ec8f0;
}

.bm-how__tab:hover:not(.is-active) {
  border-color: rgba(1, 101, 163, 0.35);
  transform: translateY(-1px);
}

/* Stage */
.bm-how__stage {
  position: relative;
}

.bm-how__viewport {
  position: relative;
  /* Allow phone cards to hang slightly outside the media box */
  overflow: visible;
  border-radius: 1.5rem;
  min-height: 320px;
}

@media (min-width: 1024px) {
  .bm-how__viewport {
    min-height: 420px;
    border-radius: 1.75rem;
  }
}

.bm-how__slide {
  display: none;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
  opacity: 0;
}

.bm-how__slide.is-active {
  display: grid;
  animation: bm-how-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (min-width: 1024px) {
  /* Video (left) + copy (right) — DOM order is visual then copy */
  .bm-how__slide {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 2.5rem;
  }
}

@keyframes bm-how-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Visual: lifestyle bg + floating phone label (beauty float) */
.bm-how__visual {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  /* Room so the overhanging phone isn’t clipped by neighbors */
  padding: 14px 22px 28px;
  overflow: visible;
}

.bm-how__bg {
  position: relative;
  aspect-ratio: 5 / 4;
  overflow: hidden;
  border-radius: 1.15rem;
  /* Soft floating shadow — keeps the media card lifted */
  box-shadow:
    0 10px 28px -14px rgba(14, 23, 38, 0.22),
    0 4px 12px -6px rgba(14, 23, 38, 0.12);
  background: #1a2436;
}

.bm-how__bg img,
.bm-how__bg video,
.bm-how__bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.bm-how__bg-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.bm-how__bg.is-playing .bm-how__bg-poster {
  opacity: 0;
}

.bm-how__bg-video {
  z-index: 0;
}

.bm-how__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.14);
  pointer-events: none;
}

/* Outer wrapper owns the gentle beauty float.
   Card always sits on the LEFT of the video, slightly past the edge —
   independent of whether the media column is left or right. */
.bm-how__phone-float {
  position: absolute;
  left: -8%;
  bottom: -5%;
  width: min(38%, 168px);
  aspect-ratio: 162 / 275;
  z-index: 2;
  animation: beauty-float 4s ease-in-out infinite;
  will-change: transform;
}

/* Mobile: phone inside video container, left side + left margin, a bit larger */
@media (max-width: 639px) {
  .bm-how__visual {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    overflow: visible;
  }

  .bm-how__phone-float {
    left: 8%;
    bottom: 1%;
    width: min(36%, 138px);
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .bm-how__visual {
    padding-left: 0.5rem;
    overflow: visible;
  }

  .bm-how__phone-float {
    left: 8%;
    bottom: 8%;
    width: min(34%, 148px);
  }
}

@media (min-width: 1024px) {
  .bm-how__phone-float {
    left: -8%;
    bottom: -5%;
    width: min(42%, 230px);
  }
}

.bm-how:not(.is-inview) .bm-how__phone-float {
  animation-play-state: paused;
}

/* Inner card — genie pop on step change, then stays for float */
.bm-how__phone {
  width: 100%;
  height: 100%;
  border-radius: 1.35rem;
  border: 5px solid #d9dce0;
  background: #fff;
  overflow: hidden;
  /* Soft floating shadow to match the offset label look */
  box-shadow:
    0 14px 32px -10px rgba(14, 23, 38, 0.2),
    0 6px 14px -8px rgba(14, 23, 38, 0.12);
  transform-origin: 50% 100%;
  will-change: transform, opacity;
}

@media (min-width: 640px) {
  .bm-how__phone {
    border-width: 6px;
    border-radius: 1.55rem;
  }
}

@media (min-width: 1024px) {
  .bm-how__phone {
    border-radius: 1.75rem;
  }
}

.bm-how__phone.is-genie {
  animation: bm-how-genie 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes bm-how-genie {
  0% {
    opacity: 0;
    transform: translateY(28%) scale(0.18);
    filter: blur(1px);
  }
  55% {
    opacity: 1;
    transform: translateY(-8%) scale(1.08);
    filter: blur(0);
  }
  78% {
    transform: translateY(3%) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.bm-how__phone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Copy */
.bm-how__copy {
  padding: 0.25rem 0.25rem 0.5rem;
  max-width: 30rem;
  margin: 0 auto;
}

@media (min-width: 1024px) {
  .bm-how__copy {
    margin: 0;
    padding-left: 0.5rem;
  }
}

.bm-how__num {
  display: block;
  /* A touch larger/bolder than body titles */
  font-size: clamp(1.65rem, 3.4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--bm-blue);
  margin-bottom: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.bm-how__step-title {
  margin: 0 0 0.65rem;
  color: var(--bm-navy);
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.bm-how__step-text {
  margin: 0;
  color: var(--bm-muted);
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  line-height: 1.55;
}

/* Controls — removed per client (auto-advance only); keep rules inert if stale HTML */
.bm-how__controls {
  display: none !important;
}

.bm-how__nav {
  appearance: none;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(14, 23, 38, 0.12);
  background: #fff;
  color: var(--bm-navy);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.bm-how__nav:hover {
  border-color: var(--bm-blue);
  color: var(--bm-blue);
  transform: translateY(-1px);
}

.bm-how__dots {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.bm-how__dot {
  appearance: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(14, 23, 38, 0.18);
  cursor: pointer;
  transition:
    width 0.25s ease,
    background 0.25s ease;
}

.bm-how__dot.is-active {
  width: 22px;
  background: var(--bm-blue);
}

@media (prefers-reduced-motion: reduce) {
  .bm-how__slide.is-active {
    animation: none;
  }

  .bm-how__phone-float,
  .bm-how__phone-float.animate-beauty-float,
  .bm-how__phone.is-genie {
    animation: none !important;
  }
}
