/* Alder: the shared carousel's look (js/alder-carousel.js). Loaded on every
   Alder page by partials/_shell-head.tpl.php, after the page sheets, so the
   phone rows below win over each grid's own one-column phone layout.
   Owns: the pause and play button (.al-autobtn), the "2 / 6" count
   (.al-car__count), and the phone card grids as swipe rows. The arrows and
   their bar are alder.css's (.al-round, .al-rownav, .al-rownav-bar).
   Desktop is untouched: every rule but the button's sits under 768px. */

/* Pause and play for a moving row: a .al-round in the arrows' colourway,
   left of them on the same bar. It shows the action it will take. */
.al-autobtn { margin-right: 10px; border-color: transparent; background: var(--al-sage); color: var(--al-ink); box-shadow: var(--al-raise); cursor: pointer; }
.al-autobtn svg { grid-area: 1 / 1; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.al-autobtn .al-autobtn__play { display: none; fill: currentColor; stroke-width: 1.5; }
.al-autobtn.is-stopped .al-autobtn__pause { display: none; }
.al-autobtn.is-stopped .al-autobtn__play { display: block; }
@media (hover: hover) { .al-autobtn:hover { border-color: transparent; background: #BCE6C8; } }

.al-car__count { display: none; }

@media (min-width: 768px) {
  .al-car__bar { display: none !important; } /* a wide grid is a grid, whatever it measures */
}

@media (max-width: 767.98px) {
  /* Every row's bar sits on the left on a phone: the Ask button holds the
     bottom right corner, and the controls must never pass under it. */
  .al-rownav-bar { justify-content: flex-start; }
  .al-rownav { align-items: center; }
  .al-car__count {
    display: block; min-width: 56px; text-align: center;
    font: 600 14px/1 var(--al-sans); font-variant-numeric: tabular-nums; color: var(--al-muted);
  }

  /* The card grids (keep in step with GRIDS in js/alder-carousel.js): one
     row, full bleed to the screen edges with the cards lined up on the
     page's column, each 85% of it so the next one peeks in. Cards keep
     their own height (one long card does not stretch the rest). Native
     swipe and snap; the scrollbar hidden. */
  html body.al-theme :is(.al-modgrid, .lrn-cards, .al-blog__grid, .al-art__related .al-posts, .vlib-grid, .qz-tiles, .sg-cards) {
    display: grid; grid-auto-flow: column; grid-auto-columns: 85%;
    grid-template-columns: none; grid-template-rows: none; gap: 14px; align-items: start;
    max-width: none; margin-inline: calc(50% - 50vw); padding-inline: calc(50vw - 50%); padding-block: 4px 10px;
    overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
    /* The snap inset must equal that padding, but a percentage here reads
       the row's own (full screen) width, so it takes the sitewide phone
       gutter, which is where every page's column starts; the script then
       copies the exact padding in. */
    scroll-snap-type: x mandatory; scroll-padding-inline: var(--al-gutter, 24px);
    scrollbar-width: none;
  }
  html body.al-theme :is(.al-modgrid, .lrn-cards, .al-blog__grid, .al-art__related .al-posts, .vlib-grid, .qz-tiles, .sg-cards)::-webkit-scrollbar { display: none; }
  html body.al-theme :is(.al-modgrid, .lrn-cards, .al-blog__grid, .al-art__related .al-posts, .vlib-grid, .qz-tiles, .sg-cards) > * {
    min-width: 0; scroll-snap-align: start;
  }
  /* The quiz, study guide and video pages clip their column sideways; on a
     phone their rows reach past it to the screen edge (the root's
     overflow-x: clip still holds the page to the screen). */
  html body.al-theme :is(.qz-wrap, .sg-wrap, .vlib) { overflow-x: visible; }
}
