@use './styles/variables' as *;

$base-spacing: 2em;

/*
 * Basic container with readable paddings/margins
 */
.container {
  padding: $base-spacing;
}

/*
 * Sections to display text content
 */

.section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: $base-spacing;

  > :last-child {
    margin-bottom: 0;
  }

  h1,
  h2,
  h3 {
    margin: $base-spacing 0 calc($base-spacing / 2) 0;
  }

  > :first-child:is(h1, h2) {
    margin-top: calc($base-spacing / 2);
  }

  h1,
  .h1 {
    font-size: 2.5rem;
  }

  h2,
  .h2 {
    font-size: 2rem;
  }

  h3,
  .h3 {
    font-size: 1.5rem;
  }

  p {
    margin: 0 0 2em 0;
    max-width: 80ch;
  }

  ul {
    list-style: disc;
  }

  ol {
    list-style: decimal;
  }

  ul,
  ol {
    margin: 0 0 $base-spacing 0;

    li {
      margin: 0 0 calc($base-spacing/2);
    }
  }

  pre code {
    white-space: pre-wrap;
  }
}

.sectionPrimary {
  @extend .section;

  background-color: #fff;
}

.sectionAlternate {
  @extend .section;

  background-color: transparent;
}

@media (min-width: 768px) {
  .centered {
    text-align: center;
  }
}

/*
 * Card elements
 */

.article {
  border: 1px solid $main-color;
  display: flex;
  flex-direction: column;
  align-items: first baseline;
  padding: calc($base-spacing / 2);
  width: 100%;

  :is(h1, h2, h3) {
    margin: 0 0 calc($base-spacing / 4) 0;
  }

  > :last-child {
    margin-bottom: 0;
  }
}

.articleMetadata {
  list-style: none !important;
  margin: calc($base-spacing / 2) 0 !important;

  li {
    margin: 0 0 calc($base-spacing / 4) 0 !important;
  }
}

/*
 * Block level/paragraph elements
 */
.hero {
  font-size: 1.4em;
}

.spacer {
  margin-bottom: calc($base-spacing * 2) !important;
}

.horizontalActions {
  display: flex;
  gap: $base-spacing;
}

.verticalActions {
  @extend .horizontalActions;
  flex-direction: column;
}

/*
  * Organizing content altogether
  */
.desktopGridOf3 {
  display: grid;
  grid-template-columns: repeat(1fr);
  gap: $base-spacing;
  width: 100%;

  @media (min-width: 768px) {
    grid-template-columns: repeat(auto-fit, 30%);
    justify-content: center;
    justify-items: center;
  }
}
