/* byteomi-systems/electrical-systems.html — Flip-Flop Clocked Memory */

.doc-byteomi-preset.doc-byteomi-preset--hero.doc-byteomi-preset--flip-flop {
  max-width: min(100%, 68rem);
  width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
}

.doc-byteomi-preset--flip-flop .doc-byteomi-preset__tag {
  color: rgba(120, 200, 255, 0.95);
}

.doc-ff-lab__layout {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 1.15fr);
  gap: 0.65rem;
  align-items: stretch;
}

.doc-ff-lab__chamber-wrap {
  position: relative;
  min-height: 340px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(120, 200, 255, 0.22);
  background: radial-gradient(
    90% 80% at 50% 55%,
    rgba(40, 60, 100, 0.25),
    #050810
  );
}

.doc-ff-lab__fabric {
  display: block;
  width: 100%;
  height: 340px;
}

.doc-ff-lab__chamber-hud {
  position: absolute;
  left: 0.55rem;
  bottom: 0.5rem;
  z-index: 2;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  color: rgba(160, 210, 255, 0.88);
  pointer-events: none;
}

.doc-ff-lab__state-lock {
  position: absolute;
  right: 0.55rem;
  top: 0.55rem;
  z-index: 2;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  border: 1px solid rgba(120, 200, 255, 0.25);
  background: rgba(6, 14, 28, 0.85);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.55rem;
  color: rgba(150, 190, 230, 0.85);
  pointer-events: none;
}

.doc-ff-lab__state-lock strong {
  display: block;
  font-size: 0.72rem;
  color: #2ee7f2;
  margin-bottom: 0.15rem;
}

.doc-ff-lab__state-lock.is-meta strong {
  color: #ffb56a;
}

.doc-ff-lab__state-lock.is-latch strong {
  color: rgba(181, 108, 255, 0.95);
}

.doc-ff-lab__state-lock.is-q-high strong {
  animation: ff-q-breathe 2.4s ease-in-out infinite;
  text-shadow: 0 0 10px rgba(46, 231, 242, 0.45);
}

@keyframes ff-q-breathe {
  0%,
  100% {
    opacity: 0.88;
    filter: brightness(1);
  }
  50% {
    opacity: 1;
    filter: brightness(1.25);
  }
}

@media (prefers-reduced-motion: reduce) {
  .doc-ff-lab__state-lock.is-q-high strong {
    animation: none;
    text-shadow: none;
  }
}

.doc-ff-lab__right {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0.5rem;
  min-height: 340px;
}

.doc-ff-lab__scope-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #050a0f;
  min-height: 240px;
}

.doc-ff-lab__scope {
  display: block;
  width: 100%;
  height: 240px;
}

.doc-ff-lab__timing-legend {
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(120, 200, 255, 0.18);
  background: rgba(6, 14, 28, 0.85);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.55rem;
  color: rgba(150, 185, 220, 0.8);
}

.doc-ff-lab__timing-legend p {
  margin: 0 0 0.3rem;
}

.doc-ff-lab__timing-legend p:last-child {
  margin-bottom: 0;
}

.doc-ff-lab__hud {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.55rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(120, 200, 255, 0.2);
  background: rgba(6, 12, 24, 0.75);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  color: rgba(200, 220, 240, 0.9);
}

.doc-ff-lab__formula {
  margin: 0;
  color: rgba(120, 200, 255, 0.95);
  font-weight: 600;
}

.doc-ff-lab__readout {
  margin: 0;
  color: rgba(150, 185, 220, 0.88);
}

.doc-ff-lab__console {
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(90, 150, 220, 0.22);
  background: linear-gradient(180deg, rgba(8, 14, 28, 0.92), rgba(4, 10, 22, 0.95));
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.doc-ff-lab__console-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(80, 130, 190, 0.18);
}

.doc-ff-lab__console-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(120, 170, 220, 0.85);
}

.doc-ff-lab__modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.doc-ff-lab__mode-btn {
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(120, 140, 200, 0.25);
  background: rgba(10, 18, 32, 0.8);
  color: rgba(190, 210, 240, 0.88);
  font-family: inherit;
  font-size: 0.52rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.doc-ff-lab__mode-btn.is-active {
  border-color: rgba(120, 200, 255, 0.55);
  background: rgba(20, 40, 70, 0.75);
  color: rgba(200, 240, 255, 0.98);
}

.doc-ff-lab__inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.doc-ff-lab__pin-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(80, 120, 180, 0.3);
  background: rgba(8, 16, 30, 0.9);
  color: rgba(140, 160, 190, 0.9);
  font-family: inherit;
  font-size: 0.58rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.doc-ff-lab__pin-btn.is-high {
  border-color: rgba(46, 231, 242, 0.6);
  color: #2ee7f2;
  box-shadow: 0 0 12px rgba(46, 231, 242, 0.35);
}

.doc-ff-lab__field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.doc-ff-lab__field-label {
  width: 2.4rem;
  font-size: 0.58rem;
  font-weight: 700;
  color: rgba(120, 175, 220, 0.85);
}

.doc-ff-lab__field input[type="range"] {
  flex: 1;
  min-width: 5rem;
  accent-color: #5ec8ff;
}

.doc-ff-lab__field strong {
  width: 3.5rem;
  text-align: right;
  font-size: 0.58rem;
  color: rgba(120, 200, 255, 0.95);
}

.doc-ff-lab__toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.55rem;
  color: rgba(170, 195, 230, 0.85);
  cursor: pointer;
}

.doc-ff-lab__toggle input {
  accent-color: #b56cff;
}

.doc-byteomi-preset--flip-flop:not(.is-ff-latch) .doc-ff-lab__toggle--en,
.doc-byteomi-preset--flip-flop:not(.is-ff-meta) .doc-ff-lab__toggle--meta {
  display: none;
}

.doc-ff-lab__hint {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(170, 195, 230, 0.82);
}

@media (max-width: 820px) {
  .doc-ff-lab__layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .doc-ff-lab__modes {
    width: 100%;
  }

  .doc-ff-lab__mode-btn {
    flex: 1 1 auto;
    text-align: center;
  }
}
