/* dotsmith. Names line up on their dots, like figures on a decimal point; each dot is that name's status light. */

@font-face {
  font-family: 'Atkinson Next';
  src: url('fonts/atkinson-next.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --paper: #f3f5fa;
  --paper-2: #ffffff;
  --ink: #172042;
  --ink-2: #4f5876;
  --ink-3: #8c94ad;
  --rule: #d6dbe9;
  --tint: #e6eaf5;
  --open: #0d9a58;
  --open-ink: #0a7444;
  --premium: #cf8f00;
  --premium-ink: #95660a;
  --reserved: #7b58d6;
  --taken: #b9bfce;
  --unknown: #dc3f48;
  --focus: #2f5bea;
  --shadow: 0 1px 0 rgb(23 32 66 / 0.05), 0 14px 36px -14px rgb(23 32 66 / 0.32);

  --dom: clamp(1.375rem, 1.05rem + 1.1vw, 1.8rem);
  --gutter: clamp(1rem, 4vw, 3rem);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101524;
    --paper-2: #181e33;
    --ink: #e9edf8;
    --ink-2: #a8b0c8;
    --ink-3: #6e7793;
    --rule: #2a3251;
    --tint: #1e2643;
    --open: #36cf80;
    --open-ink: #4fd891;
    --premium: #f0b431;
    --premium-ink: #f0b431;
    --reserved: #a78bfa;
    --taken: #474f6b;
    --unknown: #ff6b70;
    --focus: #84a1ff;
    --shadow: 0 1px 0 rgb(0 0 0 / 0.3), 0 18px 40px -16px rgb(0 0 0 / 0.7);
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Atkinson Next', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  background: var(--paper-2);
  padding: 0.5rem 0.75rem;
}

/* ---------- header ---------- */

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.25rem var(--gutter) 0;
}

.mark {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}

.mark-dot {
  display: inline-block;
  width: 0.3em;
  height: 0.3em;
  margin: 0 0.07em;
  border-radius: 50%;
  background: var(--open);
}

.modes {
  display: flex;
  gap: 0.25rem 1.25rem;
  flex-wrap: wrap;
}

.modes button {
  background: none;
  border: 0;
  padding: 0.25rem 0;
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 560;
  text-decoration: none;
}

.modes button[aria-pressed='true'] {
  color: var(--ink);
  border-bottom: 0.14em dotted currentColor;
}

.modes button:hover {
  color: var(--ink);
}

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--gutter) 6rem;
}

/* ---------- the sentence ---------- */

.ask {
  padding: clamp(2rem, 6vw, 4.5rem) 0 clamp(1.25rem, 3vw, 2rem);
}

.lead {
  font-size: clamp(1.75rem, 1.1rem + 2.9vw, 3.1rem);
  line-height: 1.16;
  font-weight: 420;
  letter-spacing: -0.012em;
  margin: 0 0 0.5em;
  max-width: 21em;
  text-wrap: balance;
}

.sub {
  font-size: clamp(1.1rem, 1rem + 0.55vw, 1.375rem);
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0;
  max-width: 36em;
}

/* Editable parts of the sentence. A border, not text-decoration: Safari drops dotted
   underlines set through the text-decoration shorthand. */
.tok {
  font: inherit;
  font-weight: 720;
  color: var(--ink);
  background: var(--tint);
  border: 0;
  border-bottom: 0.08em dotted currentColor;
  padding: 0 0.14em;
  margin: 0 0.02em;
  cursor: pointer;
  border-radius: 0.2em 0.2em 0 0;
  -webkit-tap-highlight-color: transparent;
}

.tok:hover,
.tok[aria-expanded='true'] {
  background: color-mix(in srgb, var(--tint) 55%, var(--rule));
}

.reset {
  margin-left: 0.6em;
  font-size: 0.8em;
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.ext-price {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.95rem;
  color: var(--ink-3);
}

.paste {
  width: 100%;
  min-height: 7.5rem;
  margin-top: 0.75rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper-2);
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.4rem);
  font-weight: 600;
  line-height: 1.4;
  resize: vertical;
}

.paste-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.idea-input {
  min-height: 0;
  margin-bottom: 0;
}

.hint-inline {
  color: var(--ink-3);
  font-size: 0.875rem;
}

.paste-row + .sub {
  margin-top: 1rem;
}

.kind {
  color: var(--ink-2);
  font-style: normal;
}

/* ---------- buttons ---------- */

.btn,
.run {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 9px;
  padding: 0.42rem 0.8rem;
  font-weight: 620;
  cursor: pointer;
  line-height: 1.3;
}

.btn:hover,
.run:hover {
  border-color: var(--ink-3);
}

.btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

/* ---------- tally ---------- */

.tally {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-bottom: 0.9rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  padding-top: 0.75rem;
}

.count-wrap {
  flex: 1 1 22rem;
}

.count {
  margin: 0;
  color: var(--ink-2);
}

.caveat {
  margin: 0.2rem 0 0;
  font-size: 0.875rem;
  color: var(--ink-3);
  max-width: 40em;
}

.caveat:empty {
  display: none;
}

