.products.index {

  h1.category-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 16px;
    text-align: center;
  }

  /* FACETED SEARCH  */

  .product-filters-tray {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    height: calc(100vh - 32px);
    overflow: hidden;
    box-shadow:
      0 0 12px rgba(0, 0, 0, 0.06),
      0 0 40px rgba(0, 0, 0, 0.08);
  }

  .faceted-search-category,
  .faceted-search-selections {
    width: 100%;
    padding: 34px 34px;
    background-color: var(--color-white);
    border-bottom: 2px solid var(--color-gray-2);
  }

  .faceted-search-category {
    padding: 36px;
    h2 {
      font-size: 14px;
      font-weight: 700;
      padding: 0;
      margin: 0;
      line-height: 1;
    }
  }

  .faceted-search-wrapper {
    padding: 28px 0 48px 0;
  }

  /* SHOP CATEGORY NAV — replaces the facet tray on the accessories page */

  .shop-category-nav {
    display: flex;
    flex-direction: column;
    padding: 28px 36px 48px 36px;

    a {
      padding: 6px 0;
      color: var(--color-black);
      text-decoration: none;
    }

    a:hover {
      text-decoration: underline;
    }

    a.active {
      font-weight: 700;
    }
  }

  .facets {
    --facet-border: #d9d9d9;
    --facet-text: var(--color-black);
    --facet-muted: #6e6e73;
    --facet-indent-1: 0;
    --facet-indent-2: 16px;
    --facet-row-padding-block: 4px;
    --facet-row-padding-inline: 0;
    --facet-panel-gap: 8px;
    --facet-transition-duration: 280ms;
    --facet-transition-ease: cubic-bezier(.2, .8, .2, 1);
    color: var(--facet-text);
  }

  .facet {
    /*border-top: 1px solid var(--facet-border);*/
  }

  .facet--level-2:last-child {
    padding-bottom: 12px;
  }

  .facet--level-2:last-child .facet-controls {
    padding-bottom: 0;
  }

  .facet:last-child {
    /*border-bottom: 1px solid var(--facet-border);*/
  }

  .facet-heading {
    margin: 0;
    font: inherit;
  }

  .facet-toggle {
    appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: var(--facet-row-padding-block) var(--facet-row-padding-inline);
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
  }

  .facet-toggle--single {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: var(--facet-row-padding-block) var(--facet-row-padding-inline);
    cursor: pointer;
  }

  .facet-toggle--single:disabled {
    cursor: default;
    opacity: 0.4;
  }

  .facet-toggle--single input {
    margin: 0;
  }

  .facet-toggle--single {
    justify-content: flex-start;
  }

  .facet-toggle--single .facet-title {
    min-width: 0;
  }

  .facet-title {
    min-width: 0;
  }

  .facet--level-1>.facet-heading .facet-toggle {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
  }

  .facet--level-2>.facet-heading .facet-toggle {
    padding-left: var(--facet-indent-2);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
  }

  .facet-icon {
    position: relative;
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
  }

  .facet-icon::before,
  .facet-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 1px;
    background: currentColor;
    transform: translate(-50%, -50%);
    transform-origin: center;
    transition: transform var(--facet-transition-duration) var(--facet-transition-ease),
      opacity var(--facet-transition-duration) var(--facet-transition-ease);
  }

  .facet-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
  }

  .facet-toggle[aria-expanded="true"] .facet-icon::after {
    transform: translate(-50%, -50%) rotate(90deg) scaleX(0);
    opacity: 0;
  }

  .facet-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--facet-transition-duration) var(--facet-transition-ease);
  }

  .facet-panel[hidden] {
    display: none;
  }

  .facet-panel-inner {
    overflow: hidden;
  }

  .facet.is-open>.facet-panel {
    grid-template-rows: 1fr;
  }

  .facet-controls {
    margin: 0;
    padding: 0 0 12px;
    border: 0;
    min-inline-size: 0;
  }

  .facet--level-2 .facet-controls {
    padding-left: var(--facet-indent-2);
  }

  .facet-options {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .facet-option {
    margin: 0;
    padding: 0;
  }

  .facet-label {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    align-items: start;
    column-gap: 6px;
    row-gap: 2px;
    padding: 4px 0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.35;
  }

  .facet-label input {
    opacity: 0;
    width: 12px;
    height: 12px;
    margin-top: 1px;
  }

  .facet-name {
    min-width: 80%;
  }

  .facet-count {
    display: none;
    color: var(--facet-muted);
    white-space: nowrap;
  }

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

  .facet-toggle:focus-visible,
  .facet-label input:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
  }

  /* PRODUCT LISTS */

  .product-list-wrapper {
    display: block;
    width: 100%;
    margin-bottom: var(--space-7);
  }

  .product-list-frames {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-gap: 1rem;
  }

  .product-list-frame {
    grid-column: span 4;
  }

  .product-filters-frame {
    position: relative;
    height: 100%;
  }

  .product-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-gap: 16px;
    transition: color var(--motion-duration-standard) var(--motion-ease-standard);
  }

  .pagination-wrapper.bottom {
    display: block;
    text-align: center;
    margin-top: var(--space-9);
  }

  @media screen and (min-width: 2400px) {

    .product-list-frame .product-list {
      grid-template-columns: repeat(6, minmax(0, 1fr));
    }

  }

}

