/*
 * The journey of a video (plan 21, package C; spec §4.4): seven stations from discovery to
 * publishing, joined by a line that turns green as far as the work went, then the button of the
 * step to take next. Done is green with a check, under way an amber ring, next filled amber,
 * later a plain ring, locked a dashed one with a small lock; each state is said in words too.
 * On a phone the stations scroll sideways under the finger, snapping, while the button stays in
 * view under them. The editor's compact bar sits over its timeline on one line, in its dark.
 */

/* Where the module puts the bar: hidden until the journey answers. */
.lq-journey-slot {
  margin-block-end: 24px;
}

.lq-journey-slot--compact {
  margin-block-end: 0;
}

.lq-journey-slot[hidden],
.lq-journey [hidden] {
  display: none;
}

.lq-journey {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 16px 20px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
}

.lq-journey__steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lq-journey__step {
  position: relative;
  min-width: 0;
}

/* The line from the station before to this one, from centre to centre, behind the nodes. */
.lq-journey__step + .lq-journey__step::before {
  content: "";
  position: absolute;
  inset-block-start: 17px;
  inset-inline: -50% 50%;
  height: 2px;
  background: var(--color-border-default);
}

/* As far as the work went. */
.lq-journey__step--done + .lq-journey__step::before {
  background: var(--color-status-success);
}

.lq-journey__link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 4px;
  color: var(--color-text-primary);
  text-align: center;
  text-decoration: none;
  border-radius: var(--radius-md);
}

.lq-journey__node {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-full);
  background: var(--color-bg-surface);
  color: var(--color-text-muted);
}

.lq-journey__node > .lq-icon {
  width: 16px;
  height: 16px;
}

/* The small badge on a node: a check once done, a lock while locked. */
.lq-journey__mark {
  position: absolute;
  inset-block-end: -5px;
  inset-inline-end: -7px;
  display: none;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-bg-surface);
  border-radius: var(--radius-full);
}

.lq-journey__mark > .lq-icon {
  display: none;
  width: 10px;
  height: 10px;
}

.lq-journey__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

.lq-journey__label {
  font: 500 13px / 20px var(--font-ui);
}

/* The state after the name, said and never shown («، تمّ»), kept on the name's line. */
.lq-journey__said {
  white-space: nowrap;
}

.lq-journey__hint {
  display: -webkit-box;
  overflow: hidden;
  color: var(--color-text-muted);
  font: 400 12px / 18px var(--font-ui);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.lq-journey__step--done .lq-journey__node {
  border-color: var(--color-status-success);
  color: var(--color-status-success);
}

.lq-journey__step--done .lq-journey__mark {
  display: grid;
  background: var(--color-status-success);
  color: var(--color-text-inverse);
}

.lq-journey__step--done .lq-journey__check,
.lq-journey__step--locked .lq-journey__lock {
  display: block;
}

.lq-journey__step--active .lq-journey__node {
  border-color: var(--color-accent-amber);
  border-style: dashed;
  color: var(--color-text-primary);
}

.lq-journey__step--next .lq-journey__node {
  border-color: var(--color-accent-amber);
  background: var(--color-accent-amber);
  box-shadow: 0 0 0 4px var(--color-bg-selection-soft);
  color: var(--color-text-on-accent);
}

.lq-journey__step--next .lq-journey__label {
  font-weight: 700;
}

.lq-journey__step--todo .lq-journey__label,
.lq-journey__step--locked .lq-journey__label {
  color: var(--color-text-secondary);
}

.lq-journey__step--locked .lq-journey__node {
  border-color: var(--color-border-default);
  border-style: dashed;
  background: var(--color-bg-subtle);
}

.lq-journey__step--locked .lq-journey__mark {
  display: grid;
  background: var(--color-bg-muted);
  color: var(--color-text-secondary);
}

/*
 * Plan 23 (Figma 15, 217:296): the bar's head, its name with the count in words; on a phone the
 * share done as a pill and a meter under them. Then, under the stations, the step under way.
 */
.lq-journey__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.lq-journey__title {
  margin: 0;
  color: var(--color-text-primary);
  font: 700 16px / 24px var(--font-ui);
}

.lq-journey__pct {
  display: none;
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: var(--color-status-success-bg);
  color: var(--color-status-success);
  font: 600 12px / 20px var(--font-ui);
}

.lq-journey__sum {
  flex-basis: 100%;
  margin: 0;
  color: var(--color-text-secondary);
  font: 400 13px / 20px var(--font-ui);
}

.lq-journey__meter {
  display: none;
  width: 100%;
  height: 6px;
}

.lq-journey__meter-base {
  fill: var(--color-bg-muted);
}

.lq-journey__meter-fill {
  fill: var(--color-status-success);
}

.lq-journey__running {
  margin: 0;
  color: var(--color-text-secondary);
  font: 400 13px / 20px var(--font-ui);
}

/* The next step's button, or the journey's end; and what holds the rest back. */
.lq-journey__next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0;
}

/* The button may take two lines on the narrowest phones rather than push the page sideways. */
.lq-journey__go {
  max-width: 100%;
  height: auto;
  min-height: 40px;
  padding-block: 8px;
  white-space: normal;
}

.lq-journey__go.lq-btn--sm {
  min-height: 32px;
  padding-block: 4px;
}

