/* BackgammonX v0.2.8 — 08-human-interaction.css — Phase 2, Human-v-Human
   Interaction Foundation

   Owns: the invisible point hit-target LANE layer (.human-interaction-
   layer, .hti-point-target — js/21-human-turn-interaction.js's own DOM,
   positioned/sized per-point from BGX.humanTurnInteractionHitGeometry.
   pointHitRegions(), NOT from a single uniform circle), the separate
   decorative highlight ring layer (.hti-point-ring, centered on each
   point's own checker anchor via BGX.geometry — visual only,
   pointer-events:none), the legal-source/selected-source/legal-
   destination highlight classes (applied to .hti-point-ring AND the
   existing fixed rail cells — no new rail markup, see
   css/07-player-status.css for the rail cells themselves), and the
   compact TEST / SUPPLIED DICE control panel in the Engine Lab page.

   v0.2.8 CORRECTION (ChatGPT red-team on v0.2.7 — see
   CHATGPT-RED-TEAM-v0.2.7.txt "BLOCKING FINDING 2"): v0.2.7's own
   `.hti-point-target { width: max(11%, 34px); height: max(11%, 34px); }`
   is GONE. That fixed circular size, against the calibrated ~2.8%-of-
   board-width adjacent point spacing, overlapped several neighboring
   point lanes and could resolve a click/tap to the wrong physical
   point. `.hti-point-target` is now an unstyled-size element — its own
   left/top/width/height are set inline, per point, by js/21's
   buildPointTargets() from the non-overlapping lane geometry — and
   `.hti-point-ring` (new) carries the old compact circular LOOK as pure
   decoration, completely separate from the click surface.

   Does not own: the board frame/image (css/02), checker circles
   (css/06), or the rail structure itself (css/07) — this file only adds
   INTERACTION affordances on top of all three, unchanged.

   Player-colored language follows the same Blue (P1) / Red (P2)
   identity the fixed rails already use (css/07's --bgx-rail-blue-ish
   var(--bgx-p1-mid, #62b5ff) / --bgx-rail-red-ish var(--bgx-p2-mid, #ff6675)), not the neutral cream/dark
   checker artwork colors (css/06) — this is BGX's own existing product
   language for PLAYER IDENTITY in UI chrome (shared with TX's own
   Blue/Red/Green convention), reused here, not copied from TX code. */

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

/* ---------------- Point hit-target LANE layer (click surface) ---------------- */

.human-interaction-layer {
  position: absolute;
  inset: 0;
  /* Unlike .checker-layer (display-only, pointer-events:none), this
     layer IS the click/tap surface — but only its own `.hti-point-
     target` button children capture pointer events; the layer itself
     and every `.hti-point-ring` inside it stay click-through so they
     never block anything else stacked in .board-art. */
  pointer-events: none;
}