.products.index.global {

  .search-result-section {
    margin-top: 32px;
  }

  h2.subsection-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 16px;
  }

  .product-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.products.show {

  .pdp-fullscreen-display {
    display: block;
    width: 100vw;
    height: 100vh;
    background-repeat: no-repeat;
    background-size: cover;
    margin-bottom: 16px;

  }

  .pdp-display {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-gap: 16px;
    align-items: start;
    margin-bottom: 16px;
  }

  .pdp-images-holder {
    grid-column: span 8;
  }

  .pdp-tray-holder {
    grid-column: span 4;
    position: relative;
    height: 100%;
  }

  .pdp-tray {
    position: sticky;
    top: 16px;
    z-index: var(--z-3);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-x: visible;
    width: 100%;
    height: calc(100vh - 32px);
    vertical-align: top;
    background-color: var(--color-white);
    /* border-radius: 24px; */
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.03),
      0 0 40px rgba(0, 0, 0, 0.06);
  }

  .mdp .pdp-tray {
    margin-top: -147px;
  }

  p.product-name,
  p.product-color {
    font-weight: 700;
  }

  .products-area .pdp-image,
  .pdp-images-holder .pdp-image {
    margin-bottom: 16px;
  }

  .pdp-image {
    position: relative;
  }

  /* OVERLAYS */

  .overlay {
    position: absolute;
    z-index: var(--z-overlay);
    bottom: 8px;
    right: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.3s ease,
      visibility 0s linear 0.3s;
  }

  .pdp-image:hover .overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
      opacity 0.3s ease,
      visibility 0s linear 0s;
  }

  .overlay-buttons-wrapper {
    display: flex;
    justify-content: flex-start;
    gap: 6px;
    border-radius: 10px;
    padding: 6px;
    background-color: rgba(255, 255, 255, 0.5);
  }

  .overlay-title,
  .overlay-measurement {
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    height: 28px;
    padding: 0 9px;
    background-color: rgba(255, 255, 255, 1);
    border-radius: 4px;
    cursor: default;
  }

  .overlay-title {
    p {
      font-size: 13px;
      line-height: 1;
      margin-bottom: 0;
      transform: translateY(2px);
    }
  }

  .overlay-measurement {
    width: 120px;

    p {
      font-size: 12px;
      line-height: 1;
      margin-bottom: 0;
      transform: translateY(2px);
    }

  }

  .overlay-button {
    display: inline-block;
    width: 28px;
    height: 28px;
    padding: 8px;
    background-color: rgba(255, 255, 255, 1);
    border-radius: 4px;
    /*transition: background-color var(--motion-duration-standard) var(--motion-ease-standard);*/
    cursor: pointer;

    &:hover {
      background-color: rgba(255, 255, 255, 1);
    }

    &.icon {
      stroke-width: 1.5px !important;
    }

    &:hover.icon {
      stroke: var(--color-black) !important;
    }

    &:hover {
      opacity: 1;
    }

  }

  .products-area {

    .pdp-image-3d {
      background-color: rgba(0, 0, 0, 0.125);
      aspect-ratio: 1 / 1;
    }

    .pdp-video,
    .pdp-color-search {
      aspect-ratio: 16 / 9;
      background-color: rgba(0, 0, 0, 0.125);
    }

    .pdp-image:last-child {
      margin-bottom: 0 !important;
    }

  }

  .pdp-product-info {
    display: block;
    width: 100%;
    position: relative;
    padding: 34px 36px;

    .product-caption-wrapper,
    .content-wrapper,
    .decision-drivers-wrapper,
    .mdp-description-wrapper,
    .product-price-wrapper {
      margin-bottom: 20px;
    }

    .toolbar {
      position: absolute;
      bottom: 36px;
      left: 36px;
      display: inline-block;
      text-align: left;
      min-width: 24px;
      height: 16px;
      border-radius: 0;
      padding: 0;
      margin: 0;

      .tool {
        display: inline-block;
        opacity: 1;
        margin-right: 8px;
        cursor: pointer;
        transition: opacity var(--motion-duration-standard) var(--motion-ease-standard);
      }

    }

  }

  .pdp-tray {

    p.product-brand,
    p.product-name,
    p.product-color,
    p.product-price,
    p.number-colors,
    p.decision-driver {
      font-size: 16px;
      line-height: 1.6;
      margin-bottom: 0;
      color: var(--color-black);
    }

    p.mdp-description {
      font-size: 14px;
      line-height: 1.6;
      color: var(--color-black);
      margin-bottom: 0;
    }

    p.mdp-pricing-note {
      font-size: 12px;
      line-height: 1.4;
      color: var(--color-gray-15);
      margin-top: 8px;
      margin-bottom: 0;
    }

    p.legacy-code {
      color: #B3B3AF;
    }

    p.exclusivity-message {
      font-size: 12px;
      line-height: 1.4;
      color: var(--color-gray-15);
      margin-top: 8px;
      margin-bottom: 0;
    }

  }

  .thumbnails-ui {
    height: 36px;

    .sort-button {
      background-color: transparent;
      margin-right: 16px;
      font-weight: 700;
      cursor: pointer;
      transition: color var(--motion-duration-standard) var(--motion-ease-standard);
    }

    .sort-button.active,
    .sort-button:hover {
      color: var(--color-primary);
    }
  }

  .thumbnail-options {
    display: block;
    width: 100%;
    padding-top: 36px;
    padding-bottom: 24px;

    p {
      font-size: 14px;
      line-height: 1;
      margin-bottom: 0;
    }
  }

  .thumbnails {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-gap: 12px;
    margin-bottom: 48px;
    transition: color var(--motion-duration-standard) var(--motion-ease-standard);

    .thumbnail {
      position: relative;
      width: 100%;
      transition: color var(--motion-duration-standard) var(--motion-ease-standard);

      a {
        display: block;
        width: 100%;
        img {
          padding: 6px;
          border-radius: var(--radius-round);
          overflow: hidden;
        }
      }

      &.active a img {
        padding: 5.5px;
        border: 1px solid var(--color-black);
      }

      .tooltip {
        position: fixed;
        transform: none;
        visibility: hidden;
        opacity: 0;
        transition: opacity var(--motion-duration-slow) var(--motion-ease-standard) 100ms;
      }

      &:hover .tooltip,
      &.is-open .tooltip {
        visibility: visible;
        opacity: 1;
      }

    }

    /* Isotope absolutely positions its items, which a grid container cannot
       host, so a sortable tray lays out in percentage-width blocks instead.
       Five across either way; the swatch inside is untouched. */
    &.is-sortable {
      display: block;

      .thumbnail {
        width: 20%;
      }
    }

  }

  .specifications-holder {
    display: block;
    padding-top: 16px;
    padding-bottom: 16px;
    margin-bottom: 16px;
  }

  .related-products-holder {
    display: block;
    aspect-ratio: 5 / 1;
    background-color: rgba(0, 0, 0, 0.125);
    margin-bottom: 16px;
  }

  .industry-partners-holder {
    display: block;
    aspect-ratio: 5 / 4;
    background-color: rgba(0, 0, 0, 0.125);
    margin-bottom: 16px;
  }

  .section-title-wrapper {
    margin-bottom: 16px;

    h3 {
      font-size: 24px;
      margin-bottom: 24px;
    }

    p {
      font-size: 16px;
      font-weight: 700;
      line-height: 1.5;
    }

  }

  .specifications-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-gap: 24px;
    margin-top: 32px;

    .specifications-group {
      margin-bottom: 32px;
    }

    h4 {
      font-size: 24px;
      line-height: 1.5;
      color: var(--color-black);
      margin-bottom: 16px;
    }

    p {
      font-size: 16px;
      line-height: 1.5;
      color: var(--color-black);
      margin-bottom: 24px;
    }

  }

  .three-d-image-holder {
    margin: 0;
  }

  .documents-wrapper,
  .assets-wrapper {
    grid-column: span 4;

    form {
      margin-bottom: 32px;
    }

  }

  .video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    pointer-events: none;
    overflow: hidden;

    iframe {
      width: 100%;
      height: 56.25%;
      min-height: 100%;
      min-width: 177.77%;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }

  }

  .three-sixty-wrapper {
    position: relative;
    content: "";
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #eaeaea;

    iframe {
      width: 100%;
      height: 100%;
      background-color: #eaeaea;
    }

  }

  .specifications-highlights {
    padding-right: 48px;

    p {
      line-height: 1.5;
      margin-bottom: 0;
    }

  }

  .highlights-group {
    display: block;
    margin-bottom: 16px;
  }

  /* Documents and Assets */

  ul.downloads {
    width: 100%;

    li {
      display: block;
      width: auto;
      padding: 0 96px 0 0;

      a.download-link {
        display: flex;
        align-items: center;
        height: 56px;
        cursor: pointer;
        background-color: transparent;
        border-radius: var(--radius-round);
        padding: 0 24px;
        transform: translateX(-24px);

        &:hover {
          background-color: var(--color-gray-2);
        }

        span.icon {
          position: relative;
          display: inline-block;
          flex-shrink: 0;
          width: 16px;
          height: 16px;

          &.download-type {
            stroke: var(--color-black);
            margin-right: 8px;
          }

          &.download {
            stroke: var(--color-black);
            stroke-width: 1.5px;
            opacity: 0;
          }

        }

        p.label {
          font-size: 16px;
          line-height: 1.5;
          margin: 0;
          margin-right: auto;
          transform: translateY(1.5px);
        }

        &:hover {
          span.icon.download-type {
            stroke: var(--color-black);
          }

          p.label {
            color: var(--color-black);
          }

          span.icon.download {
            opacity: 1;
          }
        }

      }
    }

  }

  /* Legend */

  .mdp-legend-image {
    position: relative;
    padding-bottom: 60px;

    .measurement-h,
    .measurement-v {
      position: absolute;
      font-size: 12px;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .measurement-h {
      bottom: 0;
      left: 0;
      width: 100%;
      height: 60px;
      text-align: left;
    }

    .measurement-v {
      top: 0;
      right: -60px;
      width: 60px;
      flex-direction: column;
      height: calc(100% - 60px);
      text-align: center;
    }

    .measurement-h:before,
    .measurement-h:after {
      content: "";
      height: 0.5px;
      background: var(--color-black);
    }

    .measurement-h:before {
      flex: 0;
    }

    .measurement-h:after {
      flex: 1;
    }

    .measurement-h span {
      padding-right: 12px;
      white-space: nowrap;
    }

    .measurement-v:before,
    .measurement-v:after {
      content: "";
      width: 0.5px;
      background: var(--color-black);
    }

    .measurement-v::before {
      flex: 0;
    }

    .measurement-v::after {
      flex: 1;
    }

    .measurement-v span {
      padding-bottom: 12px;
    }

  }

  /* Industry Partners */

  .grid.industry-partners {
    padding-top: 12px;
  }

  .manufacturer {
    padding-bottom: 16px;

    &.openable {
      transition: all 220ms ease;

      .name {
        display: inline-flex;
        align-items: center;
        gap: 12px;
        cursor: pointer;

        &::before {
          content: "";
          flex: 0 0 auto;
          width: 7px;
          height: 7px;
          border-right: 1px solid currentColor;
          border-bottom: 1px solid currentColor;
          transform: translateY(-2px) rotate(-45deg);
          transform-origin: 50% 50%;
          transition: transform 220ms ease;
        }

      }

      &.is-open {
        margin-top: 16px;

        .name::before {
          transform: translateY(-2px) rotate(45deg);
        }

      }

    }

    &:not(.openable) {
      .name {
        cursor: default;
        padding-left: 18px;
      }
    }

    .grades {
      overflow: hidden;
      max-height: 0;
      padding-left: 36px;
      transition: max-height 300ms ease;
    }

    &.openable.is-open .grades {
      max-height: 200px;
      padding-bottom: 16px;
    }

    .grade {
      display: block;
      margin-top: 6px;

      a {
        text-decoration: underline;
      }

    }

  }

  .rug-schematic {
    width: 66%;
  }

  .tab-panels {
    height: 520px;
    .tab-panel {
      height: 520px;
    }
  }
}

