@import '@vtmn/css-design-tokens/src/base-colors';
@import '@vtmn/css-design-tokens/src/themes/default';
@import '@vtmn/css-design-tokens/src/typography';
@import '@vtmn/css-design-tokens/src/opacities';
@import '@vtmn/css-design-tokens/src/shadows';
@import '@vtmn/css-design-tokens/src/spacings';

.vtmn-accordion {
  box-sizing: border-box;
  display: block;
  inline-size: 100%;
  min-block-size: rem(48px);
  block-size: fit-content;
  font-family: var(--vtmn-typo_font-family);
  font-size: var(--vtmn-typo_text-2-font-size);
  line-height: var(--vtmn-typo_text-2-line-height);
  color: var(--vtmn-semantic-color_content-primary);
  font-weight: var(--vtmn-typo_font-weight--normal);
  background-color: var(--vtmn-semantic-color_background-primary);
  border-block-end: rem(1px) solid var(--vtmn-semantic-color_border-primary);
  outline: 0;
}

.vtmn-accordion--with-icon-left summary::before {
  content: '';
  mask: url("data:image/svg+xml;charset=utf-8, <svg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M1.333 8a6.666 6.666 0 1 0 13.333 0A6.666 6.666 0 0 0 1.333 8Zm12 0A5.333 5.333 0 1 1 2.667 8a5.333 5.333 0 0 1 10.666 0ZM8.667 4.667V6H7.333V4.667h1.334Zm0 6.666v-4H7.333v4h1.334Z'/></svg>");
  mask-size: cover;
  inline-size: rem(24px);
  block-size: rem(24px);
  position: relative;
  display: inline-block;
  margin-inline-end: rem(12px);
  background-color: var(--vtmn-semantic-color_content-primary);
}

.vtmn-accordion summary {
  display: flex;
  cursor: pointer;
  list-style: none;
  font-weight: var(--vtmn-typo_font-weight--bold);
  position: relative;
  padding-block: var(--vtmn-spacing_3);
  padding-inline: var(--vtmn-spacing_4);
  outline: 0;
  transition: background-color 400ms ease;
}

.vtmn-accordion summary::-webkit-details-marker {
  display: none;
}

.vtmn-accordion:not([aria-disabled='true']) summary:hover {
  background-color: var(--vtmn-semantic-color_hover-primary);
}

.vtmn-accordion:not([aria-disabled='true']) summary:active {
  background-color: var(--vtmn-semantic-color_active-primary);
}

.vtmn-accordion:not([aria-disabled='true']) > summary:focus-visible {
  box-shadow: var(--vtmn-shadow_focus-visible);
}

.vtmn-accordion[aria-disabled='true'] {
  cursor: not-allowed;
}

.vtmn-accordion[aria-disabled='true'] > * {
  opacity: var(--vtmn-opacity_disabled-state);
  pointer-events: none;
}

.vtmn-accordion summary > span[class^='vtmx-'] {
  font-size: var(--vtmn-typo_title-4-font-size);
  margin-inline-end: var(--vtmn-spacing_3);
}

.vtmn-accordion summary::after {
  content: '';
  mask: url("data:image/svg+xml;charset=utf-8, <svg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='m8 8.781 3.3-3.3.943.943L8 10.667 3.757 6.424l.943-.943 3.3 3.3z'/></svg>");
  inline-size: rem(24px);
  block-size: rem(24px);
  position: absolute;
  inset-inline-end: 0;
  margin-inline-end: var(--vtmn-spacing_3);
  background-color: var(--vtmn-semantic-color_content-primary);
  transition: transform 400ms ease;
}

.vtmn-accordion[open] {
  border-block-end: 0;
}

.vtmn-accordion[open] summary::after {
  transform: rotateZ(-180deg);
}

.vtmn-accordion_content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--vtmn-spacing_4);
}

.vtmn-accordion_content > * {
  margin-block: var(--vtmn-spacing_1);
  margin-inline: 0;
}

.vtmn-accordion_content:last-child {
  border-block-end: rem(1px) solid var(--vtmn-semantic-color_border-primary);
}
