.material-sample-form {
  [hidden] {
    display: none !important;
  }

  .content-left {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    font-size: 1.4rem;
  }

  .material-sample-form__description > *:last-child {
    margin-bottom: 0;
  }

  .material-sample-form__material-type,
  .material-sample-form__color,
  .material-sample-form__clear-selection-button,
  .material-sample-form__selected-color-chip {
    appearance: none;
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    text-align: inherit;
    cursor: pointer;
  }

  .material-sample-form__step {
    display: flex;
    align-items: center;
    gap: 1.4rem;
  }

  .contact-form .material-sample-form__step {
    margin-bottom: 2.4rem;
  }

  .material-sample-form__step-number {
    font-weight: 600;
    font-size: 1.3rem;
    width: 2.6rem;
    height: 2.6rem;
    flex: none;
    background: rgb(var(--color-button));
    color: rgb(var(--color-button-text));
    border-radius: 0.6rem;
    display: grid;
    place-items: center;
  }

  .material-sample-form__step-title {
    font-size: 1.8rem;
    font-weight: 500;
  }

  .material-sample-form__step-subtitle {
    font-size: 1.3rem;
    font-weight: 400;
    color: rgba(var(--color-foreground), 0.65);
    margin-left: 0.6rem;

    @media (max-width: 749px) {
      display: block;
      margin-left: 0;
      margin-top: 0.3rem;
    }
  }

  .material-sample-form__material-type-description-toggle,
  .material-sample-form__address-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    width: 100%;
    appearance: none;
    background: rgba(var(--color-foreground), 0.04);
    border: 1px solid rgba(var(--color-foreground), 0.12);
    border-radius: 0.8rem;
    padding: 1.4rem 1.6rem;
    font: inherit;
    font-size: 1.4rem;
    font-weight: 500;
    color: inherit;
    text-align: inherit;
    cursor: pointer;
    transition: var(--duration-default);

    &:hover {
      background: rgba(var(--color-foreground), 0.07);
    }
  }

  .material-sample-form__material-type-description-toggle-icon,
  .material-sample-form__address-toggle-icon {
    display: flex;
    flex: none;

    svg {
      width: 1.6rem;
      height: 1.6rem;
      transition: var(--duration-default);
      transform: rotate(90deg);
    }
  }

  .material-sample-form__material-type-description-toggle[aria-expanded="true"] .material-sample-form__material-type-description-toggle-icon svg,
  .material-sample-form__address-toggle[aria-expanded="true"] .material-sample-form__address-toggle-icon svg {
    transform: rotate(-90deg);
  }

  .material-sample-form__material-type-description {
    margin-top: 1.2rem;
    font-size: 1.4rem;
  }

  .material-sample-form__address-group {
    margin-bottom: 2.4rem;
  }

  .material-sample-form__address-fields {
    margin-top: 1.6rem;
  }

  .material-sample-form__required-marker {
    color: rgb(var(--color-error, 180, 30, 27));
    margin-left: 0.3rem;
  }

  /* Toggled via setupRequiredFieldValidation() in material-sample-form.js when a submit
     attempt finds an empty/invalid required field, since native browser validation can't
     focus or highlight fields hidden inside the collapsed address dropdown. */
  .contact-form [aria-invalid="true"] {
    border-color: rgba(var(--color-error-border));
  }

  .material-sample-form__address-toggle[aria-invalid="true"] {
    border-color: rgba(var(--color-error-border));
    color: rgb(var(--color-error, 180, 30, 27));
  }

  .material-sample-form__material-type-list,
  .material-sample-form__color-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.6rem;

    @media (min-width: 500px) {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    @media (min-width: 625px) {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    @media (min-width: 950px) {
      grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    @media (min-width: 1199px) {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    @media (min-width: 1400px) {
      grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    @media (min-width: 1600px) {
      grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    @media (min-width: 1800px) {
      grid-template-columns: repeat(7, minmax(0, 1fr));
    }
  }

  .material-sample-form__material-type,
  .material-sample-form__color {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-radius: 0.9rem;
    border: 1.5px solid transparent;
    padding: 2rem;
    text-align: center;
    background-color: rgba(var(--color-foreground), 0.04);
    transition: var(--duration-default);

    &:hover {
      background-color: rgba(var(--color-foreground), 0.07);
    }

    &.material-sample-form__material-type--selected {
      border-color: rgb(var(--color-foreground));
      background-color: transparent;
    }
  }

  .material-sample-form__color {
    position: relative;
    padding: 0.9rem;
    background-color: unset !important;
    text-align: left;
    font-weight: 500;
    border: 1px solid rgba(var(--color-foreground), 0.12);

    &:hover {
      box-shadow: 0 1.4rem 3.4rem -2.2rem rgba(0, 0, 0, 0.45);
    }

    &[aria-pressed="true"] {
      border-color: rgb(var(--color-foreground));
      box-shadow: 0 0 0 1.5px rgb(var(--color-foreground));
    }

    &[disabled] {
      opacity: 0.4;
      cursor: not-allowed;
    }
  }

  .material-sample-form__material-type-swatch,
  .material-sample-form__color-swatch {
    position: relative;
    display: block;
    border-radius: 0.3rem;
    overflow: hidden;

    &:after {
      content: '';
      position: absolute;
      inset: 0;
      box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), inset 0 -1.2rem 1.8rem -1.2rem rgba(0, 0, 0, 0.28);
      border-radius: 0.3rem;
    }

    img {
      border-radius: 0.3rem;
      display: block;
      width: 100%;
      height: auto;
    }
  }

  .material-sample-form__color-check {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    background: rgb(var(--color-button));
    color: rgb(var(--color-button-text));
    display: grid;
    place-items: center;
    transform: scale(0);
    transition: transform 0.25s cubic-bezier(.34, 1.56, .64, 1);
    z-index: 2;

    svg {
      width: 1.2rem;
      height: 1.2rem;
    }
  }

  .material-sample-form__color[aria-pressed="true"] .material-sample-form__color-check {
    transform: scale(1);
  }

  .material-sample-form__color-label {
    font-size: 1.3rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .material-sample-form__color-label-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .material-sample-form__color-code {
    font-size: 1.05rem;
    color: rgba(var(--color-foreground), 0.55);
    font-variant-numeric: tabular-nums;
    font-weight: 400;
    flex: none;
  }

  .material-sample-form__no-results-message {
    color: rgba(var(--color-foreground), 0.65);
    font-size: 1.4rem;
    padding: 1rem 0.2rem;
  }

  .material-sample-form__toolbar {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
  }

  .material-sample-form__search {
    flex: 1;
    min-width: 22rem;
    margin: 0;

    .icon-search {
      position: absolute;
      left: 1.6rem;
      top: 50%;
      transform: translateY(-50%);
      width: 1.8rem;
      height: 1.8rem;
      color: rgba(var(--color-foreground), 0.6);
      pointer-events: none;
    }
  }

  .material-sample-form__search-input {
    padding-left: 4.8rem;
  }

  .material-sample-form__selection-summary {
    margin-top: 0.4rem;
    border: 1px solid rgba(var(--color-foreground), 0.12);
    border-radius: 0.8rem;
    background: rgba(var(--color-foreground), 0.04);
    padding: 1.6rem 1.8rem;
    display: flex;
    align-items: center;
    gap: 1.6rem;
    flex-wrap: wrap;
  }

  .material-sample-form__selection-summary-heading {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: none;

    @media (max-width: 749px) {
      flex-basis: 100%;
    }
  }

  .material-sample-form__selection-summary-label {
    font-size: 1.05rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(var(--color-foreground), 0.6);
  }

  .material-sample-form__selected-color-chip-list {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 16rem;
    max-height: 12rem;
    overflow: auto;

    @media (max-width: 749px) {
      max-height: none;
      overflow: visible;
    }
  }

  .material-sample-form__selected-color-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    background: rgb(var(--color-background));
    border: 1px solid rgba(var(--color-foreground), 0.15);
    border-radius: 999px;
    padding: 0.5rem 0.9rem 0.5rem 0.5rem;
    font-size: 1.25rem;
    transition: 0.2s;

    &:hover {
      border-color: rgb(var(--color-foreground));
    }

    &:hover .material-sample-form__selected-color-chip-remove-icon {
      color: rgb(var(--color-foreground));
    }
  }

  .material-sample-form__selected-color-chip-swatch {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
    flex: none;
  }

  .material-sample-form__selected-color-chip-remove-icon {
    display: inline-flex;
    color: rgba(var(--color-foreground), 0.6);

    svg {
      width: 1rem;
      height: 1rem;
    }
  }

  .material-sample-form__selected-color-chip-list-empty-message {
    color: rgba(var(--color-foreground), 0.65);
    font-size: 1.3rem;
  }

  .material-sample-form__selected-color-count {
    flex: none;
    font-weight: 600;
    font-size: 1.25rem;
    background: rgb(var(--color-button));
    color: rgb(var(--color-button-text));
    border-radius: var(--border-radius-button);
    padding: 0.8rem 1.4rem;
  }

  .material-sample-form__clear-selection-button {
    flex: none;
    border: 1px solid rgb(var(--color-foreground));
    font-weight: 600;
    font-size: 1.25rem;
    padding: 0.8rem 1.4rem;
    border-radius: var(--border-radius-button);
    transition: 0.2s;

    &:hover {
      background: rgb(var(--color-foreground));
      color: rgb(var(--color-background));
    }
  }

  .material-sample-form__sample-limit-reached-message {
    font-size: 1.25rem;
    color: rgb(var(--color-error, 180, 30, 27));
  }

  .material-sample-form__color-wish-input {
    resize: none;
    overflow: hidden;
  }

  .contact-form__bottom .button {
    background-color: #2f2f2f;
    color: #ffffff;
  }

  .contact-form__bottom .button:hover {
    background-color: #1a1a1a;
    color: #ffffff;
  }
}

.product-form__controls.product-form__controls--colors legend {
  margin-bottom: calc(0.8rem + 10px);
}