:root {
  --sky: #0c122d;
  --cloud: #37427e;
  --starlight: #ebe8f7;
  --haze: #8a8fbe;
  --moon: #fcd587;
  --mint: #82e6d6;
  --ember: #ef9c68;

  --line: 32px;
  --margin-x: 88px;

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background-color: var(--sky);
  /* three offset grids of pinpricks, primes so they never line up */
  background-image:
    radial-gradient(circle at 37px 61px, rgb(255 244 214 / 0.75) 0 1px, transparent 1.6px),
    radial-gradient(circle at 120px 18px, rgb(235 232 247 / 0.5) 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 80px 140px, rgb(130 230 214 / 0.45) 0 0.8px, transparent 1.4px);
  background-size: 211px 173px, 157px 229px, 263px 199px;
}

body {
  position: relative;
  margin: 0;
  padding: calc(var(--line) * 2) 16px 200px;
  min-height: 100vh;
  font-family: "Nunito", ui-rounded, system-ui, sans-serif;
  font-size: 17px;
  line-height: var(--line);
  color: var(--starlight);
}

body::before {
  content: "";
  position: absolute;
  top: 20px;
  right: 12px;
  width: clamp(96px, calc(100vw - 34rem - var(--margin-x) - 64px), 340px);
  aspect-ratio: 360 / 320;
  background: url("/assets/moon.svg") center / contain no-repeat;
  pointer-events: none;
}

body::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 200px;
  background: url("/assets/clouds.svg") center bottom / cover no-repeat;
  pointer-events: none;
}

@media (min-width: 720px) {
  body {
    padding-left: var(--margin-x);
  }
}

/* no column to the side on a phone, so the moon gets its own row */
@media (max-width: 719px) {
  body {
    padding-top: 120px;
  }
}

.sheet {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  margin: 0;
}

h1 {
  margin: 0 0 var(--line);
  font-size: 22px;
  font-weight: 800;
  line-height: var(--line);
  letter-spacing: 0.005em;
}

h1 .stage-no {
  color: var(--moon);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgb(252 213 135 / 0.6);
}

p {
  margin: 0 0 var(--line);
  max-width: 32rem;
}

a {
  color: inherit;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--haze);
}

a:hover {
  text-decoration-color: var(--moon);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.88em;
  color: var(--moon);
}

.check,
.lock {
  display: flex;
  gap: 12px 20px;
  align-items: baseline;
  margin-bottom: var(--line);
  flex-wrap: wrap;
}

.check input,
.check textarea,
.lock input,
.shop input {
  flex: 1 1 18rem;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--haze);
  border-radius: 0;
  background: transparent;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 15px;
  line-height: calc(var(--line) - 1px);
  color: var(--starlight);
}

.check input::placeholder,
.lock input::placeholder {
  color: var(--haze);
  opacity: 0.7;
}

/* the underline is the focus ring, a box around it would undo the point */
.check input:focus-visible,
.lock input:focus-visible {
  outline: none;
  border-bottom-color: var(--moon);
  box-shadow: 0 1px 0 var(--moon);
}

.check button,
.lock button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--moon);
  cursor: pointer;
}

.check button:hover,
.lock button:hover {
  text-shadow: 0 0 12px rgb(252 213 135 / 0.6);
}

.verdict {
  margin: 0 0 var(--line);
  min-height: var(--line);
  font-size: 15px;
  color: var(--haze);
}

.verdict[data-state="right"] {
  color: var(--starlight);
  font-weight: 700;
}

.verdict[data-state="wrong"] {
  color: var(--ember);
}

.goal {
  margin: 0 0 4px;
  color: var(--moon);
  font-weight: 700;
}

.look {
  margin: 0 0 var(--line);
  padding-left: 1.2em;
  color: var(--haze);
}

.cleared {
  margin: 0 0 var(--line);
  font-size: 0.85em;
  line-height: 1.5;
  color: var(--haze);
}

.cleared strong {
  color: var(--moon);
}

.flock {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0 0 calc(var(--line) * 1.5);
  padding: 0;
  list-style: none;
}

.flock a,
.flock span {
  display: block;
  padding: 2px;
  border-radius: 8px;
  text-decoration: none;
}

.tier {
  margin: 0 0 6px;
  font-size: 0.74em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--haze);
}

.flock svg {
  display: block;
  width: 30px;
  height: 24px;
  fill: none;
  stroke: var(--haze);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flock [data-state="locked"] {
  opacity: 0.3;
}

.flock a:hover svg {
  stroke: var(--starlight);
}

.flock [data-state="cleared"] svg {
  filter: drop-shadow(0 0 6px rgb(252 213 135 / 0.7));
  stroke: var(--moon);
  --sheep-body: var(--moon);
  fill-opacity: 0.3;
}

.door {
  margin-top: calc(var(--line) * 2);
}

/* the last page's sunrise, and stage 3's */
html.morning {
  --sky: #f3c3a4;
  --cloud: #d98e86;
  --starlight: #35203d;
  --haze: #6e4a62;
  --moon: #a8402b;
  background-image: linear-gradient(to bottom, #7d7fb8 0%, #d9a0b0 38%, #f3c3a4 70%, #f8dca0 100%);
  background-size: auto;
  background-attachment: fixed;
}

html.morning body::before {
  opacity: 0.3;
}

html.morning body::after {
  opacity: 0.45;
}

body::before,
body::after {
  transition: opacity 2s;
}

.nav {
  margin-top: calc(var(--line) * 2);
  font-size: 15px;
  color: var(--haze);
}

.nav a {
  color: var(--starlight);
}

/* nobody wants a page of navy ink */
@media print {
  :root {
    --sky: #fff;
    --starlight: #111;
    --haze: #555;
    --moon: #111;
    color-scheme: light;
  }

  html {
    background: none;
  }

  body {
    padding: 0;
  }

  body::before,
  body::after {
    display: none;
  }
}