.lq-journey__complete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-primary);
  font: 600 14px / 22px var(--font-ui);
}

.lq-journey__complete > .lq-icon {
  width: 18px;
  height: 18px;
  color: var(--color-status-success);
}

.lq-journey__note {
  margin: 0;
  color: var(--color-text-secondary);
  font: 400 13px / 20px var(--font-ui);
}

/* «أعد المحاولة» under a refusal or a dropped network, in the slot. */
.lq-journey__retry {
  margin-block-start: 8px;
}

.lq-journey__fix {
  color: var(--color-text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The projects list's way to a video's journey, as the row's other buttons. */
.lq-project__journey:hover {
  color: var(--color-text-primary);
}

/* A phone: the stations scroll sideways, each snapping into place; the button stays in view. */
@media (max-width: 767px) {
  .lq-journey {
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
  }

  .lq-journey__steps {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }

  /* Wide enough for «سحب إلى الاستوديو» on one line. */
  .lq-journey__step {
    flex: 0 0 112px;
    scroll-snap-align: start;
  }

  /* The share done, as a pill by the name and a meter under the head (Figma 15, 217:296). */
  .lq-journey__pct {
    display: inline-block;
  }

  .lq-journey__meter {
    display: block;
    margin-block-start: -4px;
  }

  /* The button fills the line, as the frame draws it. */
  .lq-journey__go {
    width: 100%;
  }
}

/*
 * From the tablet up (Figma 15, 223:2274): the button beside the head on its first line, the
 * stations under both, then the step under way and what holds the rest back.
 */
@media (min-width: 768px) {
  .lq-journey:not(.lq-journey--compact) {
    display: grid;
    grid-template-areas:
      "head next"
      "steps steps"
      "running running"
      "note note";
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .lq-journey:not(.lq-journey--compact) > .lq-journey__head {
    grid-area: head;
  }

  .lq-journey:not(.lq-journey--compact) > .lq-journey__steps {
    grid-area: steps;
  }

  .lq-journey:not(.lq-journey--compact) > .lq-journey__running {
    grid-area: running;
  }

  .lq-journey:not(.lq-journey--compact) > .lq-journey__next {
    grid-area: next;
  }

  .lq-journey:not(.lq-journey--compact) > .lq-journey__note {
    grid-area: note;
  }
}

/* The editor's: one line over the timeline, the hints in each station's tooltip. */
.lq-journey--compact {
  flex-flow: row wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 6px 16px;
  border: 0;
  border-block-start: 1px solid var(--color-border-default);
  border-radius: 0;
}

.lq-journey--compact .lq-journey__steps {
  display: flex;
  flex: 1 1 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.lq-journey--compact .lq-journey__step {
  flex: 1 0 auto;
}

/* A short stroke between stations in place of the line under them. */
.lq-journey--compact .lq-journey__step + .lq-journey__step::before {
  inset-block-start: calc(50% - 1px);
  inset-inline: -4px calc(100% - 4px);
}

.lq-journey--compact .lq-journey__link {
  flex-direction: row;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
}

.lq-journey--compact .lq-journey__node {
  width: 24px;
  height: 24px;
  border-width: 1.5px;
}

.lq-journey--compact .lq-journey__node > .lq-icon {
  width: 12px;
  height: 12px;
}

.lq-journey--compact .lq-journey__step--next .lq-journey__node {
  box-shadow: none;
}

.lq-journey--compact .lq-journey__mark {
  inset-block-end: -4px;
  inset-inline-end: -5px;
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.lq-journey--compact .lq-journey__mark > .lq-icon {
  width: 8px;
  height: 8px;
}

.lq-journey--compact .lq-journey__label {
  font: 500 12px / 18px var(--font-ui);
  white-space: nowrap;
}

.lq-journey--compact .lq-journey__next {
  flex: none;
}

.lq-journey--compact .lq-journey__note {
  flex-basis: 100%;
  font-size: 12px;
  line-height: 18px;
}

/* Below the editor's own width the compact bar says its stations by their icons alone. */
@media (max-width: 1279px) {
  .lq-journey--compact .lq-journey__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .lq-journey--compact .lq-journey__step--next .lq-journey__label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }
}

/*
 * Where the editor keeps to the window (editor.a6dd18ee.css counts its bar, its timeline and its foot), its
 * panels and its stage give the compact bar its 45 pixels, so the page does not scroll for it.
 */
@media (min-width: 1280px) {
  .lq-editor:has(> .lq-journey-slot--compact:not([hidden])) .lq-editor__panel {
    max-height: calc(100vh - var(--lq-editor-bar) - var(--lq-tl-height) - 88px - 45px);
  }

  .lq-editor:has(> .lq-journey-slot--compact:not([hidden])) .lq-editor__stage-box {
    max-height: calc(100vh - var(--lq-editor-bar) - var(--lq-tl-height) - 200px - 45px);
  }
}

/* The editor waits for a wider screen on a phone; so does its bar. */
@media (max-width: 767px) {
  .lq-journey-slot--compact {
    display: none;
  }
}

/* A station that is a link says so under the pointer (last: it outweighs the names' rules). */
a.lq-journey__link:hover .lq-journey__label {
  text-decoration: underline;
  text-underline-offset: 3px;
}
