/* GRIDS */

.grid {
  display: grid;

  &.base {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-gap: 1rem;
  }

  &.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-gap: 1rem;
  }

  &.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-gap: 1rem;
  }

  &.six {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-gap: 1rem;
  }

  &.bottom-margin-l {
    margin-bottom: 16px;
  }

  .column {

    &.xs {
      grid-column: span 1;
    }

    &.s {
      grid-column: span 2;
    }

    &.l {
      grid-column: span 10;
    }

    &.xl {
      grid-column: span 11;
    }

    &.full {
      grid-column: span 12;
    }

    &.tray-area {
      grid-column: span 4;
      position: relative;
    }

    &.tray-area.narrow {
      grid-column: span 3;
    }

    &.products-area {
      grid-column: span 8;
    }

    &.products-area.wide {
      grid-column: span 9;
    }

    &.h-span-2 {
      grid-column: span 2;
    }

    &.h-span-3{
      grid-column: span 3;
    }

    &.h-span-4 {
      grid-column: span 4;
    }

    &.h-span-5 {
      grid-column: span 5;
    }

    &.h-span-6 {
      grid-column: span 6;
    }

    &.h-span-7 {
      grid-column: span 7;
    }

    &.h-span-8 {
      grid-column: span 8;
    }

    &.h-span-9 {
      grid-column: span 9;
    }

    &.h-span-10 {
      grid-column: span 10;
    }

    &.h-span-11 {
      grid-column: span 11;
    }

    &.h-span-12 {
      grid-column: span 12;
    }

  }

  &.three .column.span-2 {
    grid-column: span 2;
  }

  &.three .column.span-3 {
    grid-column: span 3;
  }

}

/* ICONS */

.icon-type, .icon-act {
  font-family: 'MaharamNeue';
  font-size: 14px;
  padding: 5px 5px 5px 0;
  display: inline-block;
}

.icon {
  width: 16px;
  height: 16px;
  stroke: var(--color-black);
  fill: none;
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;

  &.small {
    width: 12px;
    height: 12px;
  }

  &.inline {
    display: inline-block;
    margin-right: 4px;
    /* vertical-align: text-top; */
  }

  svg {
    display: block;
    width: 100%;
    height: 100%;
  }

}

/* CARDS */

.card {
  position: relative;
  width: 100%;
  overflow: hidden;
  box-shadow:
    0 0 8px rgba(0, 0, 0, 0.1);
  background-color: var(--color-white);
  transform-origin: center center;
  will-change: transform, box-shadow, filter;
  transition:
    transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 320ms cubic-bezier(0.2, 0.8, 0.2, 1);

  &:hover {
    cursor: pointer;
  }

  a.card-link {
    display: block;
  }

  a.card-link .images-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
  }

  a.card-link .images-wrapper .detail-image,
  a.card-link .images-wrapper .install-image {
     position: absolute;
     width: 100%;
     aspect-ratio: 1 / 1;
     background-repeat: no-repeat;
     background-size: cover;
     background-position: center center;
  }

  a.card-link .images-wrapper .install-image {
    opacity: 0;
    transition: opacity var(--motion-duration-standard) var(--motion-ease-standard);
  }

  /* Scoped to the card rather than the link so hovering the toolbar — which
     lives outside the link — doesn't drop the install-image swap. */
  &:hover .images-wrapper .install-image {
    opacity: 1;
  }

  span.new-product {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: var(--font-size-2);
    line-height: 1;
    color: var(--color-black);
    background: rgba(255, 255, 255, 0.625);
    z-index: 5;
    padding: 7px 12px 6px 12px;
  }

  .text-wrapper {
    position: relative;
    aspect-ratio: 2.5 / 1;
  }

  &.double .text-wrapper {
    position: relative;
    aspect-ratio: 4 / 1;
  }

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

  a.card-link .product-caption {
    padding: 0.75rem 1rem 1rem 1rem;
  }

  p.product-name,
  p.product-color,
  p.product-price {
    line-height: 1.35;
  }

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

  /* -- Card Toolbar -- */

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

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

  &:hover .toolbar .tool {
    opacity: 1;
  }

  /* A favorited heart stays visible even when the card isn't hovered */
  .toolbar .tool.selected,
  .toolbar .tool.favorited {
    opacity: 1;
  }

  .toolbar .tool:hover .icon {
    stroke: var(--color-red);
    transition: opacity var(--motion-duration-standard) var(--motion-ease-standard);
  }

  .toolbar .tool.selected .icon {
    stroke: var(--color-red);
  }

  .toolbar .tool.favorited .icon {
    stroke: var(--color-red);
    fill: var(--color-red);
  }

  /* button_to wraps the icon in a <button>; strip the UA chrome so it reads
     as the same inline glyph the other tools are. */
  .toolbar .tool button {
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
  }

}

