/* See ./help-me-choose.md for design notes and rationale. */
.help-me-choose {
  /* Layout ------------------------------------------------------- */
  --hmc-section-padding-block: var(--ll-space-9);
  --hmc-stack-gap: var(--ll-space-7);
  --hmc-pill-radius: var(--ll-radius-pill);
  --hmc-card-radius: var(--ds-radius-l);
  --hmc-card-padding-block-start: var(--ll-space-7);
  --hmc-card-padding-block-end: var(--ll-space-8);
  --hmc-card-padding-inline: var(--ll-space-7);
  --hmc-card-max-width: 100%;
  --hmc-intro-max-width: 100%;
  --hmc-questions-max-width: 100%;
  --hmc-grid-gap: var(--ll-space-9);

  /* Progress ----------------------------------------------------- */
  --hmc-progress-row-gap: var(--ll-space-3);
  --hmc-progress-height: 3px;
  --hmc-progress-track-bg: color-mix(in srgb, var(--ll-color-text-brand) 20%, transparent);
  --hmc-progress-fill-bg: var(--ll-color-text-brand);

  /* Typography ladders ------------------------------------------- */
  --hmc-title-size: var(--ll-text-h5-size);
  --hmc-title-line-height: var(--ll-text-h5-line-height);
  --hmc-title-letter-spacing: var(--ll-text-h5-letter-spacing);
  --hmc-title-align: center;
  --hmc-title-margin-block-end: var(--ll-space-4);
  --hmc-lede-size: var(--ds-font-size-14);
  --hmc-lede-line-height: var(--ds-line-height-body-sm);
  --hmc-lede-letter-spacing: var(--ds-letter-spacing-body-sm);
  --hmc-lede-align: center;
  --hmc-progress-label-size: var(--ds-font-size-12);
  --hmc-question-text-size: var(--ll-text-h7-size);
  --hmc-question-text-line-height: var(--ll-text-h7-line-height);
  --hmc-question-text-letter-spacing: var(--ll-text-h7-letter-spacing);
  --hmc-question-text-margin-block-end: var(--ll-space-7);
  --hmc-answer-padding-block: var(--ll-space-4);
  --hmc-answer-padding-inline: var(--ll-space-5);
  --hmc-product-name-size: var(--ll-text-h5-size);
  --hmc-product-name-line-height: var(--ll-text-h5-line-height);
  --hmc-product-name-letter-spacing: var(--ll-text-h5-letter-spacing);
  --hmc-description-size: var(--ds-font-size-14);
  --hmc-description-line-height: var(--ds-line-height-body-sm);
  --hmc-description-letter-spacing: var(--ds-letter-spacing-body-sm);
  --hmc-tagline-size: var(--ds-font-size-12);
  --hmc-tagline-margin-block-end: var(--ll-space-3);
  --hmc-product-name-margin-block-end: var(--ll-space-4);
  --hmc-cta-margin-block-start: var(--ll-space-8);
  --hmc-retake-margin-block-start: var(--ll-space-6);
  --hmc-cta-size: var(--ds-font-size-16);
  --hmc-cta-padding-block: var(--ll-space-4);
  --hmc-cta-padding-inline: var(--ll-space-6);
  --hmc-cta-display: block;
  --hmc-cta-width: auto;
  --hmc-retake-size: var(--ds-font-size-16);
  --hmc-retake-weight: var(--ds-font-weight-medium);

  /* Motion + focus ----------------------------------------------- */
  --hmc-cross-fade-duration: var(--ll-motion-exit-duration);
  --hmc-cross-fade-easing: var(--ll-motion-exit-easing);
  --hmc-enter-duration: var(--ll-motion-enter-duration);
  --hmc-enter-easing: var(--ll-motion-enter-easing);
  --hmc-progress-duration: 300ms;
  --hmc-focus-ring-color: var(--ll-color-focus-ring);
  --hmc-focus-ring-width: var(--ll-border-width-strong);
  --hmc-focus-ring-offset: var(--ll-space-2);
  --hmc-bg-color: #e8f2f5;
}

