/*
 * @file
 * Provides the layout styles for three-column layout section.
 */

@import "../base/media-queries.pcss.css";

.layout--threecol-section {
  display: flex;
  flex-wrap: wrap;

  & > .layout__region {
    flex: 1 0 100%;
    margin-block-end: var(--grid-gap);

    @media (--lg) {
      flex-grow: 0;
      flex-shrink: 0;
      margin-block-end: 0;
    }
  }
}

@media (--lg) {
  .layout--threecol-section {
    & > .layout__region--first {
      margin-inline-end: calc(var(--grid-gap) * 0.5);
    }

    & > .layout__region--second {
      margin-inline: calc(var(--grid-gap) * 0.5);
    }

    & > .layout__region--third {
      margin-inline-start: calc(var(--grid-gap) * 0.5);
    }
  }

  .layout--threecol-section--25-50-25 {
    & > .layout__region--first,
    & > .layout__region--third {
      flex-basis: calc(25% - (var(--grid-gap) * 0.5));
    }

    & > .layout__region--second {
      flex-basis: calc(50% - var(--grid-gap));
    }
  }

  .layout--threecol-section--25-25-50 {
    & > .layout__region--first,
    & > .layout__region--second {
      flex-basis: calc(25% - (var(--grid-gap) * 0.5));
    }

    & > .layout__region--third {
      flex-basis: calc(50% - var(--grid-gap));
    }
  }

  .layout--threecol-section--50-25-25 {
    & > .layout__region--first {
      flex-basis: calc(50% - var(--grid-gap));
    }

    & > .layout__region--second,
    & > .layout__region--third {
      flex-basis: calc(25% - (var(--grid-gap) * 0.5));
    }
  }

  .layout--threecol-section--33-34-33 {
    & > .layout__region--first,
    & > .layout__region--second,
    & > .layout__region--third {
      flex-basis: calc(33.33% - (var(--grid-gap) * 0.667));
    }
  }
}
