:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", Ubuntu, "DejaVu Sans", sans-serif;
  background: #0d0f86;
  color: #fff;
}

* {
  box-sizing: border-box;
}

html,
body,
.stage {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-width: 20rem;
}

.stage {
  position: relative;
  isolation: isolate;
  background: #1114a8;
}

#raytracer {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#raytracer:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -5px;
}

.launch {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow-y: auto;
  background: rgb(7 9 72 / 58%);
  transition: opacity 180ms ease;
}

.launch__content {
  position: relative;
  width: min(100%, 31rem);
  padding: 2rem;
  text-align: center;
  background: rgb(5 7 48 / 90%);
  border: 1px solid rgb(255 255 255 / 28%);
}

.language {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  margin: 0;
  font-size: 0.75rem;
}

.language a {
  color: rgb(255 255 255 / 78%);
  text-underline-offset: 0.2em;
}

.language a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

h1 {
  margin: 0;
  font-size: clamp(2.25rem, 8vw, 4.75rem);
  font-weight: 780;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.intro {
  max-width: 29rem;
  margin: 1.25rem auto 1.5rem;
  color: rgb(255 255 255 / 84%);
  line-height: 1.6;
}

.start {
  flex: 1 1 0;
  min-height: 3rem;
  padding: 0.75rem 1.25rem;
  border: 2px solid #fff;
  border-radius: 0;
  background: #f4ec52;
  color: #080923;
  font: inherit;
  font-weight: 780;
  cursor: pointer;
}

.start-options {
  display: flex;
  gap: 0.75rem;
}

.start--secondary {
  background: transparent;
  color: #fff;
}

.start--secondary:hover:not([aria-disabled="true"]) {
  background: rgb(255 255 255 / 12%);
}

.start:hover:not([aria-disabled="true"]) {
  background: #fff86b;
}

.start:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

.start[aria-disabled="true"] {
  cursor: wait;
  opacity: 0.64;
}

.status,
.hint,
.credit {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: rgb(255 255 255 / 68%);
}

.hint {
  margin-top: 0.25rem;
}

.credit a {
  color: inherit;
  text-underline-offset: 0.2em;
}

.about {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgb(255 255 255 / 20%);
  text-align: left;
  font-size: 0.8125rem;
}

.about summary {
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

.about summary:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.about__content p {
  margin: 0.625rem 0 0;
  color: rgb(255 255 255 / 84%);
  line-height: 1.55;
}

.about__content a {
  color: inherit;
  text-underline-offset: 0.2em;
}

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

.controls {
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  width: 100%;
  padding:
    0.625rem
    max(0.75rem, env(safe-area-inset-right))
    max(0.625rem, env(safe-area-inset-bottom))
    max(0.75rem, env(safe-area-inset-left));
  border-top: 1px solid rgb(255 255 255 / 34%);
  background: rgb(5 7 48 / 96%);
  transition: opacity 240ms ease;
}

.controls[hidden] {
  display: none;
}

/* Tijdens het afspelen verdwijnt de balk na een paar seconden rust; hij blijft
   in de toegankelijkheidsboom en komt terug bij beweging, toets of focus. */
.stage[data-idle="true"] .controls {
  opacity: 0;
  pointer-events: none;
}

.stage[data-idle="true"] #raytracer {
  cursor: none;
}

.controls__primary {
  display: grid;
  grid-template-columns:
    minmax(4.25rem, 0.75fr)
    minmax(8rem, 1.4fr)
    minmax(4.25rem, 0.75fr);
  gap: 0.5rem;
  align-items: end;
}

.controls__secondary,
.speed-control {
  display: grid;
  align-items: center;
}

.controls__secondary {
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.speed-control {
  grid-template-columns: max-content minmax(5rem, 1fr) 2.75rem;
  gap: 0.5rem;
}

.controls label,
.controls output,
.control-label,
.control-button,
.mode-switch__option,
.camera-menu summary {
  font-size: 0.8125rem;
  font-weight: 700;
}

.mode-control {
  min-width: 0;
}

.control-label {
  display: block;
  margin-bottom: 0.25rem;
  color: rgb(255 255 255 / 78%);
  font-size: 0.6875rem;
  text-align: center;
}

.mode-switch {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0.1875rem;
  border: 1px solid rgb(255 255 255 / 72%);
  background: rgb(255 255 255 / 8%);
}

.mode-switch::before {
  position: absolute;
  z-index: 0;
  top: 0.1875rem;
  bottom: 0.1875rem;
  left: 0.1875rem;
  width: calc(50% - 0.1875rem);
  background: #f4ec52;
  content: "";
  pointer-events: none;
  transform: translateX(0);
  transition:
    transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 120ms ease-out;
}

.mode-switch[data-mode="modern"]::before {
  transform: translateX(100%);
}

.control-button,
.mode-switch__option,
.camera-menu summary {
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
}

.control-button {
  min-height: 3rem;
  padding: 0.5rem 0.625rem;
}

.control-button--primary,
#drone-shot-camera[aria-pressed="true"] {
  border-color: #f4ec52;
  background: #f4ec52;
  color: #080923;
}

.mode-switch__option {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.375rem 0.25rem;
  border: 0;
  transition: color 120ms ease-out;
}

.mode-switch__option[aria-pressed="true"] {
  color: #080923;
}

#animation-speed {
  width: 100%;
  min-height: 2.75rem;
  margin: 0;
  accent-color: #f4ec52;
  cursor: pointer;
}

