/**
 * Final layout & alignment polish (2026-05-20).
 * Does not change animation timing or viz markup — spacing, grids, and chrome only.
 */

/* —— Main column uses available width (sidebar + insights already constrain) —— */
.shell .content {
  max-width: 100%;
  width: 100%;
}

/* —— Grids: drop stacked card bottom margins, equal-height columns —— */
.grid-2,
.grid-3,
.tx-lab-panels {
  align-items: stretch;
}
.grid-2 > .card,
.grid-3 > .card,
.tx-lab-panels > .card {
  margin-bottom: 0;
  height: 100%;
}

/* —— Tx lab: config column narrower, viz gets room; stack on tablet —— */
.tx-lab {
  gap: var(--space-4);
}
.tx-lab .tx-steps {
  margin-bottom: 0;
}
.tx-lab-panels {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: var(--space-5);
}
@media (max-width: 1024px) {
  .tx-lab-panels {
    grid-template-columns: 1fr;
  }
}
.tx-config-card {
  min-height: 100%;
}
.tx-stage {
  display: flex;
  flex-direction: column;
}
.tx-status {
  min-height: 2.75em;
  color: var(--ink);
}
.tx-status:empty {
  min-height: 0;
}
#tx-callouts:empty {
  display: none;
}
#tx-callouts:not(:empty) {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
#tx-callouts .callout {
  margin: 0;
}

/* —— Network: SVG + step cards alignment —— */
.network-viz-card.card {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
}
.network-viz-status {
  min-height: 1.5em;
  margin-top: var(--space-3);
  color: var(--ink);
  font-size: var(--text-sm);
}
.network-viz-toolbar {
  align-items: center;
}
.network-viz-hint {
  line-height: 1.45;
}
.network-svg-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-4) var(--space-3);
}
.network-flow-svg {
  display: block;
  width: 100%;
  min-width: 520px;
  min-height: 130px;
}
.flow-diagram {
  margin-top: var(--space-4);
}
/* Loop 1: council callout + equal flow step cards */
.callout-council p {
  margin: var(--space-2) 0 0;
  line-height: 1.55;
  color: var(--ink-muted);
}
.flow-box {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.flow-box .desc {
  line-height: 1.45;
  flex: 1;
}

/* —— Architecture: scrollable node grid on narrow viewports —— */
.node-grid-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
}
.arch-seat-bridge {
  align-items: center;
}
.arch-siemens-dot-wrap {
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}

/* —— Signing: form alignment —— */
.sign-simulator-card .sign-threshold-field {
  display: block;
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin-bottom: var(--space-3);
}
.sign-threshold-select {
  display: block;
  width: 100%;
  max-width: 240px;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-base);
}
.sign-simulator-card #sign-emergency {
  margin-top: var(--space-2);
}
.sign-intro {
  color: var(--ink-muted);
  font-size: var(--text-base);
  line-height: 1.55;
  margin: 0 0 var(--space-4);
  max-width: 72ch;
}

/* Loop 3: tx steps + arch seats */
.tx-steps {
  gap: var(--space-3);
}
.tx-step-pill {
  line-height: 1.3;
}
.arch-seat-pips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 100%;
}

/* Loop 4: sidebar code + tables */
.sidebar-internal code {
  font-size: 10px;
  word-break: break-word;
}
.callout p {
  line-height: 1.55;
}
.sign-timing-card .table-wrap {
  margin: var(--space-3) 0;
}
.sign-timing-table td {
  line-height: 1.45;
}

/* Loop 5: flow diagram clearance above sticky nav */
.flow-diagram {
  padding-bottom: var(--space-2);
}

/* —— Reflection + council callouts: rhythm before sticky nav —— */
.module-head + .callout {
  margin-top: calc(-1 * var(--space-2));
}
.reflection-card {
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

/* —— Sticky nav respects collapsed insight strip —— */
.shell-with-insights:has(.insight-panel.collapsed) .nav-buttons {
  right: 44px;
}
@media (max-width: 960px) {
  .shell-with-insights:has(.insight-panel.collapsed) .nav-buttons {
    right: 0;
    bottom: 48px;
  }
}

/* —— Watermark clears sticky footer —— */
.watermark {
  bottom: calc(72px + env(safe-area-inset-bottom));
}

/* —— Topbar title truncation on small screens —— */
.topbar-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
  margin-right: var(--space-3);
}
.topbar {
  gap: var(--space-3);
}

/* —— Presenter: slightly wider readable measure for bullets only —— */
.content.presenter .module-head .exec-bullets,
.content.presenter .module-head .lead {
  max-width: 75ch;
}

/* —— Tx viz placeholder before first submit (not part of animation SVG) —— */
#tx-viz:empty {
  display: flex;
  align-items: center;
  justify-content: center;
}
.domains-owner-summary {
  font-size: var(--text-sm);
  color: var(--siemens-bright);
  margin: 0 0 var(--space-4);
  font-weight: 600;
}
.explorer-search-hint {
  font-size: var(--text-sm);
  color: var(--ink-dim);
  margin: var(--space-2) 0 var(--space-3);
}

#tx-viz:empty::before {
  content: 'Submit a transaction to see propagation across receiver → gossip → consensus.';
  color: var(--ink-dim);
  font-size: var(--text-sm);
  line-height: 1.5;
  text-align: center;
  max-width: 32ch;
  padding: var(--space-4);
}
