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

:root {
  /* the piece's own two colours */
  --ground: #060607;
  --ink: #f4f2ec;
  --raised: #0f0f12;
  --muted: #8e9099;
  --line: rgba(244, 242, 236, 0.12);
  --line-strong: rgba(244, 242, 236, 0.28);

  --pad: clamp(1rem, 4vw, 3.5rem);
  --aspect: 16 / 9;
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.viewing {
  overflow: hidden;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 1001;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--ground);
  text-decoration: none;
  font-size: 0.875rem;
}
.skip-link:focus {
  top: 0;
}
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ── labels and pills: the piece's own export buttons ── */
.kicker,
.num,
.pill,
.res,
.toggle,
.maker-count,
.viewer-title,
.masthead nav a {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  min-height: 2.25rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(244, 242, 236, 0.06);
  color: rgba(244, 242, 236, 0.85);
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.pill:hover:not(:disabled) {
  background: rgba(244, 242, 236, 0.14);
  color: var(--ink);
}
.pill:disabled {
  opacity: 0.35;
  cursor: default;
}
.pill[aria-pressed="true"] {
  border-color: var(--ink);
  color: var(--ink);
}
.pill.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ground);
}
.pill.primary:hover:not(:disabled) {
  background: #fff;
  color: var(--ground);
}
.pill .dim {
  opacity: 0.55;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

/* ── masthead ── */
.masthead {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.5rem var(--pad);
  mix-blend-mode: difference;
  color: #fff;
}
.masthead .home {
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.masthead nav {
  display: flex;
  gap: 1.5rem;
}
.masthead nav a {
  text-decoration: none;
  opacity: 0.7;
}
.masthead nav a:hover {
  opacity: 1;
}
@media (max-width: 560px) {
  .masthead nav {
    display: none;
  }
}

/* ── hero ── */
.hero {
  position: relative;
  height: 100svh;
  min-height: 34rem;
  overflow: hidden;
}
.hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* Copy over moving black and white: difference keeps it legible on both. */
.hero-copy {
  position: absolute;
  left: var(--pad);
  bottom: clamp(1.5rem, 6vh, 4rem);
  max-width: 34rem;
  color: #fff;
  mix-blend-mode: difference;
}
.kicker {
  opacity: 0.6;
  margin-bottom: 0.8rem;
}
h1 {
  font-weight: 700;
  font-size: clamp(2.8rem, 8vw, 6rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}
.standfirst {
  margin-top: 1rem;
  max-width: 44ch;
  opacity: 0.72;
  font-size: 1rem;
}
.hero-copy .cta {
  position: static;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
  mix-blend-mode: normal;
}
.hero-copy .pill {
  background: #fff;
  color: #000;
  border-color: #fff;
  backdrop-filter: none;
}
.hero-copy .pill:not(.primary) {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}
.hero .sound {
  position: absolute;
  right: var(--pad);
  bottom: clamp(1.5rem, 6vh, 4rem);
}
.sound .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
}
.sound[aria-pressed="true"] .dot {
  opacity: 1;
  animation: pulse 1s infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}
@media (max-width: 700px) {
  .hero {
    height: auto;
    min-height: 0;
  }
  .hero canvas {
    position: relative;
    height: 62svh;
  }
  .hero-copy {
    position: relative;
    left: auto;
    bottom: auto;
    padding: 1.5rem var(--pad) 0;
    mix-blend-mode: normal;
  }
  .hero .sound {
    top: calc(62svh - 3.5rem);
    bottom: auto;
  }
}

/* ── sections ── */
.section {
  padding: clamp(4rem, 10vw, 8rem) var(--pad) 0;
  max-width: 96rem;
  margin: 0 auto;
}
.sec-head {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  column-gap: 1rem;
  max-width: 62rem;
  margin-bottom: 2rem;
}
.sec-head .num {
  color: var(--muted);
  padding-top: 0.85rem;
}
h2 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.sec-head p {
  grid-column: 2;
  margin-top: 0.9rem;
  max-width: 60ch;
  color: var(--muted);
}
@media (max-width: 560px) {
  .sec-head {
    grid-template-columns: 1fr;
  }
  .sec-head p {
    grid-column: 1;
  }
}

/* ── resolution chips ── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 2rem;
  margin-bottom: 1.5rem;
}
.res-list,
.live-speed {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
@media (max-width: 700px) {
  .toolbar .res-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 calc(-1 * var(--pad));
    padding: 0 var(--pad) 2px;
    width: calc(100% + 2 * var(--pad));
  }
  .toolbar .res-list::-webkit-scrollbar {
    display: none;
  }
  .res {
    flex: none;
  }
}
.res {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.5rem 0.85rem;
  border-radius: 0.6rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.res:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.res[aria-checked="true"] {
  border-color: var(--ink);
  color: var(--ink);
}
.res-dim {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}
.res.detected .res-name::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  margin-left: 0.5em;
  vertical-align: 2px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  color: var(--muted);
}
.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch {
  width: 2.1rem;
  height: 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.2rem - 6px);
  height: calc(1.2rem - 6px);
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s;
}
.toggle input:checked + .switch {
  background: var(--ink);
}
.toggle input:checked + .switch::after {
  transform: translateX(0.9rem);
  background: var(--ground);
}
.toggle input:checked ~ span:last-child {
  color: var(--ink);
}
.toggle input:focus-visible + .switch {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ── cards ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: 2.5rem 1.5rem;
}
body[data-kind="phone"] .grid {
  grid-template-columns: repeat(auto-fill, minmax(min(46%, 13rem), 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.shot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--aspect);
  border: 0;
  padding: 0;
  background: var(--raised);
  cursor: zoom-in;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--line),
    0 24px 60px -30px rgba(0, 0, 0, 0.9);
}
body[data-kind="phone"] .shot {
  border-radius: 6%/2.8%;
}
.shot canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.shot-hint {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(6, 6, 7, 0.7);
  color: var(--ink);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.shot:hover .shot-hint,
.shot:focus-visible .shot-hint {
  opacity: 1;
  transform: none;
}
.card figcaption {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.card-name {
  display: block;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-note {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.45;
  margin-top: 0.15rem;
}
body[data-kind="phone"] .card figcaption {
  flex-direction: column;
}

/* ── maker ── */
.maker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.maker-stage {
  position: relative;
  max-width: 100%;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--line),
    0 30px 80px -40px rgba(0, 0, 0, 1);
  touch-action: none;
}
.maker-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
.maker-hint {
  position: absolute;
  left: 50%;
  bottom: 9%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: rgba(244, 242, 236, 0.7);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.4s;
  white-space: nowrap;
}
.maker-hint.gone {
  opacity: 0;
}
.hint-line {
  width: 3.5rem;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  animation: sweep 2.4s cubic-bezier(0.6, 0, 0.2, 1) infinite;
}
@keyframes sweep {
  0% {
    transform: scaleX(0);
  }
  40%,
  70% {
    transform: scaleX(1);
    opacity: 1;
  }
  100% {
    transform: scaleX(1);
    opacity: 0;
  }
}
.maker-bar {
  width: 100%;
  max-width: 72rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.maker-tune {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 1.8rem;
  flex-wrap: wrap;
  justify-content: center;
}
.maker-count {
  color: var(--muted);
}
.notes {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
}
/* each note sits higher the higher it sounds */
.notes li {
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
  transform: translateY(calc((0.5 - var(--h, 0)) * 0.9rem));
}
.notes li:last-child {
  color: var(--ground);
  background: var(--ink);
  border-color: var(--ink);
}
.maker-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.5rem;
}
.maker-actions .group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

/* ── live ── */
.live {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 2rem 3rem;
  align-items: start;
}
@media (max-width: 860px) {
  .live {
    grid-template-columns: 1fr;
  }
}
.live-view {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.live-view iframe {
  width: 100%;
  aspect-ratio: var(--aspect);
  max-height: 70vh;
  border: 0;
  border-radius: 4px;
  background: var(--ground);
  box-shadow: 0 0 0 1px var(--line);
}
.live-url {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.live-url code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  background: var(--raised);
  border: 1px solid var(--line);
  margin-right: 0.25rem;
}
.steps {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  color: var(--muted);
}
.steps strong {
  color: var(--ink);
  font-weight: 600;
}
.steps li::marker {
  color: var(--muted);
  font-size: 0.85em;
}
.fine {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ── footer ── */
.foot {
  max-width: 96rem;
  margin: clamp(5rem, 12vw, 9rem) auto 0;
  padding: 2rem var(--pad) 3rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.foot strong {
  color: var(--ink);
  font-weight: 600;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.foot-links a {
  text-decoration: none;
}
.foot-links a:hover {
  color: var(--ink);
}

/* ── viewer ── */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.viewer[hidden] {
  display: none;
}
.viewer canvas {
  display: block;
}
.viewer-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem clamp(1rem, 3vw, 2rem) max(1rem, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  opacity: 0;
  transition: opacity 0.3s;
}
/* out of the way until the pointer moves near it */
.viewer:hover .viewer-bar,
.viewer-bar:focus-within {
  opacity: 1;
}
@media (hover: none) {
  .viewer-bar {
    opacity: 1;
  }
}
.viewer-title {
  display: flex;
  gap: 1rem;
  color: var(--ink);
}
.viewer-title .dim {
  opacity: 0.55;
}
.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.viewer .pill {
  background: rgba(6, 6, 7, 0.55);
}
.viewer .pill.primary {
  background: var(--ink);
}
