/* Homepage perspective chooser. Kept separate from the prebuilt bundles. */
.v4-chooser {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 44px;
  padding-block: clamp(180px, 18vw, 280px);
  border-top: 0;
  text-align: center;
}

.v4-chooser .eyebrow {
  justify-content: center;
  margin-bottom: 18px;
}

.v4-chooser h2 {
  margin: 0 0 18px;
  font-size: clamp(36px, 4.2vw, 54px);
  line-height: 1.12;
  text-wrap: balance;
}

.v4-chooser p:not(.eyebrow):not(.sr-only) {
  max-width: 480px;
  margin-inline: auto;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  text-wrap: balance;
}

.v4-chooser .v4-choices {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  width: min(100%, 860px);
}

.v4-chooser .v4-choices::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -120px -12px;
  pointer-events: none;
  /* Each halo fades out before reaching the background's rectangular edge. */
  background:
    radial-gradient(ellipse closest-side at 20% 55%, rgb(121 170 150 / 12%), transparent 100%),
    radial-gradient(ellipse closest-side at 50% 50%, rgb(162 155 208 / 18%), transparent 100%),
    radial-gradient(ellipse closest-side at 80% 55%, rgb(196 160 132 / 12%), transparent 100%);
}

.v4-chooser .v4-choices a[data-view="user"] {
  --choice-accent: #50755f;
  --choice-delay: 0s;
}

.v4-chooser .v4-choices a[data-view="developer"] {
  --choice-accent: #756ca6;
  --choice-delay: -.8s;
}

.v4-chooser .v4-choices a[data-view="company"] {
  --choice-accent: #936a4d;
  --choice-delay: -1.6s;
}

:root[data-theme="dark"] .v4-choices a[data-view="user"] {
  --choice-accent: #91b6a3;
}

:root[data-theme="dark"] .v4-choices a[data-view="developer"] {
  --choice-accent: #b1a9db;
}

:root[data-theme="dark"] .v4-choices a[data-view="company"] {
  --choice-accent: #d1ae91;
}

.v4-chooser .v4-choices a {
  justify-content: center;
  gap: 12px;
  min-height: 94px;
  padding: 24px 20px;
  border: 1px solid color-mix(in srgb, var(--choice-accent) 42%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--choice-accent) 13%, var(--paper));
  color: var(--ink);
  font-size: 17px;
  font-weight: 550;
  line-height: 1.4;
  box-shadow: 0 12px 32px rgb(0 0 0 / 5%);
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.v4-chooser .v4-choices a .icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--choice-accent);
}

.v4-chooser.is-awaiting-choice .v4-choices a {
  animation: choice-breathe 3.2s ease-in-out var(--choice-delay) infinite;
}

.v4-chooser .v4-choices a:hover,
.v4-chooser .v4-choices a:focus-visible {
  transform: translateY(-4px);
  border-color: var(--choice-accent);
  background: color-mix(in srgb, var(--choice-accent) 22%, var(--paper));
  animation-play-state: paused;
}

.v4-chooser .v4-choices a:focus-visible {
  outline: 2px solid var(--choice-accent);
  outline-offset: 6px;
}

.v4-chooser .v4-choices a[aria-pressed="true"] {
  border-color: var(--choice-accent);
  background: color-mix(in srgb, var(--choice-accent) 24%, var(--paper));
  box-shadow: inset 0 2px var(--choice-accent), 0 12px 32px rgb(0 0 0 / 5%);
}

@keyframes choice-breathe {
  0%, 100% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--choice-accent) 0%, transparent),
      0 12px 32px rgb(0 0 0 / 5%);
  }
  50% {
    box-shadow:
      0 0 0 6px color-mix(in srgb, var(--choice-accent) 10%, transparent),
      0 12px 38px color-mix(in srgb, var(--choice-accent) 16%, transparent);
  }
}

/* Animate the incoming guide while keeping section anchors in a stable position. */
#choose-your-view + #persona-content > .v4-section > .wrap {
  animation: perspective-reveal 420ms cubic-bezier(.22, 1, .36, 1) backwards;
}

#choose-your-view + #persona-content > .v4-section:nth-child(2) > .wrap {
  animation-delay: 50ms;
}

#choose-your-view + #persona-content > .v4-section:nth-child(3) > .wrap {
  animation-delay: 100ms;
}

#choose-your-view + #persona-content > .v4-section:nth-child(4) > .wrap {
  animation-delay: 150ms;
}

@keyframes perspective-reveal {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .v4-chooser {
    gap: 34px;
    padding-block: 160px 180px;
  }

  .v4-chooser .v4-choices {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    max-width: 360px;
  }

  .v4-chooser .v4-choices::before {
    inset: -64px -14px;
    background: radial-gradient(ellipse at center, rgb(162 155 208 / 18%), transparent 70%);
  }

  .v4-chooser .v4-choices a {
    min-height: 82px;
    padding: 22px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #choose-your-view + #persona-content > .v4-section > .wrap {
    animation: none;
  }

  .v4-chooser .v4-choices a,
  .v4-chooser.is-awaiting-choice .v4-choices a {
    animation: none;
    transition: none;
    transform: none;
    border-color: var(--choice-accent);
  }
}

/* Keep V5 guide content independent from the restored selector. */
.v5-active-guide-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.v5-active-guide-label { color: var(--persona-accent); font-size: 13px; font-weight: 600; }
.v5-active-guide-bar a { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); font-size: 12px; text-underline-offset: 4px; }
.v5-active-guide-bar a:hover { color: var(--persona-accent); text-decoration: underline; }
#persona-content { scroll-margin-top: 104px; }
#persona-content[data-experience="user"] { --persona-accent: #47735b; }
#persona-content[data-experience="developer"] { --persona-accent: var(--indigo); }
#persona-content[data-experience="company"] { --persona-accent: #8b6941; }
:root[data-theme="dark"] #persona-content[data-experience="user"] { --persona-accent: #94b8a0; }
:root[data-theme="dark"] #persona-content[data-experience="company"] { --persona-accent: #c3a276; }
