h1 { margin: 0; }
header {
  display: flex; flex-direction: column-reverse; gap: 2rem;
  position: relative; margin: 4rem 1rem 0;
  >div {
    display: flex; flex-direction: column; gap: 1rem;
    &:last-of-type { gap: 0.5rem; }
    >p {
      margin: .5rem 0; text-align: center; font-size: 1.25rem;
      b {
        padding: 0.1rem 0.25rem; margin: .25rem 0; border-radius: .25rem; display: inline-block;
        background-color: var(--yellow); color: var(--black);
        &:last-of-type { color: var(--white); background-color: var(--red); }
      }
    }
    >div {
      display: flex; gap: 1rem; justify-content: center;
      >a {
        margin: 0; color: var(--black); background-color: var(--blue);
        padding: .6rem 1.25rem .75rem; border-radius: .75rem; font-size: 1.25rem;
        font-weight:bold; text-decoration: underline; text-align: center;
        border: 1px solid transparent;
        &:hover {
          color: var(--white); background-color: var(--red);
          border-color: var(--light-red);
        }
      }
    }
  }
  details {
    border-radius: 0.5rem;
    summary {
      background-color: var(--blue); color: var(--black); padding: 0.25rem .5rem;
      border-radius: 0.5rem;
    }
    &[open] {
      padding-bottom: 0.5rem;
      background-image: linear-gradient(to bottom, var(--black), var(--dark-gray) 20%);
      summary { border-radius: 0.5rem 0.5rem 0 0; margin-bottom: 0.25rem; }
    }
    >span, label>span:first-child {
      display: block; padding: 0.3rem 1rem;
      position: relative;
      &::after {
        content:""; display: block;
        width: 0.75rem; height: 0.75rem;
        border-radius: 1rem; background-color: var(--yellow);
        position: absolute; left: -0.4rem; top: 0.5rem;
        box-shadow: -2px 0 var(--black), 0 2px var(--black), 2px 0 var(--black), 0 -2px var(--black);
      }
    }
  }
  #node-img span:last-of-type::after,
  #node-hsl label>span:first-child::after { background-color: var(--light-gray); }
  #node-img {
    summary { background-color: var(--red); color: var(--white)}
    >span {
        text-align: right;
        &::after { left:auto; right: -0.4rem; }
    }
    >p {
      margin: 0.25rem 1rem 0; display: flex;
      background-color: var(--black);
      border-radius: 0.75rem;
      button {
        background-color: var(--black); cursor: pointer;
        flex-basis: 20%; max-height: 2rem; max-width: 2rem;
        aspect-ratio: 1/1; flex-grow: 0;
        border-radius: 0.5rem 0 0 0.5rem;
        border: 0; border-right: 2px solid var(--dark-gray); padding: 0.25rem; 
        &:hover { background-color: var(--dark-gray);}
      }
      button:last-child {
        background-color: var(--gray);
        border-radius: 0 .5rem .5rem 0; border: 0;
        &:hover { background-color: var(--dark-gray);}
      }
      span { flex-grow: 1; padding: 0 .5rem; align-content: center;}
    }
  }
  #node-hsl {
    summary { background-color: var(--yellow); color: var(--black);}
    >span::before {
      content:""; display: block;
      width: 0.75rem; height: 0.75rem;
      border-radius: 1rem; background-color: var(--yellow);
      position: absolute; right: -0.4rem; top: 0.5rem;
      box-shadow: -2px 0 var(--black), 0 2px var(--black), 2px 0 var(--black), 0 -2px var(--black);
    }
  }
  #node-viewer {
    position: relative;
    >img {
      position: absolute; right: 2.5rem; top: -3rem;
      width: 3.5rem; height: auto; cursor: pointer;
    }
    >a {
      position: absolute; right: 6rem; top: -3rem;
      height: 2.5rem; width: auto;
      img { height: 100%; width: auto;}
    }
    >a:hover { background-color: transparent; }
  }
}
main {
  margin: 1rem; border-radius: 0 0 2rem 2rem; position: relative;
  #flow, #faq {
    display: flex; flex-direction: column; gap: 0.5rem; position: relative;
    details {
      border-radius: 0.5rem;
      summary {
        background-color: var(--red); padding: 0.5rem 1rem;
        border-radius: 0.5rem;
      }
      &[open] {
        padding-bottom: 1rem;
        background-image: linear-gradient(to bottom, var(--black), var(--dark-gray) 20%);
        summary { border-radius: 0.5rem 0.5rem 0 0; margin-bottom: 1rem; }
      }
      p { margin: 0 1rem; }
      &:nth-of-type(3n-1) summary { color: var(--black); background-color: var(--yellow); }
      &:nth-of-type(3n) summary { background-color: var(--blue); color: var(--black); }
    }
  }
  #flow {
    position: relative;
    details {
      width: 100%; position: relative;
      >summary { padding: .25rem .5rem; }
      >p:first-of-type::before, >p:first-of-type::after {
        content:""; display: block;
        width: 0.75rem; height: 0.75rem;
        border-radius: 1rem; background-color: var(--yellow);
        position: absolute; left: -0.4rem; top: 3rem;
        box-shadow: -2px 0 var(--black), 0 2px var(--black), 2px 0 var(--black), 0 -2px var(--black);
      }
      >p:first-of-type::after { left: auto; right: -0.4rem;}
      &:first-of-type>p::before { display: none; }
    }
  }
}

