@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  /* https://kilianvalkhof.com/2022/css-html/your-css-reset-needs-text-size-adjust-probably/ */
  html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
  }

  body,
  h1,
  h2,
  h3,
  h4,
  p,
  figure,
  blockquote,
  dl,
  dd {
    margin: 0;
  }

  /* https://www.scottohara.me/blog/2019/01/12/lists-and-safari.html */
  [role="list"] {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  body {
    min-block-size: 100vh;
    line-height: 1.6;
    font-size: 15px;
  }

  h1,
  h2,
  h3,
  button,
  input,
  label {
    line-height: 1.1;
  }

  h1,
  h2,
  h3,
  h4 {
    text-wrap: balance;
  }

  p,
  li {
    text-wrap: pretty;
  }

  img,
  picture {
    max-inline-size: 100%;
    display: block;
  }

  input,
  button,
  textarea,
  select {
    font: inherit;
  }
}

@layer base {
  @font-face {
    font-family: "BarlowSemiCondensed-Medium", sans-serif;
    src: url(./assets/BarlowSemiCondensed-Medium.ttf);
  }

  @font-face {
    font-family: "BarlowSemiCondensed-SemiBold", sans-serif;
    src: url(./assets/BarlowSemiCondensed-SemiBold.ttf);
  }

  :root {
    /* primary colors */
    --purple-50: hsl(260, 100%, 95%);
    --purple-300: hsl(264, 82%, 80%);
    --purple-500: hsl(263, 55%, 52%);

    /* neutral colors */
    --white: hsl(0, 0%, 100%);
    --grey-100: hsl(214, 17%, 92%);
    --grey-200: hsl(0, 0%, 81%);
    --grey-400: hsl(224, 10%, 45%);
    --grey-500: hsl(217, 19%, 35%);
    --darkBlue: hsl(219, 29%, 14%);
    --black: hsl(0, 0%, 7%);

    /* font family */
    --ff-main: "BarlowSemiCondensed-Medium", sans-serif;
    --ff-heading: "BarlowSemiCondensed-SemiBold", sans-serif;

    /* font sizes */
    --fs-main: 0.81rem; /* 13px */
    --fs-h2: 1rem; /* 16px */
    --fs-h1: 1.125rem; /* 18px */
  }

  body {
    font-family: var(--ff-main);
    font-size: var(--fs-main);
    font-weight: 300;
    color: var(--grey-500);
    background-color: var(--grey-100);
    margin: 8em auto;
  }

  h1 {
    font-family: var(--ff-heading);
    font-size: var(--fs-h1);
    font-weight: 400;
  }

  h2 {
    font-family: var(--ff-heading);
    font-size: var(--fs-h2);
    font-weight: 300;
    margin-block-start: 0.25em;
  }

  .attribution {
    font-size: var(--fs-main);
    text-align: center;
  }
  .attribution a {
    color: var(--purple-500);
  }

  .attribution a:hover {
    color: var(--purple-300);
  }
}

@layer layout {
  main {
    max-inline-size: 1200px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    padding: 2rem;
    margin: 0 auto;
  }

  section {
    border-radius: 0.5em;
    display: flex;
    flex-direction: column;
    padding: 1em;
    gap: 1em;
    box-shadow: rgba(255, 255, 255, 0.1) 0px 1px 1px 0px inset,
      rgba(50, 50, 93, 0.25) 0px 50px 100px -20px,
      rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
  }

  section header {
    display: flex;
    align-items: center;
    gap: 1em;
  }

  img {
    border-radius: 50%;
    width: 50px;
    height: 50px;
    object-fit: cover;
  }

  blockquote {
    font-family: var(--ff-heading);
    font-size: var(--fs-h1);
    font-weight: 600;
  }

  .testimonial-1 {
    background-color: var(--purple-500);
    color: var(--white);
  }

  .img-1 {
    border: 1px solid var(--purple-300);
  }

  .testimonial-2 {
    background-color: var(--grey-500);
    color: var(--white);
  }

  .img-2 {
    border: 1px solid var(--grey-200);
  }

  .testimonial-3,
  .testimonial-5 {
    background-color: var(--white);
  }

  .testimonial-4 {
    background-color: var(--darkBlue);
    color: var(--white);
  }

  @media (min-width: 1000px) {
    main {
      grid-template-rows: repeat(2, auto);
      grid-auto-flow: dense;
    }

    .testimonial-1 {
      grid-column: span 2;
      grid-row: 1;
      order: 1;
    }

    .testimonial-2 {
      grid-row: 1;
      order: 2;
    }

    .testimonial-3 {
      grid-row: 2;
      order: 1;
    }

    .testimonial-4 {
      grid-column: span 2;
      grid-row: 2;
      order: 2;
    }

    .testimonial-5 {
      grid-column: 4;
      grid-row: span 2;
      order: 3;
    }
  }
}
