/* ship-room.css — styles for ship-room.js, written against the role tokens in styles.css.

   Studio's Ship room is drawn from its design system, and so is this: every measure below
   is a token of `app/DesignSystem.json` (spacing 2, 4, 6, 8, 12, 16 and 24; a 76-point
   header; 28-point controls; 12-, 8-, 6- and 5-point corners) and every colour is a role
   the page already has. One token is the Ship room's own, as it is in Studio: the chart
   series colour, `chartSeries`, #2A78D6 in light and #3987E5 in dark. Nothing here, and
   nothing in the script, writes a style attribute: chart geometry is SVG attributes. */
:root { --ship-series: #2a78d6; }
:root[data-theme="dark"] { --ship-series: #3987e5; }

/* ------------------------------------------------------------ the three hosts */

/* The page's host. Shown as a section of its own it is sized as the workspace is beneath
   the bar; mounted inside the workspace grid it takes the grid's height. */
.ship-room-view { height: calc(100vh - var(--topbar-height)); min-width: 0; min-height: 0; }
.workspace > .ship-room-view { height: auto; }

/* The navigator list's host: the room's list, between the project header and the card. */
.ship-list-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* The activity card's host at the foot of the navigator: 8 at the sides and above, 12
   below. When the navigator collapses it stays, holding the card's status icon at the
   bottom of the strip; the shell's rule that hides the rail's other children is outranked
   here on purpose. */
.ship-card-host { flex: none; padding: 8px 8px 12px; }
body.rail-collapsed .feature-rail > .ship-card-host:not(.rail-stub):not(.pane-resizer) {
  display: flex; justify-content: center; margin-top: auto; padding: 0 0 12px;
}

/* The Ship room keeps the navigator column and replaces the stage and the inspector with
   one page. These rules do that inside the shell's workspace grid once the shell marks
   the room on <body>; until it does they match nothing. */
body.ship-room-open .workspace { grid-template-columns: var(--rail-col) minmax(0, 1fr); }
body.ship-room-open .workspace > .stage-pane,
body.ship-room-open .workspace > .detail-pane,
body.ship-room-open .feature-rail > .rail-scroll { display: none; }
body:not(.ship-room-open) .workspace > .ship-room-view,
body:not(.ship-room-open) .feature-rail > .ship-list-host { display: none; }
/* A narrow window keeps the navigator beside the page, whichever side pane Studio's room
   had in front; narrower still it is one pane at a time, the page unless the navigator
   was brought forward, with the navigator's strip beside the page to bring it back. */
@media (max-width: 760px) {
  body.ship-room-open .workspace { grid-template-columns: var(--pane-stub) minmax(0, 1fr); }
  body.ship-room-open.front-one-rail .workspace { grid-template-columns: minmax(0, 1fr); }
  body.ship-room-open .workspace > .ship-room-view { height: 100%; }
  body.ship-room-open.front-one-rail .workspace > .ship-room-view { display: none; }
}

/* ------------------------------------------------------------------ the room */

.ship-room { height: 100%; min-height: 0; display: flex; }

/* Without a list host the module draws the navigator column itself. */
.ship-room.has-sidebar { display: grid; grid-template-columns: var(--rail-base) minmax(0, 1fr); }
.ship-sidebar { min-height: 0; display: flex; flex-direction: column; background: var(--panel-muted); border-right: 1px solid var(--line); }
.ship-sidebar-head { flex: 0 0 76px; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; padding: 0 16px; border-bottom: 1px solid var(--line); }
.ship-sidebar-eyebrow { color: var(--muted); font: var(--type-eyebrow); letter-spacing: var(--eyebrow-tracking); }
.ship-sidebar-name { overflow: hidden; color: var(--ink); font: var(--type-h3); white-space: nowrap; text-overflow: ellipsis; }
.ship-sidebar-foot { flex: none; padding: 8px 8px 12px; }

/* Studio's navigator list: Overview and Builds, a rule, then every build, newest first.
   Every row is selectable, and there are no group labels. */
.ship-nav { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.ship-nav-top { flex: none; display: flex; flex-direction: column; gap: 4px; padding: 12px 8px 0; }
.ship-nav-rule { flex: none; height: 1px; margin: 12px; background: var(--line); }
.ship-nav-builds { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 0 8px; }
.ship-nav-builds > .ship-row { margin-bottom: 4px; }

/* Studio's row: hover lays the tint on; the selected row is the raised neutral fill with
   a neutral edge and primary ink. */
.ship-row {
  width: 100%; min-height: 36px; flex: none;
  display: flex; align-items: center; gap: 8px; padding: 8px;
  color: var(--ink); text-align: left; background: transparent; border: 0;
  border-radius: var(--radius-row); cursor: pointer;
}
.ship-row:hover { background: var(--hover); }
.ship-row.is-selected { background: var(--selected-fill); box-shadow: inset 0 0 0 1px var(--selected-line-strong); }
.ship-row-copy { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ship-row-title { overflow: hidden; color: var(--ink); font: var(--type-small-strong); white-space: nowrap; text-overflow: ellipsis; }
.ship-row.is-selected .ship-row-title { color: var(--selected-ink); }
.ship-row-detail,
.ship-row-trailing { overflow: hidden; color: var(--muted); font: var(--type-caption); white-space: nowrap; text-overflow: ellipsis; }
.ship-row-trailing { flex: none; }

/* The page lays out against its own width, not the window's: it sits beside the
   navigator, so the queries below are container queries on this element. */
.ship-main { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--panel); container: ship-main / inline-size; }
.ship-head { flex: 0 0 76px; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 24px; border-bottom: 1px solid var(--line); }
.ship-head-copy { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ship-head-eyebrow { margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ship-title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ship-title { margin: 0; overflow: hidden; color: var(--ink); font: var(--type-h3); white-space: nowrap; text-overflow: ellipsis; }
.ship-head-badge { flex: none; display: flex; }
.ship-head-actions { flex: none; display: flex; align-items: center; gap: 8px; }
.ship-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 16px; padding: 24px; }
/* No project, still asking, or refused: one thing, in the middle of the page. */
.ship-scroll.is-centered { align-items: center; justify-content: center; }

/* Studio's empty state: a mark on the raised neutral fill, a title, a message, and at most
   one action, in a block no wider than 380. */
.ship-empty { align-self: flex-start; width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; text-align: center; }
.ship-empty.is-centered { align-self: center; }
.ship-empty-mark { width: 52px; height: 52px; display: grid; place-items: center; color: var(--selected-ink); background: var(--selected-fill); border-radius: var(--radius-card); }
.ship-empty-mark svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ship-empty-copy { display: flex; flex-direction: column; gap: 6px; }
.ship-empty-title { margin: 0; color: var(--ink); font: var(--type-h3); }
.ship-empty-message { margin: 0; color: var(--muted); font: var(--type-small); }
.ship-empty-message code { display: inline-block; margin-top: 6px; color: var(--muted); font: var(--type-mono); word-break: break-all; }
.ship-empty-action { margin-top: 4px; }

.ship-loading { display: grid; place-items: center; }
.ship-spinner { display: block; transform-origin: 50% 50%; animation: ship-turn 1s linear infinite; }
.ship-spinner-track { fill: none; stroke: var(--line); stroke-width: 3; }
.ship-spinner-arc { fill: none; stroke: var(--loading); stroke-width: 3; stroke-linecap: round; }

/* A card in the room: an eyebrow with its accessory, then the content, on the muted
   surface with a soft edge. */
.ship-panel { min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--panel-muted); border: 1px solid var(--line-soft); border-radius: var(--radius-card); }
.ship-panel-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ship-panel-title { flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ship-panel-accessory { flex: none; color: var(--muted); font: var(--type-caption); }
.ship-panel-copy { margin: 0; color: var(--ink-soft); font: var(--type-small); }
.ship-panel-foot { margin: 0; color: var(--muted); font: var(--type-caption); }

/* Studio's status badge: the family's ink on its tinted fill. Neutral is the default. */
.ship-badge { flex: none; display: inline-flex; align-items: center; padding: 4px 8px; color: var(--note-ink); background: var(--note-bg); border-radius: var(--radius-badge); font: var(--type-caption-strong); white-space: nowrap; }
.ship-badge.is-success { color: var(--ok-ink); background: var(--ok-bg); }
.ship-badge.is-activity { color: var(--activity-ink); background: var(--activity-wash); }
.ship-badge.is-danger { color: var(--bad-ink); background: var(--bad-bg); }

/* A row inside a card that opens a build's page: the tint reaches 6 past the content. */
.ship-link {
  width: calc(100% + 12px); margin: 0 -6px; padding: 6px; display: flex;
  color: inherit; text-align: left; background: transparent; border: 0;
  border-radius: var(--radius-row); cursor: pointer;
}
.ship-link:hover { background: var(--hover); }
.ship-chevron { flex: none; display: block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- Overview */

.ship-link.is-beta { flex-direction: column; gap: 4px; }
.ship-beta-head { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.ship-big { min-width: 0; overflow: hidden; color: var(--ink); font: var(--type-h1); white-space: nowrap; text-overflow: ellipsis; }
.ship-beta-line { color: var(--ink-soft); font: var(--type-small); }
.ship-rule { height: 1px; background: var(--line-soft); }
.ship-link.is-current { align-items: center; gap: 8px; }
.ship-dot { flex: none; width: 6px; height: 6px; background: var(--muted); border-radius: 50%; }
.ship-dot.is-activity { background: var(--activity); }
.ship-dot.is-danger { background: var(--danger); }
.ship-dot.is-success { background: var(--green); }
.ship-current-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ship-current-title { overflow: hidden; color: var(--ink); font: var(--type-small-strong); white-space: nowrap; text-overflow: ellipsis; }
.ship-current-line { overflow: hidden; color: var(--muted); font: var(--type-caption); white-space: nowrap; text-overflow: ellipsis; }

/* Builds by date. The legend says what each mark is by shape and colour together: a
   circle in the series blue for a build, in orange for one in progress, and a square in
   the danger colour for a failure. The readout names the build under the pointer. */
.ship-timeline,
.ship-bars { display: flex; flex-direction: column; gap: 8px; }
.ship-chart-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ship-legend { flex: none; display: flex; align-items: center; gap: 12px; margin: 0; padding: 0; list-style: none; }
.ship-legend-item { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); font: var(--type-caption); }
.ship-legend-item svg { display: block; }
.ship-readout { flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; color: var(--muted); font: var(--type-caption); white-space: nowrap; text-overflow: ellipsis; }
.ship-chart-head .ship-readout { text-align: right; }
.ship-timeline-row { display: flex; align-items: flex-start; gap: 8px; }
/* The lane's name sits level with its marks, which are drawn 62 down the plot. */
.ship-timeline-lane { flex: none; padding-top: 54px; color: var(--ink-soft); font: var(--type-small); }
.ship-timeline-plot { flex: 1 1 auto; min-width: 0; display: block; overflow: visible; }
.ship-timeline-plot.is-pointing { cursor: pointer; }
.ship-plot-hit { fill: transparent; }
.ship-grid { stroke: var(--line-soft); stroke-width: 1; }
.ship-today { stroke: var(--line-strong); stroke-width: 1; }
.ship-mark.is-upload { fill: var(--ship-series); }
.ship-mark.is-inProgress { fill: var(--activity); }
.ship-mark.is-failed { fill: var(--danger); }
/* Chart text wears the text roles, never the series colour. */
.ship-axis-label,
.ship-point-label,
.ship-bar-value { fill: var(--muted); font: var(--type-caption); font-variant-numeric: tabular-nums; }

/* Studio's table: five equal columns, a header nobody presses, and rows pressed whole. */
.ship-table { display: flex; flex-direction: column; }
.ship-table-head,
.ship-table-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; gap: 8px; padding: 0 8px; }
.ship-table-head { padding-bottom: 4px; color: var(--muted); font: var(--type-caption); }
.ship-table-row { width: 100%; min-height: 28px; color: var(--ink); text-align: left; background: transparent; border: 0; border-radius: var(--radius-row); font: var(--type-small); cursor: pointer; }
.ship-table-row:hover:not([aria-disabled="true"]) { background: var(--hover); }
.ship-table-row[aria-disabled="true"] { cursor: default; }
.ship-cell { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ship-cell.is-strong { font: var(--type-small-strong); }
.ship-cell.is-soft { color: var(--ink-soft); }
/* A run still going counts its time in Studio's elapsed-time type. */
.ship-cell.is-live { color: var(--muted); font: var(--type-caption); }

/* ------------------------------------------------------------------- Builds */

.ship-average { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.ship-average-note { color: var(--ink-soft); font: var(--type-small); }
/* Value first, label after: the figure is what a reader came for. */
.ship-stats { display: flex; align-items: flex-start; gap: 16px; margin: 0; }
.ship-stat { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column-reverse; gap: 2px; }
.ship-stat dt { overflow: hidden; color: var(--muted); font: var(--type-caption); white-space: nowrap; text-overflow: ellipsis; }
.ship-stat dd { margin: 0; overflow: hidden; color: var(--ink); font: var(--type-h3); font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }

/* Build times: one blue series, 24 wide with a 4-point round top, the average as a line,
   and the bars other than the hovered one dimmed to half. */
.ship-bars-plot { display: block; overflow: visible; }
.ship-bar-band { fill: transparent; }
.ship-bar-mark { fill: var(--ship-series); }
.ship-bar.is-dimmed .ship-bar-marks { opacity: .5; }
.ship-average-line { stroke: var(--line-strong); stroke-width: 1; pointer-events: none; }

/* ------------------------------------------------------------ a build's page */

/* Side by side while the main column keeps 480 beside a 300 side column; stacked below. */
.ship-version { display: flex; align-items: flex-start; gap: 16px; }
.ship-version-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ship-version-side { flex: 0 0 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* Progress: a 4-point bar a step. Green is done, orange is in progress, the danger colour
   is where it stopped, and the chip is not started. */
.ship-steps { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ship-step { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ship-step-bar { display: block; height: 4px; background: var(--chip); border-radius: 2px; }
.ship-step.is-done .ship-step-bar { background: var(--green); }
.ship-step.is-current .ship-step-bar { background: var(--activity); }
.ship-step.is-stopped .ship-step-bar { background: var(--danger); }
.ship-step-title { overflow: hidden; color: var(--ink); font: var(--type-small-strong); white-space: nowrap; text-overflow: ellipsis; }
.ship-step-detail { display: -webkit-box; overflow: hidden; color: var(--muted); font: var(--type-caption); -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
/* Said, not shown: how far a step got, for a reader who cannot see its colour. */
.ship-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.ship-changes,
.ship-events { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ship-change { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ship-change-name { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--ink); font: var(--type-small-strong); white-space: nowrap; text-overflow: ellipsis; }
.ship-change-note { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--ink-soft); font: var(--type-small); white-space: nowrap; text-overflow: ellipsis; }
.ship-event { display: flex; align-items: baseline; gap: 12px; font: var(--type-small); }
.ship-event-time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ship-event-text { flex: 1 1 auto; min-width: 0; color: var(--ink); }

/* Studio's detail row: the name, the value against the far edge, and a soft rule under. */
.ship-details { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.ship-detail { display: flex; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.ship-detail dt { flex: none; color: var(--muted); font: var(--type-small); }
.ship-detail dd { flex: 1 1 auto; min-width: 0; margin: 0; color: var(--ink); font: var(--type-small-strong); text-align: right; overflow-wrap: anywhere; user-select: text; }
.ship-related { display: flex; flex-direction: column; gap: 4px; }
.ship-link.is-related { align-items: center; gap: 8px; }
.ship-related-title { flex: 1 1 auto; min-width: 0; color: var(--ink); font: var(--type-small-strong); }
.ship-link.is-related .ship-chevron { color: var(--muted); }

/* --------------------------------------------------------- the activity card */

/* On the raised surface with a hairline edge; in the Ship room the edge is the neutral
   selection line and the arrow is gone. */
.ship-card { display: flex; flex-direction: column; gap: 6px; padding: 6px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-card); }
.ship-card.is-in-room { border-color: var(--selected-line-strong); }
.ship-card-status {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px;
  color: var(--ink); text-align: left; background: transparent; border: 0;
  border-radius: var(--radius-row); cursor: pointer;
}
.ship-card-status:hover { background: var(--hover); }
.ship-card-copy { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ship-card-title { overflow: hidden; color: var(--ink); font: var(--type-small-strong); white-space: nowrap; text-overflow: ellipsis; }
.ship-card-detail { overflow: hidden; color: var(--muted); font: var(--type-caption); white-space: nowrap; text-overflow: ellipsis; }
/* The arrow on its chip, which inverts while the status line is hovered. */
.ship-card-go { flex: none; width: 24px; height: 24px; display: grid; place-items: center; color: var(--ink); background: var(--chip); border-radius: 50%; }
.ship-card-status:hover .ship-card-go { color: var(--panel); background: var(--ink); }
.ship-card-actions { position: relative; display: flex; gap: 6px; }
.ship-card-primary { flex: 1 1 auto; min-width: 0; }
.ship-menu-wrap { flex: none; }
.ship-card-more { position: relative; width: var(--control-height); height: var(--control-height); display: grid; place-items: center; padding: 0; color: var(--ink); background: var(--chip); border: 0; border-radius: var(--radius-icon); cursor: pointer; }
.ship-card-more:hover { background: var(--hover); }
.ship-card-more svg { display: block; fill: currentColor; }
/* The dot on ••• says a newer Blueprint is available. */
.ship-card-dot { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; background: var(--ink); border-radius: 50%; }
/* Studio's menu is the Mac's own, which may leave the window. This one opens above the
   card's buttons and is as wide as they are, so a narrow navigator never clips it. */
.ship-menu {
  position: absolute; z-index: 60; left: 0; right: 0; bottom: calc(100% + 6px); padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: 0 12px 32px var(--shadow-menu);
}
.ship-menu-item { width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 8px; color: var(--ink); text-align: left; background: transparent; border: 0; border-radius: var(--radius-row); cursor: pointer; }
.ship-menu-item:hover:not(:disabled) { background: var(--hover); }
.ship-menu-item:disabled { cursor: default; }
.ship-menu-item b { color: var(--ink); font: var(--type-label); }
.ship-menu-item:disabled b { color: var(--muted); }
.ship-menu-item small { color: var(--muted); font: var(--type-caption); }

/* Collapsed, the card is its status icon, and pressing it opens the Ship room. */
.ship-card-icon { width: var(--icon-button); height: var(--icon-button); display: grid; place-items: center; padding: 0; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-icon); cursor: pointer; }
.ship-card-icon:hover { background: var(--hover); }

/* The status mark: a turning ring in orange for a build on its way, a green disc with a
   check, the danger colour's triangle, and a dashed grey ring for nothing under way. */
.ship-icon { flex: none; display: block; overflow: visible; }
.ship-icon-track { fill: none; stroke: var(--activity-line); stroke-width: 2.2; }
.ship-icon-arc { fill: none; stroke: var(--activity); stroke-width: 2.2; stroke-linecap: round; }
.ship-icon.is-working { transform-origin: 50% 50%; animation: ship-turn 1s linear infinite; }
.ship-icon.is-attention .ship-icon-fill { fill: var(--danger); stroke: var(--danger); stroke-width: 1.2; stroke-linejoin: round; }
.ship-icon-glyph { fill: none; stroke: var(--raised); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@keyframes ship-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ship-icon.is-working,
  .ship-spinner { animation: none; }
}

/* ------------------------------------------------------------- narrow widths */

@container ship-main (max-width: 843px) {
  .ship-version { flex-direction: column; align-items: stretch; }
  .ship-version-side { flex-basis: auto; }
}
/* Too narrow for a label a week: every other one steps aside. */
@container ship-main (max-width: 640px) {
  .ship-axis-label.is-alternate { display: none; }
}
@container ship-main (max-width: 520px) {
  .ship-head { padding: 0 16px; }
  .ship-scroll { padding: 16px; }
}
/* On a phone the module's own navigator column stacks above the page. */
@media (max-width: 720px) {
  .ship-room.has-sidebar { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .ship-sidebar { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
}