.count strong {
  color: var(--ink);
  font-weight: 720;
}

.tally-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 9px;
  overflow: hidden;
}

.seg button {
  background: var(--paper-2);
  border: 0;
  padding: 0.42rem 0.8rem;
  font-weight: 620;
  cursor: pointer;
}

.seg button + button {
  border-left: 1px solid var(--rule);
}

.seg button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}

.sort {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-2);
}

.sort select {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 9px;
  padding: 0.38rem 0.5rem;
  font-weight: 600;
  color: var(--ink);
}

.progress {
  flex-basis: 100%;
  height: 2px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 0.3s ease;
}

/* ---------- results ---------- */

.list {
  --labm: 3ch;
  --extm: 3ch;
  --labw: min(var(--labm), 22rem);
  --extw: min(var(--extm), 13rem);
  --dotw: 0.62em;
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  font-size: var(--dom);
}

/* The seam: a faint dotted line the status dots sit on. */
.list:not(:empty)::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(0.5rem + var(--labw) + var(--dotw) / 2);
  border-left: 1px dotted var(--rule);
  pointer-events: none;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: calc(var(--labw) + var(--dotw) + var(--extw)) 10.5rem 7rem minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 1.25rem;
  padding: 0.12rem 0.5rem;
  border-radius: 10px;
}

.row:hover {
  background: color-mix(in srgb, var(--tint) 70%, transparent);
}

.row.is-open {
  background: var(--tint);
}

.hit {
  display: grid;
  grid-template-columns: var(--labw) var(--dotw) var(--extw);
  align-items: baseline;
  background: none;
  border: 0;
  padding: 0.1em 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.lab {
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
}

.ext {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  --st: var(--taken);
  justify-self: center;
  display: inline-block;
  width: 0.3em;
  height: 0.3em;
  border-radius: 50%;
  background: var(--st);
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.s-wait .dot,
.dot.s-wait {
  background: transparent;
  box-shadow: inset 0 0 0 0.06em var(--ink-3);
  --st: var(--ink-3);
}
.s-checking .dot {
  background: transparent;
  box-shadow: inset 0 0 0 0.06em var(--ink-2);
  animation: breathe 1.1s ease-in-out infinite;
}
.s-likely .dot,
.dot.s-likely {
  --st: var(--open);
  background: transparent;
  box-shadow: inset 0 0 0 0.075em var(--open);
}
.s-open .dot,
.dot.s-open,
.s-available .dot {
  --st: var(--open);
  transform: scale(1.08);
}
.s-premium .dot,
.dot.s-premium {
  --st: var(--premium);
}
.s-reserved .dot,
.dot.s-reserved {
  --st: var(--reserved);
}
.s-taken .dot,
.dot.s-taken,
.s-blocked .dot {
  --st: var(--taken);
  transform: scale(0.72);
}
.s-unknown .dot,
.dot.s-unknown {
  background: transparent;
  box-shadow: inset 0 0 0 0.07em var(--unknown);
}

.s-taken .hit,
.s-blocked .hit,
.s-reserved .hit {
  color: var(--ink-3);
  font-weight: 560;
}

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

.info {
  display: contents;
}

/* The written status: the dot's color, said in words. */
.state {
  font-size: 0.9375rem;
  font-weight: 650;
  white-space: nowrap;
}
.st-open,
.st-available,
.st-likely {
  color: var(--open-ink);
}
.st-likely {
  font-weight: 500;
}
.st-premium {
  color: var(--premium-ink);
}
.st-reserved {
  color: var(--reserved);
}
.st-taken,
.st-blocked,
.st-wait,
.st-checking {
  color: var(--ink-3);
  font-weight: 500;
}
.st-unknown {
  color: var(--unknown);
}

.price,
.meta {
  font-size: 0.9375rem;
  line-height: 1.35;
}

.price {
  font-size: 1rem;
  font-weight: 650;
  white-space: nowrap;
}

.price small {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--ink-3);
}

.s-taken .price {
  color: var(--ink-3);
  font-weight: 400;
}

.price.premium-price {
  color: var(--premium-ink);
  font-weight: 600;
}

.meta {
  color: var(--ink-2);
  min-width: 0;
}

.flag {
  font-style: normal;
  color: var(--ink-2);
  white-space: nowrap;
}

.flag::before {
  content: '';
  display: inline-block;
  width: 0.36em;
  height: 0.36em;
  margin: 0 0.4em 0.1em 0.5em;
  border-radius: 50%;
  background: var(--rule);
}

.flag.warn {
  color: var(--premium);
}

.acts {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9375rem;
}

.star {
  background: none;
  border: 0;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink-3);
  border-radius: 6px;
}

.star[aria-pressed='true'] {
  color: var(--premium);
}

.buy {
  color: var(--ink-2);
  white-space: nowrap;
}

.detail {
  grid-column: 1 / -1;
  font-size: 1rem;
  line-height: 1.55;
  padding: 0.35rem 0 0.9rem calc(var(--labw) + var(--dotw));
  color: var(--ink-2);
  max-width: calc(var(--labw) + var(--dotw) + 38rem);
}

