// Responsive layout
.wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;

  main {
    flex: 1 0 auto;

    aside {
      flex: 1;
      padding: 0.5rem;
      max-width: 500px;

      &:not(:has(~ aside)) {
        display: none;
      }

      @include media('sm', 'down') {
        display: none !important;
      }
    }

    &.fi-container {
      display: flex;
      align-items: flex-start;
      justify-content: center;
      padding-inline: 1rem;
      gap: 0.5rem;

      &[data-reverse] {
        flex-direction: row-reverse;
      }

      &:has(.home:not(.posts)) {
        align-items: center;
      }
    }
  }

  @include media('md') {
    main {
      // hide empty aside and expand article when only one aside is empty
      aside:first-child:empty:has(~ aside:not(:empty)),
      aside:first-child:not(:empty) ~ aside#toc-auto:empty {
        display: none;
      }
  
      aside:first-child:empty:has(~ aside:not(:empty)) ~ article,
      aside:first-child:not(:empty) ~ article:has(~ aside:empty) {
        flex: 3;
      }
    }

    // adjust breadcrumb flex when asides are empty
    &:has(main > aside:first-child:empty ~ aside:not(:empty)) .breadcrumb-container {
      .breadcrumb {
        flex: 3;
      }

      &::before {
        display: none;
      }
    }
    &:has(main > aside:first-child:not(:empty) ~ aside#toc-auto:empty) .breadcrumb-container {
      .breadcrumb {
        flex: 3;
      }

      &::after {
        display: none;
      }
    }
  }
}

@import "header";
@import "breadcrumb";
@import "page-style";
@import "pagination";
@import "footer";
