/* NO SINGLE IMAGE: page around the poster. Calm, one ink, the poster leads. */

:root {
  --bg: #e5e2db;
  --ink: #1b1a17;
  --muted: #4f4d48;
  --line: #b9b4aa;
  --signal: #e0422b;
  --panel-w: 344px;
  --gutter: 32px;
  --sans: "NSI Grot", system-ui, sans-serif;
  --mono: "NSI Mono", ui-monospace, monospace;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--sans);
  font-stretch: 100%;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  font: 500 13px/1 var(--mono);
  z-index: 10;
}

.skip:focus {
  top: 12px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.instrument {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "stage intro"
    "stage controls";
  column-gap: 48px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px var(--gutter);
}

.intro {
  grid-area: intro;
  padding-top: 4px;
}

.stage {
  grid-area: stage;
  align-self: start;
  position: sticky;
  top: 24px;
  display: flex;
  justify-content: flex-end;
}

.controls {
  grid-area: controls;
  padding-bottom: 24px;
}

/* The art board: 4:5, as tall as the viewport allows. */
.frame {
  position: relative;
  width: min(100%, calc((100vh - 48px) * 0.8));
  aspect-ratio: 4 / 5;
  background: #eeeae1;
  box-shadow: 0 0 0 1px rgba(27, 26, 23, 0.12);
}

.frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Shown only if the modules never start (for example, opened as a file). */
.stage-note {
  position: absolute;
  inset: auto 24px 24px;
  margin: 0;
  font: 500 13px/1.4 var(--mono);
  opacity: 0;
  animation: note-appear 0s linear 3s forwards;
}

html[data-ready="true"] .stage-note {
  display: none;
}

@keyframes note-appear {
  to {
    opacity: 1;
  }
}

h1 {
  margin: 0;
  font: 800 32px/0.95 var(--sans);
  font-stretch: 72%;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

.subtitle {
  margin: 8px 0 0;
  font: 500 12px/1.3 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.thesis {
  margin: 10px 0 0;
  max-width: 36ch;
  font-size: 15px;
  line-height: 1.4;
}

.group {
  margin: 12px 0 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}

legend,
summary {
  padding: 0;
  font: 500 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

legend {
  float: left;
  width: 100%;
  margin-bottom: 8px;
}

legend + * {
  clear: both;
}

.axis {
  margin-bottom: 2px;
}

.axis-head {
  display: flex;
  margin-bottom: 3px;
  justify-content: space-between;
  align-items: baseline;
  font: 500 12px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.axis-head .pole-b {
  text-align: right;
}

.axis-head output {
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
  text-align: center;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  box-sizing: content-box;
  height: 24px;
  /* 44 px touch target with no change to the layout: the padding adds the
     hit area and the negative margin gives the space back. */
  padding: 10px 0;
  margin: -10px 0;
  background:
    linear-gradient(var(--ink), var(--ink)) 0 50% / 1px 9px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 25% 50% / 1px 7px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 50% 50% / 1px 9px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 75% 50% / 1px 7px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 100% 50% / 1px 9px no-repeat;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--ink);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 24px;
  margin-top: -11px;
  border: 0;
  border-radius: 0;
  background: var(--ink);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--ink);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 24px;
  border: 0;
  border-radius: 0;
  background: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

input[type="range"]:focus-visible {
  outline-offset: 1px;
}

button,
.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 10px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 500 12px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
}

button:hover,
.file-label:hover {
  background: var(--ink);
  color: var(--bg);
}

button:focus-visible {
  outline-offset: 2px;
}

.preset-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.preset-list li:last-child {
  grid-column: 1 / -1;
}

.preset-list button {
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  text-align: left;
  letter-spacing: 0.03em;
}

.preset-list button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.preset-list button[aria-pressed="true"]::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  background: var(--signal);
}

.seed-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input[type="number"] {
  min-height: 36px;
  width: 100%;
  padding: 0 10px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: #f1efe9;
  color: var(--ink);
  font: 500 16px/1 var(--mono);
  font-variant-numeric: tabular-nums;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}

.own summary {
  cursor: pointer;
  min-height: 24px;
  line-height: 24px;
  /* 44 px touch target with no change to the layout */
  padding: 10px 0;
  margin: -10px 0;
}

.own[open] summary {
  margin-bottom: -6px;
}

.own input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.own .file-label:has(+ input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.file-label {
  margin-top: 10px;
}

#own-clear {
  margin-top: 10px;
  margin-left: 8px;
}

.status {
  min-height: 1.4em;
  margin: 8px 0 0;
  font: 500 12px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.credit {
  margin: 8px 0 0;
  color: var(--muted);
  font: 500 11px/1.45 var(--mono);
  letter-spacing: 0.02em;
}

.noscript {
  max-width: 40ch;
  margin: 24px;
}

@media (max-width: 860px) {
  :root {
    --gutter: 16px;
  }

  .instrument {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "intro"
      "stage"
      "controls";
    padding: 20px var(--gutter);
  }

  .stage {
    position: static;
    justify-content: center;
    margin-top: 18px;
  }

  .frame {
    width: 100%;
  }

  .thesis {
    max-width: none;
  }

  h1 {
    font-size: 30px;
  }
}

/* Windows high contrast and other forced colour modes: keep the sliders and
   the pressed preset visible with system colours. */
@media (forced-colors: active) {
  input[type="range"] {
    forced-color-adjust: none;
    background: none;
  }

  input[type="range"]::-webkit-slider-runnable-track {
    background: CanvasText;
  }

  input[type="range"]::-webkit-slider-thumb {
    background: Highlight;
  }

  input[type="range"]::-moz-range-track {
    background: CanvasText;
  }

  input[type="range"]::-moz-range-thumb {
    background: Highlight;
  }

  .preset-list button[aria-pressed="true"] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }

  :focus-visible {
    outline-color: Highlight;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
