/*
 * ALLOIC Aside. One stylesheet: the front door, the screen and the listener.
 *
 * The ALLOIC identity, as on alloic.com: white ground, near-black ink, copper
 * on the one action, General Sans throughout, grey panels with no outline,
 * round buttons. Body text is 18px or more.
 *
 * Grid sums at 1440 wide:
 *   margins 40 + 40, canvas 1360
 *   screen page: player column 952 + gap 24 + join column 384 = 1360
 *   picker: 3 tiles of 437.33 + 2 gaps of 24 = 1360
 *   two columns under the picker; the last panel of the shorter one stretches
 *   listener: centred 1104 column, 540 + 24 + 540
 *   front door: 12 columns of 91.33 + 11 gaps of 24 = 1360
 */

:root {
  color-scheme: light;
  --ground: #ffffff;
  --surface: #f2f2f0;
  --surface-2: #e5e5e2;
  --control: #b9b8b3;
  --rule: #e0e0dc;
  --text: #111111;
  --muted: #57534c;
  --accent: #c2410c;
  --accent-press: #9a3412;
  --accent-soft: #fbe3d6;
  --accent-ink: #7c2d12;
  --inv: #111111;
  --inv-ink: #f5f5f3;
  --inv-muted: #aaa59c;
  --pill-positive-bg: #dcfae5;
  --pill-positive-ink: #04250e;
  --pill-warning-bg: #fff3d6;
  --pill-warning-ink: #7a3b06;
  --stage: #0e0e0e;

  --radius: 14px;
  --gap: 24px;
  --pad: 24px;
  --gutter: 40px;
  --control-height: 50px;

  --fs-title: 32px;
  --fs-section: 22px;
  --fs-kpi: 34px;
  --fs-body: 18px;
  --fs-small: 16px;

  --font: 'General Sans', 'General Sans Fallback', 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@font-face {
  font-family: 'General Sans Fallback';
  src: local('Arial'), local('Helvetica Neue'), local('Helvetica');
  size-adjust: 98%;
  ascent-override: 98%;
  descent-override: 24%;
  line-gap-override: 0%;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.muted {
  color: var(--muted);
}

.small {
  font-size: var(--fs-small);
  line-height: 1.45;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

a {
  color: inherit;
  text-underline-offset: 4px;
}

/* ---------- the bar ---------- */

.bar {
  height: 64px;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.brand img {
  display: block;
  height: 24px;
  width: auto;
}

.brand span {
  color: var(--accent);
  transform: translateY(1px);
}

.bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.status {
  font-size: var(--fs-small);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--inv);
  color: var(--inv-ink);
  font-size: var(--fs-small);
  white-space: nowrap;
}

.room-chip b {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.canvas {
  padding: 12px var(--gutter) 56px;
}

.title-row {
  margin-bottom: var(--gap);
  max-width: 1100px;
}

.title-row h1 {
  font-size: var(--fs-title);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.title-row p {
  margin-top: 4px;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--pad);
}

.card h2 {
  font-size: var(--fs-section);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.card h2 + p {
  margin-top: 4px;
}

/* ---------- controls ---------- */

.btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--control-height);
  padding: 0 24px;
  border: 2px solid var(--text);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: transform 160ms var(--ease), background-color 180ms var(--ease), color 180ms var(--ease),
    border-color 180ms var(--ease);
}

.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.btn:active {
  transform: scale(0.97);
  transition-duration: 100ms;
}

.btn[disabled] {
  cursor: default;
  color: #6b6862;
  border-color: var(--surface-2);
  background: var(--surface-2);
  transform: none;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn-on {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.btn-big {
  min-height: 64px;
  padding: 0 32px;
  font-size: 21px;
  width: 100%;
}

.btn-icon {
  width: var(--control-height);
  padding: 0;
}

@media (hover: hover) {
  .btn:not([disabled]):not(.btn-primary):not(.btn-on):hover {
    background: var(--text);
    color: #fff;
  }
  .btn-primary:not([disabled]):hover {
    border-color: var(--accent-press);
    background: var(--accent-press);
  }
}

.field {
  height: var(--control-height);
  width: 100%;
  min-width: 0;
  padding: 0 18px;
  border: 2px solid var(--control);
  border-radius: 999px;
  background: #fff;
  font-size: 18px; /* 16px or more, or iOS zooms the page on focus */
}

.field:focus {
  border-color: var(--text);
  outline: none;
}

.field::placeholder {
  color: #6b6862;
}

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text);
}

.pill-good {
  background: var(--pill-positive-bg);
  color: var(--pill-positive-ink);
}

.pill-warn {
  background: var(--pill-warning-bg);
  color: var(--pill-warning-ink);
}

.pill-live {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/*
 * A slider: the scrubber, the volume and the trim. The track and its filled
 * part are drawn by the wrapper, the range input sits on top with a clear
 * track. --p is the position, 0 to 1.
 */
.slider {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 44px;
}

.slider::before,
.slider > i {
  content: '';
  position: absolute;
  left: 0;
  top: 19px;
  height: 6px;
  border-radius: 3px;
}

.slider::before {
  right: 0;
  background: #cfcec9;
}

.slider > i {
  width: calc(12px + (100% - 24px) * var(--p, 0));
  background: var(--text);
  pointer-events: none;
}

.slider.plain > i {
  display: none;
}

.range {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

.range:disabled {
  cursor: default;
}

.range::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
}

.range::-moz-range-track {
  height: 6px;
  background: transparent;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
}

.range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  cursor: pointer;
}

.switch b {
  font-weight: 600;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch i {
  flex: none;
  width: 52px;
  height: 30px;
  border-radius: 15px;
  background: #a8a6a0;
  position: relative;
  transition: background-color 160ms var(--ease);
}

.switch i::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms var(--ease);
}

.switch input:checked + i {
  background: var(--text);
}

.switch input:checked + i::after {
  transform: translateX(22px);
}

.switch input:focus-visible + i {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.notice {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--pill-warning-bg);
  color: var(--pill-warning-ink);
  font-size: var(--fs-small);
  line-height: 1.45;
}

.empty {
  margin-top: 12px;
  padding: 14px 16px;
  border: 2px dashed var(--control);
  border-radius: 10px;
  color: var(--muted);
  font-size: var(--fs-small);
}

.foot {
  margin-top: 40px;
  font-size: var(--fs-small);
  color: var(--muted);
  max-width: 900px;
}

/* ---------- screen page ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  grid-template-areas:
    'picker picker'
    'main rail';
  gap: var(--gap);
}

.main-col,
.rail {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

.main-col {
  grid-area: main;
}

.rail {
  grid-area: rail;
}

.picker {
  grid-area: picker;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.player {
  grid-area: player;
  padding: 0;
  overflow: hidden;
  min-width: 0;
}

.waysCard {
  grid-area: ways;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.join {
  grid-area: join;
  flex: 1;
  min-width: 0;
}

.side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

.pick {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 80px;
  padding: 12px 22px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), transform 160ms var(--ease);
}

.pick b {
  font-size: 19px;
  font-weight: 600;
}

.pick span {
  font-size: var(--fs-small);
  color: var(--muted);
  line-height: 1.4;
}

button.pick:active {
  transform: scale(0.985);
}

.pick[aria-pressed='true'] {
  background: var(--inv);
  border-color: var(--inv);
}

.pick[aria-pressed='true'] b {
  color: #fff;
}

.pick[aria-pressed='true'] span {
  color: var(--inv-muted);
}

@media (hover: hover) {
  button.pick:not([aria-pressed='true']):hover {
    border-color: var(--text);
  }
}

.pick-link {
  cursor: default;
  gap: 8px;
}

.pick-link form {
  display: flex;
  gap: 8px;
}

/* 16:9, but never so tall that the Play button falls off the first screen. */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: max(260px, calc(100vh - 368px));
  background: var(--stage);
  overflow: hidden;
  cursor: pointer;
}

.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--stage);
}