/* CHIPS */

.chip {
  display: inline-block;
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--color-gray-5);
  border-radius: 8px;
  padding: 0 16px 0 8px;
  white-space: nowrap;
  text-align: left;
  font-size: 0;
  margin: 4px;
  cursor: pointer;
  transition: all 0.2s ease;

  &.clear {
    background-color: var(--color-gray-3);
    border-radius: 0;
  }

  .icons-wrapper {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-top: 8px;
    margin-right: 4px;
  }

  .icons-wrapper .icon-wrapper {
    position: absolute;
    width: 100%;
    height: 100%;
    stroke-width: 1.5px;
    inset: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .icons-wrapper .icon-wrapper.default-state {
    opacity: 1;

    .icon {
      stroke: var(--color-green);
    }

  }

  &.clear .icons-wrapper .icon-wrapper.default-state {
    opacity: 1;

    .icon {
      stroke: var(--color-black);
      transition: stroke 0.2s ease;
    }

  }

  .icons-wrapper .icon-wrapper.hover-state {
    opacity: 0;

    .icon {
      stroke: var(--color-red);
    }

  }

  &:hover .icons-wrapper .icon-wrapper.default-state {
    opacity: 0;
  }

  &:hover .icons-wrapper .icon-wrapper.hover-state {
    opacity: 1;
  }

  &.clear:hover .icons-wrapper .icon-wrapper.default-state {
    opacity: 1;

    .icon {
      stroke: var(--color-red);
    }

  }

  &.clear:hover .icons-wrapper .icon-wrapper.hover-state {
    opacity: 0;
  }

  p.label {
    display: inline-block;
    font-size: 0.8125rem;
    line-height: 1;
    vertical-align: top;
    margin-top: 11px;
    margin-right: 2px;
    margin-bottom: 0;
  }

}

/* SORT */

.sorting-wrapper {
  width: 100%;
  height: 42px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .sort-dropdown {
    position: relative;
    user-select: none;
  }

  /* The always-visible trigger row */
  .sort-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .sort-trigger-label {
    padding: 0;
    background: none;
    font-size: 14px;
    line-height: 1;
    color: var(--color-black);
    cursor: pointer;
  }

  .sort-trigger-dir {
    padding: 6px 2px;
    background: none;
    color: var(--color-black);
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    transform: translateY(-2px);
  }

  .sort-trigger-dir svg {
    width: 14px;
    height: 14px;
    stroke: var(--color-black);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.12s;
  }

  .sort-trigger-dir.flipped svg {
    transform: scaleY(-1);
  }

  .sort-trigger-label:hover {
    color: var(--color-primary);
  }

  .sort-trigger-dir:hover svg {
    stroke: var(--color-primary);
  }

  /* The options panel — only shown when open */
  .sort-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: -20px;
    min-width: 120px;
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: 0 0 16px rgba(0,0,0,0.125);
    overflow: hidden;
    z-index: 10;
  }

  .sort-dropdown.open .sort-panel {
    display: block;
  }

  .sort-panel li {
    list-style: none;
  }

  /* The option is a <button> so it is keyboard operable; the padding lives on
     it rather than the <li> so the whole row stays the hit target. */
  .sort-panel .sort-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 20px;
    font-size: 16px;
    color: #1d1d1f;
    background: none;
    cursor: pointer;
    transition: background 0.12s;
  }

  .sort-panel .sort-option:hover {
    color: var(--color-primary);
  }

  .sort-panel li + li {
    border-top: 1px solid #e0e0e5;
  }

  .sort-panel .sort-option.active {
    color: var(--color-primary);
  }

}

