/* The pull-apart accordion: the questions of an open-air pool on a white page. At rest they sit on one card of pool
   water; the script draws that card, and its colours come from here. */
:root {
  --page: #ffffff;          /* the page */
  --water: #0f7493;         /* the card, at the top */
  --water-deep: #0b5774;    /* the card, at the bottom */
  --shadow: #0a4a63;        /* the shadow under the card */
  --text: #ffffff;          /* the questions */
  --answer: #d2eef4;        /* the answers */
  --seam: #3d93ad;          /* the line between two questions */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--text);
  font-family: 'Geologica Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 40px 16px;
}

/* the script gives the list a fixed height: room for every question and the longest answer, so the top never moves */
.faq {
  position: relative;
  width: min(640px, 100%);
}

/* ---------------------------------------------------------------- the card (drawn by the script) */
.faq__shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.faq__stop-top {
  stop-color: var(--water);
}

.faq__stop-deep {
  stop-color: var(--water-deep);
}

.faq__shadow-far {
  flood-color: var(--shadow);
  flood-opacity: 0.2;
}

.faq__shadow-near {
  flood-color: var(--shadow);
  flood-opacity: 0.22;
}

/* the open question's own shadow: it floats a little above the rest */
.faq__float {
  flood-color: var(--shadow);
  flood-opacity: 0.32;
}

.faq__seam {
  stroke: var(--seam);
  stroke-width: 1;
}

/* ---------------------------------------------------------------- one question */
.faq__item {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
}

.faq__head {
  margin: 0;
  font: inherit;
}

.faq__q {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 80px;
  padding: 0 28px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 19px;
  font-weight: 520;
  letter-spacing: -0.012em;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.faq__q:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -8px;
  border-radius: 18px;
}

.faq__text {
  transition: transform 0.16s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.2s ease;
}

.faq__q:active .faq__text {
  transform: scale(0.985);
}

/* the chevron: the script moves its three points, so it flips through a flat line */
.faq__chev {
  flex: none;
  width: 16px;
  height: 10px;
  overflow: visible;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.faq__chev path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) and (pointer: fine) {
  .faq__q:hover .faq__chev {
    transform: translateY(2px);
  }

  .faq__q[aria-expanded='true']:hover .faq__chev {
    transform: translateY(-2px);
  }
}

/* the answer: clipped by the script to the bottom of its piece of card */
.faq__a {
  position: relative;
}

.faq__inner {
  padding: 0 28px 28px;
}

.faq__a p {
  margin: 0;
  max-width: 50ch;
  color: var(--answer);
  font-size: 16px;
  font-weight: 360;
  line-height: 1.6;
}

@media (max-width: 520px) {
  .faq__q {
    min-height: 72px;
    padding: 0 22px;
    font-size: 17px;
  }

  .faq__inner {
    padding: 0 22px 24px;
  }

  .faq__a p {
    font-size: 15.5px;
  }
}