.hti-point-target {
  position: absolute;
  /* left/top/width/height are set inline per point by js/21's
     buildPointTargets(), from BGX.humanTurnInteractionHitGeometry.
     pointHitRegions() — an elongated, non-overlapping LANE along that
     point's own column, not a fixed-size circle. Nothing here overrides
     that box. */
  box-sizing: border-box;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.hti-point-target:focus-visible {
  /* Inward offset — a lane can be as narrow as ~2.8% of the board, so
     an OUTWARD outline (like the old +2px offset) could visually spill
     into the neighboring lane.
     v0.2.19 PATCH-3 §3 — TWO-TONE, colour-independent focus cue. The old
     gold-only outline measured 1.99:1 (Dark) / 2.71:1 (Light) against
     representative ivory. Now: a solid WHITE outer band (the outline,
     outermost 2px) over a solid near-black inner band (inset shadow,
     the next 2px). Any background is >= 4.4:1 from one of the two, and
     the two are 21:1 apart, so the cue holds on dark felt AND light
     points in both appearances. */
  outline: 2px solid #ffffff;
  outline-offset: -2px;
  box-shadow: inset 0 0 0 4px #0b0d10;
}

/* ---------------- Decorative highlight ring (visual only, NOT the click surface) ----------------
   A separate element from .hti-point-target, sharing the same
   data-physical-point-id and the same class names v0.2.7 put directly
   on the button. Centered on the point's own checker anchor
   (js/21's own anchorPct, independent of the lane's own box), compact
   and circular — per the handoff's own explicit allowance that this
   highlight "may remain compact/ring-like even if the actual invisible
   hit region is an elongated non-overlapping lane." */
.hti-point-ring {
  position: absolute;
  width: max(5%, 22px);
  height: max(5%, 22px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}
/* v0.2.19 PATCH-2 §C — TWO-TONE, colour-independent cues. Patch 1 left
   these rings as a single translucent mid-tone of the player's colour,
   which measured ~1.2-1.7:1 (Black on dark felt) and ~1.0:1 (White on
   ivory). Now every ring is a solid WHITE edge with an adjacent solid
   near-black edge (any background is at least 4.58:1 from one of the
   two, so >=3:1 holds on dark felt AND light points, for all five
   colours, in both appearances), and the player's own colour is only
   an inner ACCENT, never the sole carrier of visibility. Legal vs
   selected differ by ring thickness (2px vs 3px per tone), not by
   colour. */
.hti-point-ring {
  --hti-accent: var(--bgx-p1-rgb, 98, 181, 255);
  --hti-edge-light: #ffffff;
  --hti-edge-dark: #0b0d10;
}
.hti-point-ring[data-hti-side="P2"] { --hti-accent: var(--bgx-p2-rgb, 255, 102, 117); }
.hti-point-ring.hti-legal-source {
  border: 2px solid var(--hti-edge-light);
  box-shadow: 0 0 0 2px var(--hti-edge-dark), inset 0 0 0 2px rgba(var(--hti-accent), 0.9);
}
.hti-point-ring.hti-selected-source {
  border: 3px solid var(--hti-edge-light);
  box-shadow: 0 0 0 3px var(--hti-edge-dark), inset 0 0 0 3px rgba(var(--hti-accent), 1);
}
.hti-point-ring.hti-legal-dest {
  border: 2px dashed var(--hti-edge-light);
  box-shadow: 0 0 0 2px var(--hti-edge-dark), inset 0 0 0 2px rgba(255, 209, 102, 0.9);
}
/* P2's own rings reuse the same classes — only the inner accent
   changes (see --hti-accent above); the two neutral edges are shared. */

/* ---------------- Rail cell affordances (Bar source / Off destination) ----------------
   No new anchors, no new rail markup — these classes are added/removed
   directly on the EXISTING .bgx-rail-cell elements
   (css/07-player-status.css) by js/21, current-side-only.

   v0.2.16 FOCUSED POINTER-INTERACTION CORRECTION (owner browser test on
   v0.2.15 — see CHATGPT-OWNER-TEST-FINDING-v0.2.15.txt):
     Bill hit a live blocker — one Red checker on the Bar, Red rolled
     3+2, entry points 3 and 2 were open, and the checker still could
     not be played off the BAR / CAPTURED rail.

     Root cause, confirmed in source: css/07-player-status.css sets
     `.bgx-rail { pointer-events: none; }` so the overlaying rails never
     block the board underneath, and `pointer-events` INHERITS, so every
     descendant rail cell inherited `none` too. This block already gave
     a legal cell a pointer cursor and a coloured highlight — telling
     the player "click me" — but nothing ever restored the cell's own
     ability to be hit-tested. Real mouse/touch input therefore passed
     straight through it.

     js/21-human-turn-interaction.js was NOT at fault and is byte-
     identical here: its own listener already worked, which is exactly
     why the v0.2.15 suite passed. Those tests drove the cell with
     `element.click()`, and a synthetic click invokes the listener
     directly without consulting CSS hit-testing — so a green suite
     could coexist with an unclickable cell. tests/alpha-rail-pointer-
     interaction-tests.js closes that gap by asserting the COMPUTED
     pointer-events value, and, where a real layout engine is present,
     by resolving `document.elementFromPoint()` inside the cell.

     The correction is the single `pointer-events: auto` declaration
     below. It is deliberately scoped to a rail CELL that is currently
     carrying one of js/21's three legal-interaction classes, so:
       - `.bgx-rail { pointer-events: none; }` in css/07 stays the
         general, safe click-through default and is untouched;
       - the rail container, the rail heading, the opponent's cell and
         any inactive cell all remain non-targetable;
       - the affordance appears and disappears with the classes js/21
         already adds and removes, so no stale hit target can survive a
         committed step, a turn change or New Game;
       - `.bgx-rail-checkers` keeps its own `pointer-events: none`
         (css/07), so the checker markers stay click-through and a click
         on a marker still resolves to the cell beneath it.

     Nothing else changed: same cursor, same border radius, same
     transition, same Blue/Red highlight rules, same rail dimensions,
     position, typography, z-index, marker layout and rotation
     isolation. */

.bgx-rail-cell.hti-legal-source,
.bgx-rail-cell.hti-selected-source,
.bgx-rail-cell.hti-legal-dest {
  cursor: pointer;
  border-radius: 6px;
  transition: box-shadow 120ms ease;
  /* v0.2.16 — the correction. Scoped to a currently-legal rail cell
     only; never the whole rail. */
  pointer-events: auto;
}
/* v0.2.19 PATCH-2 §C — rail-cell cues: solid white outer edge + solid
   near-black inner edge (the rails are dark in BOTH appearances, so the
   white edge is >=3:1 there and the black edge is >=3:1 against the
   white), with the player's colour only as a faint inner wash. Legal =
   thin (2px+1px), selected = thicker (3px+2px) and washed. */
.bgx-rail-bar .bgx-rail-cell.hti-legal-source,
.bgx-rail-off .bgx-rail-cell.hti-legal-dest {
  box-shadow: inset 0 0 0 2px #ffffff, inset 0 0 0 3px #0b0d10;
}
.bgx-rail-bar .bgx-rail-cell.hti-selected-source {
  box-shadow: inset 0 0 0 3px #ffffff, inset 0 0 0 5px #0b0d10;
}
.bgx-rail-bar .bgx-rail-blue.hti-selected-source { background-color: rgba(var(--bgx-p1-rgb, 98, 181, 255), 0.28); }
.bgx-rail-bar .bgx-rail-red.hti-selected-source  { background-color: rgba(var(--bgx-p2-rgb, 255, 102, 117), 0.28); }

/* v0.2.19 PATCH-4 §1 — the Bar CHECKER itself, not merely the
   enclosing rail cell, is now a real click/tap target when it is a
   legal source (js/21's own render()). Overrides the base
   .bgx-rail-checker rule's own pointer-events:none specifically here
   (that base rule is otherwise untouched — Borne-Off markers and any
   non-legal Bar marker stay exactly as inert as before). Same white+
   black double-outline contrast language PATCH-2's own rail-cell cues
   already established, sized down for a single small checker rather
   than a whole cell, plus a visible focus ring for keyboard use (this
   element is also given role="button" and tabindex="0"). */
.bgx-rail-checker.hti-legal-bar-checker {
  pointer-events: auto;
  cursor: pointer;
  box-shadow: inset -1px -1px 1.5px rgba(0, 0, 0, 0.45), inset 1px 1px 1px rgba(255, 255, 255, 0.35), 0 0.5px 1px rgba(0, 0, 0, 0.5), 0 0 0 1.5px #ffffff, 0 0 0 2.5px #0b0d10;
}
.bgx-rail-checker.hti-legal-bar-checker:focus-visible {
  outline: none;
  box-shadow: inset -1px -1px 1.5px rgba(0, 0, 0, 0.45), inset 1px 1px 1px rgba(255, 255, 255, 0.35), 0 0 0 2px #ffffff, 0 0 0 4px #2f7bff;
}

/* ---------------- TEST / SUPPLIED DICE control panel ---------------- */

.hti-supplied-dice-control {
  margin: var(--space-4, 16px) 0;
  padding: var(--space-3, 12px);
  border: 1px solid var(--line, #3a3a3a);
  border-radius: var(--radius-md, 8px);
  background: rgba(212, 160, 42, 0.06);
}
.hti-supplied-dice-title {
  font-size: var(--fs-sm, 0.85rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
  color: var(--gold, #d4a02a);
}
.hti-supplied-dice-note {
  font-size: var(--fs-xs, 0.75rem);
  color: var(--text-muted, #9a9a9a);
  margin: 0 0 10px;
}
.hti-supplied-dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.hti-supplied-dice-row label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: var(--fs-xs, 0.75rem);
}
.hti-supplied-dice-row select {
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid var(--line, #3a3a3a);
  background: var(--surface, #1c1c1c);
  color: inherit;
  font: inherit;
}
.hti-status {
  font-size: var(--fs-sm, 0.85rem);
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  margin: 0;
}

/* ---------------- Responsive / no horizontal overflow ---------------- */
/* Every hit-target lane's left/top/width/height (set inline by js/21) is
   a PERCENTAGE of the board-art box, which is itself already responsive
   (css/02) — nothing here is a fixed pixel size except the decorative
   ring's own max(5%, 22px) floor, which never affects the click surface.
   Desktop, iPad and phone all inherit the same responsive box; nothing
   here introduces a wider-than-viewport element. */
@media (max-width: 480px) {
  .hti-supplied-dice-row { gap: 8px; }
  .hti-supplied-dice-row select { padding: 4px 6px; }
}
