/* Binary to Hexadecimal Converter — page-specific styles */

/* Monospace table cells for bit patterns */
.mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

/* Field header row: label + copy button side by side */
.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.field-head label { margin-bottom: 0.25rem; }
.field-head .btn-copy { min-height: 32px; }

/* 16px inputs prevent iOS zoom-on-focus; mono suits bit patterns */
#calculator input[type="text"] {
  font-size: 1rem;
  font-family: var(--font-mono);
}

/* Two equal-weight fields with the swap control between them */
.converter-pair {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.converter-pair .pair-field { flex: 1; margin-bottom: 0; }
.pair-field--first { order: 1; }
.converter-pair .swap-btn { order: 2; }
.pair-field--second { order: 3; }
.converter-pair.swapped .pair-field--first { order: 3; }
.converter-pair.swapped .pair-field--second { order: 1; }

@media (min-width: 768px) {
  .converter-pair {
    flex-direction: row;
    align-items: flex-start;
  }
  .converter-pair .swap-btn { margin-top: 2rem; }
}

.swap-btn {
  align-self: center;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-white);
  color: var(--color-primary);
  cursor: pointer;
  transition: var(--transition);
}
.swap-btn:hover {
  border-color: var(--color-primary);
  transform: rotate(180deg);
}
.swap-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .swap-btn:hover { transform: none; }
}

/* Live nibble visualiser */
.viz-wrap { margin: 0.75rem 0 0.5rem; }
.nibble-viz {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.375rem;
}
.viz-block {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-white);
}
.viz-bits {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.5rem;
  background: rgba(245, 73, 0, 0.07);
  color: var(--color-text);
}
.viz-digit {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  color: var(--color-primary);
}
.viz-pad {
  font-style: normal;
  color: var(--color-text-muted);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: help;
}
.viz-byte-start { margin-left: 0.875rem; position: relative; }
.viz-byte-start::before {
  content: "";
  position: absolute;
  left: -0.625rem;
  top: 0;
  bottom: 0;
  border-left: 2px solid var(--color-text-muted);
}
.viz-point {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  align-self: flex-end;
  padding-bottom: 0.25rem;
  color: var(--color-text);
}
.viz-note {
  font-size: 0.75rem;
  color: var(--color-text-light);
  align-self: center;
  margin-left: 0.25rem;
}
@media (max-width: 420px) {
  .nibble-viz .viz-bits { font-size: 0.8125rem; padding: 0.25rem 0.375rem; }
}

.controls-row { margin-top: 0.5rem; }

/* Read-only decimal equivalent */
.decimal-readout { margin-top: 0.75rem; }
.decimal-readout input[readonly] {
  background: var(--color-bg);
  color: var(--color-text);
}

/* Informational (non-error) field messages */
.error-msg.info-msg { color: var(--color-text-light); }

/* 400px scrollable reference tables with sticky header */
.scroll-table {
  max-height: 400px;
  overflow: auto;
}
.scroll-table .reference-table { border-radius: 0; box-shadow: none; }
.scroll-table .reference-table thead th {
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 2;
}

/* Filter inputs above big tables */
.table-filter { max-width: 320px; }
.table-filter input { font-size: 1rem; }

/* Highlighted rows (jump-to-value) */
.reference-table tr.row-hit,
.reference-table tr.row-hit td {
  background: rgba(245, 73, 0, 0.12);
}
