/* Wielder Computer: the few pages around the streams. One motif, the Orb: graphite at rest, amber while a
   machine wakes, green when it's awake. Everything else stays quiet. */

:root {
  --paper: #eef1f4;
  --surface: #ffffff;
  --ink: #14171b;
  --muted: #5c6570;
  --line: #d6dce3;
  --awake: #1d9a54;
  --waking: #b8781a;
  --asleep: #8a94a0;
  --alert: #b23f2a;
  --button: #14171b;
  --button-ink: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1013;
    --surface: #161a1f;
    --ink: #e8ecf0;
    --muted: #98a2ad;
    --line: #283038;
    --awake: #39c477;
    --waking: #e2a540;
    --asleep: #6c7681;
    --alert: #ee7a63;
    --button: #e8ecf0;
    --button-ink: #0d1013;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0d1013;
  --surface: #161a1f;
  --ink: #e8ecf0;
  --muted: #98a2ad;
  --line: #283038;
  --awake: #39c477;
  --waking: #e2a540;
  --asleep: #6c7681;
  --alert: #ee7a63;
  --button: #e8ecf0;
  --button-ink: #0d1013;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ink) 45%, transparent);
  outline-offset: 3px;
}

button,
.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

button.quiet {
  min-height: 40px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

button.quiet:hover {
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

.note {
  min-height: 1.5em;
  color: var(--muted);
  font-size: 15px;
}

.note.alert {
  color: var(--alert);
}

code {
  font: 500 0.92em ui-monospace, "SF Mono", Menlo, monospace;
  padding: 1px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

/* ---------------------------------------------------------------- the Orb */

.orb {
  --glow: transparent;
  position: relative;
  width: 112px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgb(255 255 255 / 0.95) 0 5%, rgb(255 255 255 / 0) 24%),
    radial-gradient(circle at 50% 55%, #9aa3ad 0%, #5d6672 55%, #2a3038 100%);
  box-shadow:
    inset -8px -14px 24px rgb(0 0 0 / 0.28),
    0 0 0 1px rgb(0 0 0 / 0.06),
    0 0 48px 6px var(--glow),
    0 18px 36px -18px rgb(10 20 30 / 0.55);
  transition: box-shadow 600ms ease;
}

.orb.small {
  width: 28px;
  box-shadow: inset -2px -4px 6px rgb(0 0 0 / 0.28), 0 0 14px 2px var(--glow);
}

.orb[data-mood="waking"],
.orb[data-mood="listening"] {
  --glow: color-mix(in srgb, var(--waking) 55%, transparent);
  animation: breathe 2.4s ease-in-out infinite;
}

.orb[data-mood="awake"] {
  --glow: color-mix(in srgb, var(--awake) 50%, transparent);
}

@keyframes breathe {
  50% {
    box-shadow:
      inset -8px -14px 24px rgb(0 0 0 / 0.28),
      0 0 0 1px rgb(0 0 0 / 0.06),
      0 0 22px 0 var(--glow),
      0 18px 36px -18px rgb(10 20 30 / 0.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb {
    animation: none !important;
    transition: none;
  }
}

/* ---------------------------------------------------------------- one-column pages: door, waking, paused */

.single main {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(100% - 32px, 26rem);
  margin: 0 auto;
  padding: max(14vh, 48px) 0 48px;
  text-align: center;
}

.single .orb {
  margin-bottom: 14px;
}

.single .lede {
  color: var(--muted);
  max-width: 22rem;
}

.single main > button,
.single main > .button {
  margin-top: 10px;
  min-width: 220px;
}

.steps {
  display: grid;
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.steps li::before {
  content: "";
  flex: none;
  width: 10px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid var(--asleep);
}

.steps li[data-at="now"] {
  color: var(--ink);
  font-weight: 600;
}

.steps li[data-at="now"]::before {
  border-color: var(--waking);
  background: var(--waking);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--waking) 22%, transparent);
}

.steps li[data-at="done"] {
  color: var(--ink);
}

.steps li[data-at="done"]::before {
  border-color: var(--awake);
  background: var(--awake);
}

.elapsed {
  color: var(--muted);
  font-size: 15px;
}

.elapsed strong {
  color: var(--ink);
  font-weight: 600;
}

.back {
  margin-top: 18px;
  color: var(--muted);
  font-size: 15px;
}

/* ---------------------------------------------------------------- home */

.home {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(100% - 32px, 36rem);
  margin: 0 auto;
}

.home header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(8vh, 32px) 0 28px;
}

.home h1 {
  font-size: 22px;
}

.machines {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.machine a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 2px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  text-decoration: none;
}

.machine a:hover {
  border-color: color-mix(in srgb, var(--ink) 30%, var(--line));
}

.machine .orb {
  grid-row: span 2;
  width: 40px;
  box-shadow: inset -3px -5px 9px rgb(0 0 0 / 0.28), 0 0 18px 2px var(--glow);
}

.machine .name {
  font-size: 19px;
  font-weight: 650;
}

.machine .about {
  grid-column: 2;
  color: var(--muted);
  font-size: 15px;
}

.machine .state {
  grid-row: 1 / span 2;
  grid-column: 3;
  text-align: right;
  font-size: 15px;
  color: var(--muted);
}

.machine .state strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 520px) {
  .machine a {
    grid-template-columns: auto 1fr;
  }

  .machine .state {
    grid-row: auto;
    grid-column: 2;
    text-align: left;
    margin-top: 6px;
  }

  .machine .state strong {
    display: inline;
    margin-right: 0.4em;
  }
}

.home .note {
  margin-top: 16px;
}

.home footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding: 40px 0 max(32px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 15px;
}

.home footer .credit {
  margin-right: auto;
}

.passkeys {
  flex-basis: 100%;
  margin-top: 8px;
}

.passkeys summary {
  cursor: pointer;
  width: fit-content;
}

.passkeys ul {
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.passkeys li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.passkeys li span {
  color: var(--ink);
}

.passkeys li small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.passkeys .add {
  min-height: 40px;
  padding: 0 18px;
  font-size: 15px;
}
