@property --glow {
  syntax: "<color>";
  inherits: false;
  initial-value: rgb(255 255 255 / 0.07);
}

:root {
  --bg: #050506;
  --fg: #f3f3f0;
  --soft: #cdcdc8;
  --mid: #a3a39e;
  --dim: #6e6e69;
  --line: #3a3a37;
  --pad: clamp(1.25rem, 3.2vw, 2.75rem);
  --sans: system-ui, -apple-system, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--fg);
  font: 400 1rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ol {
  margin: 0;
}

a {
  color: inherit;
}

.skip {
  position: fixed;
  left: var(--pad);
  top: -4rem;
  z-index: 7;
  padding: 0.5rem 0.75rem;
  background: var(--fg);
  color: var(--bg);
  font: 500 0.75rem/1 var(--mono);
  text-decoration: none;
}

.skip:focus {
  top: 4rem;
}

/* Frame: the only things visible before the light finds anything */

.hud {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem var(--pad);
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.hud-top {
  top: 0;
  padding-bottom: 2.5rem;
  background: linear-gradient(to bottom, var(--bg) 40%, transparent);
}

.hud-bottom {
  bottom: 0;
  padding-top: 2.5rem;
  background: linear-gradient(to top, var(--bg) 40%, transparent);
}

.js .hud {
  animation: hud-in 1.4s 0.15s both;
}

@keyframes hud-in {
  from {
    opacity: 0;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--fg);
  text-decoration: none;
}

.mark {
  width: 0.9rem;
  height: 1rem;
  flex: none;
  fill: currentColor;
}

.counter {
  font-variant-numeric: tabular-nums;
}

.count {
  color: var(--fg);
}

.copy-name {
  display: none;
}

.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4.25rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s;
}

.hint.is-on {
  opacity: 1;
  animation: breathe 2.8s ease-in-out infinite;
}

@keyframes breathe {
  50% {
    opacity: 0.35;
  }
}

.contact {
  margin: -0.75rem;
  padding: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: none;
  text-decoration: none;
  color: var(--fg);
}

.brand:focus-visible,
.contact:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}

/* Text that decodes: the real string stays in the DOM for readers and search */

.js .real {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Stage */

.stage {
  position: relative;
  padding-inline: var(--pad);
}

.stage::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle at center, rgb(255 255 255 / 0.24) 0 0.75px, transparent 1.25px);
  background-size: 26px 26px;
  pointer-events: none;
}

.intro {
  display: grid;
  align-content: center;
  min-height: 100svh;
  max-width: 21ch;
  font: 400 clamp(1.6rem, 6.6vw, 2.5rem) / 1.18 var(--sans);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.projects {
  padding: 0 0 36svh;
  list-style: none;
}

.project {
  display: grid;
  align-content: center;
  min-height: 66svh;
}

.row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  align-items: baseline;
  color: inherit;
  text-decoration: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.idx {
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.14em;
  color: var(--mid);
  transition: color 0.4s;
}

.title {
  font: 400 clamp(2.4rem, 10.5vw, 4rem) / 1.04 var(--sans);
  letter-spacing: -0.035em;
  transition: color 0.5s var(--ease), text-shadow 0.6s, transform 0.6s var(--ease);
}

.detail {
  position: relative;
  grid-column: 2;
  max-width: 30rem;
  margin-top: 1.1rem;
  transition: opacity 0.45s var(--ease), transform 0.6s var(--ease);
}

.kind,
.go {
  font: 500 0.72rem/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.kind {
  margin-bottom: 0.7rem;
  color: var(--accent);
}

.desc {
  color: var(--soft);
}

.go {
  margin-top: 0.9rem;
}

.row:focus-visible .title {
  outline: 1px solid var(--accent);
  outline-offset: 0.12em;
}

/* Hidden until found */

.js .idx {
  color: var(--dim);
}

.js .title {
  color: var(--dim);
}

.js .detail {
  opacity: 0;
  transform: translateY(8px);
}

.js .project.is-active .idx {
  position: relative;
  z-index: 4;
  color: var(--accent);
}

.js .project.is-active .title {
  position: relative;
  z-index: 4;
  color: var(--fg);
  text-shadow: 0 0 2.2em color-mix(in srgb, var(--accent) 45%, transparent);
}

.js .project.is-active .detail {
  z-index: 4;
  opacity: 1;
  transform: none;
}

/* The dark, and the light that moves through it */

.dark,
.cursor,
.exhibit {
  display: none;
}

.js .dark {
  --lx: 50vw;
  --ly: 50vh;
  --lr: 0px;
  display: block;
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(
      circle var(--lr) at var(--lx) var(--ly),
      rgb(5 5 6 / 0) 0%,
      rgb(5 5 6 / 0.1) 24%,
      rgb(5 5 6 / 0.46) 50%,
      rgb(5 5 6 / 0.82) 74%,
      rgb(5 5 6 / 0.97) 92%,
      rgb(5 5 6) 100%
    ),
    radial-gradient(circle calc(var(--lr) * 0.85) at var(--lx) var(--ly), var(--glow), transparent);
  transition: --glow 0.6s ease;
}

.js.has-pointer,
.js.has-pointer * {
  cursor: none;
}

.js.has-pointer .cursor {
  display: block;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 6;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition:
    width 0.35s var(--ease),
    height 0.35s var(--ease),
    margin 0.35s var(--ease),
    background-color 0.3s,
    border-color 0.3s,
    opacity 0.3s;
}

.js.has-pointer .cursor.is-visible {
  opacity: 1;
}

.js.has-pointer .cursor.is-hot {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-color: var(--accent, var(--fg));
  background: transparent;
}

/* Exhibit: one drawing per project, shown while that project is found */

.js .exhibit {
  display: block;
  position: fixed;
  left: 50%;
  top: 10svh;
  z-index: 1;
  width: min(64vw, 28svh);
  aspect-ratio: 1;
  translate: -50% 0;
  pointer-events: none;
}

.js .exhibit.is-on {
  z-index: 3;
}

.corner {
  display: none;
  position: absolute;
  width: 14px;
  height: 14px;
  border: 0 solid var(--line);
  transition: border-color 0.5s;
}

.exhibit.is-on .corner {
  border-color: var(--mid);
}

.corner.tl {
  left: 0;
  top: 0;
  border-width: 1px 0 0 1px;
}

.corner.tr {
  right: 0;
  top: 0;
  border-width: 1px 1px 0 0;
}

.corner.bl {
  left: 0;
  bottom: 0;
  border-width: 0 0 1px 1px;
}

.corner.br {
  right: 0;
  bottom: 0;
  border-width: 0 1px 1px 0;
}

.motif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease), visibility 0s 0.45s;
}

