/* Slipway shell: the layer that floats over the 3D view, the top strip, the stage (view controls, start card,
   progress read-out), the step list, the veil and the messages. Owner: flow.
   Every value comes from tokens.css; shared controls are in base.css. */

/* ------------------------------------------------------------------ layout of the floating layer */
.app { position: fixed; inset: 0; overflow: hidden; }
.hud {
  position: absolute; inset: var(--gutter);
  display: grid; gap: var(--gutter);
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  pointer-events: none;
}
.top { grid-column: 1 / -1; grid-row: 1; display: flex; justify-content: space-between; gap: var(--gutter); min-width: 0; }
.top > *, .panel, .log, .stage__top > *, .stage__mid > *, .tools { pointer-events: auto; }
.top__left { min-width: 0; }
.top__right { flex: none; }

.stage { container: stage / inline-size; grid-column: 2; grid-row: 2; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: var(--gutter); min-width: 0; min-height: 0; }
.stage__top { display: flex; justify-content: center; min-width: 0; }
.stage__mid { display: grid; place-items: center; min-height: 0; }
.stage__bottom { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: var(--s-4); }
.stage__axes { justify-self: start; min-width: var(--gizmo); min-height: var(--gizmo); }

/* ------------------------------------------------------------------ top strip */
.brand { display: flex; align-items: center; gap: var(--s-3); height: var(--h-control); padding: 0 var(--s-3) 0 var(--s-2); border-radius: var(--r-2); color: var(--ink); text-decoration: none; transition: background var(--t-1) var(--ease); }
.brand:hover { background: var(--hull-raise-2); }
.brand:active { background: var(--hull-sunk); }
.brand__mark { width: var(--icon-l); height: var(--icon-l); flex: none; }
.brand__rail { fill: none; stroke: var(--cold); stroke-width: 1.5; stroke-linecap: square; }
.brand__block { fill: var(--warm); }
.brand__name { font: 600 var(--fs-lead)/1 var(--font-label); letter-spacing: 0.1em; text-transform: uppercase; }

/* open files: chips of base.css, with the file name in the number font */
.files { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.files:empty { display: none; }
.files__arrow { color: var(--ink-3); }
.files .chip__text { font: 400 var(--fs-small)/1 var(--font-num); }

/* state of the connection to the converter: an icon, words, the address */
.link { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-3); color: var(--ink-2); font-size: var(--fs-control); white-space: nowrap; }
.link__icon { color: var(--cold); }
.link__icon--off { display: none; }
.link__addr { color: var(--ink-3); font-size: var(--fs-small); }
.link[data-link="busy"] .link__icon--on, .link[data-link="connecting"] .link__icon--on { animation: blink 1.1s steps(2, jump-none) infinite; }
.link[data-link="lost"] { color: var(--hot); }
.link[data-link="lost"] .link__icon--on { display: none; }
.link[data-link="lost"] .link__icon--off { display: block; color: var(--hot); }
/* who has signed in: a long name is cut, and whole in what a screen reader is told */
.user { gap: var(--s-2); padding: 0 var(--s-3); }
.user__name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ view controls */
.viewmode { padding: var(--s-2) var(--s-4); gap: var(--s-4); }
.viewmode__note { color: var(--ink-3); font-size: var(--fs-small); line-height: var(--lh-snug); }
.viewmode .seg--cap .seg__face { min-width: var(--w-switch); }
.tools { grid-column: 2; gap: var(--s-2); }
.scale { justify-self: end; display: grid; grid-template-columns: auto auto; align-items: center; column-gap: var(--s-3); padding: var(--s-2) 0; color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-snug); white-space: nowrap; }
.scale small { grid-column: 2; color: var(--ink-2); font-size: var(--fs-small); }
.scale__box { width: var(--icon-s); height: var(--icon-s); border: var(--hair) solid var(--line-bright); }

/* ------------------------------------------------------------------ progress read-out (top of the stage) */
.seq {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "clock now pct" "track track track";
  column-gap: var(--s-6); row-gap: var(--s-4); width: min(100%, var(--w-seq)); padding: var(--s-4) var(--s-5) var(--s-3);
}
.seq__clock, .seq__pct, .seq__now { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.seq__clock { grid-area: clock; min-width: 7ch; }
.seq__pct { grid-area: pct; align-items: flex-end; }
.seq__big { font: 400 var(--fs-readout)/1 var(--font-num); letter-spacing: -0.01em; white-space: nowrap; color: var(--ink); }
.seq__big small { margin-left: var(--s-1); font-size: 0.5em; color: var(--ink-3); }
.seq__now { grid-area: now; gap: var(--s-1); padding-left: var(--s-6); border-left: var(--hair) solid var(--line-strong); }
.seq__kicker { display: flex; align-items: center; gap: var(--s-2); color: var(--cold); font: 600 var(--fs-small)/var(--lh-tight) var(--font-ui); }
.seq__title { font: 600 var(--fs-lead)/var(--lh-tight) var(--font-ui); overflow-wrap: anywhere; }
.seq__note { color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-snug); }
.track { grid-area: track; display: grid; grid-template-columns: repeat(var(--n, 13), minmax(0, 1fr)); gap: var(--s-1); }
.track li { display: flex; flex-direction: column; gap: var(--s-2); }
.track i { position: relative; display: block; height: var(--h-bar-s); overflow: hidden; border-radius: var(--r-1); background: var(--line-strong); }
.track i::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--cold); }
.track span { font: 400 var(--fs-label)/1 var(--font-num); color: var(--ink-3); }
.track .is-done span { color: var(--ink-2); }
.track .is-run i { background: var(--cold-line); }
.track .is-run i::after { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--p, 0%) - var(--stripe)); width: var(--stripe); background: var(--ink); animation: blink 1.1s steps(2, jump-none) infinite; }
.track .is-run span { color: var(--cold-strong); font-weight: 700; }
.track .is-fail i { background: var(--hot-line); }
.track .is-fail i::before { background: var(--hot); }
.track .is-fail span { color: var(--hot); font-weight: 700; }
.seq.is-failed { border-color: var(--hot-line); }
.seq.is-failed .seq__kicker { color: var(--hot); }
.seq.is-failed .seq__pct .seq__big { color: var(--hot); }

