/* The install page: a quiet tool in CheerLights' own ink, with the LED colors kept for what they mean. */
:root {
  --ground: #f3f4f1;
  --surface: #fbfbfa;
  --ink: #16181b;
  --muted: #4c5056;
  --line: #d4d6d1;
  --primary: #16181b;
  --primary-ink: #fbfbfa;
  --focus: #306bfe;
  --ok: #0a7a2a;
  --error: #b3160c;
  --led-red: #fe100d;
  --led-green: #0ad13c;
  --led-blue: #306bfe;
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #141517;
    --surface: #1c1e21;
    --ink: #e9eae6;
    --muted: #a9ada6;
    --line: #34373b;
    --primary: #e9eae6;
    --primary-ink: #141517;
    --focus: #6f97ff;
    --ok: #4cc96f;
    --error: #ff7a6e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

/* A class that sets display (.choice, .live, .facts) would otherwise show an element marked hidden. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.55 "Source Sans 3", system-ui, sans-serif;
}

.top, main, .foot {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

.top { padding-top: 24px; padding-bottom: 8px; }
.home { display: inline-block; }
.home img { display: block; height: 40px; width: auto; }

h1 {
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 40px 0 16px;
  text-wrap: balance;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 8px;
}

h3 {
  font-size: 17px;
  margin: 0 0 4px;
}

p { margin: 0 0 12px; text-wrap: pretty; max-width: 62ch; }
.lead { font-size: 19px; }
.needs, .small, .hint { color: var(--muted); }
.small, .hint { font-size: 14px; }
.hint { margin: 4px 0 0; }

.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}

.step.next { border-color: var(--focus); outline: 1px solid var(--focus); }

.restore { margin: 0 0 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }

.panel { margin-top: 20px; }
.field { margin: 0 0 24px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }

.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0; }

button, select, input[type="number"] {
  font: inherit;
  color: inherit;
  border-radius: var(--radius);
}

button {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

button:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 8%, transparent); }
button:active:not(:disabled) { background: color-mix(in srgb, var(--ink) 16%, transparent); }
button.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 600; }
button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 86%, var(--ground)); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button[aria-busy="true"] { cursor: progress; }

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

input[type="radio"], input[type="checkbox"] { accent-color: var(--primary); }

select, input[type="number"] {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--ground);
}

input[type="number"] { width: 7em; font-variant-numeric: tabular-nums; }

input[type="text"], input[type="password"] {
  font: inherit;
  color: inherit;
  border-radius: var(--radius);
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--ground);
  width: 100%;
  max-width: 22em;
}

.link-choice { margin: 0 0 24px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.link-choice legend { padding: 0; margin-bottom: 4px; }
.link-choice legend h3 { margin: 0; }
.link-choice .choice:first-of-type { border-top: 0; }
h3.what { margin-top: 0; }

.networks { list-style: none; margin: 4px 0 20px; padding: 0; max-width: 32em; }
.networks li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.networks li:first-child { border-top: 0; }
.nearby-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 32em; margin-top: 28px; }
.nearby-head h3 { margin: 0; }
button.quiet { min-height: 36px; padding: 4px 12px; border-color: var(--line); white-space: nowrap; flex: none; }
.nearby { list-style: none; margin: 8px 0 0; padding: 0; max-width: 32em; }
.nearby li + li { border-top: 1px solid var(--line); }
.nearby button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 0;
  padding: 8px 8px;
  text-align: left;
  overflow-wrap: anywhere;
}
.nearby button[aria-pressed="true"] { background: color-mix(in srgb, var(--focus) 14%, transparent); }
.nearby .name { flex: 1; }
.nearby .tag { color: var(--muted); font-size: 14px; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; flex: none; }
.bars i { display: block; width: 3px; background: var(--line); border-radius: 1px; }
.bars i:nth-child(1) { height: 25%; }
.bars i:nth-child(2) { height: 50%; }
.bars i:nth-child(3) { height: 75%; }
.bars i:nth-child(4) { height: 100%; }
.bars[data-level="1"] i:nth-child(-n+1),
.bars[data-level="2"] i:nth-child(-n+2),
.bars[data-level="3"] i:nth-child(-n+3),
.bars[data-level="4"] i:nth-child(-n+4) { background: var(--ink); }
.wifi-form { margin-top: 16px; }
.wifi-form .check { margin-top: 4px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.inline { display: inline-flex; gap: 8px; align-items: center; }
.field > label.check, .check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-weight: 400; margin: 0; }
.check input { width: 20px; height: 20px; }

.choices { border: 0; padding: 0; margin: 12px 0 0; }
.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.choice:first-child { border-top: 0; }
#preset-list .choice:first-child { border-top: 0; }
.choice input { margin-top: 5px; width: 18px; height: 18px; flex: none; }
.choice strong { display: block; font-weight: 600; }
.choice .hint { display: block; }
.choice .untested { color: var(--muted); font-weight: 400; }

.ask { margin: 12px 0; }
.status { min-height: 1.55em; margin: 8px 0 0; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.error { color: var(--error); }
.note { border-left: 3px solid var(--error); padding-left: 12px; }

.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 50%; margin-right: 8px; vertical-align: -2px; border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); }
.swatch.red { background: var(--led-red); }
.swatch.green { background: var(--led-green); }
.swatch.blue { background: var(--led-blue); }
.swatch.big { width: 40px; height: 40px; margin: 0 12px 0 0; flex: none; }
.live { display: flex; align-items: center; font-size: 18px; }

.foot { padding-top: 8px; padding-bottom: 48px; color: var(--muted); font-size: 14px; }
a { color: inherit; text-underline-offset: 3px; }

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

@media (max-width: 480px) {
  .top, main, .foot { padding: 0 16px; }
  .top { padding-top: 16px; }
  h1 { font-size: 32px; margin-top: 24px; }
  .step { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