.motif.is-on {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.motif .thin {
  stroke-width: 1;
  opacity: 0.55;
}

.motif .draw {
  stroke-dasharray: 1 1.2;
  stroke-dashoffset: 1.1;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.65, 0, 0.2, 1) var(--d, 0s);
}

.motif.is-on .draw {
  stroke-dashoffset: 0;
}

/* 01: the bridge is the face */

.m-bridge .water {
  stroke-dasharray: 3 9;
  opacity: 0.3;
}

.m-bridge .ring {
  stroke: var(--accent);
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
}

.m-bridge.is-on .ring {
  animation: ring 2.7s cubic-bezier(0.2, 0.6, 0.3, 1) calc(1.1s + var(--d, 0s)) infinite;
}

@keyframes ring {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  8% {
    opacity: 0.9;
  }
  100% {
    transform: scale(17);
    opacity: 0;
  }
}

.m-bridge .eye {
  fill: var(--accent);
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
  filter: drop-shadow(0 0 6px var(--accent));
  opacity: 0;
  transition: opacity 0.4s;
}

.m-bridge.is-on .eye {
  opacity: 1;
  transition-delay: 0.9s;
  animation: blink 5s 1.6s infinite;
}

@keyframes blink {
  0%,
  91%,
  100% {
    transform: scaleY(1);
  }
  94% {
    transform: scaleY(0.08);
  }
}

/* 02: a song, cut on the beat */

.m-tempo .wave {
  opacity: 0.5;
}

.m-tempo .clip {
  --d: calc(var(--b) * 45ms);
  stroke-width: 1.25;
  fill: var(--accent);
  fill-opacity: 0;
}

.m-tempo.is-on .clip {
  animation: clip 6.4s linear calc(var(--b) * 0.4s) infinite;
}

@keyframes clip {
  0% {
    fill-opacity: 0.95;
  }
  7% {
    fill-opacity: 0.3;
  }
  26%,
  100% {
    fill-opacity: 0;
  }
}

.m-tempo .head {
  stroke: var(--accent);
  filter: drop-shadow(0 0 5px var(--accent));
  opacity: 0;
}

.m-tempo.is-on .head {
  opacity: 1;
  animation: head 6.4s linear infinite;
}

@keyframes head {
  to {
    transform: translateX(352px);
  }
}

.m-tempo .beat {
  fill: var(--accent);
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0.22;
}

.m-tempo.is-on .beat {
  animation: beat 1.6s linear calc(var(--b) * 0.4s) infinite;
}

@keyframes beat {
  0% {
    transform: scale(1.7);
    opacity: 1;
  }
  22%,
  100% {
    transform: scale(1);
    opacity: 0.22;
  }
}

/* 03: nine seats, one voice at a time */

.m-council .orbit {
  stroke-dasharray: 2 7;
}

