* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

:root {
  interpolate-size: allow-keywords;
  color-scheme: light;

  @media only screen {
    color-scheme: light dark;
  }

  --bg-color: light-dark(#ffffff, #000000);
  --sections-color: light-dark(#626262, #1c1c1c);
  --ruimte-kleur: light-dark(#1756c1, #09245b);
  /*!*--zon-gradient: light-dark(radial-gradient(circle, yellow, orange), radial-gradient(circle, #f0f0f0, #d3d3d3));*! werkte niet*/
  --eerste-kleur-zon: light-dark(yellow, #f0f0f0);
  --tweede-kleur-zon: light-dark(orange, #d3d3d3);
  --slider-track-color: light-dark(#ddd, #444);
  --slider-thumb-bg: white;
  --slider-thumb-border: #10ac84;
  --slider-track-gradient-start: #0abde3;
  --slider-track-gradient-end: #10ac84;
  --slider-thumb-shadow: rgba(0, 0, 0, 0.15);

  --snelheid-mercury: 3s;
  --snelheid-venus: 5s;
  --snelheid-aarde: 8s;
  --snelheid-mars: 12s;

  --afstand-mercury: 5em;
  --afstand-venus: 7.5em;
  --afstand-aarde: 11.25em;
  --afstand-mars: 15.625em;

  --grootte-mercury: 0.5em;
  --grootte-venus: 0.875em;
  --grootte-aarde: 1em;
  --grootte-mars: 0.75em;

  --kleur-mercury: gray;
  --kleur-venus: orange;
  --kleur-aarde: blue;
  --kleur-mars: red;

  --delay: 0;
  --scale: 1;
}

body {
  background-color: var(--bg-color);
  height: 100lvh;
  font-family: "Orbitron", sans-serif;
}

h1 {
  font-size: 1.5rem;
  text-align: center;
  color: white;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  margin-top: 20px;
  z-index: 100;
  animation: vliegenTitel 3s ease-in-out infinite;
}

article {
  height: 100vh;
  display: grid;
  grid-template-rows: 2.5fr 1.5fr;
  gap: 0.5rem;

  & section {
    background-color: var(--sections-color);
    min-width: 0px;
    overflow: hidden;
    transition: all 1s ease-out;
    container-type: inline-size;
  }

  & div:first-of-type {
    gap: 0.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-row: 1;
    grid-column: 1;
    transition: grid-template-columns 1s ease-in-out;

    & ul {
      width: 100%;
      height: 100%;
      display: grid;
      background-image: url("../img/Cosmos.jpg");
      /* https://pixabay.com/nl/photos/kosmos-milky-way-nacht-lucht-1853491/ */
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      place-items: center;
      list-style: none;
    }

    & li {
      aspect-ratio: 1 / 1;
      border-radius: 50%;
      grid-area: 1/1;
    }

    & section:first-of-type {
      display: grid;
      grid-template-columns: 1fr;

      & form {
        grid-row: 1;
        grid-column: 1;
        display: flex;
        align-items: flex-end;
      }

      & ul {
        grid-row: 1;
        grid-column: 1;
      }

      & li:first-of-type {
        height: calc(3.125em * var(--scale));
        background: radial-gradient(
          circle,
          var(--eerste-kleur-zon),
          var(--tweede-kleur-zon)
        );
        box-shadow: 0 0 50px rgba(255, 200, 0, 0.8);
      }

      & li:nth-of-type(2) {
        height: calc(0.5em * var(--scale));
        --afstand: 5em;
        background: var(--kleur-mercury);
        box-shadow: 0 0 5px rgba(200, 200, 200, 0.8);
        animation: orbit 3s linear infinite;
        animation-play-state: paused;
        animation-fill-mode: both;
      }

      & li:nth-of-type(3) {
        height: calc(1em * var(--scale));
        --afstand: 11.25em;
        background: var(--kleur-aarde);
        box-shadow: 0 0 10px rgba(0, 0, 255, 0.8);
        animation: orbit 8s linear infinite;
        animation-play-state: paused;
        animation-fill-mode: both;
      }

      & li:nth-of-type(4) {
        height: calc(0.875em * var(--scale));
        --afstand: 7.5em;
        background: var(--kleur-venus);
        box-shadow: 0 0 8px rgba(255, 165, 0, 0.8);
        animation: orbit 5s linear infinite;
        animation-play-state: paused;
        animation-fill-mode: both;
      }

      & li:nth-of-type(5) {
        height: calc(0.75em * var(--scale));
        --afstand: 15.625em;
        background: var(--kleur-mars);
        box-shadow: 0 0 7px rgba(255, 0, 0, 0.8);
        animation: orbit 12s linear infinite;
        animation-play-state: paused;
        animation-fill-mode: both;
      }

      body:has(input[type="checkbox"]:checked) & li {
        animation-play-state: running;
      }
    }

    & section:last-of-type {
      & li:first-of-type {
        height: 50px;
        background: radial-gradient(
          circle,
          var(--eerste-kleur-zon),
          var(--tweede-kleur-zon)
        );
        box-shadow: 0 0 50px rgba(255, 200, 0, 0.8);
      }

      & li:nth-of-type(2) {
        height: calc(var(--grootte-mercury) * var(--scale) * 1em);
        --afstand: calc(var(--afstand-mercury) * 1em);
        background: var(--kleur-mercury);
        box-shadow: 0 0 5px rgba(200, 200, 200, 0.8);
        animation: orbit calc(var(--snelheid-mercury) * 1s) linear infinite;
        animation-delay: calc(var(--delay) * -5s);
        animation-play-state: paused;
        animation-fill-mode: both;
      }

      & li:nth-of-type(3) {
        height: calc(var(--grootte-aarde) * var(--scale) * 1em);
        --afstand: calc(var(--afstand-aarde) * 1em);
        background: var(--kleur-aarde);
        box-shadow: 0 0 10px rgba(0, 0, 255, 0.8);
        animation: orbit calc(var(--snelheid-aarde) * 1s) linear infinite;
        animation-delay: calc(var(--delay) * -5s);
        animation-play-state: paused;
        animation-fill-mode: both;
      }

      & li:nth-of-type(4) {
        height: calc(var(--grootte-venus) * var(--scale) * 1em);
        --afstand: calc(var(--afstand-venus) * 1em);
        background: var(--kleur-venus);
        box-shadow: 0 0 8px rgba(255, 165, 0, 0.8);
        animation: orbit calc(var(--snelheid-venus) * 1s) linear infinite;
        animation-delay: calc(var(--delay) * -5s);
        animation-play-state: paused;
        animation-fill-mode: both;
      }

      & li:nth-of-type(5) {
        height: calc(var(--grootte-mars) * var(--scale) * 1em);
        --afstand: calc(var(--afstand-mars) * 1em);
        background: var(--kleur-mars);
        box-shadow: 0 0 7px rgba(255, 0, 0, 0.8);
        animation: orbit calc(var(--snelheid-mars) * 1s) linear infinite;
        animation-delay: calc(var(--delay) * -5s);
        animation-play-state: paused;
        animation-fill-mode: both;
      }
    }
  }

  & div:nth-of-type(2) {
    display: flex;
    flex-direction: column;
    align-items: center;

    & section:first-of-type {
      width: 100%;
      height: 20%;
      padding: 1em;
      display: grid;
      justify-items: center;
      align-items: center;

      & input[type="range"] {
        grid-row: 1;
        grid-column: 1;
        touch-action: none;
        appearance: none;
        width: 80%;
        padding: 0.5em 0;
        position: relative;
      }

      & input[type="range"]::after {
        content: "";
        position: absolute;
        left: 0;
        right: -15px;
        height: 1em;
        top: 2em;
        background-image: repeating-linear-gradient(
          to right,
          black 0 2px,
          transparent 0 calc((100% - 1em) / 10)
        );

        background-size: calc(100% - 1em + 1px);
        background-repeat: no-repeat;
        background-position: center center;
      }

      & input[type="range"]::-webkit-slider-runnable-track {
        width: 100%;
        height: 4px;
        background: #555;
        border-radius: 2px;
      }

      & input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 10px;
        height: 25px;
        background: red;
        border-radius: 2px;
        cursor: pointer;
        margin-top: -10px;
      }
    }

    & section:last-of-type {
      height: 80%;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;

      & form {
        display: flex;
        flex-direction: row;
        gap: 1rem;
        /* width: min-content; */
      }

      & details {
        display: flex;
        flex-direction: row;
        position: relative;
        z-index: 1;
        height: 18rem;
        border-radius: 2rem;
        overflow: hidden;
        background: transparent;
      }
      & details::marker {
        display: none;
        content: "";
      }
      & details summary {
        padding: 1rem 1em;
        /* width: 5rem; */
        width: 10vw;
        flex-shrink: 0;
        text-align: center;
        cursor: pointer;
      }
      & details summary legend {
        display: grid;
        place-content: center;
        width: 100%;
        font-size: clamp(0.8rem, 2.8vw, 2.5rem);
        margin: 0.1em;
      }
      & details summary img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        z-index: -1;
        transition: filter 0.5s ease;
      }
      & details[open] summary img {
        filter: brightness(0.5);
      }

      & ul {
        list-style-type: none;
        padding: 1.5rem 1rem;
        width: 50vw;
      }

      & ul li {
        margin-bottom: 1.5rem;
      }

      & ul li label {
        display: block;
        margin-bottom: 0.5rem;
        font-size: clamp(0.7rem, 2vw, 2rem);
      }

      & ul li input[type="range"] {
        -webkit-appearance: none;
        width: 100%;
        height: 6px;
        background: var(--slider-track-color);
        border-radius: 3px;
        outline: none;
        cursor: pointer;
        transition: background 0.3s;
      }

      & ul li input[type="range"]::-webkit-slider-runnable-track {
        height: 6px;
        background: linear-gradient(
          to right,
          var(--slider-track-gradient-start),
          var(--slider-track-gradient-end)
        );
        border-radius: 3px;
      }

      & ul li input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: var(--slider-thumb-bg);
        border: 2px solid var(--slider-thumb-border);
        box-shadow: 0 2px 4px var(--slider-thumb-shadow);
        margin-top: -6px; /* Align with track */
        transition: transform 0.2s ease;
      }

      & ul li input[type="range"]::-webkit-slider-thumb:hover {
        transform: scale(1.1);
      }
      & fieldset {
        border: 0;
      }
    }
  }

  nav {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
    grid-row: 1;
    grid-column: 1;
    border-radius: 0 0 1rem 1rem;
    justify-self: center;
    align-self: start;
  }

  label {
    margin: 0.5em;

    & input {
      background-color: red;
      padding: 1.5rem;
      appearance: none;
      border-radius: 50%;
    }

    & input:checked {
      background-color: lightgreen;
    }
  }
}

@media (max-width: 600px) {
  article {
    height: 100svh;
    display: grid;
    grid-template-rows: 2.5fr 1.5fr;
    gap: 0.2rem;

    & div:first-of-type {
      gap: 0.2rem;
      display: grid;
      grid-template-columns: 0fr 1fr;

      body:has(input[value="yes"]:checked) & {
        grid-template-columns: 1fr 0fr;
      }
    }

    & nav {
      opacity: 1;
      transform: translateY(0);
    }
    div:nth-of-type(2) section:last-of-type {
      & details {
        flex-direction: column;
      }
    }
  }
}

@container (max-width: 300px) {
  ul {
    --scale: 0.5;
  }
}

@container (min-width: 300px) {
  ul {
    --scale: 1;
  }
}

/*https://www.w3schools.com/css/css_grid.asp*/

@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: true;
}

@keyframes orbit {
  0% {
    --angle: 0deg;
    transform: translate(
      calc(var(--afstand) * cos(var(--angle))),
      calc(var(--afstand) * sin(var(--angle)))
    );
  }

  100% {
    --angle: 360deg;
    transform: translate(
      calc(var(--afstand) * cos(var(--angle))),
      calc(var(--afstand) * sin(var(--angle)))
    );
  }
}

@keyframes vliegenTitel {
  0% {
    transform: scale(1) translateY(0) rotate(0deg);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8),
      0 0 30px rgba(255, 255, 255, 0.5);
  }
  25% {
    transform: scale(1.1) translateY(-10px) rotate(10deg);
    text-shadow: 0 0 20px rgba(255, 255, 255, 1),
      0 0 40px rgba(255, 255, 255, 0.7);
  }
  50% {
    transform: scale(1.2) translateY(-15px) rotate(-10deg);
    text-shadow: 0 0 30px rgba(255, 255, 255, 1),
      0 0 50px rgba(255, 255, 255, 0.9);
  }
  75% {
    transform: scale(1.1) translateY(-10px) rotate(5deg);
    text-shadow: 0 0 20px rgba(255, 255, 255, 1),
      0 0 40px rgba(255, 255, 255, 0.8);
  }
  100% {
    transform: scale(1) translateY(0) rotate(0deg);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8),
      0 0 30px rgba(255, 255, 255, 0.5);
  }
}