footer {
  background-color: color-mix(in srgb, var(--dark-gray), transparent 50%);
  background-image: url("../img/grid-light.png"); background-size: 0.75rem 0.75rem;
  padding: 1rem;
}
/* Big mobile */
@media screen and (min-width: 25rem) {
  header {
    margin: 5rem 2rem 0;
    #node-viewer {
      >img { width: 4rem; top: -3.6rem; right: 15%;}
      >a { right: calc(15% + 4rem); }
    }
  }
  main {
    margin: 2rem;
    #flow>details {
      width: 80%;
      &:nth-of-type(2) { left: calc(calc(100% - min(80%, 30rem)) / 3); span { color: var(--black); background-color: var(--yellow);} }
      &:nth-of-type(3) { left: calc(calc(calc(100% - min(80%, 30rem)) / 3) * 2); span { background-color: var(--blue);} }
      &:last-of-type { left: calc(100% - min(80%, 30rem)); span::after { display: none}; }
    }
  }
  footer { padding: 2rem;}
}
/* Tablet */
@media screen and (min-width: 40rem) {
  header {
    margin: 6rem auto 0; padding: 0 2rem; max-width: 45rem; 
    justify-content: center; gap: 2rem; flex-direction: row;
    div { gap: 1rem; }
    >div:first-child {
      flex-basis: 34%; min-width: 13rem; max-width: 21rem;
      flex-shrink: 0; margin-top: -3rem;
    }
    >div:last-of-type { width: 100%; >a { margin-top: 0.5rem;}}
    #node-viewer {
      >img { width: 4.25rem; top: -3.9rem; right: 18%;}
      >a { right: calc(18% + 4rem); }
    }
  }
  main {
    margin: auto; padding: 2rem; max-width: 45rem;
    #flow { width: 80%; margin: auto; details { width: min(80%, 30rem); } }
    #faq {
      flex-wrap: wrap; flex-direction: row; gap: 0.75rem;
      details { width: 40%; flex-grow: 1; }
      h2 { width: 100%; flex-shrink: 0; }
    }
  }
}
/* Desktop */
@media screen and (min-width: 67rem) {
  header { max-width: 60rem; }
  main {
    max-width: 60rem;
    #flow { width: 80%; details { width: min(80%, 30rem); } }
    #faq details { width: 30%; }
  }
}
