/* Tactivela · modules/formation — scope: .fm
   Pitch, jerseys, name tags, bench strip and control bar are design-system
   components; this file only lays them out. Phone first; tablets and PCs
   are the media queries at the end (design system 6.6). */
.fm .fm-root { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.fm .fm-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }   /* pitch column + bench strip (a grid on larger screens) */
.fm .fm-none { display: none; }
.fm .fm-root.none > * { display: none; }
.fm .fm-root.none > .fm-none { display: block; }

/* control bar */
.fm .tk-controlbar { gap: 6px; }
.fm .tk-controlbar .tk-btn[aria-pressed="true"] { border-color: var(--tk-now); color: var(--tk-now); background: var(--tk-now-tint); }
.fm #fm-sct[aria-pressed="true"] { border-color: var(--tk-opponent); color: var(--tk-opp-text); background: var(--tk-bad-tint); }
.fm .fm-count { margin-left: auto; font-family: var(--tk-font-display); font-size: 14px; font-weight: 700; letter-spacing: 0.06em; color: var(--tk-text-muted); font-variant-numeric: tabular-nums; }
.fm .fm-count.full { color: var(--tk-ok); }
/* The formation name never wraps. On a phone (up to 440 px) the bar only fits with Compare and Opponent
   as icons; the buttons keep their names for screen readers (aria-label). */
.fm .tk-controlbar > .tk-chip, .fm .tk-controlbar > .tk-btn { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 440px) { .fm .fm-lbl { display: none; } }

/* pitch column */
.fm .fm-pcol { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px; overflow: hidden; }
.fm .fm-pcol.dual { flex-direction: row; gap: 10px; }
.fm .fm-pwrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fm .fm-pitch { flex-shrink: 0; }
.fm .fm-lines { position: absolute; inset: 0; pointer-events: none; }
.fm .fm-lines svg { width: 100%; height: 100%; display: block; }
.fm .fm-lines svg * { vector-effect: non-scaling-stroke; }
.fm .fm-wm { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap;
  font-family: var(--tk-font-display); font-size: 28px; font-weight: 900; letter-spacing: 0.04em; color: var(--tk-pitch-stripe); }   /* the name, never in capitals (design system 14.3) */
.fm .fm-plbl { min-height: 1em; font-family: var(--tk-font-display); font-size: var(--tk-fs-label); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tk-text-subtle); }

/* jerseys */
.fm .tk-slot { z-index: 2; cursor: pointer; }
.fm .tk-slot[draggable="true"] { cursor: grab; }
.fm .tk-slot.is-dragging { opacity: 0.4; }
.fm .tk-slot:focus-visible { outline: 2px solid var(--tk-touchline); outline-offset: 2px; border-radius: var(--tk-radius-sm); }
.fm .tk-jersey__num { top: 32%; }
.fm .tk-jersey--empty .tk-jersey__num { top: 38%; letter-spacing: 0.02em; }
.fm .fm-pitch.small .tk-nametag { display: none; }
.fm .fm-subbadge { position: absolute; right: -4px; bottom: -2px; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--tk-ok); color: var(--tk-nametag); box-shadow: 0 0 0 1.5px var(--tk-nametag); }
.fm .fm-subbadge .tk-icon { width: 11px; height: 11px; stroke-width: 2; }   /* 2.6 before design system 0.6 (Proposed, as tactics.css) */

/* bench strip: unplaced squad, bench, and opponents when scouting */
.fm .fm-strip { gap: 8px; padding: 12px; min-height: 76px; scrollbar-width: thin; }
.fm .fm-strip-lbl { flex-shrink: 0; font-family: var(--tk-font-display); font-size: var(--tk-fs-label); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tk-text-subtle); padding-left: 4px; }
.fm .fm-strip-lbl.opp { color: var(--tk-opp-text); }
.fm .fm-strip-note { flex-shrink: 0; font-size: var(--tk-fs-meta); color: var(--tk-text-subtle); padding: 0 6px; }
.fm .fm-item { cursor: grab; max-width: 170px; transition: border-color var(--tk-dur) var(--tk-ease); }
.fm .fm-item:hover { border-color: var(--tk-violet); }
.fm .fm-item.is-selected { border-color: var(--tk-now); box-shadow: 0 0 0 1px var(--tk-now); }
.fm .fm-item.is-dragging { opacity: 0.4; }
.fm .fm-item.is-target, .fm .tk-bench__slot.is-target { border-color: var(--tk-now); background: var(--tk-now-tint); }
.fm .fm-item .tk-row__num { width: 34px; height: 34px; font-size: 16px; }
.fm .fm-item.opp .tk-row__num { background: var(--tk-opponent); }
.fm .fm-item-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.1; }
.fm .fm-item-nm { font-family: var(--tk-font-display); font-size: 15px; font-weight: 700; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm .tk-bench__slot { flex-shrink: 0; gap: 4px; cursor: pointer; background: none; min-width: 76px; }

/* sheets */
.fm .fm-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fm .fm-fc { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; min-height: 52px; padding: 6px 12px; text-align: left; }
.fm .fm-fc small { font-family: var(--tk-font-body); font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--tk-text-subtle); }
.fm .fm-pick-list { display: flex; flex-direction: column; gap: 6px; }
.fm .fm-pick { width: 100%; cursor: pointer; color: var(--tk-text); text-align: left; font: inherit; }
.fm .fm-pick:hover { border-color: var(--tk-violet); }
.fm .fm-num-opp { background: var(--tk-opponent); }
.fm .tk-btn--block { justify-content: flex-start; }
.fm .fm-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--tk-fs-body-s); }
.fm .fm-sub .x-btn { margin-left: auto; }
.fm .fm-on { display: inline-flex; align-items: center; gap: 4px; color: var(--tk-ok); }
.fm .fm-off { color: var(--tk-bad-text); }

