/* BackgammonX v0.2.19 — 11-presentation-controls.css
   Presentation-only. Owns: the board-rotation transform applied to
   the PRE-EXISTING .bgx-board-rotation-stage (css/07 already declares
   transform-origin:center center there, specifically anticipating this
   file — see that file's own "future rotation boundary" comment), plus
   the new Rotate Board / Auto-Rotate control row's own layout.

   Never touches .bgx-rail, .dtf-hud, or any element outside the stage
   — the whole point of rotating only .bgx-board-rotation-stage is that
   rails/HUD/buttons/panels stay fixed and upright regardless of board
   orientation, confirmed by this file's own selector scope alone (no
   selector here targets anything outside that one class). */

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

/* ==================== rotation transform ==================== */

.bgx-board-rotation-stage {
  /* transition applies to BOTH directions (0->180 and 180->0) equally;
     duration/easing are presentation-only and never gate engine calls
     — js/24's own input-gate class (below) is what actually protects
     against a moving target being clicked mid-transition. */
  transition: transform 280ms ease-in-out;
}
.bgx-board-rotation-stage.bgx-board-rotated {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .bgx-board-rotation-stage { transition: none; }
}

/* Presentation-only input gate during the brief rotation transition —
   the SAME pattern css/10's own dtf-dice-settling-body gate already
   uses for the dice-animation window, applied here to the SAME
   .hti-point-target/rail-cell elements for the SAME reason: a pure CSS
   pointer-events override so a click during the brief transforming
   window simply never reaches js/21's own listeners, never touching
   js/21 itself. Released the instant the CSS transition ends (js/24's
   own transitionend listener), on every completion/cancellation path. */
body.bgx-board-rotating .hti-point-target,
body.bgx-board-rotating #bgx-bar-rail .bgx-rail-blue,
body.bgx-board-rotating #bgx-bar-rail .bgx-rail-red,
body.bgx-board-rotating #bgx-borne-off-rail .bgx-rail-blue,
body.bgx-board-rotating #bgx-borne-off-rail .bgx-rail-red {
  pointer-events: none !important;
}

/* ==================== presentation-controls row ==================== */

.dtf-hud-row-presentation {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(184, 145, 45, 0.14);
  font-size: 12px;
}
/* New Game shares the same weak shell edge (~1.3:1) and sits in the same
   HUD row; given the same >=3:1 boundary. */
.dtf-hud [data-action="dtf-new-game"] { border: 1px solid rgba(230, 230, 235, 0.72); }
html[data-appearance="light"] .dtf-hud [data-action="dtf-new-game"] { border-color: #5c625d; }
.bgx-rotate-btn, .bgx-auto-rotate-btn {
  font-size: 12px;
  padding: 5px 10px;
  /* v0.2.19 PATCH-2 §C — a >=3:1 component boundary (the shell's own
     translucent gold edge measured ~1.3:1 against the HUD). */
  border: 1px solid rgba(230, 230, 235, 0.72);
}
.bgx-auto-rotate-btn[aria-pressed="true"] {
  background: rgba(98, 181, 255, 0.22);
  border-color: rgba(98, 181, 255, 0.55);
}
.bgx-rotation-status {
  color: rgba(230, 230, 235, 0.7);
  font-size: 11.5px;
  margin-left: 2px;
}

/* ==================== colour-choice row (§E) ==================== */
.dtf-hud-row-colors {
  margin-top: 4px;
  font-size: 12px;
}
.bgx-color-label {
  color: rgba(230, 230, 235, 0.75);
  font-size: 11.5px;
}
.bgx-color-select {
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(20, 22, 26, 0.7);
  color: #e6e6eb;
  /* v0.2.19 PATCH-2 §C — the boundary is what identifies the control; the
     old translucent gold edge measured ~1.6:1 against the HUD. */
  border: 1px solid rgba(230, 230, 235, 0.72);
}
.bgx-color-select option:disabled {
  color: rgba(230, 230, 235, 0.35);
}

/* Disabled state while a real dice animation is in flight — "disable
   the manual control or safely defer it; never rotate mid-flight".
   Text/aria stay accurate (button remains reachable/announced, just
   inert) rather than hiding the control outright. */
.bgx-rotate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 639px) {
  .dtf-hud-row-presentation { gap: 6px; font-size: 11px; }
  .bgx-rotate-btn, .bgx-auto-rotate-btn { font-size: 11px; padding: 4px 8px; }
  .bgx-rotation-status { display: none; }   /* the button's own aria-pressed/text already conveys state at this width, matching .dtf-active-side-label's own same-width precedent in css/09 */
}

