/* EX-11 Homing (js/ex/homing/view.js) and the first-person kit Reckon (EX-12) shares: the rules for the
   kit's elements are scoped by .ex-fp (the root both views build), Homing's own by .ex-homing.
   Layouts (v1.1, docs/research/v1.1/I2-mobile-audit.md §3, R1 §7.4):
   - wide screens: the view left, the circle and its controls right;
   - phones upright: one screen that never scrolls: a landscape-shaped view on top (4:3, at most 42 % of
     the height), then one row ◀5° ◀1° circle 1°▶ 5°▶, the readout, the actions in the thumb zone;
   - phones on their side: the view at full height on the left, the controls on the right.
   Captions are subtitles over the bottom of the view; a notch at its top centre marks straight ahead. */

.ex-fp { width: 100%; }
.ex-fp .ex-fp-body {
  display: grid; align-items: start; gap: var(--s3, 0.75rem) var(--s5, 1.5rem);
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem);
}
.ex-fp .ex-fp-viewcol { min-width: 0; }
.ex-fp .ex-fp-stage {
  width: 100%; height: clamp(15rem, 54vh, 30rem); overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.ex-fp.is-answering .ex-fp-stage { touch-action: none; cursor: grab; }
.ex-fp.is-answering .ex-fp-stage:active { cursor: grabbing; }
.ex-fp .ex-fp-phase { margin: 0; font-size: var(--fs-sm, 0.875rem); font-weight: 600; line-height: 1.35; color: var(--ink, #1A1D21); }
.ex-fp .ex-fp-void { margin: 0; font-size: var(--fs-sm, 0.875rem); line-height: 1.35; color: var(--ink-2, #454B52); }
.ex-fp .ex-fp-void::before { content: '⦸ '; }

/* over the view: the ahead notch, subtitles, the pause note, the map */
.ex-fp .ex-fp-notch {
  position: absolute; top: 0; left: 50%; z-index: 2; width: 0; height: 0; transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid var(--ink-3, #5D646C); opacity: 0.75;
  pointer-events: none;
}
.ex-fp .ex-fp-sub {
  position: absolute; left: var(--s2, 0.5rem); right: var(--s2, 0.5rem); bottom: var(--s2, 0.5rem); z-index: 6; margin: 0;
  padding: 0.3rem 0.6rem; text-align: center; pointer-events: none;
  font-size: var(--fs-sm, 0.875rem); line-height: 1.35; color: var(--ink, #1A1D21);
  background: var(--surface, #FFFFFF); border: 1px solid var(--rule, #C9CED3); border-radius: var(--r-control, 4px);
}
.ex-fp .ex-fp-sub:empty { display: none; }
.ex-fp .ex-fp-pause {
  position: absolute; left: 50%; top: 50%; z-index: 7; transform: translate(-50%, -50%); margin: 0;
  padding: var(--s3, 0.75rem) var(--s4, 1rem); max-width: 80%; text-align: center;
  font-size: var(--fs-sm, 0.875rem); font-weight: 600; color: var(--ink, #1A1D21);
  background: var(--surface, #FFFFFF); border: 1px solid var(--rule-strong, #7B838A); border-radius: var(--r-control, 4px);
}
.ex-fp .ex-fp-overlay { position: absolute; inset: 0; z-index: 3; }
.ex-fp .ex-fp-overlay[hidden] { display: none; }
.ex-fp .ex-fp-overlay::before { content: ''; position: absolute; inset: 0; background: var(--stim-ground, #F7F8F7); }
.ex-fp .ex-fp-map { position: relative; display: block; width: 100%; height: calc(100% - 2.75rem); }
.ex-fp .ex-fp-maptools { display: flex; justify-content: flex-end; margin-top: var(--s2, 0.5rem); }
.ex-fp .ex-fp-maptools[hidden] { display: none; }
.ex-fp .ex-fp-map text {
  font-family: var(--font-sans, 'IBM Plex Sans', system-ui, sans-serif);
  paint-order: stroke; stroke: var(--stim-ground, #F7F8F7); stroke-linejoin: round; fill: var(--ink-2, #454B52);
}
.ex-fp .ex-fp-leg { stroke: var(--ink, #1A1D21); stroke-width: 3px; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ex-fp .ex-fp-back { stroke: var(--right, #2A7239); stroke-width: 2.5px; stroke-dasharray: 7 5; vector-effect: non-scaling-stroke; }
.ex-fp .ex-fp-yours { stroke: var(--ink-2, #454B52); stroke-width: 2px; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ex-fp .ex-fp-yours-head { fill: var(--surface, #FFFFFF); stroke: var(--ink-2, #454B52); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.ex-fp .ex-fp-stop { fill: var(--surface, #FFFFFF); stroke: var(--ink-2, #454B52); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.ex-fp .ex-fp-miss { stroke: var(--wrong, #B33A2F); stroke-width: 1.5px; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.ex-fp .ex-fp-startdot { fill: var(--signal, #0B6A86); }
.ex-fp .ex-fp-maplabel--start { font-weight: 600; fill: var(--signal, #0B6A86); }
.ex-fp .ex-fp-maplabel--you { font-style: italic; }
.ex-fp .ex-fp-you { fill: var(--signal, #0B6A86); stroke: var(--stim-ground, #F7F8F7); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.ex-fp .ex-fp-turnarc { fill: none; stroke: var(--ink-3, #5D646C); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.ex-fp .ex-fp-anglearc { fill: none; stroke: var(--signal, #0B6A86); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.ex-fp .ex-fp-map .ex-fp-anglearc-label { fill: var(--signal, #0B6A86); font-weight: 600; }
.ex-fp .ex-fp-maplandmark { fill: var(--ink-3, #5D646C); }

/* the turn row: the circle with ◀5° ◀1° and 1°▶ 5°▶ (wide: the circle above, the buttons below) */
.ex-fp .ex-fp-side { display: flex; flex-direction: column; align-items: stretch; gap: var(--s2, 0.5rem); min-width: 0; }
.ex-fp .ex-fp-turnrow {
  display: grid; gap: var(--s2, 0.5rem); align-items: center;
  grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "dial dial dial dial" "l5 l1 r1 r5";
}
.ex-fp .ex-fp-turnrow > [data-turn="-5"] { grid-area: l5; }
.ex-fp .ex-fp-turnrow > [data-turn="-1"] { grid-area: l1; }
.ex-fp .ex-fp-turnrow > [data-turn="1"] { grid-area: r1; }
.ex-fp .ex-fp-turnrow > [data-turn="5"] { grid-area: r5; }
.ex-fp .ex-fp-dialbox { grid-area: dial; width: 100%; max-width: 15rem; aspect-ratio: 1 / 1; justify-self: center; transition: opacity 0.2s; }
.ex-fp.is-watching .ex-fp-dialbox { opacity: 0.45; }
.ex-fp .ex-fp-fine {
  min-height: 2.75rem; min-width: 2.75rem; padding: 0 0.25rem; white-space: nowrap;
  /* pan-y: a vertical swipe that starts here scrolls the page (the view's script acts on release or a still hold) */
  font-variant-numeric: tabular-nums; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.ex-fp.is-revealed .ex-fp-fine { visibility: hidden; }
.ex-fp .ex-fp-dial {
  display: block; width: 100%; height: 100%; overflow: visible;
  touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.ex-fp.is-watching .ex-fp-dial, .ex-fp.is-revealed .ex-fp-dial { cursor: default; }
.ex-fp .ex-fp-dial:focus { outline: none; }
.ex-fp .ex-fp-dial:focus-visible .ex-fp-face { stroke: var(--signal, #0B6A86); stroke-width: 2.2; }
.ex-fp .ex-fp-face { fill: var(--stim-ground, #F7F8F7); stroke: var(--rule-strong, #7B838A); stroke-width: 1.1; }
.ex-fp .ex-fp-tick { stroke: var(--rule-strong, #7B838A); stroke-width: 0.9; }
.ex-fp .ex-fp-ahead-line { stroke: var(--ink-3, #5D646C); stroke-width: 0.9; stroke-dasharray: 2.5 2; }
.ex-fp .ex-fp-dial text { font-family: var(--font-sans, 'IBM Plex Sans', system-ui, sans-serif); }
.ex-fp .ex-fp-dial-name { font-size: 7px; font-weight: 600; fill: var(--ink, #1A1D21); text-anchor: middle; }
/* dial units: 6.5 ≈ 12.5 px on the wide layout's 15rem circle */
.ex-fp .ex-fp-dial-side { font-size: 6.5px; font-weight: 500; fill: var(--ink-2, #454B52); }
.ex-fp .ex-fp-hub { fill: var(--stim-ground, #F7F8F7); stroke: var(--signal, #0B6A86); stroke-width: 0.9; }
.ex-fp .ex-fp-hub-you { fill: var(--signal, #0B6A86); }
.ex-fp .ex-fp-arrow-line { stroke: var(--ink, #1A1D21); stroke-width: 2.4; stroke-linecap: round; }
.ex-fp .ex-fp-arrow-head { fill: var(--surface, #FFFFFF); stroke: var(--ink, #1A1D21); stroke-width: 1.7; stroke-linejoin: round; }
.ex-fp .ex-fp-arrow.is-right .ex-fp-arrow-line, .ex-fp .ex-fp-arrow.is-right .ex-fp-arrow-head { stroke: var(--right, #2A7239); }
.ex-fp .ex-fp-arrow.is-wrong .ex-fp-arrow-line, .ex-fp .ex-fp-arrow.is-wrong .ex-fp-arrow-head { stroke: var(--wrong, #B33A2F); }
.ex-fp .ex-fp-key-line { stroke: var(--right, #2A7239); stroke-width: 2.4; stroke-linecap: round; }
.ex-fp .ex-fp-key-head { fill: var(--right, #2A7239); }
.ex-fp .ex-fp-wedge { fill: var(--right-wash, #E3EFE5); stroke: var(--right, #2A7239); stroke-width: 0.6; stroke-dasharray: 1.6 1.4; }

/* readout, actions, hints, feedback */
.ex-fp .ex-fp-readout { margin: 0; min-height: 1.3em; font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace); font-size: var(--fs-sm, 0.875rem); color: var(--ink-2, #454B52); text-align: center; }
.ex-fp .ex-fp-actions { display: flex; gap: var(--s2, 0.5rem); }
.ex-fp .ex-fp-actions > .px-btn { flex: 1 1 0; min-height: 2.75rem; touch-action: manipulation; }
.ex-fp .ex-fp-actions > .px-btn[hidden] { display: none; }
.ex-fp .ex-fp-hint { margin: 0; font-size: var(--fs-xs, 0.8125rem); line-height: 1.45; color: var(--ink-3, #5D646C); text-align: center; }
.ex-fp.no-keyhints .ex-fp-keys, .ex-fp.is-revealed .ex-fp-hint, .ex-fp.is-watching .ex-fp-hint { display: none; }
@media (pointer: coarse) { .ex-fp .ex-fp-keys { display: none; } } /* touch: the key line only with a keyboard */
.ex-fp .ex-fp-verdict { align-self: center; }
.ex-fp .ex-fp-verdict[data-kind="right"] { color: var(--right, #2A7239); border-color: var(--right, #2A7239); }
.ex-fp .ex-fp-verdict[data-kind="wrong"] { color: var(--wrong, #B33A2F); border-color: var(--wrong, #B33A2F); border-style: dashed; }
.ex-fp .ex-fp-notes[hidden] { display: none; }
.ex-fp .ex-fp-note { margin: 0 0 var(--s2, 0.5rem); font-size: var(--fs-sm, 0.875rem); line-height: 1.45; color: var(--ink-2, #454B52); }

/* phones upright (and narrow windows): one column; the view a landscape band on top; one turn row */
@media (max-width: 42rem) {
  .ex-fp .ex-fp-body { grid-template-columns: minmax(0, 1fr); gap: var(--s2, 0.5rem); }
  /* --pl-avail: the height the player leaves for the item (css/play.css); the controls need about 17rem */
  .ex-fp .ex-fp-stage { height: auto; aspect-ratio: 4 / 3; max-height: 42vh; max-height: min(42svh, calc(var(--pl-avail, 100vh) - 17rem)); }
  .ex-fp .ex-fp-turnrow {
    grid-template-columns: 2.75rem 2.75rem minmax(0, 1fr) 2.75rem 2.75rem; grid-template-areas: "l5 l1 dial r1 r5"; gap: var(--s1, 0.25rem) 0.375rem;
  }
  .ex-fp .ex-fp-dialbox { width: min(100%, 8.5rem, 20vh); }
  .ex-fp .ex-fp-fine { padding: 0; font-size: var(--fs-sm, 0.875rem); }
  /* the "how to turn" line is a subtitle over the view here (view.js), keys are rare: no hint line */
  .ex-fp .ex-fp-hint { display: none; }
  /* the circle's words would be under 12 px here: the readout says the same */
  .ex-fp .ex-fp-dial-side, .ex-fp .ex-fp-dial-name { display: none; }
}
/* taller phones (≥ 700 px): a larger circle on its own row, the four buttons under it. Its size is what
   the height leaves: --pl-avail − the view (75vw − 24 px) − the rest of the controls (13rem with a margin). */
@media (max-width: 42rem) and (min-height: 43.75rem) {
  .ex-fp .ex-fp-turnrow { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "dial dial dial dial" "l5 l1 r1 r5"; gap: var(--s2, 0.5rem); }
  .ex-fp .ex-fp-dialbox { width: clamp(8.5rem, calc(var(--pl-avail, 100vh) - 75vw - 13rem), 13rem); }
  .ex-fp .ex-fp-dial-side, .ex-fp .ex-fp-dial-name { display: inline; font-size: 8.5px; } /* 8.5 dial units ≥ 12 px on a circle of 187 px or more (360 × 700 and taller) */
}

/* phones on their side: the view at full height on the left, the controls on the right */
@media (orientation: landscape) and (max-height: 32.5rem) {
  .ex-fp .ex-fp-body { grid-template-columns: auto minmax(13rem, 1fr); gap: var(--s2, 0.5rem) var(--s3, 0.75rem); }
  .ex-fp .ex-fp-stage { height: calc(100vh - 4.5rem); height: min(calc(100svh - 4.5rem), var(--pl-avail, 100vh)); min-height: 11rem; width: auto; aspect-ratio: 4 / 3; max-height: none; }
  .ex-fp .ex-fp-turnrow {
    grid-template-columns: 2.75rem 2.75rem minmax(0, 1fr) 2.75rem 2.75rem; grid-template-areas: "l5 l1 dial r1 r5"; gap: var(--s1, 0.25rem) 0.375rem;
  }
  .ex-fp .ex-fp-dialbox { width: min(100%, 7.5rem, 32vh); }
  .ex-fp .ex-fp-dial-side, .ex-fp .ex-fp-dial-name { display: none; }
  .ex-fp .ex-fp-hint { display: none; }
}

/* larger text (Settings → Text size scales rem): when the side column is too narrow for one turn row with
   a usable circle, the circle goes above the four buttons (rem in a container query follows the root size) */
.ex-fp .ex-fp-side { container-type: inline-size; container-name: fpside; }
@media (max-width: 42rem), (orientation: landscape) and (max-height: 32.5rem) {
  @container fpside (max-width: 18.5rem) {
    .ex-fp .ex-fp-turnrow { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "dial dial dial dial" "l5 l1 r1 r5"; }
    .ex-fp .ex-fp-dialbox { width: min(100%, 8rem); }
  }
}