/* ------------------------------------------------------------------ step list (in the right panel) */
.steps { display: flex; flex-direction: column; padding: var(--s-3) 0; }
.step { --w-no: var(--h-line); --w-mark: calc(var(--h-line) - var(--stripe)); position: relative; display: grid; grid-template-columns: var(--w-no) var(--w-mark) minmax(0, 1fr) auto; column-gap: var(--s-3); padding: var(--s-2) var(--s-4); border-left: var(--stripe) solid transparent; }
.step::before { content: ""; position: absolute; left: calc(var(--s-4) + var(--w-no) + var(--s-3) + var(--w-mark) / 2 - var(--hair)); top: calc(var(--s-2) + var(--h-line) + var(--stripe)); bottom: calc(var(--s-2) * -1 + var(--stripe)); width: var(--hair); background: var(--line-strong); }
.step:last-child::before { display: none; }
.step__no { color: var(--ink-3); font: 400 var(--fs-small)/var(--h-line) var(--font-num); text-align: right; }
.step__mark { position: relative; z-index: 1; display: grid; place-items: center; width: var(--w-mark); height: var(--h-line); color: var(--ink-3); }
.step__main { display: flex; flex-direction: column; min-width: 0; }
.step__title { font-weight: 500; line-height: var(--h-line); color: var(--ink); }
.step__sub { color: var(--ink-3); font-size: var(--fs-small); line-height: var(--lh-snug); }
.step__more { grid-column: 3 / -1; min-width: 0; }
.step__more .progress { margin-top: var(--s-3); }
.step__meta { color: var(--ink-2); font: 400 var(--fs-small)/var(--h-line) var(--font-num); text-align: right; white-space: nowrap; }
.step.is-done .step__mark { color: var(--cold); }
.step.is-done::before { background: var(--cold-line); }
.step.is-wait .step__title, .step.is-skip .step__title { color: var(--ink-2); font-weight: 400; }
.step.is-wait .step__mark::before { content: ""; width: calc(var(--chip) / 2); height: calc(var(--chip) / 2); border: var(--hair) solid var(--line-bright); border-radius: var(--r-1); }
.step.is-wait .step__meta, .step.is-skip .step__meta { color: var(--ink-3); font-family: var(--font-ui); }
.step.is-run { padding-block: var(--s-3); border-left-color: var(--cold); background: var(--cold-wash); }
.step.is-run .step__no, .step.is-run .step__meta { color: var(--cold-strong); }
.step.is-run .step__title { font-weight: 600; }
.step.is-run .step__sub { color: var(--ink-2); }
.step.is-run::before { top: calc(var(--s-3) + var(--h-line) + var(--stripe)); }
.step.is-fail { padding-block: var(--s-3); border-left-color: var(--hot); background: var(--hot-wash); }
.step.is-fail .step__no, .step.is-fail .step__mark, .step.is-fail .step__meta { color: var(--hot); }
.step.is-fail .step__title { font-weight: 600; }
.step.is-fail .step__sub { color: var(--ink-2); }
.step.is-fail::before { display: none; }
.step.is-skip::before { background: var(--line); }

/* live figures of the running step */
.step__read { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin-top: var(--s-3); }
.step__read div { display: flex; flex-direction: column; gap: var(--s-1); }
.step__read dt { color: var(--ink-3); font: 500 var(--fs-small)/var(--lh-tight) var(--font-ui); }
.step__read dd { font-size: var(--fs-small); color: var(--ink); white-space: nowrap; }

/* a failure, shown inside the step where it happened */
.fault { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-4); }
.fault__msg { font: 600 var(--fs-lead)/var(--lh-snug) var(--font-ui); color: var(--ink); text-wrap: balance; }
.fault__why { color: var(--ink-2); font-size: var(--fs-control); line-height: var(--lh-snug); }
.fault__todo { display: flex; flex-direction: column; gap: var(--s-2); padding-left: var(--s-5); list-style: decimal; color: var(--ink); font-size: var(--fs-control); line-height: var(--lh-snug); }
.fault__todo li::marker { font-family: var(--font-num); color: var(--ink-3); }
.fault__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-2); }
.fault .textlink { align-self: flex-start; }

