/* The questions on the front page: the heading and the way to the guides on
   the left, the questions on the right; stacked on a phone. Each question is
   a native `details`, so opening and closing is the browser's job and the
   list works before any script runs; `[open]` tints the row and turns the
   chevron over. */

@layer components {
  .home-faq {
    padding-block: 4.5rem;

    @media (width >= 768px) {
      padding-block: 6rem;
    }
  }

  .home-faq__container {
    display: grid;
    gap: 2.5rem;

    @media (width >= 1024px) {
      align-items: start;
      gap: 4rem;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    }
  }

  .home-faq__title {
    font-size: clamp(1.75rem, 3.2vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0 0 1rem;
    text-wrap: balance;
  }

  .home-faq__text {
    color: var(--color-ink-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 1.25rem;
    max-inline-size: 22rem;
  }

  .home-faq__guides {
    align-items: center;
    color: var(--color-brand);
    display: inline-flex;
    font-size: 0.9375rem;
    font-weight: 700;
    gap: 0.375rem;
    text-decoration: none;

    &:hover {
      gap: 0.625rem;
    }
  }

  .home-faq__list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .home-faq__item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);

    &[open] {
      background: var(--color-surface-tint);
      border-color: var(--color-surface-tint);
    }
  }

  .home-faq__question {
    align-items: center;
    cursor: pointer;
    display: flex;
    font-size: 0.9375rem;
    font-weight: 700;
    gap: 1rem;
    justify-content: space-between;
    list-style: none;
    padding: 1rem 1.125rem;

    @media (width >= 768px) {
      font-size: 1rem;
      padding: 1.125rem 1.25rem;
    }
  }

  .home-faq__question::-webkit-details-marker {
    display: none;
  }

  .home-faq__question:hover {
    color: var(--color-brand);
  }

  .home-faq__question:focus-visible {
    border-radius: var(--radius-lg);
    outline: 2px solid var(--color-brand);
    outline-offset: -2px;
  }

  .home-faq__chevron {
    align-items: center;
    background: var(--color-brand-tint);
    block-size: 1.5rem;
    border-radius: var(--radius-pill);
    color: var(--color-brand);
    display: flex;
    flex-shrink: 0;
    inline-size: 1.5rem;
    justify-content: center;
    transition: rotate 0.2s;
  }

  .home-faq__item[open] .home-faq__chevron {
    background: var(--color-brand-fill);
    color: var(--color-ink-inverted);
    rotate: 180deg;
  }

  /* The row is as wide as the page; the answer inside it keeps a measure
     that can be read. */
  .home-faq__answer {
    color: var(--color-ink-muted);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin: 0;
    max-inline-size: 44rem;
    padding: 0 1.25rem 1.25rem;
  }
}