/* ── Larger screens (design system 6.6). Everything above is the phone layout and stays as it is. ──
   Tablet (700px and up): the control bar and the bench strip still run edge to edge, but their
   contents start in the reading column (--tk-column), like the other tabs. Bars are box-sized, so
   the padding only moves the contents. The pitch column is that column too: --fm-fill tells
   pitchSize() (formation.js) to drop the phone caps, so one pitch or two fill the column's height
   or width, whichever runs out first. Targets stay 44px: the control bar's small buttons and chip
   grow to --tk-touch, and a jersey's tap area is at least --tk-touch square (the jersey itself
   stays centred on its spot). */
@media (min-width: 700px) {
  .fm .tk-controlbar { padding-inline: calc(max(0px, (100% - var(--tk-column)) / 2) + var(--tk-space-3)); }
  .fm .tk-controlbar .tk-btn, .fm .tk-controlbar .tk-chip { min-height: var(--tk-touch); }
  .fm .tk-controlbar .tk-btn--icon { min-width: var(--tk-touch); }
  .fm .fm-strip { padding-left: calc(max(0px, (100% - var(--tk-column)) / 2) + var(--tk-space-3)); }
  .fm .fm-pcol { --fm-fill: 1; width: 100%; max-width: var(--tk-column); margin-inline: auto; }
  .fm .tk-slot { min-width: var(--tk-touch); min-height: var(--tk-touch); justify-content: center; }
}
/* Tablet landscape, PC and a phone held sideways: the pitch and the bench side by side inside the
   wide column. The control bar spans the top; .fm-main becomes a two-column grid (pitch area, then
   a bench panel of --fm-bench-w) centred at --tk-column-wide; the strip stacks its groups and
   scrolls vertically. The pitch area is the grid cell, not the reading column. The second query is
   any screen from 700px held sideways: a landscape iPad (1024 to 1099px wide), a small tablet or a
   foldable (about 960 x 600), and a phone on its side, where a bench along the bottom would leave
   the pitch almost no height. The bench panel is the design system's side panel width, --tk-side-w. */
@media (min-width: 1100px), (min-width: 700px) and (orientation: landscape) {
  .fm .fm-root { --fm-bench-w: var(--tk-side-w); }
  .fm .tk-controlbar { padding-inline: calc(max(0px, (100% - var(--tk-column-wide)) / 2) + var(--tk-space-3)); }
  .fm .fm-main { display: grid; grid-template-columns: minmax(0, 1fr) var(--fm-bench-w); grid-template-rows: minmax(0, 1fr); width: 100%; max-width: var(--tk-column-wide); margin-inline: auto; }
  .fm .fm-pcol { grid-column: 1; min-width: 0; max-width: none; margin-inline: 0; }
  .fm .fm-plbl:empty { display: none; }                 /* one pitch has no label: let it line up with the bench panel */
  .fm .fm-root.none > .fm-none { margin-block: auto; }  /* "No team selected" sits mid-screen, not at the top */
  /* bench strip → bench panel: labels as headings, items and bench slots stacked full width */
  .fm .fm-strip { grid-column: 2; flex-direction: column; align-items: stretch; gap: var(--tk-space-2); min-height: 0; padding: var(--tk-space-3);
    margin: var(--tk-space-3) var(--tk-space-3) var(--tk-space-3) 0; overflow-x: hidden; overflow-y: auto;
    border: var(--tk-border) solid var(--tk-line); border-radius: var(--tk-radius-lg); }
  .fm .fm-strip-lbl { padding: var(--tk-space-2) var(--tk-space-1) 0; }
  .fm .fm-strip-lbl:first-child { padding-top: 0; }
  .fm .fm-strip-note { padding: 0 var(--tk-space-1); white-space: normal; line-height: 1.35; }
  .fm .fm-item { max-width: none; width: 100%; }
  .fm .tk-bench__slot { width: 100%; min-width: 0; }
}
