/* The order of a day's workout area under the week page's board
   (Views::Builder::DayWorkspace). On a phone the day's context bar
   (Views::Builder::ContextBar) sticks to the top, the day's guide
   (Views::Builder::DayGuide, folded away when the coach wants the room)
   comes next, then the editor; from 64rem the context bar runs across the
   top, then the editor with the guide in a sticky column beside it
   (builder-layout-guided, on a day that has one). */

.builder-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.builder-layout-context {
  order: 0;
  position: sticky;
  top: 0;
  z-index: 2;
}

.builder-layout-guide {
  order: 1;
}

.builder-layout-form {
  order: 2;
}

.builder-context {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--stratum-head);
  border-radius: var(--radius-md);
}

@media (min-width: 64rem) {
  /* With a guide (builder-layout-guided): the context bar across the top,
     then the editor and the guide side by side, the guide held in view
     while the editor scrolls. Without one, the column stays a flex column
     and the grid placements below do nothing. */
  .builder-layout-guided {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24rem;
    align-items: start;
  }

  .builder-layout-context {
    order: 1;
    grid-column: 1 / -1;
    position: static;
  }

  .builder-layout-form {
    order: 2;
  }

  .builder-layout-guide {
    order: 3;
    position: sticky;
    top: var(--space-2);
    max-height: calc(100vh - 2 * var(--space-2));
    overflow-y: auto;
  }
}

/* The editor follows the board's open day (week_board_controller.js). While
   the next day loads, the editor still shown steps back and the line above
   it says which day is coming; once it lands, the same line is read to a
   screen reader and hidden from sight. */
.day-workspace-frame {
  display: block;
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.day-workspace-frame-busy {
  opacity: 0.45;
  pointer-events: none;
}

.day-workspace-status {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-muted);
}

.day-workspace-status-quiet {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .day-workspace-frame {
    transition: none;
  }
}
