/* ====================================
   @layer ORDER DECLARATION
   ==================================== */
@layer reset, base, layout, components;

/* ====================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ==================================== */
:root {
  --Very-Dark-Magenta: hsl(300, 43%, 22%);
  --Soft-Pink: hsl(333, 80%, 67%);
  --Dark-Grayish-Magenta: hsl(303, 10%, 53%);
  --Light-Grayish-Magenta: hsl(300, 24%, 96%);
  --White: hsl(0, 0%, 100%);
  --fs-base: 15px;
  --font-family-body: "League Spartan", sans-serif;
  --fs-heading: clamp(2rem, 4vw, 3.5rem);
  --fw-normal: 400;
  --fw-bold: 500;
  --fw-extra-bold: 700;
}

/* ====================================
   @layer reset
   ==================================== */
@layer reset {
  * {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }

  img {
    max-width: 100%;
    height: auto;
  }
}

/* ====================================
   @layer base
   ==================================== */
@layer base {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image:
      url("../images/bg-pattern-top-desktop.svg"),
      url("../images/bg-pattern-bottom-desktop.svg");
    background-position:
      top left,
      bottom right;
    background-repeat: no-repeat;
    background-size: auto, contain;
    font-family: var(--font-family-body);
    font-size: var(--fs-base);
    line-height: 1.35;
    color: #333;
  }
}

/* ====================================
   @layer layout
   ==================================== */
@layer layout {
  .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .social-proof__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
  }

  .social-proof__intro {
    flex: 1 1 60%;
  }

  .social-proof__ratings {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0;
  }

  @supports (display: grid) {
    .social-proof__testimonials {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1.75rem;
      margin-top: 3.2rem;
      align-items: start;
    }
  }
}

/* ====================================
   @layer components
   ==================================== */
@layer components {
  @scope (.social-proof) {
    .social-proof__title {
      max-width: 400px;
      width: 100%;
      font-size: 3.5rem;
      font-weight: var(--fw-extra-bold);
      line-height: 0.9;
      color: var(--Very-Dark-Magenta);
      margin-bottom: 22px;
    }

    .social-proof__description {
      max-width: 360px;
      font-weight: var(--fw-bold);
      color: var(--Dark-Grayish-Magenta);
    }

    .social-proof__rating {
      display: flex;
      align-items: center;
      gap: 1.5rem;
      padding: 15px 25px;
      width: 400px;
      background-color: var(--Light-Grayish-Magenta);
      border-radius: 8px;
      font-weight: var(--fw-extra-bold);
      color: var(--Very-Dark-Magenta);
    }

    .social-proof__rating:nth-child(2) {
      margin-left: 3rem;
    }
    .social-proof__rating:nth-child(3) {
      margin-left: 6rem;
    }

    .social-proof__stars {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      line-height: 1;
    }

    .social-proof__testimonial {
      background-color: var(--Very-Dark-Magenta);
      color: var(--White);
      border-radius: 8px;
      padding: 40px 31px;
      font-size: var(--fs-base);
      font-weight: var(--fw-normal);
      transition: transform 0.3s ease;
    }

    .social-proof__testimonial:hover {
      transform: translateY(-6px);
    }
    .social-proof__testimonial:nth-child(2) {
      margin-top: 1.15rem;
    }
    .social-proof__testimonial:nth-child(3) {
      margin-top: 2.15rem;
    }

    .social-proof__user {
      display: flex;
      align-items: center;
      gap: 1.5rem;
      margin-bottom: 1.5rem;
    }

    .social-proof__user-info {
      display: flex;
      flex-direction: column;
      gap: 5px;
      line-height: 1;
      font-size: inherit;
    }

    .social-proof__user-photo {
      width: 40px;
      height: 40px;
      border-radius: 50%;
    }

    .social-proof__user-title {
      color: var(--Soft-Pink);
      font-weight: var(--fw-bold);
    }

    .social-proof__quote {
      color: var(--Light-Grayish-Magenta);
    }
  }

  .attribution {
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
    font-size: 13px;
    font-family: var(--font-family-body);
    font-weight: var(--fw-bold);
    color: var(--Very-Dark-Magenta);
  }

  .attribution a {
    color: var(--Soft-Pink);
    text-decoration: none;
  }
  .attribution a:hover {
    text-decoration: underline;
  }

  button:focus-visible,
  a:focus-visible {
    outline: 2px solid var(--Very-Dark-Magenta);
    outline-offset: 2px;
  }
}

