/*
 * Homepage page-modes scene: "One page. Every move you make."
 * A tall track pins one phone while its screen, the label list and the copy step through the
 * page modes (marketing-page-modes-scene.js sets .is-active from scroll progress).
 * Markup: buildPageModesSceneHtml() in scripts/lib/marketing-sections.mjs.
 */

.dims-modes {
  --dims-modes-ink: #000;
  --dims-modes-muted: #6e6e73;
  --dims-modes-off: #d2d2d7;
  --dims-modes-grad: linear-gradient(90deg, #f2541b 0%, #e0218a 55%, #7c3aed 100%);
  --dims-modes-ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* Phone height, and the rest of the stage's content stack (dots, plus copy on mobile). */
  --dims-modes-ph: min(70svh, 660px);
  --dims-modes-stack: 3.5rem;
  position: relative;
  width: 100%;
  background: #fff;
  color: var(--dims-modes-ink);
}

.dims-modes *,
.dims-modes *::before,
.dims-modes *::after {
  box-sizing: border-box;
}

.dims-modes__intro {
  position: relative;
  z-index: 2;
  padding: clamp(4rem, 9vw, 7rem) var(--dims-section-pad-x, 1.5rem) 0;
  text-align: center;
}

/* Same headline format as the bento + pricing titles. */
.dims-modes__title {
  margin: 0 auto;
  max-width: 24ch;
  font-family: "SF Pro Display Medium", "SF Pro Display Medium Placeholder", system-ui, -apple-system, sans-serif;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: #0f172a;
  text-align: center;
  text-wrap: balance;
}

/* Same subline format as the feature-paths section. */
.dims-modes__sub {
  max-width: 38rem;
  margin: 1rem auto 0;
  font-family: "SF Pro Display Regular", "SF Pro Display Regular Placeholder", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(11, 20, 40, 0.64);
  text-align: center;
  text-wrap: balance;
}

/*
 * The stage centres the phone in a full-height sticky viewport, which would leave an empty band
 * under the heading. Pull the track up by that band (minus a small gap) so the phone sits right
 * under the copy as the section scrolls in.
 */
.dims-modes__track {
  position: relative;
  height: 600vh;
  margin-top: min(0px, calc((var(--dims-modes-ph) + var(--dims-modes-stack) - 100svh) / 2 + 2rem));
}

.dims-modes__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--dims-nav-h, 4.25rem) * 0.6);
  overflow: hidden;
}

.dims-modes__grid {
  width: 100%;
  max-width: calc(1180px + 2 * var(--dims-section-pad-x, 1.5rem));
  margin-inline: auto;
  padding-inline: var(--dims-section-pad-x, 1.5rem);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
}

/* ---------- Mode labels (left) ---------- */

.dims-modes__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
  justify-items: start;
}

.dims-modes__list button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.1rem 0;
  cursor: pointer;
  font-family: var(--dims-font);
  font-weight: 600;
  font-size: clamp(1.5rem, 2.6vw, 2.375rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--dims-modes-off);
  text-align: left;
  transform-origin: 0 50%;
  transition:
    color 0.5s var(--dims-modes-ease),
    transform 0.6s var(--dims-modes-ease);
}

.dims-modes__list button:hover {
  color: #a1a1a6;
}

.dims-modes__list button:focus-visible {
  outline: 2px solid #0066ff;
  outline-offset: 4px;
  border-radius: 6px;
}

.dims-modes__list li.is-active button {
  color: var(--dims-modes-ink);
  transform: translateX(6px);
}

.dims-modes__new {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--dims-modes-grad);
  color: #fff;
  font-family: var(--dims-font);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: 0.6em;
  opacity: 0.35;
  transition: opacity 0.5s var(--dims-modes-ease);
}

.dims-modes__list li.is-active .dims-modes__new {
  opacity: 1;
}

/* ---------- Phone (center) ---------- */

.dims-modes__device {
  --ph: var(--dims-modes-ph);
  position: relative;
  width: calc(var(--ph) * 498 / 1024);
}

