@keyframes pulse {
  0% {
    opacity: 0.7;
  }

  40% {
    opacity: 1;
  }

  100% {
    opacity: 0.7;
  }
}

@keyframes pulseGrow {
  0% {
    scale: 0.9;
  }

  40% {
    scale: 1.2;
  }

  100% {
    scale: 0.9;
  }
}

html {
  box-sizing: border-box;
  font-size: 16px;
}

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

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ol,
ul {
  &:not(.edito) {
    margin: 0;
    padding: 0;
    font-weight: normal;
  }
}

summary {
  margin-bottom: 0.5rem;
  padding: 1rem 0;

  [open] & {
    background-color: #0b5ed7;
  }
}

ol,
ul {
  &:not(.edito) {
    list-style: none;
  }
}

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

body {
  min-height: 100vh;
}

.bonus {
  &::after {
    content: ' 🎖';
  }
}

.guidelines {
  counter-reset: section;

  h3 {
    counter-increment: section;

    &::before {
      content: counter(section) '. ';
    }
  }

  h3.no-count {
    border-top: 1px solid currentColor;
    padding-top: 50px;

    &,
    & ~ h3 {
      &::before {
        content: none;
      }
    }
  }
}

body:has(#navbarHeader.show) {
  .navbar .instructions {
    overflow: hidden;
    position: relative;

    &::after {
      background-color: rgb(175, 3, 3);
      content: "C'est un bon début, et maintenant faut fermer ! →";
      left: 0;
      padding: 0.25rem;
      position: absolute;
      text-align: center;
      top: 0;
      width: 100%;
    }
  }
}

#pre {
  anchor-name: --pre;
}

#pre + .instructions {
  font-size: 1rem;
  left: anchor(right);
  position: absolute;
  position-anchor: --pre;
  top: anchor(center);
}

.instructions {
  animation: pulse 3s infinite cubic-bezier(0.4, 0, 0.6, 1);
  background-color: rgb(175, 3, 3);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.25rem;
  text-shadow: 1px 1px 0 #0005;

  &.prev {
    margin-left: 1rem;

    &::before {
      content: '← ';
    }
  }

  &.next {
    margin-right: 1rem;

    &::after {
      content: ' →';
    }
  }

  &.sticky {
    align-items: center;
    container-type: scroll-state;
    container-name: sticky-heading;
    display: inline-flex;
    gap: 5px;
    font-size: 20px;
    position: sticky;
    bottom: 0px;

    &.prev {
      left: 0;
      margin-left: 0;
      translate: calc(-1rem - 100%) calc(-640px - 50%);

      &::before,
      &::after {
        content: ' →';
      }
    }

    &.next {
      left: 100%;
      translate: calc(2rem + 100%) calc(-640px - 50%);

      &::before,
      &::after {
        content: ' ←';
      }
    }

    &::after {
      content: ' ←';
    }

    &::before,
    &::after {
      font-size: 35px;
      transition: all 0.15s linear;
    }

    @container sticky-heading scroll-state(stuck: bottom) {
      &.next {
        &::before,
        &::after {
          rotate: -90deg;
        }
      }

      &.prev {
        &::before,
        &::after {
          rotate: 90deg;
        }
      }
    }
  }

  .navbar & {
    margin-left: auto;
  }
}
/*
@container sticky-heading scroll-state(stuck: bottom) {
  .instructions.sticky::after {
    color: red;
  }
} */

.location {
  align-items: center;
  display: inline-flex;
  gap: 0.25rem;

  &::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='currentColor' class='size-6'><path stroke-linecap='round' stroke-linejoin='round' d='M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z' /><path stroke-linecap='round' stroke-linejoin='round' d='M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z' /></svg>");
    content: '';
    height: 1.5rem;
    display: inline-flex;
    width: 1.5rem;
  }
}

.col {
  transition: all 0.15s cubic-bezier(0.64, 0.57, 0.67, 1.53);

  &:has(.infos) {
    overflow: hidden;
    position: relative;
  }
}

.over {
  scale: 1.05;
}

summary:has(h3) {
  align-items: center;
  display: flex;
  justify-content: center;
  gap: 10px;

  &::before,
  &::after {
    animation: pulseGrow 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
    content: '▼';
  }
}

.blockquote {
  border: 1px dotted #888;
  background-color: #efefef;
  padding: 2rem 3rem;

  .blockquote-footer {
    margin-top: 0;
    text-align: right;
  }
}

.infos {
  align-items: center;
  aspect-ratio: 280/280;
  background-color: #000a;
  color: #fff;
  font-size: 1rem;
  left: calc(var(--bs-gutter-x) * 0.5);
  opacity: 1;
  overflow: auto;
  padding: 3rem 2rem;
  position: absolute;
  scale: 1;
  text-align: center;
  top: 0;
  transition:
    all 0.15s cubic-bezier(0.64, 0.57, 0.67, 1.53),
    display 0.15s ease-out allow-discrete;
  width: calc(100% - var(--bs-gutter-x));

  &[contenteditable] {
    outline: 3px dotted;
    outline-offset: -3px;
  }

  @starting-style {
    opacity: 0;
    scale: 0.9;
  }
}

.hidden {
  display: none;
  opacity: 0;
  scale: 0.9;
  transition:
    all 0.15s cubic-bezier(0.64, 0.57, 0.67, 1.53),
    display 0.15s ease-out allow-discrete;
}