.leather-patterns {

  h2 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
    margin-bottom: 12px;
  }

  ul.pattern-list {
    display: block;
    margin-bottom: 12px;

    li {
      display: inline-block;
      margin-right: 8px;

      a.pattern-name {
        display: inline-block;
        font-size: 14px;
        text-decoration: none;
        color: rgba(0, 0, 0, 0.25);
        transition: color var(--motion-duration-standard) var(--motion-ease-standard);

        &:hover,
        &.active {
          color: var(--color-black);
        }
      }
    }

    @media screen and (min-width: 768px) {
      li {
        margin-right: 12px;

        a.pattern-name {
          font-size: 16px;
        }
      }
    }
  }

  .patterns {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;

    .pattern {
      position: absolute;
      width: 100%;
      opacity: 0;
      z-index: var(--z-0, 0);
      transition: opacity 0.5s ease;

      img {
        width: 100%;
        vertical-align: top;
      }

      &.active {
        opacity: 1;
        z-index: var(--z-1, 1);
      }

      .bubble-wrapper {
        position: absolute;
        z-index: 10;
        display: inline-block;
        box-sizing: border-box;
        padding: 18px;
        background: var(--color-white);
        border-radius: 18px;
        margin-top: 16px;
        margin-left: 16px;
        opacity: 0;
        transition: all 0.5s ease;

        &.top-left {
          border-top-left-radius: 0;
          transform-origin: top left;
        }

        &.delayed {
          transition: all 0.5s ease 0.25s;
        }

        &.delayed-more {
          transition: all 0.5s ease 0.5s;
        }

        .bubble-text p {
          display: inline-block;
          font-size: 14px;
          line-height: 1.1;
          color: var(--color-black);
          margin-bottom: 0;
        }
      }

      &:hover .bubble-wrapper {
        box-shadow: 0 0 48px rgba(0, 0, 0, 0.08);
        margin-top: 0;
        margin-left: 0;
        opacity: 1;
      }

      @media screen and (min-width: 768px) {
        .bubble-wrapper {
          padding: 24px;
          border-radius: 24px;
        }
      }

    }
  }

}