.controls output {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.camera-menu {
  position: static;
}

.camera-menu summary {
  display: grid;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  place-items: center;
  list-style: none;
}

.camera-menu summary::-webkit-details-marker {
  display: none;
}

/* Het cameramenu klapt boven de hele balk uit (de balk is de positioneringscontext)
   en overlapt zo niet de knop Sluiten. */
.controls__camera-actions {
  position: absolute;
  right: 0.75rem;
  bottom: calc(100% + 0.5rem);
  display: grid;
  width: min(12rem, calc(100vw - 1.5rem));
  padding: 0.5rem;
  gap: 0.5rem;
  border: 1px solid rgb(255 255 255 / 34%);
  background: #050730;
}

.controls__footer {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.frame-output {
  min-width: 2.75rem;
  color: rgb(255 255 255 / 78%);
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.frame-output:empty,
.frame-output[hidden] {
  display: none;
}

.controls__help {
  margin: 0;
  color: rgb(255 255 255 / 78%);
  font-size: 0.6875rem;
  text-align: center;
}

@media (hover: none), (pointer: coarse) {
  .controls__help-keyboard {
    display: none;
  }
}

#animation-speed:focus-visible,
.control-button:focus-visible,
.mode-switch__option:focus-visible,
.camera-menu summary:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.stage[data-state="running"] #raytracer,
.stage[data-state="paused"] #raytracer {
  cursor: grab;
}

.stage[data-state="running"] #raytracer.is-dragging,
.stage[data-state="paused"] #raytracer.is-dragging {
  cursor: grabbing;
}

.stage[data-state="running"] .launch,
.stage[data-state="paused"] .launch {
  pointer-events: none;
  opacity: 0;
}

.stage[data-state="error"] .status {
  color: #fff86b;
}

noscript {
  position: fixed;
  inset: auto 0 0;
  z-index: 2;
  padding: 1rem;
  background: #080923;
  text-align: center;
}

@media (max-width: 35rem) {
  .launch__content {
    padding: 1.5rem 1rem;
  }

  .start-options {
    flex-direction: column;
  }

}

@media (min-width: 48rem) {
  .controls {
    right: auto;
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: 50%;
    width: min(calc(100% - 2rem), 56rem);
    padding: 0.75rem 1rem;
    transform: translateX(-50%);
    border: 1px solid rgb(255 255 255 / 34%);
  }

  .controls__primary {
    grid-template-columns: minmax(7rem, 0.75fr) minmax(15rem, 1fr) minmax(7rem, 0.75fr);
  }

  .controls__secondary {
    grid-template-columns: minmax(24rem, 1fr) max-content;
  }
}

@media (min-width: 64rem) {
  .controls {
    width: min(calc(100% - 2rem), 42rem);
    padding: 0.5rem 0.75rem;
  }

  .controls__primary {
    grid-template-columns: minmax(5.25rem, 0.65fr) minmax(12rem, 1fr) minmax(5.25rem, 0.65fr);
  }

  .controls__secondary {
    grid-template-columns: minmax(18rem, 1fr) max-content;
    margin-top: 0.375rem;
  }

  .control-button {
    min-height: 2.25rem;
    padding: 0.25rem 0.5rem;
  }

  .mode-switch__option,
  #animation-speed,
  .camera-menu summary {
    min-height: 2.25rem;
  }

  .controls__footer {
    margin-top: 0.25rem;
  }
}

@media (pointer: coarse) {
  .control-button {
    min-height: 3rem;
    padding: 0.5rem 0.625rem;
  }

  .mode-switch__option,
  #animation-speed,
  .camera-menu summary {
    min-height: 2.75rem;
  }
}

@media (hover: hover) {
  .control-button:hover,
  .camera-menu summary:hover {
    background: rgb(255 255 255 / 12%);
  }

  .mode-switch__option:hover:not([aria-pressed="true"]) {
    background: rgb(255 255 255 / 12%);
  }

  .mode-switch:hover::before {
    background: #fff86b;
  }

  .control-button--primary:hover,
  #drone-shot-camera[aria-pressed="true"]:hover {
    background: #fff86b;
  }
}

@media (max-height: 30rem) {
  .controls__help {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .launch,
  .controls,
  .mode-switch::before,
  .mode-switch__option {
    transition: none;
  }
}