/* ====================================
   RESPONSIVE — TABLET (769px–820px)
   ==================================== */
@media (min-width: 769px) and (max-width: 820px) {
  .social-proof__header {
    flex-direction: column;
    text-align: center;
    gap: 3rem;
  }

  .social-proof__intro {
    flex: none;
  }

  .social-proof__title {
    font-size: 3.8rem;
    margin: 0 auto 25px;
  }

  .social-proof__header .social-proof__description {
    font-size: 1.25rem;
    max-width: 500px;
  }

  .social-proof__ratings {
    align-items: center;
    width: 100%;
  }

  .social-proof__rating {
    padding: 18px 25px;
    margin: 0 auto;
  }

  .social-proof__rating:nth-child(2),
  .social-proof__rating:nth-child(3) {
    margin: 0 auto;
  }

  .social-proof__rating-text {
    font-size: 17px;
  }

  .social-proof__testimonials {
    margin-top: 5rem;
  }
  .social-proof__testimonial:nth-child(2) {
    margin-top: 2.8rem;
  }
  .social-proof__testimonial:nth-child(3) {
    margin-top: 4.7rem;
  }

  .social-proof__user {
    flex-direction: column;
    gap: 0.9rem;
    margin-bottom: 0.9rem;
  }

  .social-proof__user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .social-proof__quote {
    text-align: center;
  }
}

/* ====================================
   RESPONSIVE — (900px-1024px)
   ==================================== */
@media (min-width: 900px) and (max-width: 1024px) {
  .social-proof__testimonials {
    align-items: normal;
  }

  .social-proof__testimonial:nth-child(2),
  .social-proof__testimonial:nth-child(3) {
    margin-top: 0;
  }

  .social-proof__description {
    font-size: 1rem;
  }
  .social-proof__rating-text {
    font-size: 1rem;
  }

  blockquote.social-proof__quote {
    font-size: 1rem;
  }
}

/* ====================================
   RESPONSIVE — MOBILE (up to 768px)
   ==================================== */
@media (max-width: 768px) {
  body {
    background-image:
      url("../images/bg-pattern-top-mobile.svg"),
      url("../images/bg-pattern-bottom-mobile.svg");
    background-position:
      top left,
      bottom right;
    background-repeat: no-repeat;
    background-size: auto, contain;
  }

  .social-proof__header {
    flex-direction: column;
    text-align: center;
    width: 100%;
  }

  .social-proof__title {
    font-size: 2.5rem;
    line-height: 1;
    width: 100%;
    margin-bottom: 20px;
  }

  .social-proof__description {
    text-align: center;
    margin: 0 auto;
    max-width: 280px;
  }

  .social-proof__ratings {
    width: 100%;
  }

  .social-proof__rating {
    flex-direction: column;
    gap: 0.5rem;
    padding: 15px;
    width: 95%;
    margin: 0 auto;
  }

  .social-proof__rating:nth-child(2),
  .social-proof__rating:nth-child(3) {
    margin: 0 auto;
  }

  .social-proof__testimonials {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 3rem;
    width: 100%;
  }

  .social-proof__testimonial {
    width: 96%;
    margin: 0 auto;
  }

  .social-proof__testimonial:nth-child(2),
  .social-proof__testimonial:nth-child(3) {
    margin: 0 auto;
  }
}

/* ====================================
   RESPONSIVE — SMALL MOBILE (up to 375px)
   ==================================== */
@media (max-width: 375px) {
  .container {
    padding: 1rem;
  }

  .social-proof__header {
    gap: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .social-proof__title {
    font-size: 2rem;
    margin-bottom: 15px;
  }

  .social-proof__description {
    font-size: 14px;
    line-height: 1.5;
  }

  .social-proof__ratings {
    gap: 0.75rem;
  }

  .social-proof__rating {
    padding: 12px 15px;
    gap: 0.75rem;
    font-size: 14px;
  }

  .social-proof__testimonials {
    gap: 1.5rem;
    margin-top: 2rem;
  }

  .social-proof__testimonial {
    padding: 20px;
    font-size: 14px;
  }

  .social-proof__user {
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .social-proof__user-photo {
    width: 35px;
    height: 35px;
  }

  .social-proof__quote {
    line-height: 1.3;
  }
}
