/* BackgammonX v0.1.9 — 05-x-shell.css
   Owns the X Platform shared product language, built BGX-native (not pasted):
   two-line header, hamburger + drawer, bottom nav, button hierarchy,
   branded modal foundation, restrained PRO badge, version/channel presentation. */

:root { --bgx-css-05: 1; }

/* Two-line header */
.x-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.x-header-row { display: flex; align-items: center; gap: var(--space-3); }
.x-header-primary { min-height: 40px; }
.x-header-secondary { min-height: 24px; font-size: var(--fs-sm); color: var(--text-muted); }

.x-brand { display: flex; align-items: baseline; gap: var(--space-2); flex: 1; min-width: 0; }
.x-brand-name {
  font-family: var(--font-brand);
  font-size: var(--fs-lg);
  letter-spacing: 0.02em;
  color: var(--text);
}
.x-brand-version { font-size: var(--fs-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }

.x-channel-tag {
  font-size: var(--fs-sm);
  padding: 2px var(--space-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
}

.x-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  flex: 0 0 auto;
}
.x-status-dot.ok   { background: var(--green); }
.x-status-dot.warn { background: var(--gold); }
.x-status-dot.fail { background: #d9534f; }

/* Icon button + hamburger glyph */
.x-icon-button {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-lg);
  line-height: 1;
}
.x-icon-button:hover { border-color: var(--line); }
.x-hamburger { display: flex; flex-direction: column; gap: 4px; }
.x-hamburger i { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 1px; }

/* Drawer */
.x-scrim, .x-modal-scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  /* v0.2.19 PATCH-4 §3 — raised 30->50. Root cause, confirmed directly
     by reading every z-index rule in the whole codebase: css/07's own
     .bgx-rail deliberately uses z-index:40 ("keeps them above every
     board content layer"), a value chosen only with the BOARD's own
     content in mind (which sits at z-index 1-2) — nobody had reason to
     also compare it against the drawer/scrim's own z-index:30/31 when
     that rule was written, since the two features were never designed
     together. 40 > 31 is exactly the owner's own reported symptom: the
     Bar/Borne-Off rails painting over an open menu. This raises the
     scrim/drawer/modal comfortably above the rail's own 40 without
     touching the rail's own z-index at all (still correctly above the
     board content it was written for) and stays below .skip-link's own
     z-index:100 (an accessibility element that must always be reachable
     above absolutely everything, unrelated to this fix). */
  z-index: 50;
}
.x-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 300px;
  z-index: 51;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
}
.x-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-3) 0 var(--space-4);
  border-bottom: 1px solid var(--line);
}
.x-drawer-list { padding: var(--space-2) 0; flex: 1; }
.x-drawer-list button {
  width: 100%;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.x-drawer-list button:hover { background: var(--surface-raised); }
.x-drawer-list button[aria-current="page"] {
  color: var(--gold);
  box-shadow: inset 3px 0 0 var(--gold);
}
.x-drawer-foot {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line);
}

/* Button hierarchy: gold = primary, green = positive/secondary, outline = tertiary */
.x-button {
  min-height: 48px;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: filter 120ms ease;
}
.x-button:hover:not(:disabled) { filter: brightness(1.08); }
.x-button:disabled { opacity: 0.45; cursor: not-allowed; }
.x-button-primary   { background: var(--gold);  color: var(--felt-900); border-color: var(--gold-deep); }
.x-button-positive  { background: var(--green); color: #fff;            border-color: var(--green-deep); }
.x-button-secondary { background: transparent;  color: var(--text);     border-color: var(--line); }
.x-button-secondary:hover { background: var(--surface-raised); }

/* Segmented control (Settings) */
.x-segment { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.x-segment button {
  min-height: 40px;
  padding: 0 var(--space-3);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.x-segment button + button { border-left: 1px solid var(--line); }
.x-segment button[aria-pressed="true"] { background: var(--gold); color: var(--felt-900); }

/* Restrained PRO badge foundation */
.x-pro-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  color: var(--gold);
  line-height: 1.5;
}

/* Mobile bottom navigation: hidden on desktop, shown below the 1024px breakpoint (kept here so 05 owns both states) */
.x-bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  height: var(--bottom-nav-height);
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.x-bottom-nav button {
  background: transparent;
  border: 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  cursor: pointer;
}
.x-bottom-nav button[aria-current="page"] { color: var(--gold); box-shadow: inset 0 2px 0 var(--gold); }
@media (max-width: 1023px) { .x-bottom-nav { display: grid; } }

/* Branded modal foundation */
.x-modal {
  position: fixed;
  /* v0.2.19 PATCH-4 §3 — same reasoning as .x-drawer/.x-scrim above:
     raised above .bgx-rail's own z-index:40 so a modal can never be
     painted under the rails either. */
  z-index: 51;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--gold-deep);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.x-modal-title { font-family: var(--font-brand); font-weight: 400; font-size: var(--fs-xl); margin-bottom: var(--space-3); }
.x-modal-body p + p { margin-top: var(--space-3); }
.x-modal-actions { display: flex; justify-content: flex-end; margin-top: var(--space-5); }