/* TOOLTIPS */

.tooltip {
  position: absolute;
  display: inline-block;
  top: -28px;
  left: 50%;
  z-index: var(--z-modal);
  transform: translateX(-50%);
  min-width: 120px;
  height: 30px;
  padding: 3px 12px 0 12px;
  background-color: var(--color-black);
  border-radius: 6px;

  p {
    display: inline-block;
    width: 100%;
    font-size: 13px;
    line-height: 1;
    color: #fff;
    text-align: center;
    margin-bottom: 0;
    white-space: nowrap;
  }

}

/* PAGINATION */

.pagination-wrapper {
  text-align: center;
  padding-bottom: 48px;
}

/* Inline pagination beside the sort dropdown (product index top row) */
.pagination-inline {
  display: inline-flex;
  align-items: center;
}

ul.pagination {
  display: inline-block;
  height: 16px;
  padding: 0 0 0 0;

  li {
    display: inline-block;
    vertical-align: top;

    a.text,
    p.text {
      width: auto;
      height: 14px;
      font-size: 14px;
      line-height: 1;
      color: var(--color-text-primary);
      padding-right: 4px;
      padding-left: 4px;
      margin-bottom: 0;
      vertical-align: top;
      transition: color var(--motion-duration-standard) var(--motion-ease-standard);
    }

    a.text {
      cursor: pointer;

      &.active {
        color: var(--color-text-primary-active);
      }

      &:hover {
        color: var(--color-text-primary-hover);
      }

    }

    p.text {
      cursor: default;

      &.active {
        color: var(--color-text-primary-active);
      }

      &.product-count {
        padding-right: 0;
      }
    }

    a.icon {
      width: 20px;
      height: 20px;
      stroke: var(--color-text-primary);
      padding: 0;
      margin-bottom: 0;
      transform: translateY(-4px);
      transition: color var(--motion-duration-standard) var(--motion-ease-standard);

      &.active {
        stroke: var(--color-text-primary-active);
      }

      &:hover {
        stroke: var(--color-text-primary-hover);
      }

    }

  }

}

a.view-all {
  display: inline-block;
  height: 14px;
  margin-left: 4px;
  padding: 0 4px;
  font-size: 14px;
  line-height: 14px;
  color: var(--color-text-primary);
  vertical-align: top;
  transition: color var(--motion-duration-standard) var(--motion-ease-standard);

  &:hover {
    color: var(--color-text-primary-hover);
  }
}

/* BUTTONS */

.cta-wrapper {
  display: flex;
  /* Wraps because the PDP tray is too narrow to hold Sample + Downloads +
     the tools oval on one row at any viewport. */
  flex-wrap: wrap;
  gap: 8px;
  row-gap: 16px;
  padding-top: 8px;
  transform: translateX(-3px);
}

.cta {
  text-decoration: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  height: 56px;
  padding-right: 30px;
  padding-left: 18px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);

  .icon {
    width: 18px;
    height: 18px;
    stroke: var(--color-white);
    stroke-width: 2px;
  }

}

/* MaharamNeue sits high in its em box, so every button label is nudged down to
   optical center. Both button sizes wrap their text in a .label to get it —
   .account-button (13_account_forms.css) is the 40px sibling of .cta. */
.cta .label,
.account-button .label {
  line-height: 1;
  transform: translateY(2px);
}