.help-me-choose__root {
  display: block;
  padding-block: var(--hmc-section-padding-block);
  background-color: var(--hmc-bg-color);
}

.help-me-choose__layout {
  display: grid;
  gap: var(--hmc-grid-gap);
  align-items: start;
  padding-inline: var(--ll-space-3);
}

.help-me-choose__intro-pane {
  max-width: var(--hmc-intro-max-width);
  transition:
    opacity var(--hmc-cross-fade-duration) var(--hmc-cross-fade-easing),
    transform var(--hmc-cross-fade-duration) var(--hmc-cross-fade-easing);
  opacity: 1;
}

.help-me-choose__intro-pane[data-state='pending'] {
  opacity: 0;
}

.help-me-choose__intro-pane[data-state='leaving'] {
  opacity: 0;
  transform: translateY(-4px);
}

.help-me-choose__title {
  font-size: var(--hmc-title-size);
  line-height: var(--hmc-title-line-height);
  letter-spacing: var(--hmc-title-letter-spacing);
  font-weight: var(--ds-font-weight-medium);
  font-family: var(--ll-text-h3-family);
  color: var(--ll-color-text-secondary);
  text-align: var(--hmc-title-align);
  margin: 0 0 var(--hmc-title-margin-block-end);
}

.help-me-choose__title:focus-visible {
  outline: var(--hmc-focus-ring-width) solid var(--hmc-focus-ring-color);
  outline-offset: var(--hmc-focus-ring-offset);
  border-radius: var(--ll-radius-sm);
}

.help-me-choose__lede {
  font-size: var(--hmc-lede-size);
  line-height: var(--hmc-lede-line-height);
  letter-spacing: var(--hmc-lede-letter-spacing);
  font-weight: var(--ds-font-weight-regular);
  font-family: var(--ll-text-body-lg-family);
  color: var(--ll-color-text-secondary);
  text-align: var(--hmc-lede-align);
}

.help-me-choose__lede > :first-child {
  margin-top: 0;
}

.help-me-choose__lede > :last-child {
  margin-bottom: 0;
}

/* Stage ---------------------------------------------------------- */
.help-me-choose__stage {
  display: block;
  position: relative;
}

.help-me-choose__panel {
  transition:
    opacity var(--hmc-cross-fade-duration) var(--hmc-cross-fade-easing);
  opacity: 1;
}

.help-me-choose__panel[hidden] {
  display: none;
}

.help-me-choose__panel[data-panel='questions'] {
  max-width: var(--hmc-questions-max-width);
  margin-inline: auto;
}

/* Progress ------------------------------------------------------- */
.help-me-choose__progress {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--hmc-progress-row-gap);
  margin-bottom: var(--ll-space-6);
}

.help-me-choose__progress-label {
  flex: 0 0 auto;
  margin: 0;
  font-size: var(--hmc-progress-label-size);
  line-height: var(--ds-line-height-tagline-sm);
  letter-spacing: var(--ds-letter-spacing-tagline-sm);
  font-weight: var(--ds-font-weight-semibold);
  font-family: var(--ll-text-body-base-family);
  color: var(--ll-color-text-brand);
  white-space: nowrap;
}

.help-me-choose__progress-current,
.help-me-choose__progress-total {
  display: inline;
}

.help-me-choose__progress-bar {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: var(--hmc-progress-height);
  background: var(--hmc-progress-track-bg);
  border-radius: var(--hmc-pill-radius);
  overflow: hidden;
}

.help-me-choose__progress-fill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: calc(var(--current, 1) / var(--total, 1) * 100%);
  background: var(--hmc-progress-fill-bg);
  border-radius: var(--hmc-pill-radius);
  transition: width var(--hmc-progress-duration) var(--hmc-enter-easing);
}