.stage-note {
  position: absolute;
  left: 20px;
  bottom: 20px;
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 500;
}

/* Only in full screen: the code stays in a corner so people can still join. */
.stage-join {
  position: absolute;
  right: 28px;
  bottom: 28px;
  display: none;
  align-items: center;
  gap: 18px;
  padding: 16px 22px 16px 16px;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: default;
}

.stage-join .qr {
  width: 168px;
  height: 168px;
  flex: none;
}

.stage-join p {
  font-size: 20px;
  line-height: 1.3;
}

.stage-join b {
  display: block;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.stage:fullscreen {
  max-height: none;
}

.stage:fullscreen .stage-join:not([data-off]) {
  display: flex;
}

/* Before anything has played, the code is the whole screen: a TV across the room has to be scannable. */
.stage:fullscreen[data-wait] .stage-join:not([data-off]) {
  inset: 0;
  margin: auto;
  width: max-content;
  height: max-content;
  flex-direction: column;
  gap: 28px;
  padding: 44px 56px 36px;
  text-align: center;
}

.stage:fullscreen[data-wait] .stage-join .qr {
  width: min(44vh, 440px);
  height: min(44vh, 440px);
}

.stage:fullscreen[data-wait] .stage-join p {
  font-size: 34px;
}

.stage:fullscreen[data-wait] .stage-join b {
  font-size: 84px;
  line-height: 1.1;
}

.transport {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px var(--pad);
}

.transport .time {
  flex: none;
  font-size: var(--fs-small);
  color: var(--muted);
  white-space: nowrap;
}

.transport .time b {
  color: var(--text);
  font-weight: 600;
}

.ways {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  margin-top: 16px;
}

.way {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 10px;
  background: #fff;
}

.way b {
  font-weight: 600;
}

.way p {
  font-size: var(--fs-small);
  line-height: 1.45;
  color: var(--muted);
}

.way .btn {
  align-self: flex-start;
}

.way-gap {
  flex: 1;
  min-height: 6px;
}

.join {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* The code takes whatever height the player beside it leaves, and stays square. */
.join .qr {
  flex: 1 1 0;
  min-height: 150px;
  container-type: size;
  display: grid;
  place-items: center;
}

.join .qr svg {
  width: min(100cqw, 100cqh);
  height: min(100cqw, 100cqh);
  border-radius: 10px;
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.join-code {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--inv);
  color: var(--inv-ink);
}

.join-code b {
  font-size: var(--fs-kpi);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.join-link {
  font-size: var(--fs-small);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.join-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.join-actions .btn {
  padding: 0 12px;
}

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

.people li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  border-top: 1px solid var(--rule);
}

.people li:first-child {
  border-top: 0;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 600;
}

.people .who {
  min-width: 0;
}

.people .who b {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.people .who span {
  display: block;
  font-size: var(--fs-small);
  color: var(--muted);
}

.people .trim {
  font-size: var(--fs-small);
  color: var(--muted);
  text-align: right;
}

.listening {
  display: grid;
  gap: 4px;
}

.listening .switch {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.here {
  display: grid;
  gap: 12px;
}

.trim-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.trim-row output {
  min-width: 112px;
  text-align: center;
  font-size: 26px;
  font-weight: 600;
}

.trim-row .btn {
  padding: 0 12px;
}

/* ---------- listener page ---------- */

.listen {
  max-width: 1184px; /* 1104 + the two 40px margins */
  margin: 0 auto;
}

.listen-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    'now delay'
    'remote set';
  gap: var(--gap);
}

.listen-grid > * {
  min-width: 0;
}

.now {
  grid-area: now;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.delay {
  grid-area: delay;
  display: grid;
  gap: 14px;
  align-content: start;
}

.now-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.figure {
  font-size: var(--fs-kpi);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.figure small {
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 8px;
}

/* The sync meter: where the sound sits against the picture, in milliseconds. */
.meter {
  position: relative;
  height: 56px;
  margin-top: 4px;
}

.meter-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 18px;
  height: 20px;
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
}

.meter-band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #f4c3a6;
}

.meter-zero {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 3px;
  height: 36px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--text);
}

.meter-dot {
  position: absolute;
  top: 13px;
  left: 50%;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  border-radius: 50%;
  border: 4px solid var(--surface);
  background: var(--accent);
  transition: left 220ms var(--ease), background-color 200ms ease;
}

.meter-dot[data-off] {
  background: #8d8a84;
}

.meter-scale {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: var(--muted);
}

/* Three live numbers from the follower, in one well. */
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  background: #fff;
}

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

.facts dd {
  font-size: 22px;
  font-weight: 600;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--control);
  border-radius: 999px;
  background: transparent;
  font-size: var(--fs-small);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
}

.chip[aria-pressed='true'] {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.chip-add {
  border-style: dashed;
  color: var(--muted);
}

.inline-form {
  display: flex;
  gap: 8px;
}

.textbtn {
  justify-self: start;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--fs-small);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* The line-up tool: tap what you see, then tap what you hear. */
.lineup {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 10px;
  background: #fff;
}

.lineup-step {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tap {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 132px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  transition: transform 80ms ease, background-color 120ms ease;
}

.tap:active {
  transform: scale(0.98);
  background: var(--accent-press);
}

.lineup-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.remote {
  grid-area: remote;
  display: grid;
  gap: 12px;
  align-content: start;
}

.remote-keys {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 10px;
}

.remote-keys .btn {
  min-height: 56px;
  padding: 0 6px;
}

.remote-time {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-small);
  color: var(--muted);
}

.progress {
  height: 6px;
  border-radius: 3px;
  background: #cfcec9;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--text);
  transform-origin: left;
  transform: scaleX(0);
}

.rows {
  grid-area: set;
}

.rows > * + * {
  border-top: 1px solid var(--rule);
  margin-top: 10px;
  padding-top: 10px;
}

.rows b {
  font-weight: 600;
}

.vol {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 44px;
}

.joinwrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}

.joinform {
  display: grid;
  gap: 16px;
  align-content: start;
}

.joinform form,
.codeform {
  display: flex;
  gap: 10px;
}

.codefield {
  height: 64px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
}

.joinform .btn,
.codeform .btn {
  min-height: 64px;
}

.steps {
  margin: 12px 0 0;
  padding-left: 1.3em;
}

.steps li + li {
  margin-top: 8px;
}

/* ---------- front door ---------- */

.door {
  padding: 0 var(--gutter);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: clamp(20px, 2.6vw, 36px) clamp(24px, 4vw, 56px);
  align-items: end;
  padding: clamp(24px, 3.4vw, 48px) 0 clamp(36px, 4.4vw, 64px);
}

.hero h1,
.hero .lead {
  grid-column: 1;
}

.hero-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.hero h1 {
  font-size: clamp(2.6rem, 9.4vw, 9.25rem);
  line-height: 0.92;
  font-weight: 600;
  letter-spacing: -0.045em;
}

.hero h1 em {
  font-style: normal;
  color: inherit;
}

.lead {
  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.75rem);
  line-height: 1.38;
  letter-spacing: -0.01em;
  max-width: 40ch;
}

