/* Builds on the site's /css/style.css for colors, fonts and .button. */

body.walkthrough {
  padding: 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

main {
  max-width: 60rem;
  margin-inline: auto;
}

h2 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

button.button {
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}

button.button.primary {
  color: var(--accent-contrast);
}

button.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  min-height: 3em;
  margin-top: 0.75rem;
  color: var(--muted);
}

/* Client, lane and server */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: stretch;
  margin-top: 0.5rem;
}

.device {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
  text-align: center;
}

.pin,
.counter {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.counter b {
  color: var(--text);
}

.lane {
  position: relative;
  min-height: 9rem;
  overflow: hidden;
}

.lane::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  border-top: 1px dashed var(--line);
}

.packet {
  position: absolute;
  top: 50%;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.sensor,
.led {
  width: 2.75rem;
  height: 2.75rem;
  margin-block: 0.5rem;
  border-radius: 50%;
}

.sensor {
  border: 2px solid var(--muted);
  background: radial-gradient(circle at 35% 30%, var(--surface), var(--line));
}

.sensor.active {
  border-color: var(--accent);
  animation: sense 0.6s ease-out 2;
}

@keyframes sense {
  from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  to { box-shadow: 0 0 0 1.1rem transparent; }
}

.led {
  border: 2px solid #7f1d1d;
  background: #450a0a;
}

.led.on {
  border-color: #fca5a5;
  background: #ef4444;
  box-shadow: 0 0 1.25rem 0.35rem rgba(239, 68, 68, 0.65);
}

/* Log and packet detail */

.panels {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

@media (min-width: 40rem) {
  .panels {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}

.empty {
  margin-top: 0.5rem;
  color: var(--muted);
}

.log {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.log button {
  display: grid;
  grid-template-columns: 4.2rem 3.4rem 3.4rem 1fr;
  gap: 0.25rem 0.5rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-align: left;
  cursor: pointer;
}

.log button[aria-current="true"] {
  border-color: var(--accent);
}

.log .payload {
  grid-column: 1 / -1;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.detail {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.detail div {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--surface);
}

.detail dt {
  font-size: 0.8rem;
  color: var(--muted);
}

.detail dd {
  font-family: var(--mono);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

@media (max-width: 26rem) {
  .device h2 {
    font-size: 0.68rem;
  }

  .pin {
    font-size: 0.62rem;
  }
}
