/*
 * The lineup check (/lineup), in the look "The anthem" (docs/design/website/lineup-check/anthem-spec.md): the
 * visitor's lineup stands on the blue line, each player under his own lamp. Every value comes from theme.css.
 * The markup holds the thirteen places; site/lineup.js (built from scripts/lineup/page) fills them.
 */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--ice); }
body.lineup {
  /* A frame is sized so the longest row fills the window: its players stand --figure-step apart. */
  --row-most: var(--squad-most);
  --across: calc(1 + (var(--row-most) - 1) * var(--figure-step));
  --frame-w: min(calc(100cqi / (var(--across) + var(--room, 0))), var(--figure-max));
  --frame-h: calc(var(--frame-w) * var(--frame-tall));
  /* What a row of frames shows: its two ends melt, and a rank loses its lamps or its reflection to the next one. */
  --row-end: calc(var(--frame-w) * var(--line-fade));
  --row-ends: linear-gradient(to right, transparent, var(--mask-most) calc(var(--row-end) / 2), var(--mask-on) var(--row-end), var(--mask-on) calc(100% - var(--row-end)), var(--mask-most) calc(100% - var(--row-end) / 2), transparent);
  --rank-behind: linear-gradient(var(--mask-on) var(--rank-foot-from), transparent var(--rank-foot-to));
  --rank-front: linear-gradient(transparent var(--rank-head-from), var(--mask-on) var(--rank-head-to));
  --rank-between: linear-gradient(transparent var(--rank-head-from), var(--mask-on) var(--rank-head-to), var(--mask-on) var(--rank-foot-from), transparent var(--rank-foot-to));
  --rank-tuck: calc(var(--frame-h) * (var(--rank-step) - 1));
  margin: 0; background: var(--ice); color: var(--text);
  font: var(--weight-regular) var(--size-body)/var(--lead-body) var(--font); -webkit-font-smoothing: antialiased;
}
@supports not (width: 1cqi) {
  body.lineup { --frame-w: min(calc(100vw / (var(--across) + var(--room, 0))), var(--figure-max)); }
}
h1, p, dl, dd, fieldset { margin: 0; }
a { color: inherit; }
:focus-visible { outline: var(--line-bold) solid var(--green); outline-offset: var(--space-1); }
.sr { position: absolute; width: var(--line); height: var(--line); overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--bar-height); padding-inline: var(--edge); }
.mark { display: inline-flex; align-items: center; min-height: var(--touch); }
.wordmark { display: block; width: auto; height: var(--wordmark-tall); }
.wordmark .puck { fill: var(--text); }
.wordmark .iq { fill: var(--red); }
.actions { display: flex; gap: var(--space-2); margin-right: calc(var(--space-2) * -1); white-space: nowrap; }
.quiet {
  min-height: var(--touch); padding: 0 var(--space-2); border: 0; background: none; color: var(--text); cursor: pointer;
  font: var(--weight-medium) var(--size-lede)/var(--lead-tight) var(--font); text-underline-offset: var(--space-1);
}
.quiet:hover { text-decoration: underline; }

main { container-type: inline-size; }

/* The headline, and beside it (below it on a narrow window) the roster box or a question about a name. */
.intro { position: relative; z-index: 1; display: grid; gap: var(--space-6); padding-inline: var(--edge); }
h1 { font-size: var(--size-hero); font-weight: var(--weight-heavy); line-height: var(--lead-display); letter-spacing: var(--track-tight); text-wrap: balance; }
.summary { margin-top: var(--space-4); font-size: var(--size-hero-lede); line-height: var(--lead-snug); font-variant-numeric: tabular-nums; }
.notes { margin-top: var(--space-2); color: var(--text-dim); font-size: var(--size-small); }

.roster, .choose { display: grid; gap: var(--space-3); max-width: var(--measure-entry); }
.roster label, .ask legend { padding: 0; color: var(--text-dim); font-size: var(--size-small); font-weight: var(--weight-strong); letter-spacing: var(--track-caps); text-transform: uppercase; }
.roster textarea {
  display: block; width: 100%; min-height: var(--entry-tall); padding: var(--space-3) var(--space-4); resize: vertical;
  border: var(--line) solid var(--glass); border-radius: var(--radius-control); background: var(--glass-fill); color: var(--text);
  font: inherit; line-height: var(--lead-snug);
}
.roster textarea::placeholder { color: var(--text-faint); opacity: 1; }
.hint { color: var(--text-faint); font-size: var(--size-small); }
.button {
  display: inline-flex; align-items: center; justify-content: center; justify-self: start; min-height: calc(var(--touch) + var(--space-2));
  padding: 0 var(--space-6); border: 0; border-radius: var(--radius-control); background: var(--text); color: var(--ice); cursor: pointer;
  font: var(--weight-strong) var(--size-lede)/var(--lead-tight) var(--font); text-decoration: none;
  transition: transform var(--quick) var(--ease), box-shadow var(--quick) var(--ease);
}
.button:hover { transform: translateY(calc(var(--line) * -1)); box-shadow: var(--glow-light-far); }
.button.is-loud { min-height: calc(var(--touch-loud) + var(--space-2)); font-size: var(--size-label); }
.button:disabled { opacity: var(--dim-hover); cursor: progress; transform: none; box-shadow: none; }

