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

.field {
  width: 100%;
  height: var(--control-height-sm);
  padding: 0 10px;
  border: 1px solid var(--field-border);
  background: var(--field-fill);
  color: var(--text-heading);
  font: 400 13px var(--font-body);
}

.field:focus {
  outline: none;
  border-color: rgba(139, 92, 246, .55);
  background: rgba(139, 92, 246, .07);
}

.field--area {
  height: auto;
  padding: 9px 10px;
  line-height: 1.5;
  resize: vertical;
}

.field--json,
.field--number,
.field--value {
  font-family: var(--font-mono);
  font-size: 12px;
}

.field--select {
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%226%22 viewBox=%220 0 10 6%22%3E%3Cpath d=%22M1 1l4 4 4-4%22 fill=%22none%22 stroke=%22%237c8aa5%22 stroke-width=%221.4%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

select.field {
  background-color: var(--field-surface);
}

select.field:focus {
  background-color: var(--field-surface-focus);
}

/* ---- controls ---- */

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control--inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.control--alias {
  padding-left: 10px;
  border-left: 1px solid var(--rule);
}

.control__label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text-label);
  letter-spacing: .2em;
  text-transform: uppercase;
}

.control__flag {
  color: var(--lilac);
  font-style: normal;
  letter-spacing: .18em;
}

.control__hint {
  color: var(--text-timestamp);
  line-height: 1.5;
  letter-spacing: .02em;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- segmented control ---- */

.seg {
  display: flex;
  flex-wrap: wrap;
}

.seg--stack {
  flex-direction: column;
}

.seg__button {
  height: var(--control-height-sm);
  padding: 0 10px;
  border: 1px solid var(--field-border);
  background: var(--field-fill);
  color: var(--text-label);
  font: 400 var(--size-micro)/1 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.seg__button + .seg__button {
  margin-left: -1px;
}

.seg--stack .seg__button + .seg__button {
  margin-left: 0;
  margin-top: -1px;
}

.seg__button:hover {
  border-color: rgba(139, 92, 246, .55);
  color: var(--text-heading);
}

.seg__button--on {
  position: relative;
  z-index: 1;
  border-color: rgba(139, 92, 246, .55);
  background: rgba(139, 92, 246, .16);
  color: var(--text-heading);
}

/* ---- switch ---- */

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  flex: 0 0 auto;
}

.switch__input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch__track {
  position: absolute;
  inset: 0;
  background: var(--field-fill);
  border: 1px solid var(--field-border);
  pointer-events: none;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-timestamp);
  transition: transform 200ms var(--ease-snap), background 200ms ease;
}

.switch__input:checked + .switch__track::after {
  background: var(--violet);
  transform: translateX(18px);
}

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

.button {
  height: var(--control-height-sm);
  padding: 0 12px;
  border: 1px solid var(--field-border);
  background: none;
  color: var(--text-label);
  font: 400 var(--size-micro)/1 var(--font-mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.button:hover {
  border-color: rgba(139, 92, 246, .55);
  color: var(--text-heading);
}

.button--quiet {
  border-color: transparent;
}

.button--danger:hover {
  border-color: #f472b6;
  color: #f472b6;
}

.capture__button {
  height: var(--control-height-sm);
  padding: 0 20px;
  border: 0;
  background-image: linear-gradient(100deg, #8b5cf6, #4a7dff, #8b5cf6);
  background-size: 220% 100%;
  background-position: 0 0;
  color: #fff;
  font: 700 13px var(--font-display);
  letter-spacing: .1em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
  cursor: pointer;
  transition: background-position 520ms var(--ease-snap);
}

.capture__button:hover:not(:disabled) {
  background-position: 100% 0;
}

.capture__button:disabled {
  opacity: .5;
  cursor: default;
}

/* ---- the channel rail ---- */

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel__name {
  padding-bottom: 6px;
  color: var(--text-timestamp);
  letter-spacing: .2em;
  overflow-wrap: anywhere;
}

.layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--control-height-sm);
  padding: 0 10px;
  border: 1px solid transparent;
  background: none;
  color: var(--text-body);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.layer-row:hover {
  border-color: rgba(139, 92, 246, .22);
  color: var(--text-heading);
}

.layer-row--on {
  border-color: rgba(139, 92, 246, .55);
  background: rgba(139, 92, 246, .1);
  color: var(--text-heading);
}

.layer-row__name {
  letter-spacing: .14em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-row__flag {
  flex: 0 0 auto;
  color: var(--text-timestamp);
  letter-spacing: .14em;
}

/* ---- the message pane ---- */

.message__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.message__title {
  margin: 0;
  color: var(--text-heading);
  font: 700 clamp(22px, 2.2vw, 30px)/1.05 var(--font-display);
  letter-spacing: -.012em;
  text-transform: uppercase;
}

.message__prose {
  margin: 0;
  max-width: 68ch;
  color: var(--text-body);
  font: 400 15px/1.55 var(--font-body);
}

/* ---- key/value editor ---- */

.entries {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.entries__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--control-height-sm);
  gap: 6px;
}

/* ---- the send rail ---- */

.readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.readout--wide {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.readout__label {
  color: var(--text-timestamp);
  letter-spacing: .2em;
  text-transform: uppercase;
}

.readout__value {
  color: var(--text-body);
  font-family: var(--font-mono);
  letter-spacing: .06em;
  overflow-wrap: anywhere;
  text-align: right;
}

.readout__value--warn {
  color: #f472b6;
}

.readout__code {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--lilac);
  font: 400 12px/1.5 var(--font-mono);
  overflow-wrap: anywhere;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(167, 139, 250, .3);
  white-space: nowrap;
}

.pill__dot {
  width: 6px;
  height: 6px;
  background: var(--lilac);
  animation: pill-pulse 2.2s ease-in-out infinite;
}

.pill__label {
  color: var(--lilac);
  letter-spacing: .18em;
  text-transform: uppercase;
}

.pill--live {
  border-color: rgba(74, 222, 128, .3);
}

.pill--live .pill__dot {
  background: var(--signal);
}

.pill--live .pill__label {
  color: var(--signal);
}

@keyframes pill-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  .pill__dot {
    animation: none;
  }
}

/* ---- the document panel ---- */

.logpanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--rule);
  background: var(--panel);
  background-image: linear-gradient(var(--panel-wash), var(--panel-wash));
}

.logpanel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid var(--rule);
}

.logpanel__title {
  color: var(--text-label);
  letter-spacing: .2em;
  text-transform: uppercase;
}

.logpanel__body {
  margin: 0;
  padding: 14px;
  max-height: 60vh;
  overflow: auto;
  color: var(--text-log);
  font: 400 var(--size-log)/1.6 var(--font-mono);
  white-space: pre;
}

/* ---- notices ---- */

.notice,
.noscript {
  margin: var(--page-padding);
  color: var(--text-body);
  font: 400 15px/1.55 var(--font-body);
}