/* ==================== v0.2.19 PATCH-2 §C — Light appearance ====================
   The HUD's text colours were all written for the Dark appearance
   (near-white on a translucent near-black wash). On Light's tan page
   that wash resolves to a mid-tone, so every HUD text/label measured
   ~1.5-2.1:1. In Light the HUD becomes a light surface with dark text.
   The rails are dark in BOTH appearances (their own opaque-ish dark
   gradient) and are deliberately NOT re-toned. */
html[data-appearance="light"] .dtf-hud {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(120, 90, 20, 0.45);
  color: #1d231f;
}
html[data-appearance="light"] .dtf-active-side-label,
html[data-appearance="light"] .dtf-opening-attribution,
html[data-appearance="light"] .dtf-status,
html[data-appearance="light"] .bgx-rotation-status,
html[data-appearance="light"] .bgx-color-label { color: #2c332e; }
html[data-appearance="light"] .dtf-result { color: #6b4a00; }
html[data-appearance="light"] .dtf-test-mode-note { color: #5c3f00; background: rgba(212, 160, 42, 0.22); }
html[data-appearance="light"] .bgx-color-select {
  background: #ffffff;
  color: #1d231f;
  border-color: #5c625d;
}
html[data-appearance="light"] .bgx-rotate-btn,
html[data-appearance="light"] .bgx-auto-rotate-btn { border-color: #5c625d; }
html[data-appearance="light"] .bgx-color-select option:disabled { color: #6a706b; }
html[data-appearance="light"] .bgx-auto-rotate-btn[aria-pressed="true"] {
  background: rgba(30, 110, 190, 0.18);
  border-color: rgba(20, 80, 150, 0.8);
}

/* ==================== v0.2.19 PATCH-3 §3 — Engine Lab + shared-control contrast ====================
   Measured in real Chromium (evidence/raw/contrast-*.json). Presentation
   only; no layout, size or behaviour change. */

/* White text on the shell's green measured 3.47:1 (Dark). The deeper green
   token already defined in css/01 gives >= 4.5:1 in both appearances. This
   also covers the enabled ROLL / ROLL OPENING buttons, which the Patch 2
   matrix never measured. */
.x-button-positive { background: var(--green-deep); border-color: rgba(230, 230, 235, 0.72); }

/* Supplied-dice selects and every enabled Engine Lab button: >= 3:1 boundary
   (they measured ~1.3-1.4:1). Disabled controls are exempt from WCAG 1.4.11
   and are left as they are.
   v0.2.22: the Engine Lab panel's own [data-panel="engine-lab"] attribute
   is REMOVED when js/28 reparents it into the Developer / Diagnostics
   stack section (so the old [data-panel] router can't fight the new
   stack's own open/closed state for the same `hidden` attribute -- see
   js/28's own comment at the reparenting site) and replaced with a
   stable, non-route-reactive [data-bgx-content="engine-lab"] marker.
   These two selectors are updated to match it so this fix keeps
   applying to the real, now-relocated panel. */
.hti-supplied-dice-row select,
[data-bgx-content="engine-lab"] .x-button-secondary:not(:disabled) { border-color: rgba(230, 230, 235, 0.72); }
html[data-appearance="light"] .hti-supplied-dice-row select,
html[data-appearance="light"] [data-bgx-content="engine-lab"] .x-button-secondary:not(:disabled) { border-color: #5c625d; }

/* Light appearance: small gold/green text on the light surface. */
html[data-appearance="light"] .hti-supplied-dice-title { color: #6b4a00; }
html[data-appearance="light"] .gate-status-row dd.ok,
html[data-appearance="light"] .diag-row dd.ok,
html[data-appearance="light"] .test-summary.ok,
html[data-appearance="light"] .test-group-count.ok { color: #1e6a36; }
html[data-appearance="light"] .gate-status-row dd.warn,
html[data-appearance="light"] .diag-row dd.warn { color: #7a5200; }

/* Light appearance keyboard focus: the shell's gold measured ~2.7-3.1:1 on
   the light surfaces; a darker brown-gold keeps the same 2px outline >= 4.5:1. */
/* (Point targets keep their own two-tone white/near-black cue from css/08 in
   both appearances, so they are excluded here — this selector would
   otherwise out-rank theirs and turn the white band brown.) */
html[data-appearance="light"] :focus-visible:not(.hti-point-target) { outline-color: #7a5200; }