.cta-primary {
  color: var(--color-white);
  border-radius: var(--radius-round);
  background-color: var(--color-primary);

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

.cta-ghost {
  color: var(--color-primary);
  border-radius: var(--radius-round);
  background-color: var(--color-primary-tint);

  &:hover {
    background-color: var(--color-primary-tint);
  }

  .icon {
    stroke: var(--color-primary);
    stroke-width: 2px;
  }
}

/* SCROLL AREA */

.scroll-area {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0 36px;
  overflow-x: visible;
  overflow-y: auto;

  /* reserve scrollbar space */
  scrollbar-gutter: stable;

  /* Firefox */
  scrollbar-width: none;

  /* old Edge / IE */
  -ms-overflow-style: none;

  &::-webkit-scrollbar {
    display: none;
  }

}

/* ACCORDION */

.accordion {
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 0;
  border-bottom: 0.625px solid var(--color-black);

  .accordion-item {
    overflow: hidden;
    border-top: 0.625px solid var(--color-black);

    input {
      display: none;
    }

    .accordion-label {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 0;
      cursor: pointer;
      font-size: 16px;
      transition: background 0.3s ease;
    }

    .accordion-icon {
      position: relative;
      width: 14px;
      height: 14px;
      flex-shrink: 0;

      &::before, &::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 14px;
        height: 1px;
        background: var(--color-black);
        border-radius: 2px;
        transform: translate(-50%, -50%);
        transition: transform 0.3s ease, opacity 0.3s ease;
      }

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

    }

    .accordion-content {
      display: grid;
      grid-template-rows: 0fr;
      transition: grid-template-rows 0.35s ease;

      & > div {
        overflow: hidden;
        margin-bottom: 24px;
      }

      p {
        max-width: 580px;
        font-size: 16px;
        line-height: 1.5;
        color: var(--color-black);
        padding: 0 22px 16px 0;
      }

    }

    input:checked + .accordion-label .accordion-icon::after {
      opacity: 0;
      transform: translate(-50%, -50%) rotate(90deg) scale(0);
    }

    input:checked ~ .accordion-content {
      grid-template-rows: 1fr;
    }

  }

}

/* TABS */

.tabs {
  width: 100%;

  .tab-labels {
    position: relative;
    display: flex;
    gap: 32px;

    .tab-label {
      appearance: none;
      border: 0;
      background: none;
      padding: 8px 0;
      margin: 0;
      font-weight: 700;
      color: var(--color-black);
      cursor: pointer;
      transition: color 220ms ease;

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

    }

  }

  .tab-underline {
    position: absolute;
    left: 0;
    bottom: 0;
    display: block;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transform: translateX(0);
    transition:
      width 500ms cubic-bezier(0.4, 0, 0.2, 1),
      transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
  }

}

.tab-panels {
  position: relative;
  padding-top: 28px;

  .tab-panel {
    position: absolute;
    inset: 28px 0 auto 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 500ms cubic-bezier(0.4, 0, 0.2, 1),
      visibility 0s linear 0ms;

    &.is-active {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
    }

    h2 {
      margin: 0 0 12px;
      font-size: 24px;
      font-weight: 400;
    }

    p {
      margin: 0;
      line-height: 1.6;
      color: var(--color-black);
    }

  }

}

/* CAROUSEL */

