.collapsable-code { position: relative; width: 100%; margin: 40px 0; input[type="checkbox"] { position: absolute; visibility: hidden; } .highlight, .code-toolbar .highlight { max-height: 80vh; overflow: auto; transition: max-height 0.15s ease; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; } input[type="checkbox"]:checked { ~ .highlight, ~ .code-toolbar .highlight { max-height: 0; padding: 0; border-top: none; overflow: hidden; } ~ .code-toolbar { padding: 0; border-top: none; .toolbar { display: none; } } ~ label { border-radius: 10px; } ~ label .collapsable-code__toggle:after { content: attr(data-label-expand); } } label { position: relative; display: flex; justify-content: space-between; background: $light-background-secondary; padding: 10px; border-top-left-radius: 10px; border-top-right-radius: 10px; min-width: 30px; min-height: 30px; margin: 0; cursor: pointer; .dark-theme & { background: $dark-background-secondary; } } &__title { flex: 1; color: $light-color; padding: 3px 10px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; font-weight: 600; .dark-theme & { color: $dark-color; } } &__language { background: $light-background; color: $light-color; border-radius: 10px; padding: 3px 10px; font-weight: 600; .dark-theme & { background: $dark-background; color: $dark-color; } } &__toggle { color: $light-color; font-size: 16px; padding: 3px 10px; font-weight: 700; &:after { content: attr(data-label-collapse); } .dark-theme & { color: $dark-color; } } pre { margin-top: 0; margin-bottom: 0; border-radius: 0; } .code-toolbar { margin: 0; } }