.choose { gap: var(--space-5); }
.ask { display: grid; gap: var(--space-3); min-width: 0; padding: 0; border: 0; }
.ask legend { margin-bottom: var(--space-2); }
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.option {
  min-height: var(--touch); padding: 0 var(--space-4); border: var(--line) solid var(--glass); border-radius: var(--radius-control);
  background: var(--glass-fill); color: var(--text); cursor: pointer; font: var(--weight-medium) var(--size-body)/var(--lead-tight) var(--font);
}
.option:hover { border-color: var(--text); }
.options .quiet { margin-left: calc(var(--space-2) * -1); }

/*
 * The line. Thirteen frames of one photograph, each over the right side of the one before it; a row of them is
 * a squad on a phone, a rank (forwards, then defence and goalies) on a tablet, the whole line on a wide window.
 */
.rink { overflow: clip; }
.line { display: flex; flex-direction: column; }
.rank { display: contents; }
.squad, .rank, .line { --rank-mask: linear-gradient(var(--mask-on), var(--mask-on)); }
.squad {
  display: flex; align-self: center; margin-top: var(--rank-tuck); --rank-mask: var(--rank-between);
  -webkit-mask-image: var(--row-ends), var(--rank-mask); mask-image: var(--row-ends), var(--rank-mask);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
.rank:first-child > .squad:first-child { margin-top: 0; --rank-mask: var(--rank-behind); }
.rank:last-child > .squad:last-child { --rank-mask: var(--rank-front); }

.figure {
  --blend-over: linear-gradient(to right, transparent var(--blend-from), var(--mask-on) var(--blend-to));
  position: relative; flex: none; width: var(--frame-w); height: var(--frame-h);
  margin-left: var(--tuck, calc(var(--frame-w) * (var(--figure-step) - 1)));
  background: url(lineup-line.webp) calc(var(--frame) * 100% / (var(--frame-count) - 1)) 0 / calc(var(--frame-count) * 100%) 100% no-repeat;
  -webkit-mask-image: var(--blend, var(--blend-over)); mask-image: var(--blend, var(--blend-over));
}
.squad > .figure:first-child { --tuck: 0px; --blend: none; }
.is-goalie + .is-goalie { --tuck: calc(var(--frame-w) * (var(--goalie-step) - 1)); }
/* The frames of lineup-line.webp, left to right (scripts/lineup/art.py). */
.is-a { --frame: 0; }
.is-b { --frame: 1; }
.is-c { --frame: 2; }
.is-goalie { --frame: 3; }
.is-open { --frame: 4; }
.is-a.is-pickup { --frame: 5; }
.is-goalie.is-pickup { --frame: 6; }

.jersey {
  position: absolute; top: var(--jersey-top); left: 50%; width: var(--jersey-wide); transform: translateX(-50%);
  display: grid; justify-items: center; color: var(--light); line-height: var(--lead-tight); text-align: center;
}
.name, .note { white-space: nowrap; transform-origin: 50% 0; }
.name {
  font-size: calc(var(--frame-w) * var(--jersey-name)); font-weight: var(--weight-heavy);
  transform: scale(calc(var(--squeeze, 1) * var(--shrink, 1)), var(--shrink, 1));
}
.note { transform: scale(calc(var(--squeeze, 1) * var(--shrink, 1)), var(--shrink, 1)); }
.slot { font-size: calc(var(--frame-w) * var(--jersey-slot)); font-weight: var(--weight-strong); letter-spacing: var(--track-caps); }
.is-open .jersey { color: var(--text-dim); }
.is-open .slot { font-size: calc(var(--frame-w) * var(--jersey-name)); }
.is-pickup .jersey { color: var(--mint); }
.note { margin-top: calc(var(--frame-w) * var(--note-size)); font-size: calc(var(--frame-w) * var(--note-size)); font-weight: var(--weight-strong); text-transform: uppercase; }
.note:empty { display: none; }

/* The lamps come on one after another, left to right. */
@keyframes lamp-on { from { opacity: 0; } }
.line.is-arriving .figure { animation: lamp-on var(--slow) var(--ease-out) backwards; animation-delay: calc(var(--place, 0) * var(--stagger)); }

/* On the reflections: who sits (the unlit bench), the pickup and the one invitation. */
.band { position: relative; z-index: 1; display: grid; gap: var(--space-5); text-shadow: var(--shade-text); margin-top: calc(var(--frame-h) * var(--band-rise) * -1); padding: 0 var(--edge) var(--space-7); }
.bench { display: grid; gap: var(--space-2); justify-items: start; }
.bench-photo { display: block; width: var(--bench-wide); height: auto; margin-left: calc(var(--edge) * -1); -webkit-mask-image: var(--fade-bench); mask-image: var(--fade-bench); -webkit-mask-composite: source-in; mask-composite: intersect; }
.sitting { display: grid; gap: var(--space-3); max-width: var(--measure-hero); }
.sitting dt, .pickup-label { font-size: var(--size-small); font-weight: var(--weight-heavy); letter-spacing: var(--track-caps); text-transform: uppercase; }
.pickup { display: grid; gap: var(--space-1); justify-self: start; max-width: var(--pickup-wide); padding: var(--space-2) var(--space-5) var(--space-2) var(--space-4); border-left: var(--line-bold) solid var(--green); background: var(--shade-callout); }
.pickup-label { color: var(--green); }
.pickup-name { font-size: var(--size-title); font-weight: var(--weight-heavy); line-height: var(--lead-tight); letter-spacing: var(--track-tight); }
.pickup-detail { color: var(--text); }
.band .button { text-shadow: none; }

.foot { display: grid; gap: var(--space-3); padding: var(--space-7) var(--edge) var(--space-8); border-top: var(--line) solid var(--rule); color: var(--text-faint); font-size: var(--size-small); }
.foot p { max-width: var(--measure); }
.foot nav { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); }
.foot nav a { display: inline-flex; align-items: center; min-height: var(--touch); color: var(--text); font-weight: var(--weight-strong); text-decoration: none; }
.foot nav a:hover { text-decoration: underline; }
.fine { font-size: var(--size-micro); }