.hero-actions {
  display: grid;
  gap: 14px;
}

.hero-actions .btn-big {
  min-height: 68px;
}

.or {
  font-size: var(--fs-small);
  color: var(--muted);
}

.sect {
  padding: clamp(56px, 8vw, 120px) 0 0;
}

.sect > h2 {
  font-size: clamp(2rem, 1.2rem + 3vw, 4rem);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.035em;
  margin-bottom: clamp(24px, 3vw, 44px);
}

/* The demo: this page is a screen and a listener at once. */
.demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: var(--gap);
  align-items: stretch;
}

.demo-screen {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: 16 / 9;
}

.demo-screen video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tag {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--inv);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}

.demo-phone {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

/* The product itself: the real screens, a TV and the phone beside it. */
.devices {
  display: grid;
  grid-template-columns: minmax(0, 7.4fr) minmax(0, 2.2fr);
  gap: clamp(20px, 3vw, 48px);
  align-items: end;
  margin: 0 0 clamp(56px, 8vw, 120px);
  padding: clamp(28px, 4vw, 64px);
  border-radius: var(--radius);
  background: var(--surface);
}

.devices figure {
  margin: 0;
}

.devices figcaption {
  margin-top: 14px;
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--muted);
}

.devices figcaption b {
  color: var(--text);
  font-weight: 600;
}

