/* GRAYLINE v0.5.1: INVIZBL3 public release candidate clarity and integration. */

/* The title line frames the signal. It does not touch it. */
.title-screen .title-content {
  padding-left: clamp(38px, 4.2vw, 78px) !important;
  padding-right: clamp(20px, 2.2vw, 38px) !important;
}

/* Research is read, then chosen. Four cards preserve hierarchy and touch room. */
html.research-deck-expanded {
  --deck-height: clamp(308px, 35vh, 334px);
}

.command-panel.research-context-readable .command-context-copy > strong {
  overflow: visible;
  color: #f0f0f0;
  font-size: calc(11px * var(--ui-text-scale, 1)) !important;
  line-height: 1.2 !important;
  letter-spacing: .08em;
  text-overflow: clip;
  white-space: normal;
}

.command-panel.research-context-readable .command-context-copy small {
  overflow: visible;
  color: #a9a9a9 !important;
  font-size: calc(10px * var(--ui-text-scale, 1)) !important;
  line-height: 1.25 !important;
  text-overflow: clip;
  white-space: normal;
}

.command-grid.research-readable {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  padding: 8px !important;
  overflow: hidden !important;
}

.command-grid.research-readable .command-button {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(22px, auto) minmax(30px, auto) minmax(28px, auto) !important;
  place-items: center !important;
  align-content: center !important;
  min-height: 88px !important;
  padding: 12px 13px 10px !important;
  overflow: hidden !important;
}

.command-grid.research-readable .command-button .command-icon {
  grid-row: 1;
  align-self: end;
  min-width: 0;
  color: #d8d8d8;
  font-size: calc(21px * var(--ui-text-scale, 1)) !important;
  line-height: 1 !important;
}

.command-grid.research-readable .command-button > span:not(.command-icon):not(.command-cost) {
  grid-row: 2;
  display: block;
  align-self: center;
  max-width: calc(100% - 12px);
  overflow: visible;
  color: #e2e2e2;
  font-size: calc(12px * var(--ui-text-scale, 1)) !important;
  line-height: 1.16 !important;
  letter-spacing: .045em;
  text-align: center;
  text-overflow: clip;
  white-space: normal;
}

.command-grid.research-readable .command-button .command-cost {
  top: 8px;
  right: 10px;
  color: #c2c2c2 !important;
  font-size: calc(10px * var(--ui-text-scale, 1)) !important;
}

.command-grid.research-readable .command-button .command-reason {
  grid-row: 3;
  display: block;
  align-self: start;
  min-height: 26px;
  max-height: 46px;
  max-width: 100%;
  overflow: hidden;
  color: #ababab !important;
  font-size: calc(10px * var(--ui-text-scale, 1)) !important;
  line-height: 1.22 !important;
  letter-spacing: .025em;
  text-align: center;
  text-overflow: clip;
  white-space: normal;
}

.command-grid.research-readable .command-button:disabled > span:not(.command-icon):not(.command-cost) {
  color: #a1a1a1 !important;
}

.command-grid.research-readable .command-button:disabled .command-reason {
  color: #909090 !important;
}

/* The old catalog is not an ordinary play surface. */
#commandIndexDialog,
#commandIndexButton,
#titleCommandIndexButton,
#pauseCommandIndexButton,
#manualIndexButton,
[data-open-command-index] {
  display: none !important;
}

/* Public embedding keeps the complete game surface available to the bridge. */
html,
body,
#graylineApp,
#gameShell {
  width: 100%;
  min-width: 0;
  min-height: 100%;
}

@media (max-width: 980px) {
  html.research-deck-expanded {
    --deck-height: clamp(276px, 40vh, 308px);
  }
  .title-screen .title-content {
    padding-left: clamp(30px, 4vw, 46px) !important;
  }
  .command-grid.research-readable {
    gap: 6px !important;
    padding: 6px !important;
  }
  .command-grid.research-readable .command-button {
    min-height: 82px !important;
    padding: 9px 10px 8px !important;
  }
}
