/* === FONT SETUP === */

@font-face {
  font-family: "WorkSans";
  src: url("./assets/fonts/WorkSans.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 100 900;
}


/* === RESET === */


html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body,
h1,
h2,
p {
  margin: 0;
}


/* === CUSTOM PROPERTIES === */

:root {
  --white: hsl(0, 100%, 100%);
  --purple-100: hsl(275, 100%, 97%);
  --purple-600: hsl(292, 16%, 49%);
  --purple-700: hsl(281, 93%, 57%);
  --purple-950: hsl(292, 42%, 14%);
  --ff-base: "WorkSans", sans-serif;
}


/* === BODY LAYOUT === */

body {
  min-block-size: 100vh;
  min-block-size: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  font-family: var(--ff-base);
  font-size: 1rem;
  background: var(--purple-100) url("./assets/images/background-pattern-mobile.svg") top center / contain no-repeat;
  color: var(--purple-950);

  @media (width >=48rem) {
    background-image: url("./assets/images/background-pattern-desktop.svg");
  }
}


/* === UTILITY CLASS === */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}


/* === FAQ COMPONENT === */

.faq {
  inline-size: clamp(20.51rem, 87.5vw, 37.5rem);
  margin-top: 1.5em;
  padding: 1.4rem 1.55rem 0;
  background-color: var(--white);
  border-radius: .5em;
  box-shadow: 0 20px 40px 5px hsl(from var(--purple-700) h s l/.15);

  @media (width >=48rem) {
    margin-top: 1.35rem;
    padding: 2.47rem 2.5rem 1em;
    border-radius: 1em;
  }
}


/* --- Header --- */

.faq__header {
  display: flex;
  align-items: center;
  gap: 1.5em;
}

.faq__icon {
  block-size: 1.5rem;

  @media (width >=48rem) {
    block-size: inherit;
  }
}

.faq__title {
  font-size: clamp(2rem, 1.15rem + 3.2vw, 3.5rem);
}


/* --- List --- */

.faq__list {
  margin-top: .7em;
}


/* --- Item (<details>) --- */

.faq__item {
  padding-block: 1.6em;
  position: relative;

  /* Divider between items */
  &:not(:last-of-type) {
    border-bottom: 1px solid var(--purple-100);
  }

  /* Closed state animation setup */
  &::details-content {
    font-size: clamp(.88rem, .5rem + 1.62vw, 1rem);
    font-weight: 450;
    line-height: 1.496;
    color: var(--purple-600);
    block-size: 0;
    overflow: hidden;

    /* Smoth transition using new CSS transition-behavior */
    transition-property: block-size content-visibility;
    transition-duration: .5s;
    transition-behavior: allow-discrete;
  }

  /* Open state reveals content */
  &:open::details-content {
    margin-top: 1.765em;
    block-size: auto;
    block-size: calc-size(auto, size);
  }

  /* Icon changes to minus when open */
  &:open .faq__question::after {
    content: url("./assets/icons/icon-minus.svg");
  }
}


/* --- Question (<summary>) --- */

.faq__question {
  padding-right: 3em;
  font-size: clamp(1rem, .5rem + 2.13vw, 1.125rem);
  font-weight: 600;
  cursor: pointer;
  transition: color .3s ease-in-out;
  position: relative;

  /* Remove default disclosure triangle */
  &::marker {
    content: none;
  }

  /* Hover and keyboard focus interaction */
  &:is(:focus-visible, :hover) {
    color: var(--purple-700);
  }

  /* Default icon (plus) */
  &::after {
    content: url("./assets/icons/icon-plus.svg");
    position: absolute;
    top: calc(50% + 2px);
    right: 0;
    transform: translateY(-50%);
  }
}


/* === FOOTER ATTRIBUTION === */

.attribution {
  padding: 1em 0 2em;
  font-size: .78rem;

  a {
    margin-inline: .35em;
    font-weight: 600;
    text-decoration: underline wavy;
    text-underline-offset: 2px;
    color: inherit;

    /* Interaction style for links */
    &:is(:focus-visible, :hover) {
      text-decoration: none;
      color: var(--purple-700);
    }
  }
}

/* === GLOBAL FOCUS STYLE (A11y) === */

*:focus-visible {
  outline: 2px dotted currentColor;
  outline-offset: .25em;
}