/*
 * Block: Size finder
 *
 * Values here mirror the site's form system and card styling: fields use the
 * same border, radius, padding and typography as the Gravity Forms fields on
 * /contact/, the panel uses the .card border and 24px radius, and the submit
 * buttons reuse the theme's .btn markup so no button styling is repeated.
 *
 * Lives as its own stylesheet instead of in assets/scss, because the SCSS tree
 * currently does not compile: _bootscore-custom.scss line 4190 reads
 * "width: fit-content !;". Fold this into the SCSS once that is fixed.
 */

.size-finder__content h2 {
  margin-bottom: 8px;
}

.size-finder__lead {
  color: #52525b;
}

.size-finder__figure-wrap {
  margin: 24px 0;
  padding: 24px;
  border: 1px solid #e4e4e7;
  border-radius: 24px;
  background-color: #fafafa;
}

.size-finder__figure {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 auto;
  color: #18181b;
  border-radius: 8px;
}

.size-finder__steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: size-finder-step;
}

.size-finder__steps li {
  position: relative;
  counter-increment: size-finder-step;
  padding-left: 40px;
  margin-bottom: 12px;
  color: #52525b;
}

.size-finder__steps li:last-child {
  margin-bottom: 0;
}

.size-finder__steps li::before {
  content: counter(size-finder-step);
  position: absolute;
  top: 1px;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: #f4f4f5;
  color: #18181b;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.size-finder__steps strong {
  color: #18181b;
}

.size-finder__note {
  margin: 16px 0 0;
  color: #71717a;
  font-size: 14px;
  line-height: 20px;
}

/* Panel ------------------------------------------------------------------ */

.size-finder__panel {
  padding: 32px;
  border: 1px solid #e4e4e7;
  border-radius: 24px;
  background-color: #fff;
}

.size-finder__panel-title {
  margin: 0 0 4px;
  font-family: "Manrope", sans-serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: 0.4px;
  color: #18181b;
}

.size-finder__panel-text {
  margin: 0 0 24px;
  color: #71717a;
  font-size: 14px;
  line-height: 20px;
}

/* Fields ----------------------------------------------------------------- */

.size-finder__field {
  margin-bottom: 16px;
}

.size-finder__label {
  display: block;
  margin-bottom: var(--form-label-gap, 4px);
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0.4px;
  color: #18181b;
}

.size-finder__control {
  position: relative;
}

.size-finder__input {
  width: 100%;
  height: 41px;
  padding: var(--form-control-padding-y, 8px) 44px var(--form-control-padding-y, 8px)
    var(--form-control-padding-x, 12px);
  border: var(--form-control-border-width, 1px) solid #e4e4e7;
  border-radius: var(--form-control-radius, 2.5px);
  background-color: #fff;
  color: #18181b;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  appearance: textfield;
}

/* Number spinners would fight the mm suffix for the same 12px of space. */
.size-finder__input::-webkit-outer-spin-button,
.size-finder__input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.size-finder__input:focus {
  border-color: #18181b;
  outline: none;
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}

.size-finder__input[aria-invalid="true"] {
  border-color: #dc3545;
}

.size-finder__unit {
  position: absolute;
  top: 50%;
  right: var(--form-control-padding-x, 12px);
  transform: translateY(-50%);
  color: #a1a1aa;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

.size-finder__error {
  display: none;
  margin: 4px 0 0;
  color: #dc3545;
  font-size: 14px;
  line-height: 20px;
}

.size-finder__error.is-visible {
  display: block;
}

.size-finder__actions {
  margin-top: 8px;
}

/* Result ----------------------------------------------------------------- */

.size-finder__result:empty {
  display: none;
}

.size-finder__result {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid #e4e4e7;
}

.size-finder__verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 12px;
  border-radius: 9999px;
  background-color: #f4f4f5;
  color: #3f3f46;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
}

.size-finder__result--fits .size-finder__verdict {
  background-color: #ecfdf5;
  color: #065f46;
}

.size-finder__result--close .size-finder__verdict {
  background-color: #fff7ed;
  color: #9a3412;
}

.size-finder__result-title {
  margin: 0 0 8px;
  font-family: "Manrope", sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: 0.4px;
  color: #18181b;
}