/* A phone: before an answer one squad of empty lamps waits, not four; its small sweaters get bigger lettering. */
@media (max-width: 39.99rem) {
  body:not([data-state="answer"]) :is(.rank ~ .rank, .squad ~ .squad) { display: none; }
  body:not([data-state="answer"]) .rank:first-child > .squad:first-child { --rank-mask: linear-gradient(var(--mask-on), var(--mask-on)); }
  body.lineup { --jersey-slot: var(--jersey-slot-near); --note-size: var(--note-size-near); }
}

/* A tablet: two ranks, the forwards behind, the defence and goalies in front. */
@media (min-width: 40rem) {
  .bench { grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: var(--space-5); }
  body.lineup { --row-most: var(--rank-most); --room: var(--line-room); }
  .squad { display: contents; }
  .squad:not(:first-child) > .figure:first-child { --tuck: initial; --blend: initial; }
  .rank {
    display: flex; align-self: center; margin-top: var(--rank-tuck); --rank-mask: var(--rank-front);
    -webkit-mask-image: var(--row-ends), var(--rank-mask); mask-image: var(--row-ends), var(--rank-mask);
    -webkit-mask-composite: source-in; mask-composite: intersect;
  }
  .rank:first-child { margin-top: 0; --rank-mask: var(--rank-behind); }
}

/* A window with room: the roster box beside the headline, the pickup across from the bench. */
@media (min-width: 64rem) {
  .intro { grid-template-columns: minmax(0, 1fr) var(--measure-entry); align-items: end; }
  /* A list of names to settle can run long: the headline stays at its top. */
  [data-state="choose"] .intro { align-items: start; }
  .band { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "bench pickup" "store pickup"; align-items: end; }
  .bench { grid-area: bench; }
  .pickup { grid-area: pickup; align-self: start; margin-top: var(--space-8); }
  .band .button { grid-area: store; }
}

/* A wide window: the whole team on one line. */
@media (min-width: 80rem) {
  body.lineup { --row-most: var(--line-most); }
  .rank { display: contents; }
  .rank:not(:first-child) > .squad > .figure:first-child { --tuck: initial; --blend: initial; }
  .line { flex-direction: row; justify-content: center; -webkit-mask-image: var(--row-ends); mask-image: var(--row-ends); -webkit-mask-composite: source-in; mask-composite: intersect; }
  /* The pickup's callout hangs from the skater it stands for: its green rule drops from that pool of light. */
  .pickup.is-placed {
    position: absolute; grid-area: auto; top: 0; margin: 0;
    left: clamp(calc(var(--edge) + var(--bench-wide)), calc(50% - var(--across) * var(--frame-w) / 2 + var(--frame-w) * (var(--place) * var(--figure-step) + .5)), calc(100% - var(--edge) - var(--pickup-wide)));
  }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
  .line.is-arriving .figure { animation: none; }
}
