:root {
  --paper: #efece5;
  --ink: #1b1a18;
  --mute: #6e6a62;
  --faint: #bdb8ae;
  --line: #d6d1c6;
  --them: #e3dfd6;
  --me: #1b1a18;
  --me-ink: #efece5;
  --wound: #8c1d18;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, Georgia, serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b0b0c;
    --ink: #d9d5cc;
    --mute: #86827a;
    --faint: #4d4b47;
    --line: #232322;
    --them: #19191a;
    --me: #d9d5cc;
    --me-ink: #0b0b0c;
    --wound: #c4473e;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--serif);
  font-feature-settings: "onum", "kern";
}

#app {
  max-width: 36rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--wound);
}

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

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--paper);
  padding: 0.5rem;
}

kbd,
time,
.who,
.receipt,
.roll,
.progress,
.pill,
label,
legend,
button,
input,
.note,
.err,
.top,
.foot {
  font-family: var(--mono);
}

kbd {
  font-size: 0.82em;
  letter-spacing: 0.04em;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.5rem 0 0;
  font-size: 0.8rem;
  color: var(--mute);
}

.top a {
  text-decoration: none;
}

.top nav {
  display: flex;
  gap: 1.25rem;
}

.mark {
  letter-spacing: 0.08em;
}

.page {
  padding: 5rem 0 3rem;
}

.narrow {
  padding-top: 3.5rem;
}

h1,
h2 {
  font-weight: 400;
  margin: 0;
}

#title {
  font-size: clamp(2.6rem, 11vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.h {
  font-size: 2.25rem;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.0625rem;
  font-style: italic;
  margin: 3.5rem 0 0.75rem;
}

.def {
  margin: 0.6rem 0 0;
  color: var(--mute);
}

.lede {
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 2rem 0;
}

p {
  margin: 0 0 1rem;
}

.roll {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin: 4rem 0 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--mute);
}

.roll-day {
  color: var(--ink);
  margin-right: 0.5rem;
}

.roll-name.gone {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-color: var(--faint);
}

.roll-name.last {
  color: var(--wound);
}

.thread {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.1rem;
}

.msg {
  display: grid;
  grid-template-columns: 3.25rem 1fr auto;
  align-items: end;
  gap: 0 0.75rem;
}

.who {
  font-size: 0.72rem;
  color: var(--mute);
  padding-bottom: 0.55rem;
}

.at {
  font-size: 0.68rem;
  color: var(--faint);
  padding-bottom: 0.55rem;
}

.bubble {
  margin: 0;
  justify-self: start;
  background: var(--them);
  padding: 0.5rem 0.85rem;
  border-radius: 1.1rem 1.1rem 1.1rem 0.3rem;
  max-width: 100%;
  line-height: 1.4;
}

.thread .msg:nth-child(4) .bubble {
  opacity: 0.92;
}
.thread .msg:nth-child(5) .bubble {
  opacity: 0.84;
}
.thread .msg:nth-child(6) .bubble {
  opacity: 0.76;
}

.stamp {
  font: 0.68rem var(--mono);
  color: var(--faint);
  text-align: center;
  margin-top: 2.5rem;
}

.msg.me {
  grid-template-columns: 1fr;
  justify-items: end;
}

.msg.me .bubble {
  justify-self: end;
}

.msg.me .bubble {
  background: var(--me);
  color: var(--me-ink);
  border-radius: 1.1rem 1.1rem 0.3rem 1.1rem;
}

.receipt {
  font-size: 0.68rem;
  color: var(--mute);
  margin-top: 0.3rem;
}

.dots {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.75rem 0.85rem;
}

.dots span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--mute);
  animation: blink 1.2s infinite;
}

.dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.dots span:nth-child(3) {
  animation-delay: 0.4s;
}

.typing {
  animation: vanish 9s forwards;
}

@keyframes blink {
  0%,
  60%,
  100% {
    opacity: 0.25;
  }
  30% {
    opacity: 1;
  }
}

@keyframes vanish {
  0%,
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

.steps {
  padding-left: 1.4rem;
  margin: 0 0 1.25rem;
}

.steps li {
  margin-bottom: 0.6rem;
  padding-left: 0.25rem;
}

.steps li::marker {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--mute);
}

.steps b,
.terms b {
  font-weight: 600;
}

.price h2 {
  font-style: normal;
  font-size: 3rem;
  line-height: 1;
  margin: 0 0 1rem;
}