.detail p {
  margin: 0 0 0.45rem;
}

.detail strong {
  color: var(--ink);
}

.detail .links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.4rem;
}

.empty {
  font-size: 1.125rem;
  color: var(--ink-2);
  padding: 1.5rem 0;
  max-width: 36em;
}

.more {
  padding: 1rem 0.5rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  color: var(--ink-2);
}

.more:empty {
  display: none;
}

/* ---------- legend + footer ---------- */

.legend {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  max-width: 44rem;
}

.legend h2 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.legend li {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  align-items: baseline;
}

.legend .dot {
  width: 0.62rem;
  height: 0.62rem;
  justify-self: start;
}

.foot {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--gutter) 3rem;
  color: var(--ink-3);
  font-size: 0.875rem;
}

.foot p {
  max-width: 52rem;
  margin: 0 0 0.5rem;
}

/* ---------- popover editors ---------- */

.pop {
  position: absolute;
  z-index: 50;
  width: min(25rem, calc(100vw - 2rem));
  max-height: min(80vh, 40rem);
  overflow: auto;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.1rem;
  font-size: 1rem;
  color: var(--ink);
}

.pop.wide {
  width: min(40rem, calc(100vw - 2rem));
}

.pop h3 {
  font-size: 1rem;
  font-weight: 720;
  margin: 0 0 0.6rem;
}

.pop p.hint {
  color: var(--ink-2);
  font-size: 0.9375rem;
  margin: 0.5rem 0 0;
}

.pop .field {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.pop label {
  font-weight: 600;
}

.pop input[type='text'],
.pop input[type='search'] {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--paper);
  font-size: 1rem;
}

.pop input[type='range'] {
  width: 100%;
  accent-color: var(--ink);
}

.steppers {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 1.0625rem;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
}

.stepper button {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  background: var(--paper);
  font-size: 1.25rem;
  cursor: pointer;
}

.stepper output {
  min-width: 2.6rem;
  text-align: center;
  font-weight: 720;
  font-size: 1.125rem;
}

.choices {
  display: grid;
  gap: 0.25rem;
}

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.45rem 0.6rem;
  border-radius: 9px;
  cursor: pointer;
}

.choice:hover {
  background: var(--tint);
}

.choice input {
  accent-color: var(--ink);
}

.choice small {
  display: block;
  color: var(--ink-2);
  font-weight: 400;
}

.check {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-top: 0.4rem;
  font-weight: 500;
}

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0;
}

.quick button {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 12.5rem;
  overflow: auto;
  padding: 0.2rem 0;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.2rem 0.5rem;
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
}

.chip small {
  font-weight: 450;
  color: var(--ink-2);
}

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

.chip[aria-pressed='true'] small {
  color: color-mix(in srgb, var(--paper) 75%, transparent);
}

.chip.other {
  border-style: dashed;
}

.pop-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.add-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.add-row input {
  flex: 1;
}

/* ---------- saved names ---------- */

.saved-pill {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 40;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.sheet {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(26rem, 100vw);
  background: var(--paper-2);
  border-left: 1px solid var(--rule);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  overflow: auto;
}

.sheet h2 {
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

.sheet ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.5rem;
}

.sheet li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 0.75rem;
}

.saved-name {
  font-weight: 700;
  font-size: 1.25rem;
}

.saved-name .dot {
  width: 0.28em;
  height: 0.28em;
  margin: 0 0.06em;
  vertical-align: baseline;
}

.sheet .row-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(4.5rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  font-weight: 600;
  z-index: 80;
}

/* ---------- small screens ---------- */

@media (max-width: 40rem) {
  .list {
    --labw: min(var(--labm), 46vw);
    --extw: min(var(--extm), 34vw);
  }
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0;
    padding: 0.35rem 0.25rem;
  }
  .list:not(:empty)::before {
    left: calc(0.25rem + var(--labw) + var(--dotw) / 2);
  }
  .hit {
    grid-column: 1 / -1;
  }
  .info {
    grid-column: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.55rem;
    padding-left: calc(var(--labw) + var(--dotw));
    margin-top: -0.1rem;
  }
  .price {
    font-size: 0.9375rem;
  }
  .price small {
    display: inline;
    margin-left: 0.3rem;
  }
  .meta {
    display: contents;
  }
  .flag {
    white-space: normal;
  }
  .flag::before {
    margin-left: 0;
  }
  .acts {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
  }
  .buy {
    display: none;
  }
  .modes .long {
    display: none;
  }
  .tally {
    position: static;
  }
  .sort-label {
    display: none;
  }
  .detail {
    padding-left: 0.25rem;
  }
  .pop {
    position: fixed;
    left: 0 !important;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: 100%;
    max-height: 78vh;
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
  }
  .pop.wide {
    width: 100%;
  }
  .tally-controls .sort span {
    display: none;
  }
  .sheet {
    top: auto;
    width: 100%;
    max-height: 80vh;
    border-left: 0;
    border-top: 1px solid var(--rule);
    border-radius: 18px 18px 0 0;
  }
  .pop input[type='text'],
  .pop input[type='search'],
  .sort select {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