.tv-frame {
  padding: 1.1%;
  border-radius: 14px;
  background: #0b0b0b;
}

.phone-frame {
  padding: 4%;
  border-radius: 15% / 9%;
  background: #0b0b0b;
}

.tv-frame img,
.phone-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.tv-frame img {
  border-radius: 4px;
}

.phone-frame img {
  border-radius: 12% / 7.5%;
}

/* The use that sells it, at full width. */
.use-lead {
  margin: 0 0 clamp(36px, 4vw, 56px);
}

.use-lead img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
}

.use-lead figcaption {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: var(--gap);
  align-items: baseline;
  margin-top: 18px;
}

/* Where it earns its place: three more rooms, a picture each. */
.uses {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(36px, 4vw, 56px) var(--gap);
}

.uses li {
  display: grid;
  gap: 10px;
  align-content: start;
}

.uses img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 8px;
}

.uses h3,
.use-lead h3 {
  margin: 0;
  font-size: clamp(1.6rem, 1rem + 1.6vw, 2.5rem);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.uses p,
.use-lead p {
  font-size: clamp(1.125rem, 1rem + 0.3vw, 1.3125rem);
  line-height: 1.45;
  color: var(--muted);
  max-width: 46ch;
}

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

.tool {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 26px 26px 30px;
  border-radius: var(--radius);
  background: var(--surface);
}

.tool h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tool p {
  color: var(--muted);
}

.tool-lead {
  background: var(--accent);
}

.tool-lead h3,
.tool-lead p {
  color: #fff;
}

/* The honest part, on a field of ink. */
.limits {
  margin: clamp(56px, 8vw, 120px) calc(-1 * var(--gutter)) 0;
  padding: clamp(48px, 7vw, 104px) var(--gutter);
  background: var(--inv);
  color: var(--inv-ink);
}

.limits h2 {
  font-size: clamp(2rem, 1.2rem + 3vw, 4rem);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.035em;
  margin-bottom: clamp(24px, 3vw, 44px);
}

.limits ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap) clamp(24px, 4vw, 64px);
}