.carousel {
  position: relative;
  width: 100%;

  .carousel-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: calc(100% + 16px);
    padding: 8px;
    margin-left: -8px;

    &::-webkit-scrollbar {
      display: none;
    }

  }

  .carousel-item {
    flex: 0 0 calc((100% - (16px * 3)) / 4);
    min-height: 160px;
    display: grid;
    place-items: center;
    background: var(--color-white);
    padding: 16px 0;
  }

  .carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 0;
    cursor: pointer;
    background-color: transparent;

    &[hidden] {
      display: none;
    }

    svg {
      width: 36px;
      height: 36px;
      stroke: var(--color-black);
      stroke-width: 1px;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

  }

  .carousel-arrow-prev {
    left: -42px;
  }

  .carousel-arrow-next {
    right: -42px;
  }

  @media (max-width: 900px) {
    .carousel-item {
      flex: 0 0 calc((100% - 8px) / 2);
    }
  }

  @media (max-width: 560px) {
   .carousel-item {
      flex: 0 0 100%;
    }
  }

  /* Artwork variant: sized to a common height so the row stays even regardless
     of each image's aspect ratio. */

  &.artwork {
    --artwork-image-height: 528px;

    .carousel-track {
      align-items: start;
      padding: 16px 0;
    }

    /* Unlike the product carousel, artwork items aren't a fixed fraction of the
       track: every image is the same height and each item is only as wide as its
       own image, so aspect ratios are preserved and nothing is cropped. The
       min-content column keeps a long credit line wrapping to the image width
       instead of widening the item. */
    .carousel-item {
      flex: 0 0 auto;
      min-height: 0;
      padding: 0;
      grid-template-columns: min-content;
      align-content: start;
    }

    img {
      display: block;
      height: var(--artwork-image-height);
      width: auto;
      max-width: none;
    }

    .image-credit {
      display: block;
      color: var(--color-gray-20);
      font-size: var(--font-size-2);
      margin-top: var(--space-1);
    }

    @media (max-width: 900px) {
      & {
        --artwork-image-height: 380px;
      }
    }

    @media (max-width: 560px) {
      & {
        --artwork-image-height: 280px;
      }
    }

  }

}

/* MODAL */

body.modal-open {
  overflow: hidden;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.375);
  align-items: center;
  justify-content: center;

  &.open {
    display: flex;
  }

  .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: none;
    cursor: pointer;
    color: var(--color-gray-15);
    background-color: var(--color-white);
    padding: 6px;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.12);
    border-radius: 50%;

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

  .modal-box {
    position: relative;
    background: var(--color-white);
  }

  .modal-box.type-image {
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;

    #modal-content {
      width: 100%;
      height: 100%;
    }

    .img-tile {
      width: 100%;
      height: 100%;
    }

    .modal-close {
      color: var(--color-white);
    }

  }

  .modal-box.type-installation {
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;

    #modal-content {
      width: 100%;
      height: 100%;
    }
    .img-contain {
      width: 100%;
      height: 100%;
      background-repeat: no-repeat;
      background-size: cover;
      background-position: center;
    }
    .modal-close {
      color: var(--color-white);
    }

  }

  .modal-box.type-cart {
    min-width: 360px;
    text-align: center;
    border-radius: 32px;
    padding: 64px 48px 48px 48px;

    p.product-name {
      font-size: 16px;
      font-weight: 700;
      line-height: 1;
      margin-bottom: 12px;
    }

    p.product-color {
      font-size: 16px;
      font-weight: 700;
      color: #000;
      line-height: 1;
      margin-bottom: 36px;
    }

  }

}

/* TILE DOWNLOAD CHOOSER */

/* Rides on .modal + .modal-box.type-cart above; only the form needs rules. */
.tile-download-modal {

  .tile-download-intro {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 24px;
  }

  .tile-download-choices {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 36px;
  }

  .tile-download-choice {
    display: flex;
    align-items: center;
    gap: 8px;

    label {
      font-size: 14px;
      line-height: 1.5;
      cursor: pointer;
    }

    input[type="radio"] {
      flex-shrink: 0;
      cursor: pointer;
      accent-color: var(--color-primary);
    }
  }

  .tile-download-submit {
    border: none;
    cursor: pointer;
    width: 100%;
    height: 56px;
    padding: 0 24px;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-white);
    border-radius: var(--radius-round);
    background-color: var(--color-primary);
    transition: background-color var(--transition-fast);

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

}

/* PDP TOOLS */

/* The favorite / compare / palette oval that sits in the PDP tray's
   .cta-wrapper. Height and border-radius match .expandable-btn so it reads as
   the same pill; the width is content-driven since it carries no label. */

