/* Swiss: one typeface, a strict grid, black, white, one theme color. */

:root {
  --ink: #f2f0eb;
  --paper: #0b0b0c;
  --sheet: #f2f0eb;
  --sheet-ink: #0b0b0c;
  --theme: #6366f1;
  --gutter: clamp(16px, 3vw, 32px);
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 4px 0;
  cursor: pointer;
}
button:hover { border-bottom-color: currentColor; }
:focus-visible { outline: 2px solid var(--theme); outline-offset: 4px; }

/* ── stage ─────────────────────────────────────────── */
gw-stage { position: fixed; inset: 0; display: block; }
gw-stage canvas { display: block; width: 100%; height: 100%; }

/* ── top bar ───────────────────────────────────────── */
.bar {
  position: fixed;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--gutter);
}
.mark { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.mark::before {
  content: "";
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-right: 0.5em;
  background: var(--theme);
}
.bar nav { display: flex; gap: 24px; }

/* ── intro ─────────────────────────────────────────── */
.intro {
  position: fixed;
  left: var(--gutter);
  bottom: var(--gutter);
  max-width: min(36rem, calc(100vw - 2 * var(--gutter)));
}
.intro h1 {
  margin: 0 0 24px;
  font-size: clamp(44px, 8vw, 104px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.035em;
}
.intro { display: block; }
/* Hidden until the experiment has picked a variant, so nobody sees the wrong pitch flash by. */
gw-intro:not([variant]) { visibility: hidden; }
.intro p { margin: 0 0 24px; max-width: 30em; color: color-mix(in srgb, var(--ink) 75%, transparent); }
.intro .actions { display: flex; gap: 24px; align-items: center; }
.intro .primary {
  background: var(--theme);
  color: #fff;
  padding: 12px 22px;
  border: 0;
  font-weight: 700;
}
.intro .primary:hover { background: color-mix(in srgb, var(--theme) 75%, white); }
.note:empty { display: none; }
.note { margin-top: 16px; font-size: 13px; }
.intro[hidden] { display: none; }
.door { margin: 20px 0 0; font-size: 13px; }
.door button { color: color-mix(in srgb, var(--ink) 70%, transparent); border-bottom-color: currentColor; }
.door button:hover { color: var(--ink); }
.door--thanks { color: color-mix(in srgb, var(--ink) 70%, transparent); }
.signup { display: flex; align-items: baseline; gap: 12px; margin: 12px 0 0; font-size: 13px; }
.signup label { color: color-mix(in srgb, var(--ink) 70%, transparent); }
.signup input {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 40%, transparent);
  padding: 2px 0;
  min-width: 14em;
}
.signup input:focus-visible { border-bottom-color: var(--theme); }
.signup button { color: var(--theme); font-weight: 700; }
.signup--sent, .signup-error { margin: 12px 0 0; font-size: 13px; }
.signup-error { color: var(--theme); }

/* ── readout ───────────────────────────────────────── */
gw-readout {
  position: fixed;
  left: var(--gutter);
  bottom: var(--gutter);
  font-variant-numeric: tabular-nums;
}
body:has(.intro:not([hidden])) gw-readout { visibility: hidden; }
gw-readout dl { display: flex; gap: clamp(20px, 3vw, 40px); margin: 0; }
gw-readout dt {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 55%, transparent);
  margin-bottom: 6px;
}
gw-readout dd {
  margin: 0;
  font-size: clamp(24px, 3.2vw, 44px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ── media layer controls ──────────────────────────── */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.layer-source { margin-bottom: 16px; }
.layer-name { margin: 0 0 8px; font-size: 13px; overflow-wrap: anywhere; }
.layer-name span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--theme); margin-right: 6px; }
.layer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.layer-actions .button, .layer-actions button {
  padding: 8px 12px;
  border: 1px solid var(--sheet-ink);
  font-size: 13px;
  cursor: pointer;
}
.layer-actions .button:hover, .layer-actions button:hover { background: var(--sheet-ink); color: var(--sheet); }
.layer-actions .button:focus-within { outline: 2px solid var(--theme); outline-offset: 2px; }

/* ── settings sheet (popover) ──────────────────────── */
#settings {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(380px, 100vw);
  height: 100dvh;
  max-height: none;
  padding: var(--gutter);
  border: 0;
  overflow-y: auto;
  background: var(--sheet);
  color: var(--sheet-ink);
  color-scheme: light;
  transition: translate 0.28s cubic-bezier(0.2, 0.7, 0, 1), overlay 0.28s allow-discrete, display 0.28s allow-discrete;
  translate: 100% 0;
}
#settings:popover-open { translate: 0 0; }
@starting-style { #settings:popover-open { translate: 100% 0; } }
@media (prefers-reduced-motion: reduce) { #settings { transition: none; } }

#settings header { display: flex; justify-content: space-between; align-items: baseline; }
#settings h2 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
#settings .status { margin: 8px 0 32px; font-size: 13px; color: #6b6b6b; }

#settings fieldset {
  margin: 0 0 28px;
  padding: 12px 0 0;
  border: 0;
  border-top: 2px solid var(--sheet-ink);
}
#settings legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 16px;
  font-weight: 700;
}
#settings legend span { color: var(--theme); margin-right: 12px; font-variant-numeric: tabular-nums; }
#settings legend + * { clear: both; }

.field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 2px 12px;
  margin-bottom: 14px;
}
.field label { font-size: 14px; }
.field output { font-size: 13px; font-variant-numeric: tabular-nums; color: #555; }
.field input[type="range"] { grid-column: 1 / -1; width: 100%; margin: 4px 0 0; accent-color: var(--theme); }
.field--select select {
  font: inherit;
  font-size: 14px;
  color: inherit;
  background: transparent;
  border: 1px solid var(--sheet-ink);
  border-radius: 0;
  padding: 6px 8px;
}

#settings .actions button {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--sheet-ink);
}
#settings .actions button:hover { background: var(--sheet-ink); color: var(--sheet); }