.limits h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
  margin-bottom: 8px;
}

.limits p {
  color: var(--inv-muted);
}

.closer {
  background: var(--inv);
  color: var(--inv-ink);
  padding: 0 var(--gutter) 36px;
}

.closer img {
  display: block;
  width: 100%;
  height: auto;
  filter: invert(1) brightness(0.96);
}

.closer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  margin-top: 28px;
  font-size: var(--fs-small);
  color: var(--inv-muted);
}

.closer-row a {
  color: var(--inv-ink);
}

/* Things arrive once, quietly. Nothing is hidden if the script never runs. */
@media (prefers-reduced-motion: no-preference) {
  .js [data-rise] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 700ms var(--ease), transform 700ms var(--ease);
    transition-delay: calc(var(--i, 0) * 70ms);
  }
  .js [data-rise].in {
    opacity: 1;
    transform: none;
  }
}

/* ---------- tablet ---------- */

@media (max-width: 1100px) {
  :root {
    --gutter: 24px;
  }
  /* The two columns dissolve; their panels are placed one by one. */
  .main-col,
  .rail {
    display: contents;
  }
  .layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      'picker picker'
      'player player'
      'join join'
      'side side'
      'ways ways';
  }
  .picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pick-link {
    grid-column: 1 / -1;
  }
  .stage {
    max-height: none;
  }
  /* The join panel lies down: code on the left, the rest beside it. */
  .join {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    gap: 12px 24px;
    align-content: start;
  }
  .join > * {
    grid-column: 2;
  }
  .join .qr {
    grid-column: 1;
    grid-row: 1 / span 6;
    height: 208px;
    min-height: 0;
  }
  .side {
    flex-direction: row;
  }
  .side > .card {
    flex: 1;
  }
  .listen-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'now'
      'delay'
      'remote'
      'set';
  }
  .demo,
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-actions {
    grid-column: 1;
    grid-row: auto;
  }
  .tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .uses {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- phone ---------- */

@media (max-width: 700px) {
  :root {
    --gutter: 16px;
    --gap: 16px;
    --pad: 18px;
    --fs-title: 26px;
    --fs-kpi: 30px;
  }
  .bar {
    height: 56px;
  }
  .brand {
    font-size: 21px;
    gap: 10px;
  }
  .brand img {
    height: 21px;
  }
  .status {
    display: none;
  }
  /* The player first, then what to play, then this phone's own sound. */
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'player'
      'picker'
      'side'
      'ways'
      'join';
  }
  .picker,
  .ways,
  .joinwrap,
  .tools,
  .limits ul {
    grid-template-columns: minmax(0, 1fr);
  }
  .uses {
    grid-template-columns: minmax(0, 1fr);
  }
  .use-lead img {
    aspect-ratio: 4 / 3;
  }
  .use-lead figcaption {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .devices {
    grid-template-columns: minmax(0, 1fr) 38%;
    gap: 14px;
    padding: 18px 16px;
  }
  .devices .tv {
    grid-column: 1 / -1;
  }
  /* On a phone the label would sit on the clip's own words. */
  .tag {
    display: none;
  }
  .pick-link {
    grid-column: auto;
  }
  .join {
    display: flex;
  }
  .side {
    flex-direction: column-reverse;
  }
  .pick {
    min-height: 68px;
  }
  .stage {
    max-height: none;
  }
  .transport {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px var(--pad);
  }
  .transport .slider {
    order: 5;
    flex: 1 0 100%;
  }
  .transport .time {
    margin-right: auto;
  }
  .join .qr {
    flex: none;
    height: 200px;
  }
  .facts {
    gap: 8px;
    padding: 12px 14px;
  }
  .facts dd {
    font-size: 20px;
  }
  .canvas {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
  .closer {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