.rug-configurator {
  --rug-configurator-outline: #d71920;
  background: var(--color-soft-gray);
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding-block: 2rem;

  .layout {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
  }

  .canvas {
    grid-column: span 8;

    .scale {
      border-bottom: 1px solid var(--color-black);
      height: 2.4rem;
      position: relative;
      .scale-tick {
        bottom: 0;
        font-size: var(--font-size-2);
        line-height: 1;
        padding-bottom: .6rem;
        position: absolute;
        transform: translateX(-50%);
        white-space: nowrap;
        &::after {
          border-left: 1px solid var(--color-black);
          bottom: 0;
          content: "";
          height: .55rem;
          left: 50%;
          position: absolute;
        }
        &.end {
          left: 100%;
          transform: translateX(-100%);
          &::after {
            left: auto;
            right: 0;
          }
        }
      }
    }

    .canvas-grid {
      aspect-ratio: var(--rug-configurator-preview-aspect);
      background-color: #dedbd6;
      background-position: center;
      background-repeat: repeat-y;
      background-size: 100% auto;
      overflow: hidden;
      position: relative;
    }

    .canvas-mask {
      background: rgb(25 24 23 / .28);
      inset: 0;
      pointer-events: none;
      position: absolute;
      z-index: var(--z-base);
    }

    .selection {
      background: rgba(255, 255, 255, .22);
      border: 2px solid var(--rug-configurator-outline);
      cursor: grab;
      left: 0;
      min-height: 3%;
      min-width: 3%;
      position: absolute;
      top: 0;
      touch-action: none;
      transition: width var(--motion-duration-fast) var(--motion-ease-standard), height var(--motion-duration-fast) var(--motion-ease-standard), left var(--motion-duration-fast) var(--motion-ease-standard);
      z-index: var(--z-1);
    }

    .selection::before {
      background: var(--rug-configurator-outline);
      border: 2px solid var(--color-white);
      border-radius: var(--radius-round);
      box-shadow: 0 1px 4px rgba(20, 20, 20, .25);
      content: "";
      height: .55rem;
      left: -.43rem;
      opacity: 0;
      position: absolute;
      top: 50%;
      transform: translateY(-50%) scale(.7);
      transition: opacity var(--motion-duration-fast) var(--motion-ease-standard), transform var(--motion-duration-fast) var(--motion-ease-standard);
      width: .55rem;
    }

    .canvas-grid:hover .selection::before,
    .selection.is-dragging::before {
      opacity: 1;
      transform: translateY(-50%) scale(1);
    }

    .selection.is-dragging {
      cursor: grabbing;
      transition: none;
    }

  }

  .panel {
    container-type: inline-size;
    grid-column: span 4;
    padding: 36px 36px 0;

    h2 {
      font-weight: 700;
      margin-bottom: 1rem;
    }

    .form {
      display: grid;
      gap: var(--space-4);

      input,
      textarea {
        background: var(--color-white);
        border: 1px solid #a9a69f;
        border-radius: 0;
        font: inherit;
        padding: 0.5rem;
        width: 100%;

        &:focus {
          border-color: var(--rug-configurator-outline);
          outline: 2px solid transparent;
          box-shadow: 0 0 0 2px color-mix(in srgb, var(--rug-configurator-outline) 22%, transparent);
        }
      }

    }

    /* Units, Width, Length, and Offset are all reset fieldsets sharing an
       identical legend. Offset carries the .dimension class too, so it is
       styled here as well even though it sits outside .dimensions. */
    .units,
    .dimension {
      border: 0;
      margin: 0;
      min-width: 180px;
      padding: 0;

      legend {
        font-size: var(--font-size-3);
        line-height: var(--line-height-body-tight);
        margin-bottom: var(--space-2);
        padding: 0;
      }
    }

    .units {
      display: flex;
      gap: var(--space-2);

      /* Selectable unit toggle, styled as a bordered box. */
      label {
        align-items: center;
        border: 1px solid #a9a69f;
        cursor: pointer;
        display: inline-flex;
        font-size: var(--font-size-2);
        gap: var(--space-1);
        min-height: 2.75rem;
        width: 85px;
        padding: 0 var(--space-3);
        transition: border-color var(--transition-fast), background var(--transition-fast);

        &:has(input:checked) {
          background: var(--color-white);
          border-color: var(--color-black);
        }

        input {
          accent-color: var(--rug-configurator-outline);
          height: 1rem;
          margin: 0;
          padding: 0;
          width: 1rem;
        }
      }

    }

    .dimensions, .offset {
      display: grid;
      gap: var(--space-4);
      grid-template-columns: 1fr 1fr;

      /* Below ~316px the panel can't fit four 74px inputs side by side,
         so Length stacks below Width. Queries the .panel container. */
      @container (max-width: 316px) {
        grid-template-columns: 1fr;
      }
    }

    .measurements {
      display: grid;
      gap: var(--space-2);
      grid-template-columns: 85px 85px;
      justify-content: start;

      &.is-hidden {
        display: none;
      }

      /* Bordered white box wrapping a number input and its unit label. */
      .measurement {
        align-items: center;
        background: var(--color-white);
        border: 1px solid #a9a69f;
        display: flex;
        min-width: 0;
        transition: border-color var(--transition-fast), box-shadow var(--transition-fast);

        &:focus-within {
          border-color: var(--rug-configurator-outline);
          box-shadow: 0 0 0 2px color-mix(in srgb, var(--rug-configurator-outline) 22%, transparent);
        }

        input {
          border: 0;
          box-shadow: none;
          min-width: 0;
          padding-right: var(--space-1);
          text-align: right;

          &:focus {
            box-shadow: none;
            outline: 0;
          }
        }

        span {
          color: #6a6863;
          font-size: var(--font-size-2);
          padding-right: var(--space-3);
        }
      }
    }

    .center-crop {
      align-items: center;
      cursor: pointer;
      display: inline-flex;
      font-size: var(--font-size-2);
      gap: var(--space-2);

      input {
        accent-color: var(--rug-configurator-outline);
        height: 1rem;
        margin: 0;
        padding: 0;
        width: 1rem;
      }

      &:focus-within span {
        text-decoration: underline;
        text-decoration-thickness: 1px;
        text-underline-offset: 3px;
      }
    }

    .crop-summary {
      border-top: 1px solid #a9a69f;
      border-bottom: 1px solid #a9a69f;
      padding: 1em 0;

      .crop-size, .estimated-price {
        font-size: var(--font-size-2);

        display: flex;
        justify-content: space-between;

        span {
          font-size: var(--font-size-2);
        }

        strong {
          font-size: var(--font-size-3);
          font-weight: 700;
        }
      }

    }

    .colors {
      display: grid;
      gap: var(--space-2);

      > span {
        font-size: var(--font-size-3);
      }

      .color-thumbnails {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        grid-template-columns: none;
        margin: 0;

        .thumbnail {
          flex: 0 0 3rem;
          width: 3rem;

          a {
            aspect-ratio: 1;
          }

          span {
            align-items: center;
            display: flex;
            font-size: var(--font-size-1);
            height: 100%;
            justify-content: center;
          }
        }
      }
    }

    .crop-input {
      font-size: var(--font-size-2);
      span {
        color: #6a6863;
        font-size: var(--font-size-1);
      }
    }

    .submit {
      align-items: center;
      background-color: var(--color-white);
      border: 1px solid var(--color-black);
      border-radius: 28px;
      color: var(--color-black);
      display: inline-flex;
      font-size: 14px;
      font-weight: 700;
      justify-content: center;
      justify-self: start;
      min-height: 2.75rem;
      width: auto;
      padding: 0.65rem 1rem;
      text-decoration: none;
      transition: transform var(--transition-fast);

      &:hover {
        color: var(--color-white);
        background-color: var(--color-black);
      }
    }

  }


  @media (max-width: 800px) {
    margin-top: 3rem;
    padding-block: 3rem;

    .layout { grid-template-columns: 1fr; }
    .canvas, .panel { grid-column: auto; }
  }

}
