/*
 * The NEXUM Terminal: a fixed-size panel with three tabs. The head (title,
 * energy, Close, tabs) stays put, and only the open tab's page scrolls, so
 * the way out and the way across are always in reach. What goes inside a
 * page (settings, switches, upgrade cards) is in terminal-parts.css.
 */
.terminal {
  /* Wide and low: every tab is laid out in columns to fit this one size, so
     no tab scrolls and the panel does not change size from tab to tab. */
  width: min(96vw, 62rem);
  /* 42rem since the home shield joined the Behavior tab and the heavy-unit
     unlocks the Upgrades tab (docs/plans/15-strategy-rebalance.md); 50rem
     since the carrier's upgrades made every Upgrades column three cards tall. */
  height: min(92vh, 50rem);
  padding: 0;
  display: none;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.terminal[open] {
  display: grid;
}

.terminal__head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-4) var(--space-5) 0;
  background: var(--bg-1);
  box-shadow: 0 1px 0 var(--line);
}

.terminal__head .dialog__title {
  margin-bottom: 0;
}

/* What there is to spend, beside the things it buys. */
.terminal__purse {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.terminal__energy {
  font-size: var(--text-lg);
  color: var(--node);
}

/* Tabs: the open one is underlined in the accent and brighter. */
.ttabs {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-1);
}

.ttab {
  min-height: var(--target);
  padding: 0 var(--space-4);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font: 600 var(--text-md) / 1 var(--font-mono);
  cursor: pointer;
  transition:
    color var(--dur-quick) var(--ease-standard),
    border-color var(--dur-quick) var(--ease-standard);
}

/* The tab's number key sits before its name. */
.ttab__key {
  margin: 0 var(--space-2) 0 0;
}

.ttab[aria-selected='true'] .ttab__key {
  color: var(--text);
  border-color: var(--accent);
}

.ttab:hover {
  color: var(--text);
}

.ttab[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* A page fits without scrolling at every supported window size. The scroll
   is a last resort for a window smaller than that, never the design. */
.tpage {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
}

/* Columns inside a page: two for settings and upgrades, three for fighter types. */
.tcols {
  display: grid;
  align-items: start;
  gap: var(--space-4) var(--space-5);
}

.tcols--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tcols--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tcol {
  display: grid;
  gap: var(--space-4);
}

.tpage[hidden] {
  display: none;
}

.tgroup {
  display: grid;
  gap: var(--space-3);
}

.tgroup__title {
  font: 600 var(--text-xs) / 1.2 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Too narrow for columns: one column, and the page may scroll. */
@media (max-width: 56rem) {
  .tcols--two,
  .tcols--three {
    grid-template-columns: minmax(0, 1fr);
  }

  .terminal {
    height: min(92vh, 52rem);
  }
}

@media (max-width: 34rem) {
  .terminal__head {
    padding-inline: var(--space-4);
  }

  .tpage {
    padding: var(--space-4);
  }
}
