/* v5 Phase 4 — page layout.
 *
 * Single full-width column with sticky header + sticky footer.  Body
 * sections stack inside #page.  Mobile breakpoint at 720 px collapses
 * any 2-column splits into single-column.
 */

#header {
  background: var(--header);
  border-bottom: var(--hairline);
  position: sticky;
  top: 0;
  z-index: 20;
}

#footer {
  background: var(--header);
  border-top: var(--hairline);
  font-size: var(--fs-xs);
  color: var(--dim);
  padding: 4px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

#page {
  padding: 0;
}

/* Brand row: HYDRUM | MARKET MAKING | BINANCE | center prices | right WS+clock */
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  gap: 16px;
  flex-wrap: nowrap;
}

.brand-left  { display: flex; align-items: baseline; gap: 6px; flex-shrink: 0; }
.brand-mid   { display: flex; align-items: baseline; gap: 16px; flex: 1 1 auto; justify-content: center; }
.brand-right { display: flex; align-items: center;  gap: 12px; flex-shrink: 0; }

/* Tier bar: 3 columns — share hero + gauge + tile cards */
.tier-bar {
  display: grid;
  grid-template-columns: minmax(170px, auto) 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 10px 16px 12px;
  border-top: var(--hairline);
}

/* Tab nav */
.tabs {
  display: flex;
  align-items: stretch;
  border-bottom: var(--hairline);
  padding: 0 8px;
  background: var(--header);
  overflow-x: auto;
}

/* Page-level container for stacking body sections */
.stack {
  display: flex;
  flex-direction: column;
}

/* Two-column split: 50/50 with a 1px gutter (uses border colour). */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

.split-2 > .panel { background: var(--panel); }

/* N-column equal-width grids with internal 1px gutters drawn by the
 * panel background contrast.  Used for period grid (4), sub-row (6),
 * perf metrics (5), pnl details columns (3). */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; }

.grid-3 > * + *,
.grid-4 > * + *,
.grid-5 > * + *,
.grid-6 > * + * {
  border-left: var(--hairline);
}

/* Panel base */
.panel {
  background: var(--panel);
  padding: 8px 12px;
}

.panel + .panel { border-top: var(--hairline); }

/* Mobile breakpoint <720 px — collapse splits and condense the brand */
@media (max-width: 720px) {
  .brand-row {
    flex-wrap: wrap;
    padding: 4px 8px;
    gap: 4px 12px;
  }
  .brand-left, .brand-mid, .brand-right { flex: 1 1 100%; justify-content: flex-start; }
  .brand-right { justify-content: space-between; }

  .tier-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 12px;
  }
  .tier-bar .tier-tiles { display: grid; grid-template-columns: repeat(2, 1fr); }

  .split-2 {
    grid-template-columns: 1fr;
  }

  /* Tabs scroll on mobile */
  .tabs { padding: 0; }

  /* Period grid: 2 columns; sub-row + perf metrics: 3 columns. */
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }

  /* Stage 4 overview-specific: Volume Qualification grid collapses
     to 2 columns; charts shrink to a usable but compact height. */
  .vq-grid { grid-template-columns: repeat(2, 1fr); }
  .vq-math { font-size: 12px; }
  .chart-wrap { height: 220px; }
  .ticker-table { font-size: 10px; }
  .ticker-table th, .ticker-table td { padding: 3px 4px; }
  /* Hide non-essential ticker columns on phone width to avoid
     horizontal scroll being the only navigation. */
  .ticker-table th:nth-child(4),
  .ticker-table td:nth-child(4),
  .ticker-table th:nth-child(5),
  .ticker-table td:nth-child(5) { display: none; }
}