.size-finder__result-text {
  margin: 0 0 20px;
  color: #52525b;
}

.size-finder__specs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.size-finder__spec {
  flex: 1 1 8rem;
  padding: 12px 16px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background-color: #fafafa;
}

.size-finder__spec dt {
  margin: 0 0 2px;
  color: #71717a;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 16px;
}

.size-finder__spec dd {
  margin: 0;
  color: #18181b;
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.size-finder__alternatives {
  margin: 0 0 20px;
  color: #71717a;
  font-size: 14px;
  line-height: 20px;
}

/* Leave your size ------------------------------------------------------- */

.size-finder__lead-form[hidden] {
  display: none;
}

.size-finder__lead-form {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e4e4e7;
}

.size-finder__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.size-finder__feedback {
  margin: 12px 0 0;
  color: #065f46;
  font-size: 14px;
  line-height: 20px;
}

.size-finder__feedback--error {
  color: #dc3545;
}

@media (max-width: 575.98px) {
  .size-finder__panel {
    padding: 24px;
  }

  .size-finder__figure-wrap {
    padding: 16px;
  }
}

/* Text fields have no mm suffix, so they use the plain inset on both sides. */
.size-finder__input--text {
  padding-right: var(--form-control-padding-x, 12px);
}

/* Dark section variant --------------------------------------------------- */

/*
 * The theme forces every p inside .bg-color-dark-blue to white, which would
 * make the white panel unreadable, and the step text is not a p at all so it
 * would stay dark grey on dark blue. Both are corrected here rather than by
 * dropping the dark option from the block.
 */
.bg-color-dark-blue .size-finder__steps li,
.bg-color-dark-blue .size-finder__lead {
  color: rgba(255, 255, 255, 0.9);
}

.bg-color-dark-blue .size-finder__steps strong {
  color: #fff;
}

.bg-color-dark-blue .size-finder__figure-wrap {
  border-color: rgba(255, 255, 255, 0.16);
  background-color: rgba(255, 255, 255, 0.06);
}

.bg-color-dark-blue .size-finder__panel p:not(.subtitle) {
  color: #71717a !important;
}

.bg-color-dark-blue .size-finder__panel .size-finder__panel-title,
.bg-color-dark-blue .size-finder__panel .size-finder__label {
  color: #18181b !important;
}

.bg-color-dark-blue .size-finder__panel .size-finder__result-text,
.bg-color-dark-blue .size-finder__panel .size-finder__alternatives {
  color: #52525b !important;
}

/* Measuring illustration ------------------------------------------------- */

/*
 * The width and depth guides sit at half strength until the matching field has
 * focus, so the drawing answers "which number goes where" while typing.
 */
.size-finder__dim {
  opacity: 0.45;
  transition: opacity 0.25s ease;
}

.size-finder__area {
  transition: fill 0.25s ease, stroke-width 0.25s ease;
}

.size-finder.is-measuring-width-left .size-finder__dim--width-left,
.size-finder.is-measuring-width-right .size-finder__dim--width-right,
.size-finder.is-measuring-depth .size-finder__dim--depth {
  opacity: 1;
}

.size-finder.is-measuring-width-left .size-finder__area--left,
.size-finder.is-measuring-width-right .size-finder__area--right,
.size-finder.is-measuring-depth .size-finder__area--left {
  fill: #ffedd5;
}

/* Result reveal ---------------------------------------------------------- */

.size-finder__result.is-revealed {
  animation: size-finder-reveal 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes size-finder-reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.size-finder__verdict i {
  font-size: 12px;
}

/* Buttons report their own progress while a request is in flight. */
.size-finder__lead-form button[disabled] {
  cursor: progress;
}

@media (prefers-reduced-motion: reduce) {
  .size-finder__result.is-revealed {
    animation: none;
  }

  .size-finder__dim,
  .size-finder__area {
    transition: none;
  }
}

/*
 * The theme colours every paragraph on the site, so the two states that carry
 * meaning through colour have to say so louder than that rule does.
 */
.size-finder .size-finder__error {
  color: #dc3545 !important;
}

.size-finder .size-finder__feedback {
  color: #065f46 !important;
}

.size-finder .size-finder__feedback--error {
  color: #dc3545 !important;
}