/* Dark frame; the 498px screenshots carry a white rim + rounded corners that .__scr crops off. */
.dims-modes__phone {
  position: relative;
  aspect-ratio: 498 / 1024;
  width: 100%;
  padding: 2.6%;
  border-radius: 17.5% / 8.5%;
  background: linear-gradient(150deg, #3a3a3f 0%, #121214 22%, #0b0b0c 70%, #2a2a2e 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 0 1px rgba(0, 0, 0, 0.18),
    0 60px 100px -40px rgba(0, 0, 0, 0.55);
}

.dims-modes__scr {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 15.5% / 7.4%;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

.dims-modes__scr img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 107.4%;
  height: auto;
  max-width: none;
  transform: translate(-50%, -50%);
}

.dims-modes__scr img.dims-modes__bleed {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: none;
}

/* Dynamic island */
.dims-modes__scr::after {
  content: "";
  position: absolute;
  z-index: 5;
  top: 2.4%;
  left: 50%;
  width: 30%;
  height: 3.6%;
  margin-left: -15%;
  border-radius: 999px;
  background: #000;
  pointer-events: none;
}

.dims-modes__screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.06);
  transition:
    opacity 0.7s var(--dims-modes-ease),
    transform 1.1s var(--dims-modes-ease);
}

.dims-modes__screen.is-active {
  z-index: 1;
  opacity: 1;
  transform: none;
}

/* Soft blurred copy of the current screen glowing behind the phone. */
.dims-modes__glow {
  position: absolute;
  inset: 6% -38%;
  z-index: -1;
  pointer-events: none;
}

.dims-modes__glow img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(70px) saturate(1.8);
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 0.9s var(--dims-modes-ease),
    transform 1.2s var(--dims-modes-ease);
}

.dims-modes__glow img.is-active {
  opacity: 0.24;
  transform: none;
}

.dims-modes__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 1.75rem;
}

.dims-modes__dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--dims-modes-off);
  transition:
    width 0.5s var(--dims-modes-ease),
    background 0.5s var(--dims-modes-ease);
}

.dims-modes__dots i.is-active {
  width: 22px;
  background: var(--dims-modes-ink);
}

/* ---------- Copy (right) ---------- */

.dims-modes__copy {
  position: relative;
  min-height: 12rem;
  align-self: center;
}

.dims-modes__mode {
  position: absolute;
  inset: 0 auto auto 0;
  max-width: 19rem;
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition:
    opacity 0.5s var(--dims-modes-ease),
    transform 0.8s var(--dims-modes-ease);
}

.dims-modes__mode.is-active {
  opacity: 1;
  transform: none;
  transition-delay: 0.12s;
}

.dims-modes__n {
  display: block;
  margin-bottom: 0.75rem;
  font-family: "AT Brunea", ui-monospace, monospace;
  font-size: 1.125rem;
  color: transparent;
  background-image: var(--dims-modes-grad);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Same headline face as the section titles (SF Pro Display Medium 500). */
.dims-modes__mode h3 {
  display: none;
  margin: 0 0 0.5rem;
  font-family: "SF Pro Display Medium", "SF Pro Display Medium Placeholder", system-ui, -apple-system, sans-serif;
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: #0f172a;
}

.dims-modes__mode p {
  margin: 0;
  font-family: var(--dims-font-medium);
  font-size: clamp(1.1875rem, 1.6vw, 1.4375rem);
  line-height: 1.32;
  letter-spacing: -0.02em;
  color: #1d1d1f;
  text-wrap: pretty;
}

/* ---------- Mobile: phone on top, label + copy below ---------- */

@media (max-width: 900px) {
  .dims-modes__track {
    height: 500vh;
  }
  .dims-modes__grid {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 1.25rem;
  }
  .dims-modes__list {
    display: none;
  }
  .dims-modes {
    --dims-modes-ph: min(54svh, 520px);
    --dims-modes-stack: 13rem;
  }
  .dims-modes__dots {
    margin-top: 1.1rem;
  }
  .dims-modes__copy {
    width: 100%;
    max-width: 22rem;
    min-height: 8.5rem;
    text-align: center;
  }
  .dims-modes__mode {
    inset: 0 0 auto 0;
    max-width: none;
  }
  .dims-modes__n {
    display: none;
  }
  .dims-modes__mode h3 {
    display: block;
    font-size: 1.625rem;
    margin-bottom: 0.35rem;
  }
  .dims-modes__mode p {
    padding-inline: 1.25rem;
    font-family: "SF Pro Display Regular", "SF Pro Display Regular Placeholder", system-ui, -apple-system, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.45;
    color: var(--dims-modes-muted);
    text-wrap: balance;
  }
  .dims-modes__sub {
    padding-inline: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dims-modes__screen,
  .dims-modes__mode,
  .dims-modes__glow img,
  .dims-modes__list button {
    transition: none !important;
  }
}