.help-me-choose__questions {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.help-me-choose__question {
  display: block;
  margin: 0;
  grid-column: 1;
  grid-row: 1;
  transition:
    opacity var(--hmc-cross-fade-duration) var(--hmc-cross-fade-easing),
    transform var(--hmc-cross-fade-duration) var(--hmc-cross-fade-easing);
  opacity: 1;
}

.help-me-choose__question[data-state='pending'] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.help-me-choose__question[hidden] {
  display: none;
}

.help-me-choose__question[data-state='leaving'] {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.help-me-choose__question-text {
  margin: 0 0 var(--hmc-question-text-margin-block-end);
  font-size: var(--hmc-question-text-size);
  line-height: var(--hmc-question-text-line-height);
  letter-spacing: var(--hmc-question-text-letter-spacing);
  font-weight: var(--ds-font-weight-medium);
  font-family: var(--ll-text-h5-family);
  color: var(--ll-color-text-secondary);
}

.help-me-choose__answers {
  display: flex;
  flex-direction: column;
  gap: var(--ll-space-5);
}

.help-me-choose__answer {
  appearance: none;
  display: flex;
  align-items: center;
  gap: var(--ll-space-5);
  width: 100%;
  padding-block: var(--hmc-answer-padding-block);
  padding-inline: var(--hmc-answer-padding-inline);
  background: var(--ll-color-bg-default);
  color: var(--ll-color-text-secondary);
  border: 0;
  border-radius: var(--hmc-pill-radius);
  font-family: var(--ll-text-body-base-family);
  font-size: var(--ll-text-body-base-size);
  line-height: var(--ll-text-body-base-line-height);
  letter-spacing: var(--ll-text-body-base-letter-spacing);
  font-weight: var(--ds-font-weight-medium);
  text-align: start;
  cursor: pointer;
  transition:
    background-color var(--ll-motion-hover-duration) var(--ll-motion-hover-easing),
    color var(--ll-motion-hover-duration) var(--ll-motion-hover-easing),
    box-shadow var(--ll-motion-hover-duration) var(--ll-motion-hover-easing),
    transform var(--ll-motion-focus-duration) var(--ll-motion-focus-easing);
}

.help-me-choose__answer-radio {
  flex: 0 0 auto;
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 1px solid var(--ll-color-text-secondary);
  border-radius: var(--ll-radius-pill);
  background: transparent;
  position: relative;
}

.help-me-choose__answer-label {
  flex: 1 1 auto;
  min-width: 0;
}

.help-me-choose__answer:hover {
  background: var(--ll-color-highlight-brand-light);
  color: var(--ll-color-text-primary);
}

.help-me-choose__answer:hover .help-me-choose__answer-radio {
  border-color: var(--ll-color-text-primary);
}

.help-me-choose__answer:focus-visible {
  outline: var(--hmc-focus-ring-width) solid var(--hmc-focus-ring-color);
  outline-offset: var(--hmc-focus-ring-offset);
}

.help-me-choose__answer:active {
  transform: scale(0.985);
}

.help-me-choose__answer[aria-checked='true'] {
  background: var(--ll-color-bg-brand);
  color: var(--ll-color-text-inverse);
}

.help-me-choose__answer[aria-checked='true'] .help-me-choose__answer-radio {
  border-color: var(--ll-color-text-inverse);
}

.help-me-choose__answer[aria-checked='true'] .help-me-choose__answer-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: var(--ll-radius-pill);
  background: var(--ll-color-text-inverse);
}

.help-me-choose__result-card {
  background: var(--ll-color-bg-default);
  border-radius: var(--hmc-card-radius);
  box-shadow: var(--ll-shadow-floating);
  padding-block: var(--hmc-card-padding-block-start) var(--hmc-card-padding-block-end);
  padding-inline: var(--hmc-card-padding-inline);
  box-sizing: border-box;
  max-width: var(--hmc-card-max-width);
  margin-inline: auto;
  text-align: center;
}

.help-me-choose__catalog {
  list-style: none;
  margin: 0;
  padding: 0;
}

.help-me-choose__product {
  display: block;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  opacity: 1;
  transition:
    opacity var(--hmc-enter-duration) var(--hmc-enter-easing),
    transform var(--hmc-enter-duration) var(--hmc-enter-easing);
}

.help-me-choose__product[hidden] {
  display: none;
}

.help-me-choose__product-tagline {
  margin: 0 0 var(--hmc-tagline-margin-block-end);
  font-size: var(--hmc-tagline-size);
  line-height: var(--ds-line-height-tagline-sm);
  letter-spacing: var(--ds-letter-spacing-tagline-sm);
  font-weight: var(--ds-font-weight-semibold);
  font-family: var(--ll-text-body-base-family);
  color: var(--ll-color-text-link);
  text-transform: uppercase;
  text-align: center;
}

.help-me-choose__product-name {
  margin: 0 0 var(--hmc-product-name-margin-block-end);
  font-size: var(--hmc-product-name-size);
  line-height: var(--hmc-product-name-line-height);
  letter-spacing: var(--hmc-product-name-letter-spacing);
  font-weight: var(--ds-font-weight-medium);
  font-family: var(--ll-text-h4-family);
  color: var(--ll-color-text-secondary);
}

.help-me-choose__product-description {
  margin: 0;
  font-size: var(--hmc-description-size);
  line-height: var(--hmc-description-line-height);
  letter-spacing: var(--hmc-description-letter-spacing);
  font-weight: var(--ds-font-weight-regular);
  font-family: var(--ll-text-body-lg-family);
  color: var(--ll-color-text-secondary);
}

.help-me-choose__product-cta-wrapper {
  margin: var(--hmc-cta-margin-block-start) 0 0;
  text-align: center;
}

.help-me-choose__product-cta {
  box-sizing: border-box;
  display: var(--hmc-cta-display);
  width: var(--hmc-cta-width);
  margin: 0;
  align-items: center;
  justify-content: center;
  padding-block: var(--hmc-cta-padding-block);
  padding-inline: var(--hmc-cta-padding-inline);
  background: var(--ll-color-bg-cta-gradient);
  color: var(--ll-color-text-inverse);
  border: 0;
  border-radius: var(--hmc-pill-radius);
  font-family: var(--ll-text-button-lg-family);
  font-size: var(--hmc-cta-size);
  line-height: var(--ds-line-height-button-lg);
  letter-spacing: var(--ds-letter-spacing-button-lg);
  font-weight: var(--ds-font-weight-medium);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--ll-motion-focus-duration) var(--ll-motion-focus-easing),
    box-shadow var(--ll-motion-hover-duration) var(--ll-motion-hover-easing);
}