.m-council .core {
  fill: var(--accent);
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
}

.m-council.is-on .core {
  animation: core 0.9s ease-in-out infinite;
}

@keyframes core {
  30% {
    transform: scale(1.9);
  }
}

.m-council .seats {
  transform-origin: 200px 200px;
}

.m-council.is-on .seats {
  animation: spin 140s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.m-council .seat circle {
  stroke-width: 1.25;
  fill: var(--accent);
  fill-opacity: 0;
}

.m-council .ray {
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0;
}

.m-council.is-on .seat circle {
  animation: speak 8.1s linear calc(var(--n) * 0.9s) infinite;
}

.m-council.is-on .ray {
  animation: ray 8.1s linear calc(var(--n) * 0.9s) infinite;
}

@keyframes speak {
  0%,
  9% {
    fill-opacity: 1;
    stroke: var(--accent);
  }
  15%,
  100% {
    fill-opacity: 0;
    stroke: var(--fg);
  }
}

@keyframes ray {
  0%,
  9% {
    opacity: 0.9;
  }
  15%,
  100% {
    opacity: 0;
  }
}

/* 04: always on the air */

.m-tv .show {
  opacity: 0;
  transition: opacity 0.5s;
}

.m-tv.is-on .show {
  opacity: 1;
  transition-delay: 0.8s;
}

.m-tv .scan {
  stroke-width: 1;
  opacity: 0.1;
}

.m-tv .solid {
  fill: var(--bg);
}

.m-tv.is-on .couch {
  animation: glitch 4.6s steps(1) infinite;
}

@keyframes glitch {
  0%,
  64%,
  87%,
  100% {
    transform: none;
  }
  61% {
    transform: translate(5px, 0);
  }
  62.5% {
    transform: translate(-4px, 1px);
  }
  86% {
    transform: translate(0, -3px);
  }
}

.m-tv .band {
  fill: var(--accent);
  stroke: none;
  opacity: 0.16;
}

.m-tv.is-on .band {
  animation: band 3.4s linear infinite;
}

@keyframes band {
  to {
    transform: translateY(206px);
  }
}

.m-tv .live {
  fill: var(--accent);
  stroke: none;
  opacity: 0;
}

.m-tv .live-label {
  fill: var(--accent);
  stroke: none;
  font: 600 10px var(--mono);
  letter-spacing: 0.16em;
  opacity: 0;
  transition: opacity 0.4s;
}

.m-tv.is-on .live-label {
  opacity: 1;
  transition-delay: 0.9s;
}

.m-tv.is-on .live {
  animation: live 1.4s steps(1) 0.9s infinite both;
}

@keyframes live {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.15;
  }
}

/* Error page */

.lost {
  display: grid;
  align-content: center;
  gap: 1.5rem;
  min-height: 100svh;
  padding: var(--pad);
}

.lost h1 {
  font: 400 clamp(2.4rem, 9vw, 5rem) / 1.04 var(--sans);
  letter-spacing: -0.045em;
}

.lost a {
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
}

/* Showcase layout: everything on one screen, drawing and notes pinned right */

@media (hover: hover) and (pointer: fine) and (min-width: 60rem) {
  :root {
    --ex: min(34vw, 50vh, 28rem);
  }

  .copy-name {
    display: inline;
  }

  .js .hud-top,
  .js .hud-bottom {
    padding-block: 1.4rem;
    background: none;
  }

  .hud-bottom {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }

  .hint {
    position: static;
  }

  .contact {
    justify-self: end;
  }

  .stage {
    display: grid;
    align-items: center;
    min-height: 100svh;
    padding-block: 6rem 5.5rem;
  }

  .index {
    width: min(58%, 46rem);
  }

  .intro {
    display: block;
    min-height: 0;
    max-width: 25rem;
    margin-bottom: clamp(1.75rem, 5vh, 3.25rem);
    padding-left: 3.5rem;
    font-size: 1.0625rem;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--mid);
  }

  .projects {
    padding: 0;
  }

  .project {
    display: block;
    min-height: 0;
  }

  .row {
    grid-template-columns: 3.5rem minmax(0, 1fr);
    padding-block: 0.5rem;
  }

  .title {
    font-size: clamp(2.75rem, 5.3vw, 5.25rem);
    line-height: 1.02;
    white-space: nowrap;
  }

  .js .project.is-active .title {
    transform: translateX(0.16em);
  }

  .js .detail {
    position: fixed;
    right: var(--pad);
    top: calc(50% + var(--ex) / 2 - 1.5rem);
    width: var(--ex);
    margin: 0;
    pointer-events: none;
  }

  .js .exhibit {
    left: auto;
    right: var(--pad);
    top: calc(50% - var(--ex) / 2 - 3rem);
    width: var(--ex);
    translate: none;
  }

  .corner {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
