components/Accordion/Accordion.module.css
.Accordion {
box-sizing: border-box;
display: flex;
align-items: flex-start;
justify-content: flex-start;
position: relative;
margin: 1rem auto;
min-height: unset;
min-width: unset;
width: 100%;
--widthUpToButtonInAccordion: 90%;
}
.headingContainer {
font-size: 1.25rem;
font-weight: bold;
text-transform: uppercase;
width: var(--widthUpToButtonInAccordion);
}
.icon {
fill: currentcolor;
position: absolute;
top: 1.25rem; /* Should correspond with heading content height (vertically centered with rest of content */
right: 1.25rem;
width: 30px;
}
@media screen and (--medium-viewport) {
.icon {
right: 0.5rem;
}
}
.rotate90 {
transform: rotate(90deg);
}
.accordionToggleButton {
position: absolute;
top: 0;
right: 0;
appearance: none;
background: none;
border: none;
color: currentcolor;
cursor: pointer;
font-size: 1rem;
padding: 0.25rem;
text-decoration: none;
height: 100%;
width: 75px;
}
@media screen and (--medium-viewport) {
.accordionToggleButton {
width: 50px;
}
}
@media screen and (--small-viewport) {
.accordionToggleButton {
width: 40px;
}
}
.accordionToggleButton:hover {
text-decoration: underline;
}
.accordionToggleButton:focus-visible {
border: 1px solid var(--primary);
border-radius: inherit;
outline: none;
}
.accordionContent {
position: relative;
width: var(--widthUpToButtonInAccordion);
}
.accordionContent.invisible {
height: 0;
}
.accordionContent.visible {
height: auto;
margin-top: 1rem;
}