.pdp-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 56px;
  padding: 0 8px;
  border: 1px solid var(--color-gray-4);
  border-radius: 28px;
  background: var(--color-white);
  align-self: flex-start;

  .tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-gray-2);
    cursor: pointer;
    transition: background-color var(--motion-duration-standard) var(--motion-ease-standard);
  }

  /* button_to wraps the heart in a <button class="icon">; strip the UA chrome
     so it sits in the circle the same way the plain .icon divs do. */
  .tool button.icon {
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }

  .tool:hover {
    background: var(--color-black);
  }

  .tool:hover .icon {
    stroke: var(--color-white);
  }

  .tool.favorited .icon {
    stroke: var(--color-red);
    fill: var(--color-red);
  }

}

/* EXPANDABLE BUTTON */

/* Outer shell */
/* border-radius: 28px = 50% of the 56px collapsed height.
   overflow: hidden clips children to the rounded rect.
   No fixed height — the container grows with its content. */

.expandable-btn {
  min-width: 150px;
  border-radius: 28px;
  overflow: hidden;
  background: var(--color-gray-15);
  align-self: flex-start;
  &:hover {
    background: var(--color-gray-16);
  }

  &.expandable-btn-primary {
    color: var(--color-white);
    background: var(--color-primary);
    &:hover {
      background: var(--color-primary-hover);
    }
  }

}

/* Trigger <a> */
.expandable-btn-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 24px;
  height: 56px;
  color: var(--color-white);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* The Bruce Sample link borrows the same pill but has no chevron, so the
   padding asymmetry that makes room for one would push its label off-centre. */
.bruce-sample .expandable-btn-trigger {
  justify-content: center;
  padding: 0 24px;
}

/* Icon + label grouped on the left with 8px gap */
.trigger-label {
  display: flex;
  align-items: center;
  gap: 16px;
  transform: translateY(1px);
}

.trigger-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--color-white);
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(-1px);
}

/* Chevron: points right (→) when closed */
.chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--color-white);
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(0deg);
  transform-origin: center center;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chevron: rotates clockwise to point down (↓) when open */
.expandable-btn.open .chevron {
  transform: rotate(90deg);
}

/* Sub-button wrapper */
/* grid-template-rows animates from 0 to full content height —
   works with any number of sub-buttons, no fixed px values. */
.sub-items {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.expandable-btn.open {
  .sub-items {
    grid-template-rows: 1fr;
  }

  /* Stagger reveal on open */
  .sub-btn:nth-child(1) { transition-delay: 0.10s; opacity: 1; transform: none; }
  .sub-btn:nth-child(2) { transition-delay: 0.17s; opacity: 1; transform: none; }
  .sub-btn:nth-child(3) { transition-delay: 0.24s; opacity: 1; transform: none; }
  .sub-btn:nth-child(4) { transition-delay: 0.31s; opacity: 1; transform: none; }
  .sub-btn:nth-child(5) { transition-delay: 0.38s; opacity: 1; transform: none; }

}

/* overflow: hidden on the inner div is required for the grid trick */
.sub-items-inner {
  overflow: hidden;
  padding: 0 8px 8px;
}

.sub-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: 20px;
  background: transparent;
  color: var(--color-white);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;

  &.tinted {
    background: rgba(255, 255, 255, 0.1875);
  }

  &::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  /* Hover background fades in */
  &:hover::before {
    opacity: 1;
  }

  .icon  {
    width: 16px;
    height: 16px;
    stroke: var(--color-white);
    stroke-width: 1.5px;
    position: relative;
  }

  .label {
    position: relative;
    transform: translateY(1px);
  }

}

.qty-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 28px 0;

  button {
    width: 2rem;
    height: 2rem;
    background: none;
    font-size: 1.2rem;
    color: var(--color-white);
    cursor: pointer;

    &:disabled {
      opacity: 0.35;
      cursor: not-allowed;
    }
  }

  span {
    font-size: 16px;
    min-width: 16px;
    text-align: center;
  }

  input[type="number"] {
    width: 2.25rem;
    border: none;
    background: none;
    font: inherit;
    font-size: 16px;
    color: inherit;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;

    &::-webkit-outer-spin-button,
    &::-webkit-inner-spin-button {
      appearance: none;
      margin: 0;
    }
  }
}