/* ------------------------------------------------------------------ start screen */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--s-5); width: min(100%, var(--w-drop)); padding: var(--s-7) var(--s-7) var(--s-6); border-style: dashed; border-color: var(--line-control); text-align: center; transition: border-color var(--t-2) var(--ease), background var(--t-2) var(--ease); }
.dropzone__corner { position: absolute; width: var(--icon-l); height: var(--icon-l); border: 0 solid var(--cold); }
.dropzone__corner--tl { top: calc(var(--hair) * -1); left: calc(var(--hair) * -1); border-top-width: var(--stripe); border-left-width: var(--stripe); }
.dropzone__corner--tr { top: calc(var(--hair) * -1); right: calc(var(--hair) * -1); border-top-width: var(--stripe); border-right-width: var(--stripe); }
.dropzone__corner--bl { bottom: calc(var(--hair) * -1); left: calc(var(--hair) * -1); border-bottom-width: var(--stripe); border-left-width: var(--stripe); }
.dropzone__corner--br { bottom: calc(var(--hair) * -1); right: calc(var(--hair) * -1); border-bottom-width: var(--stripe); border-right-width: var(--stripe); }
.dropzone__icon { width: var(--icon-xl); height: var(--icon-xl); color: var(--cold); }
.dropzone h1 { margin-top: calc(var(--s-3) * -1); font: 600 var(--fs-title)/var(--lh-tight) var(--font-ui); text-wrap: balance; }
.dropzone__lead { max-width: 46ch; margin-top: calc(var(--s-4) * -1); color: var(--ink-2); }
.dropzone__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-4); }
.dropzone__actions .btn { min-width: var(--w-btn-lg); }
.formats { display: flex; flex-direction: column; gap: var(--s-3); align-self: stretch; padding: var(--s-4) 0; border-block: var(--hair) solid var(--line); text-align: left; }
.formats > div { display: flex; align-items: center; gap: var(--s-4); }
.formats dt { flex: none; width: var(--w-label); color: var(--ink-3); font: 500 var(--fs-small)/var(--lh-tight) var(--font-ui); }
.formats dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.formats__note { margin-left: var(--s-2); color: var(--ink-3); font-size: var(--fs-small); }
.dropzone__uses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); align-self: stretch; text-align: left; }
.dropzone__uses li { display: flex; gap: var(--s-3); color: var(--ink-3); font-size: var(--fs-small); line-height: var(--lh-snug); }
.dropzone__uses .icon { margin-top: var(--s-1); color: var(--ink-2); }
.dropzone__uses b { display: block; color: var(--ink); font-size: var(--fs-control); font-weight: 600; }
.is-dragging .dropzone { border-color: var(--cold); background: var(--hull); }

/* shown while a file is dragged over the window */
.dragveil { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--hull-veil); }
.dragveil__box { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-7) var(--s-8); border: var(--hair) dashed var(--cold); border-radius: var(--r-3); color: var(--ink-2); }
.dragveil__box .icon { width: var(--icon-xl); height: var(--icon-xl); color: var(--cold); }
.dragveil__box strong { font: 600 var(--fs-title)/var(--lh-tight) var(--font-ui); color: var(--ink); }

/* a short message that goes away by itself */
.toast { position: absolute; left: 50%; bottom: var(--s-8); z-index: 50; translate: -50% 0; display: flex; align-items: center; gap: var(--s-3); max-width: calc(100% - var(--s-7)); padding: var(--s-3) var(--s-5); background: var(--hull); box-shadow: var(--shadow-pop); border-color: var(--cold-line); font-size: var(--fs-control); }
.toast > .icon { color: var(--cold); }
.toast[data-level="warning"] { border-color: var(--warm-line); }
.toast[data-level="warning"] > .icon { color: var(--warm); }
.toast[data-level="error"] { border-color: var(--hot-line); }
.toast[data-level="error"] > .icon { color: var(--hot); }

/* ------------------------------------------------------------------ narrow windows (about 1000 to 1280 px) */
/* the row under the view, when the stage has no room for all of it: the note of the scale goes first, then the
   words of the shading. The toolbar keeps every button, and stays clear of the axes on its left. */
@container stage (max-width: 52.4rem) { .scale { display: none; } }
@container stage (max-width: 48rem) { .tools .seg__text { display: none; } }
@container stage (max-width: 40rem) {
  .scale { display: none; }
  .stage__bottom { grid-template-columns: auto minmax(0, 1fr); }
  /* narrower than its buttons in one line, the toolbar takes two: the axes beside it are that high already */
  .tools { justify-self: center; flex-wrap: wrap; justify-content: center; padding-block: var(--s-2); }
}
@media (max-width: 1279px) {
  .link__addr, .viewmode__note, .scale small, .files .chip__state, .files .chip__label, .tools .seg__text, .user__name { display: none; }
  .seq { column-gap: var(--s-5); padding-inline: var(--s-4); }
  .seq__now { padding-left: var(--s-5); }
}