.price {
  margin-top: 0;
}

.go {
  display: inline-block;
  margin-top: 1rem;
  font-size: 1.2rem;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.foot {
  border-top: 1px solid var(--line);
  padding: 1.25rem 0 2.5rem;
  font-size: 0.72rem;
  color: var(--mute);
}

.foot p {
  margin: 0 0 0.35rem;
}

/* forms */

.progress {
  list-style: none;
  padding: 0;
  margin: 0 0 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.72rem;
  color: var(--faint);
  counter-reset: s;
}

.progress li {
  counter-increment: s;
}

.progress li::before {
  content: counter(s) " ";
}

.progress [aria-current] {
  color: var(--ink);
}

.progress .done {
  color: var(--mute);
  text-decoration: line-through;
}

.form {
  display: grid;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
}

.form h2 {
  margin-top: 2rem;
  margin-bottom: 0;
}

label,
legend {
  font-size: 0.75rem;
  color: var(--mute);
}

.form > label:not(.check) {
  margin-top: 0.75rem;
}

input:not([type]),
input[type="tel"],
input[inputmode="numeric"] {
  font-size: 1.1rem;
  padding: 0.6rem 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: inherit;
  width: 100%;
}

input::placeholder {
  color: var(--faint);
}

input[aria-invalid] {
  border-bottom-color: var(--wound);
}

.code {
  letter-spacing: 0.5em;
  font-size: 1.6rem !important;
}

.check {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--ink);
  margin: 1rem 0 0;
  cursor: pointer;
}

.turnstile {
  margin: 1rem 0 0;
  min-height: 65px;
}

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--wound);
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.1rem 0 0;
  flex: none;
}

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

.row input {
  flex: 1 1 10rem;
  width: auto;
}

button {
  font-size: 0.85rem;
  padding: 0.75rem 1.2rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--wound);
  border-color: var(--wound);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

a.button {
  display: inline-block;
  font-size: 0.85rem;
  padding: 0.75rem 1.2rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  text-decoration: none;
}

a.button:hover {
  background: var(--wound);
  border-color: var(--wound);
}

a.button.send,
button.done {
  font-size: 1rem;
  padding: 1rem 1.6rem;
  min-width: 14rem;
  text-align: center;
}

.code-show {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 2.4rem;
  letter-spacing: 0.35em;
  margin: 0.5rem 0;
  color: var(--ink);
  user-select: all;
}

button.quiet {
  background: transparent;
  color: var(--mute);
  border-color: transparent;
  padding-left: 0;
}

button.quiet:hover:not(:disabled) {
  background: transparent;
  color: var(--wound);
}

button.danger {
  background: transparent;
  color: var(--wound);
  border-color: var(--wound);
}

button.danger:hover:not(:disabled) {
  color: var(--paper);
}

.note {
  font-size: 0.75rem;
  color: var(--mute);
  line-height: 1.55;
  margin: 0.25rem 0 0;
}

.err {
  font-size: 0.8rem;
  color: var(--wound);
  margin: 0.25rem 0 0;
}

.msg.sys {
  display: block;
  margin: 0 0 0.5rem;
}

.msg.sys .bubble {
  display: inline-block;
  font-size: 0.95rem;
}

.terms {
  padding-left: 1.6rem;
  margin: 0 0 1rem;
}

.terms li {
  margin-bottom: 0.5rem;
}

.terms li::marker {
  color: var(--faint);
  content: "— ";
}

.scopes {
  margin: 1.5rem 0;
  display: grid;
  gap: 1.1rem;
}

.scopes dt {
  font-weight: 600;
}

.scopes dd {
  margin: 0.15rem 0 0;
  color: var(--mute);
}

.pill {
  font-weight: 400;
  font-size: 0.68rem;
  color: var(--mute);
  margin-left: 0.4rem;
}

.pill.on {
  color: var(--wound);
}

.dump {
  font: 0.75rem/1.5 var(--mono);
  background: var(--them);
  padding: 1rem;
  overflow: auto;
  max-height: 20rem;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 30rem) {
  body {
    font-size: 1rem;
  }
  .page {
    padding-top: 3.5rem;
  }
  .msg {
    grid-template-columns: 2.75rem 1fr;
  }
  .msg .at {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dots span,
  .typing {
    animation: none;
  }
  .typing {
    display: none;
  }
}

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