/* The controls a page is assembled from: buttons, badges, state dots, panels,
   fields, status lines and the footer. Lists, disclosures, prose and tables
   are lists.css. */

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

/* A press answers at once (the first painted frame is the pressed one) and
   lets go on the snappy spring, so a control settles rather than snaps. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-button);
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: var(--callout);
  font-weight: 600;
  letter-spacing: var(--track-callout);
  white-space: nowrap;
  transition: transform var(--spring-snappy-ms) var(--spring-snappy), background-color var(--fast) var(--ease-out-soft),
    color var(--fast) var(--ease-out-soft);
}

.button:hover {
  background: var(--accent-fill-hover);
  color: var(--on-accent);
  text-decoration: none;
}

.button:active {
  transform: scale(0.97);
  transition-duration: var(--press-in);
}

.button-ghost {
  background: var(--fill);
  color: var(--label);
}

.button-ghost:hover {
  background: var(--hairline-strong);
  color: var(--label);
}

.button-quiet {
  padding: 0 12px;
  background: transparent;
  color: var(--tint);
}

.button-quiet:hover {
  background: var(--tint-fill);
  color: var(--tint);
}

.button-sm {
  min-height: 32px;
  padding: 0 14px;
  font-size: var(--footnote);
}

.button-danger {
  background: #d1281e;
  color: #ffffff;
}

.button-danger:hover {
  background: #be241b;
  color: #ffffff;
}

.button[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

/* A download that is not out yet: shaped like the button it will become. */
.button-soon {
  background: var(--fill-2);
  color: var(--label-2);
  cursor: default;
  pointer-events: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.actions-center {
  justify-content: center;
}

/* On a narrow screen two buttons of different widths side by side read as a
   misalignment, so they stack and fill. */
@media (max-width: 560px) {
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .button {
    width: 100%;
  }
}

.button-block {
  width: 100%;
}

/* A row of buttons that closes a block needs air above it; inside a form the
   field's margin sits above its label, not under the input. */
.checklist + .actions,
.group + .actions,
.faq-list + .actions,
.field + .actions {
  margin-top: 24px;
}

/* ---------------------------------------------------------------- badges --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--fill-2);
  color: var(--label-2);
  font-size: var(--caption);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.5;
  white-space: nowrap;
}

.badge.is-blue {
  background: var(--tint-fill);
  color: var(--tint);
}

.badge.is-ok {
  background: var(--green-fill);
  color: var(--green-ink);
}

/* A badge in a heading sits on the heading's middle, not its line box. */
:is(h2, h3, h4) .badge {
  vertical-align: 0.2em;
  margin-left: 6px;
}

/* The 6px state dot: filled while running, a ring while idle. */
.dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.dot-live {
  color: var(--green);
}

.dot-idle {
  border: 1.5px solid currentColor;
  background: none;
  color: var(--label-2);
}

/* ------------------------------------------------------------- checklist --- */

.checklist {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.lede + .checklist,
p + .checklist {
  margin-top: 28px;
}

.checklist li {
  position: relative;
  padding-left: 28px;
  color: var(--label-2);
  font-size: var(--callout);
  line-height: 1.5;
  letter-spacing: var(--track-callout);
}

.checklist li::before {
  position: absolute;
  top: 0.38em;
  left: 3px;
  width: 10px;
  height: 5.5px;
  border-bottom: 1.75px solid var(--tint);
  border-left: 1.75px solid var(--tint);
  content: "";
  transform: rotate(-45deg);
}

.checklist li strong {
  color: var(--label);
}

/* ---------------------------------------------------------------- panels --- */

.panel {
  padding: clamp(24px, 3vw, 36px);
  border-radius: var(--r-panel);
  background: var(--elevated);
  box-shadow: var(--highlight), var(--shadow-float);
}

/* Inside a panel the heading labels a form; at display size it would shout. */
.panel h2 {
  font-size: var(--title-3);
  letter-spacing: var(--track-title-3);
  line-height: 1.27;
}

.panel h2 + p,
.panel form > p:first-child {
  margin-top: 8px;
  font-size: var(--callout);
  line-height: 1.5;
}

.panel-tight {
  max-width: 520px;
}

/* ---------------------------------------------------------------- fields --- */

.field {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.field label {
  color: var(--label-2);
  font-size: var(--footnote);
  font-weight: 510;
  letter-spacing: var(--track-footnote);
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-button);
  background: var(--well);
  box-shadow: inset 0 0 0 0.5px var(--hairline-strong);
  color: var(--label);
  font-size: 16px;
  transition: box-shadow var(--fast) var(--ease-out-soft);
}

.field input::placeholder {
  color: var(--label-3);
}

.field input:focus,
.field select:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--tint), 0 0 0 4px var(--tint-fill);
}

.code-input {
  font-family: var(--mono);
  font-size: 22px !important;
  letter-spacing: 0.32em;
  text-align: center;
}

/* ---------------------------------------------------------------- status --- */

.status {
  min-height: 22px;
  margin-top: 14px;
  color: var(--label-2);
  font-size: var(--footnote);
  line-height: 1.5;
}

.status:empty {
  margin-top: 0;
}

.panel > .status:empty {
  min-height: 0;
}

.status.error {
  color: var(--red);
}

.status.ok {
  color: var(--green-ink);
}

.error-link {
  color: var(--red);
}

/* ---------------------------------------------------------------- footer --- */

.foot {
  /* The body is a column, so on a page shorter than the window the footer
     sits on the bottom edge instead of leaving a strip of the page ground. */
  margin-top: auto;
  padding-block: 56px 36px;
  background: var(--well);
  font-size: var(--footnote);
  letter-spacing: var(--track-footnote);
}

.foot-grid {
  display: grid;
  gap: 32px 40px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.foot-grid .caption {
  max-width: 28ch;
  margin-top: 12px;
}

.foot h4 {
  margin-bottom: 12px;
  color: var(--label);
  font-size: var(--footnote);
  font-weight: 600;
  letter-spacing: var(--track-footnote);
}

.foot ul {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.foot a {
  color: var(--label-2);
}

.foot a:hover {
  color: var(--label);
  text-decoration: none;
}

.foot-base {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  justify-content: space-between;
  margin-top: 48px;
  color: var(--label-2);
  font-size: var(--caption);
}

.foot-base:first-child {
  margin-top: 0;
}

.foot-grid + .foot-base {
  padding-top: 20px;
  box-shadow: inset 0 0.5px 0 var(--hairline);
}