.help-me-choose__product-cta:hover {
  box-shadow: var(--ll-shadow-floating-bottom);
  color: var(--ll-color-text-inverse);
}

.help-me-choose__product-cta:focus-visible {
  outline: var(--hmc-focus-ring-width) solid var(--hmc-focus-ring-color);
  outline-offset: var(--hmc-focus-ring-offset);
}

.help-me-choose__product-cta:active {
  transform: scale(0.985);
}

.help-me-choose__product-cta-context {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.help-me-choose__retake {
  margin: var(--hmc-retake-margin-block-start) 0 0;
  text-align: center;
}

.help-me-choose__retake-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: var(--ll-space-2) var(--ll-space-3);
  color: var(--ll-color-text-link);
  font-family: var(--ll-text-body-lg-family);
  font-size: var(--hmc-retake-size);
  line-height: var(--ds-line-height-body-lg);
  letter-spacing: var(--ds-letter-spacing-body-lg);
  font-weight: var(--hmc-retake-weight);
  text-decoration: underline;
  cursor: pointer;
}

.help-me-choose__retake-btn:hover {
  color: var(--ll-color-text-link-hover);
}

.help-me-choose__retake-btn:focus-visible {
  outline: var(--hmc-focus-ring-width) solid var(--hmc-focus-ring-color);
  outline-offset: var(--hmc-focus-ring-offset);
  border-radius: var(--ll-radius-sm);
}

/* Empty state ---------------------------------------------------- */
.help-me-choose__empty {
  padding: var(--ll-space-7);
  background: var(--ll-color-bg-muted);
  border-radius: var(--hmc-card-radius);
  color: var(--ll-color-text-secondary);
  text-align: center;
}

