/*
 * LANES DOWN THE SIDE, A SHARED AXIS ACROSS.
 *
 * Every box on a lane is placed by two SHARES the caller computed
 * (`--lotics-lane-board-left` / `--lotics-lane-board-width`), so the board holds
 * its arithmetic at any width and nothing here measures itself before it draws.
 *
 * THE BOARD OWNS ITS HORIZONTAL SCROLL, never the page: the lane gutter is
 * pinned and the axis is what gives, the same law the column board obeys.
 *
 * An OPENING is drawn as the ground and a BLOCK as the ink over it — the reverse
 * of a chart, and deliberate: what is still free is what a dispatcher is reading
 * for, so it is a surface with words on it rather than the absence of one.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-lane-board {
    /* The rung a lane stands at with its two readings under its name. */
    --lotics-lane-board-lane: 56px;
    /* THE NARROWEST A BLOCK IS DRAWN. Under it a bar is a hairline nobody can
       press; at it a quarter-hour on a shift-long axis is still a target. It is
       the one place the board rounds a duration, and it rounds it UP. */
    --lotics-lane-board-block: 10px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    overflow-x: auto;
  }

  /* The ruler starts where the tracks do, so a mark stands over the minute it
     names rather than over the lane's name. */
  .lotics-lane-board__ruler {
    position: relative;
    flex-shrink: 0;
    height: var(--lotics-space-24);
    margin-left: var(--lotics-lane-board-head);
  }

  .lotics-lane-board__tick {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-left: var(--lotics-space-4);
    border-left: 1px solid var(--border);
  }

  .lotics-lane-board__lane {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-shrink: 0;
    min-height: var(--lotics-lane-board-lane);
    border-top: 1px solid var(--border);
  }

  .lotics-lane-board__head {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    width: var(--lotics-lane-board-head);
    gap: var(--lotics-space-2);
    padding-right: var(--lotics-space-12);
    padding-block: var(--lotics-space-8);
  }

  .lotics-lane-board__loads {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--lotics-space-2);
    min-width: 0;
  }

  .lotics-lane-board__load {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--lotics-space-8);
    min-width: 0;
  }

  .lotics-lane-board__overflow {
    flex-shrink: 0;
  }

  .lotics-lane-board__track {
    position: relative;
    flex: 1;
    min-width: 0;
  }

  /* The opening is the lane's own ground — a dashed edge, because what is free
     is a shape nobody has filled in yet. */
  .lotics-lane-board__opening {
    position: absolute;
    display: flex;
    flex-direction: row;
    align-items: center;
    /* THE BOX IS THE LANE'S OWN HEIGHT, inset off its rules: a bar of a height
       picked here would have to be re-centred every time a lane grew a second
       reading, and the occupancy IS the row. */
    inset-block: var(--lotics-space-8);
    left: var(--lotics-lane-board-left);
    width: var(--lotics-lane-board-width);
    padding-inline: var(--lotics-space-6);
    overflow: hidden;
    border: 1px dashed var(--border);
    border-radius: var(--lotics-radius-control);
  }

  .lotics-lane-board__block {
    position: absolute;
    display: flex;
    flex-direction: row;
    align-items: center;
    inset-block: var(--lotics-space-8);
    left: var(--lotics-lane-board-left);
    width: var(--lotics-lane-board-width);
    min-width: var(--lotics-lane-board-block);
    padding-inline: var(--lotics-space-6);
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: var(--lotics-radius-control);
    background-color: var(--lotics-lane-board-tone, var(--lotics-tone-zinc));
    appearance: none;
    text-align: left;
  }

  .lotics-lane-board__block[data-pressable] {
    cursor: pointer;
  }

  /* THE ROW THE DRAWER IS STANDING ON — the kit's own selected wash, so the
     board and the register beneath it mark one row the same way. */
  .lotics-lane-board__block[data-selected] {
    border-color: var(--ring);
  }

  /* LATE IS HATCHED, not only toned: a second channel over the state's colour,
     so a cancelled block and a late one are never one ink. */
  .lotics-lane-board__block[data-late] {
    background-image: repeating-linear-gradient(
      135deg,
      var(--lotics-white) 0,
      var(--lotics-white) 2px,
      transparent 2px,
      transparent 6px
    );
  }

  .lotics-lane-board__block:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: 0;
  }
}
