/* Layout fixes for the Studio decks, found by tools/check_layout.py (clipped text and overlapping elements at every
   build step, at desktop and phone sizes). Loaded after session.css by the decks that need them. */

/* ── phones: the slide scrolls, so a box takes the height of its content instead of being squeezed into the frame,
   where its text was shrunk and then cut off (the R labs' "What each part does" list, the text beside a calculator,
   and a self-study question once it is checked, whose answer now goes below the question rather than beside it) ── */
@container pcstage (max-width: 620px) {
  .ics .pc-scene > .code-grid, .ics .pc-scene > .grid2 { flex: none !important; }
  .ics .pc-scene .calc-text { overflow: visible !important; }
  .ics .pc-scene.self-rev .ask-body { flex: none; grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto !important; }
  .ics .pc-scene.self-rev .self-w, .ics .pc-scene.self-rev .selfans { overflow: visible; }
  /* a question with a long case or table: the answer boxes go below it at full size instead of being squeezed */
  .ics .pc-scene .ask { height: auto; }
  .ics .pc-scene .ask .ask-body { flex: none; }
  .ics .pc-scene .ask .ask-body > *, .ics .pc-scene .ask .self-w { flex: none !important; align-self: stretch; }
  .ics .pc-scene .ask .ask-body.side > .ctx { max-height: none; }
  .ics .pc-scene .ask .ask-body.side .task { height: auto; justify-content: flex-start; }
  /* the R window's side panes are too narrow for every tab name: only the open tab is shown, not half a word */
  .rs-env .rs-tabs span:not(.on), .rs-plot .rs-tabs span:not(.on) { display: none; }
  /* a formula wraps rather than running off the edge of the screen */
  .ics .pc-scene .pc-math { white-space: normal; }
}

/* ── peer activities: when the card also carries the challenge (presenting and live rooms), it ran past the bottom
   of the slide; the card is set a little smaller and its boxes a little more compact ── */
body:not(.m-self).ics .peer:has(.pr.gm) { font-size: .92em; }
.ics .peer .pr { padding-top: .32em; padding-bottom: .32em; line-height: 1.36; }
.ics .peer .pr + .pr { margin-top: .3em; }
.ics .peer ol.ps li { padding-top: .26em; padding-bottom: .26em; }

/* ── self-study: a peer activity whose steps ran into the module link below them. The steps take more of the
   width (so they wrap onto fewer lines) and sit closer together. A slide opts in with cls: 'top tight'. ── */
body.m-self.ics .pc-scene.tight .peer { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); }
.ics .pc-scene.tight .peer ol.ps li { padding-top: .2em; padding-bottom: .2em; line-height: 1.32; }
.ics .pc-scene.tight .peer ol.ps li + li { margin-top: .22em; }
/* the same, for a slide whose case box above the peer card is long: the case is set a little smaller */
.ics .pc-scene.tight.long-case .wp { font-size: .76em !important; }

/* ── the code boxes of the R labs (with the Copy button): a long line wraps inside the box instead of scrolling
   sideways out of sight. The Copy button still copies the lines exactly as written. ── */
.ics .ainput .rcode { white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: hidden; }
