.navds-accordion {
  --__ac-accordion-header-shadow-color: var(--ac-accordion-header-border, var(--a-border-divider));
}

/*************************
 * Header *
 *************************/
.navds-accordion__header {
  --__ac-accordion-header-shadow: inset 2px 0 0 0 var(--a-transparent), inset -2px 0 0 0 var(--a-transparent),
    inset 0 2px 0 0 var(--__ac-accordion-header-shadow-color);

  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: var(--a-spacing-2);
  padding: var(--a-spacing-3);
  margin: 0;
  text-align: left;
  background: var(--ac-accordion-header-bg, var(--a-surface-transparent));
  cursor: pointer;
  border: none;
  position: relative;
  box-shadow: var(--__ac-accordion-header-shadow);
  z-index: 1;
}

.navds-accordion__header:hover {
  background-color: var(--ac-accordion-header-bg-hover, var(--a-surface-hover));
  text-decoration: underline;
  color: var(--ac-accordion-header-text-hover, inherit);
}

.navds-accordion--small .navds-accordion__header {
  padding: var(--a-spacing-2) var(--a-spacing-3);
}

.navds-accordion--medium .navds-accordion__header {
  padding: var(--a-spacing-3);
}

.navds-accordion--large .navds-accordion__header {
  padding: var(--a-spacing-4) var(--a-spacing-3);
}

.navds-accordion__item:last-child > :where(.navds-accordion__header) {
  box-shadow:
    var(--__ac-accordion-header-shadow),
    inset 0 -2px 0 0 var(--__ac-accordion-header-shadow-color);
}

.navds-accordion__item:last-child:where(.navds-accordion__item--open) :where(.navds-accordion__header) {
  box-shadow:
    inset 2px 0 0 0 var(--a-transparent),
    inset -2px 0 0 0 var(--a-transparent),
    inset 0 2px 0 0 var(--a-transparent),
    inset 0 2px 0 0 var(--__ac-accordion-header-shadow-color);
}

.navds-accordion__item:last-child:where(.navds-accordion__item--open) {
  box-shadow:
    inset 2px 0 0 0 var(--a-transparent),
    inset -2px 0 0 0 var(--a-transparent),
    inset 0 2px 0 0 var(--a-transparent),
    inset 0 -2px 0 0 var(--__ac-accordion-header-shadow-color);
}

.navds-accordion__item--open > :where(.navds-accordion__header) {
  box-shadow: var(--__ac-accordion-header-shadow);
}

.navds-accordion__header:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 3px;
  box-shadow: var(--a-shadow-focus);
  border-radius: var(--a-border-radius-large);
}

@supports not selector(:focus-visible) {
  .navds-accordion__header:focus {
    outline: none;
    box-shadow: var(--a-shadow-focus);
    border-radius: var(--a-border-radius-large);
  }
}

.navds-accordion__header-content {
  overflow: hidden;
  text-overflow: ellipsis;
}

/*************************
 * Icon *
 *************************/
.navds-accordion__icon-wrapper {
  display: grid;
  place-content: center;
  border-radius: var(--a-border-radius-medium);
  height: var(--a-spacing-6);
  width: var(--a-spacing-6);
  align-self: center;
}

.navds-accordion__header:hover > .navds-accordion__icon-wrapper {
  background-color: var(--ac-accordion-header-icon-bg-hover, var(--a-surface-neutral-subtle-hover));
}

.navds-accordion__header-chevron {
  border-radius: var(--a-border-radius-medium);
  font-size: 1.5rem;
  height: 1.75rem;
  flex-shrink: 0;
  transition: transform 150ms ease-in-out;
  align-self: center;
}

:where(.navds-accordion__header):hover > :where(.navds-accordion__icon-wrapper) > :where(.navds-accordion__header-chevron) {
  transform: translateY(1px);
}

.navds-accordion__item--open
  > :where(.navds-accordion__header)
  > :where(.navds-accordion__icon-wrapper)
  > :where(.navds-accordion__header-chevron) {
  transform: translateY(0) rotate(-180deg);
}

.navds-accordion__item--open
  > :where(.navds-accordion__header):hover
  > :where(.navds-accordion__icon-wrapper)
  > :where(.navds-accordion__header-chevron) {
  transform: translateY(-1px) rotate(-180deg);
}

/*************************
 * Variant/Default *
 *************************/
.navds-accordion__item--open {
  background-color: var(--ac-accordion-item-bg-open, var(--a-transparent));
}

/*************************
 * Variant/Neutral *
 *************************/
.navds-accordion__item--open.navds-accordion__item--neutral {
  background-color: var(--ac-accordion-neutral-item-bg-open, var(--a-surface-neutral-subtle));
}

/*************************
 * Content *
 *************************/

.navds-accordion__content {
  padding: var(--a-spacing-1) var(--a-spacing-3) var(--a-spacing-5);
  animation: fadeAccordionContent 250ms ease;
}

.navds-accordion--indent > :where(.navds-accordion__item) > :where(.navds-accordion__content) {
  padding: var(--a-spacing-1) var(--a-spacing-3) var(--a-spacing-5) var(--a-spacing-11);
}

.navds-accordion__content--closed {
  display: none;
}

.navds-accordion__item--no-animation :where(.navds-accordion__content) {
  animation: none;
}

@keyframes fadeAccordionContent {
  0% {
    opacity: 0.25;
    transform: translateY(-8px);
  }

  40% {
    opacity: 0.7;
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (forced-colors: active) {
  .navds-accordion__header {
    border: 1px solid buttonborder;
    background-color: canvas;
    color: canvastext;
  }

  .navds-accordion__header:hover {
    background-color: canvas;
    border: 1px solid highlight;
    color: highlight;
  }
}
