/* ==========================================================================
   gama-chrome.css — shared header bar + primary-nav rail
   Canonical copy. Edit here, then re-vendor (copy, do NOT @import over a
   CDN — see wiki-theme/resources/GamaTheme/mediawiki-common.css's history:
   a jsdelivr outage once white-screened the whole wiki) into every
   non-React property that needs it:
     - wiki-theme/resources/GamaTheme/gama-chrome-bundle.css
     - wp-theme/gama-junction/gama-chrome-bundle.css
   Dimensions/rationale: docs/gama-chrome-dimension-spec-2026-08-15.md.
   Paired with gama-chrome.js, which builds the DOM this file styles.
   ========================================================================== */

:root {
  --gc-void: #0A0A0A;
  --gc-void-raised: #10160f;
  --gc-phosphor: #00FF66;
  --gc-phosphor-dim: rgba(0, 255, 102, 0.4);
  --gc-phosphor-faint: rgba(0, 255, 102, 0.15);
  --gc-phosphor-dim-text: #3C965F;
  --gc-font: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --gc-header-h: 96px;   /* two rows, matches the React apex's real rendered height */
  --gc-rail-w: 220px;    /* left rail, spec: 220px fixed, never fluid */
  --gc-gap: 16px;
}

.gama-chrome-header,
.gama-chrome-header * {
  box-sizing: border-box;
}

/* ---- Header: two sticky rows, full width, above everything ---- */
.gama-chrome-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 500;
  background: color-mix(in srgb, var(--gc-void) 95%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--gc-phosphor-dim);
  font-family: var(--gc-font);
}
.gc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
}
@media (min-width: 640px) { .gc-row { padding: 0 20px; } }
.gc-row--brand { min-height: 44px; border-bottom: 1px solid var(--gc-phosphor-dim); }
.gc-row--nav { min-height: 44px; }

.gc-brand {
  color: var(--gc-phosphor);
  text-shadow: 0 0 8px color-mix(in srgb, var(--gc-phosphor) 45%, transparent);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  white-space: nowrap;
}
@media (min-width: 640px) { .gc-brand { font-size: 1rem; } }

.gc-status {
  display: none;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  color: var(--gc-phosphor-dim-text);
  white-space: nowrap;
}
@media (min-width: 1280px) { .gc-status { display: block; } }

.gc-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid var(--gc-phosphor-dim);
  background: transparent;
  color: var(--gc-phosphor);
  cursor: pointer;
}
@media (min-width: 1024px) { .gc-toggle { display: none; } }

.gc-nav {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.gc-nav::-webkit-scrollbar { display: none; }
.gc-nav a {
  flex-shrink: 0;
  padding: 10px 12px;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--gc-phosphor-dim-text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
@media (min-width: 640px) { .gc-nav a { padding: 10px 16px; } }
.gc-nav a:hover, .gc-nav a[aria-current="page"] {
  color: var(--gc-phosphor);
  border-bottom-color: var(--gc-phosphor);
}

.gc-search {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  background: none;
  border: none;
  color: var(--gc-phosphor-dim-text);
  font-family: var(--gc-font);
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: pointer;
}
@media (min-width: 768px) { .gc-search { display: flex; } }
.gc-search kbd {
  border: 1px solid var(--gc-phosphor-dim);
  padding: 1px 5px;
  font-size: 0.625rem;
}

/* ---- Rail: left column, primary nav, fixed under the header ---- */
.gama-chrome-rail {
  position: fixed;
  top: calc(var(--gc-header-h) + var(--gc-gap));
  left: 12px;
  width: var(--gc-rail-w);
  max-height: calc(100vh - var(--gc-header-h) - var(--gc-gap) * 2);
  overflow-y: auto;
  z-index: 400;
  font-family: var(--gc-font);
  display: none;
}
@media (min-width: 1024px) { .gama-chrome-rail { display: block; } }
@media (min-width: 640px) { .gama-chrome-rail { left: 20px; } }

.gc-rail-panel {
  border: 1px solid var(--gc-phosphor-dim);
  background: var(--gc-void-raised);
}
.gc-rail-title {
  padding: 8px 10px;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  color: var(--gc-phosphor-dim-text);
  border-bottom: 1px solid var(--gc-phosphor-dim);
}
.gc-rail-panel a,
.gc-rail-panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  font-family: var(--gc-font);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--gc-phosphor);
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 1px solid var(--gc-phosphor-faint);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gc-rail-panel a:last-child,
.gc-rail-panel button:last-child { border-bottom: none; }
.gc-rail-panel a:hover,
.gc-rail-panel button:hover,
.gc-rail-panel a[aria-current="page"] {
  background: var(--gc-phosphor-faint);
  color: var(--gc-phosphor);
}

/* Mobile drawer: rail becomes an overlay panel toggled by .gc-toggle */
.gama-chrome-rail.gc-drawer-open {
  display: block;
  position: fixed;
  inset: var(--gc-header-h) 12px auto 12px;
  width: auto;
  max-height: calc(100vh - var(--gc-header-h) - 24px);
}
@media (min-width: 1024px) {
  .gama-chrome-rail.gc-drawer-open { inset: auto; left: 20px; width: var(--gc-rail-w); }
}

/* ---- Offsets applied to <html> once chrome mounts, so host content
   never sits under the fixed header/rail. Host stylesheets should NOT
   need their own header — that's the point of overriding the platform
   chrome instead of stacking a second one under/over it. ---- */
html.gc-active { scroll-padding-top: calc(var(--gc-header-h) + var(--gc-gap)); }
html.gc-active body { padding-top: var(--gc-header-h) !important; }
@media (min-width: 1024px) {
  html.gc-active body { padding-left: calc(var(--gc-rail-w) + 40px) !important; }
}