.help-me-choose__empty-message {
  margin: 0;
  font-size: var(--ll-text-body-base-size);
  line-height: var(--ll-text-body-base-line-height);
  font-family: var(--ll-text-body-base-family);
}

/* Tablet (MD) ---------------------------------------------------- */
@media (width >= 768px) {
  .help-me-choose {
    --hmc-section-padding-block: var(--ll-space-15);
    --hmc-card-padding-block-start: var(--ll-space-8);
    --hmc-card-padding-block-end: var(--ll-space-8);
    --hmc-card-padding-inline: var(--ll-space-8);
    --hmc-tagline-margin-block-end: var(--ll-space-4);
    --hmc-product-name-margin-block-end: var(--ll-space-5);
    --hmc-grid-gap: var(--ll-space-12);
    --hmc-progress-row-gap: var(--ll-space-5);
    --hmc-progress-height: 4px;
    --hmc-title-size: var(--ll-text-h3-size);
    --hmc-title-line-height: var(--ll-text-h3-line-height);
    --hmc-title-letter-spacing: var(--ll-text-h3-letter-spacing);
    --hmc-lede-size: var(--ds-font-size-18);
    --hmc-lede-line-height: var(--ds-line-height-body-lg);
    --hmc-lede-letter-spacing: var(--ds-letter-spacing-body-lg);
    --hmc-progress-label-size: var(--ds-font-size-14);
    --hmc-question-text-size: var(--ll-text-h5-size);
    --hmc-question-text-line-height: var(--ll-text-h5-line-height);
    --hmc-question-text-letter-spacing: var(--ll-text-h5-letter-spacing);
    --hmc-question-text-margin-block-end: var(--ll-space-8);
    --hmc-answer-padding-block: var(--ll-space-5);
    --hmc-product-name-size: var(--ll-text-h4-size);
    --hmc-product-name-line-height: var(--ll-text-h4-line-height);
    --hmc-product-name-letter-spacing: var(--ll-text-h4-letter-spacing);
    --hmc-description-size: var(--ds-font-size-18);
    --hmc-description-line-height: var(--ds-line-height-body-lg);
    --hmc-description-letter-spacing: var(--ds-letter-spacing-body-lg);
    --hmc-tagline-size: var(--ds-font-size-14);
    --hmc-cta-size: var(--ds-font-size-18);
    --hmc-cta-padding-block: var(--ll-space-5);
    --hmc-cta-padding-inline: var(--ll-space-7);
    --hmc-cta-display: inline-flex;
    --hmc-cta-width: 174px;
    --hmc-retake-size: var(--ds-font-size-18);
    --hmc-retake-weight: var(--ds-font-weight-regular);
  }

  .help-me-choose__layout {
    grid-template-columns: repeat(var(--ll-grid-columns), minmax(0, 1fr));
    gap: var(--hmc-grid-gap) var(--ll-grid-gutter);
    padding-inline: 0;
  }

  .help-me-choose__intro {
    grid-column: 2 / span 10;
  }

  .help-me-choose__stage {
    grid-column: 3 / span 8;
  }

  .help-me-choose__panel[data-panel='questions'] {
    margin-inline: 0;
  }
}

/* Desktop (LG) --------------------------------------------------- */
@media (width >= 1024px) {
  .help-me-choose {
    --hmc-title-align: left;
    --hmc-lede-align: left;
  }

  .help-me-choose__intro {
    grid-column: 2 / span 4;
    grid-row: 1;
  }

  .help-me-choose__stage {
    grid-column: 7 / span 5;
    grid-row: 1;
  }

  .help-me-choose__panel[data-panel='questions'] {
    padding-inline: var(--ll-space-12);
  }
}

/* Reduced motion ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .help-me-choose__intro-pane,
  .help-me-choose__panel,
  .help-me-choose__question,
  .help-me-choose__progress-fill,
  .help-me-choose__product,
  .help-me-choose__product-cta,
  .help-me-choose__answer {
    transition: none;
  }
}
