/* Alder homepage, education and partner site (homepage.tpl.php). Loaded
   after alder.css and alder-compact.css. Owns: the search typeahead list
   (.al-tahead), the modules grid (.al-mod*),
   the lesson carousel and the study tools
   (.al-lesson*, .al-ptool; the pause button and the count are the shared
   carousel's, css/alder-carousel.css), the
   partner band (.al-pcta*), the video row (.al-vid*), the closing band
   (.al-close*), the partner logo marquee (.al-marq*), the figure slots
   beside each section header (.al-sechead, .al-figslot; Wren's isometric
   figures) and the scrub hooks ([data-scrub-item]) that Wren's
   motion/scrub.js drives. The hero keeps css/alder-hero.css.
   Phone first; one breakpoint at 921px. */

/* Typeahead: a sheet under the finder pill, inside the form so blur and
   pointer logic stay simple. Options are 44px links. */
.al-finder { position: relative; }
.al-tahead {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30;
  margin: 0; padding: 6px; list-style: none;
  background: #fff; color: var(--al-ink); border-radius: 16px;
  box-shadow: 0 18px 48px rgba(14, 42, 27, .18), 0 0 0 1px var(--al-line);
}
.al-tahead[hidden] { display: none; }
.al-tahead li a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
  border-radius: 10px; color: inherit; text-decoration: none;
  font: 400 16px/1.3 var(--al-sans);
}
.al-tahead li[aria-selected="true"] a, .al-tahead li a:hover { background: var(--al-paper); }
.al-tahead__all a { margin-top: 4px; border-top: 1px solid var(--al-line); border-radius: 0 0 10px 10px; color: var(--al-moss); font-weight: 600; }
.al-tahead__t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-tahead__t mark { background: none; color: inherit; font-weight: 700; }
.al-tahead__k { flex: none; font: 500 12px/1 var(--al-sans); color: var(--al-muted); letter-spacing: .02em; text-transform: uppercase; }
/* The rotating suggestion list yields while the typeahead is open. */
.al-finder.is-open .al-finder__sug { display: none; }

/* Shared card picture frame. */
.al-mod__pic, .al-lesson__pic, .al-vid__pic {
  position: relative; display: block; overflow: hidden; border-radius: var(--al-r);
  background: var(--al-sand-2);
}
.al-mod__pic img, .al-lesson__pic img, .al-vid__pic img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}

/* Modules: one card per module with lessons. */
.al-modgrid { display: grid; gap: 20px; margin: 0; padding: 0; list-style: none; }
.al-modgrid > li { min-width: 0; }
.al-mod { position: relative; display: grid; gap: 14px; }
.al-mod__pic { aspect-ratio: 16 / 10; }
.al-mod__kick { font: 600 13px/1.2 var(--al-sans); color: var(--al-moss); letter-spacing: .02em; text-transform: uppercase; }
.al-mod__h { margin-top: 6px; font: 700 22px/1.2 var(--al-display); letter-spacing: -.015em; color: var(--al-ink); }
.al-mod__h a { color: inherit; text-decoration: none; }
.al-mod__h a::after { content: ""; position: absolute; inset: 0; border-radius: var(--al-r); }
.al-mod__ex { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--al-body); }
.al-mod__subs { margin-top: 8px; font: 500 13px/1.5 var(--al-sans); color: var(--al-muted); }
@media (hover: hover) { .al-mod:hover .al-mod__h a { color: var(--al-moss); } }
@media (min-width: 560px) { .al-modgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 921px) {
  .al-modgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 24px; }
  .al-mod__h { font-size: 24px; }
}
/* Modules sit on a card surface so the wireframe behind never runs through
   their text; the picture bleeds to the card's rounded edge. */
.al-mod { padding: 10px 10px 18px; border: 1px solid var(--al-line); border-radius: calc(var(--al-r) + 6px); background: rgba(250, 250, 248, .92); }
.al-mod__body { padding-inline: 6px; }

/* Lesson carousel (js/alder-lessonrow.js shuffles it and moves it on): snap
   cards about a fifth narrower than the house row, each in a white frame
   with the study tools' hairline. The row is a scroller, so it keeps room
   under the cards for their shadow; the tools below give that room back. */
.al-lessonrow { margin: 0; padding-block: 4px 18px; list-style: none; grid-auto-columns: min(76%, 264px); }
.al-lessonrow > li { display: grid; min-width: 0; }
.al-lessonrow > li[hidden] { display: none; }
.al-lesson {
  position: relative; display: grid; grid-template-rows: auto 1fr; gap: 10px;
  padding: 8px 8px 14px; border-radius: calc(var(--al-r) + 4px); background: #fff;
  box-shadow: inset 0 0 0 1px var(--al-line), 0 12px 18px -16px rgba(14, 42, 27, .5);
  transition: box-shadow .18s, transform .18s;
}
/* The picture sits inside the frame, its corners concentric with the card's. */
.al-lesson__pic { aspect-ratio: 16 / 9; border-radius: calc(var(--al-r) - 4px); }
/* The lesson's place in the course, not its place in the row. */
.al-lesson__n {
  position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center;
  height: 24px; padding: 0 9px; border-radius: 999px;
  background: rgba(14, 42, 27, .82); color: #fff; font: 600 11.5px/1 var(--al-sans); letter-spacing: .03em;
}
/* The meta line sits on the card's floor, so it lines up along the row. */
.al-lesson__body { display: flex; flex-direction: column; padding-inline: 6px; }
.al-lesson__kick { font: 600 11.5px/1.3 var(--al-sans); color: var(--al-moss); letter-spacing: .02em; text-transform: uppercase; }
.al-lesson__h { margin-top: 4px; font: 700 16.5px/1.3 var(--al-display); letter-spacing: -.01em; color: var(--al-ink); }
.al-lesson__h a { color: inherit; text-decoration: none; }
.al-lesson__h a::after { content: ""; position: absolute; inset: 0; border-radius: calc(var(--al-r) + 4px); }
.al-lesson__meta { margin-top: auto; padding-top: 8px; font: 500 12.5px/1.4 var(--al-sans); color: var(--al-muted); }
@media (hover: hover) {
  .al-lesson:hover { box-shadow: inset 0 0 0 1.5px var(--al-brand), 0 12px 18px -16px rgba(14, 42, 27, .5); transform: translateY(-1px); }
  .al-lesson:hover .al-lesson__h a { color: var(--al-moss); }
}
@media (min-width: 921px) { .al-lessonrow { grid-auto-columns: 296px; } }
@media (prefers-reduced-motion: reduce) { .al-lesson { transition: none; } .al-lesson:hover { transform: none; } }
/* Study tools: quizzes, study guide, walkthrough as wide tappable rows. */
.al-practice { display: grid; gap: 12px; margin: 14px 0 0; padding: 0; list-style: none; }
.al-ptool {
  display: grid; grid-template-columns: 44px 1fr 24px; align-items: center; gap: 14px;
  min-height: 72px; padding: 14px 16px; border-radius: var(--al-r);
  background: #fff; box-shadow: inset 0 0 0 1px var(--al-line); color: var(--al-ink); text-decoration: none;
  transition: box-shadow .18s, transform .18s;
}
.al-ptool__ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--al-paper); }
.al-ptool__ico svg { width: 24px; height: 24px; fill: none; stroke: var(--al-moss); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.al-ptool__t { display: grid; gap: 2px; min-width: 0; }
.al-ptool__t strong { font: 700 17px/1.25 var(--al-display); letter-spacing: -.01em; }
.al-ptool__t span { font: 400 14px/1.45 var(--al-sans); color: var(--al-body); }
.al-ptool__go { color: var(--al-moss); }
@media (hover: hover) { .al-ptool:hover { box-shadow: inset 0 0 0 1.5px var(--al-brand); transform: translateY(-1px); } }
@media (min-width: 921px) { .al-practice { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; } }

/* Partner logo marquee: one set of tiles repeated; every track rolls left
   by exactly its own width plus the gap, so the join never shows. Hover
   and keyboard focus pause it; a finger or mouse drags it (js/alder-drag.js,
   below). The wrapper clips, never the page: no horizontal overflow at 390. */
.al-marq { --g: 20px; display: flex; gap: var(--g); overflow-x: clip; padding-block: 8px 4px; margin-inline: calc(-1 * var(--al-gutter, 20px)); padding-inline: 0; -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent); }
.al-marq__track { display: flex; flex: none; gap: var(--g); margin: 0; padding: 0; list-style: none; animation: al-marq var(--al-marq-dur, 40s) linear infinite; animation-delay: var(--al-marq-delay, 0s); }
.al-marq:hover .al-marq__track,
.al-marq:focus-within .al-marq__track { animation-play-state: paused; }
/* Drag (js/alder-drag.js): while the user holds or flings it, and for two
   seconds after, the tracks sit where the hand left them (.is-manual,
   --al-marq-x); then the animation resumes from that spot (--al-marq-delay). */
.al-marq { touch-action: pan-y; cursor: grab; }
.al-marq.is-drag { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.al-marq.is-drag .al-marq__a { pointer-events: none; }
.al-marq.is-manual .al-marq__track { animation: none; transform: translateX(var(--al-marq-x, 0px)); }
.al-marq:focus-visible { outline: 2px solid var(--al-moss); outline-offset: 4px; border-radius: 8px; }
@keyframes al-marq { to { transform: translateX(calc(-100% - var(--g))); } }
.al-marq__i { flex: none; width: 116px; }
.al-marq__a { display: grid; justify-items: center; gap: 8px; min-height: 44px; padding: 6px 4px 10px; border-radius: var(--al-r); color: var(--al-ink); text-decoration: none; text-align: center; }
.al-marq__a:focus-visible { outline: 2px solid var(--al-moss); outline-offset: 2px; }
.al-marq__logo { display: grid; place-items: center; width: 84px; height: 84px; overflow: hidden; border-radius: 24px; border: 1px solid var(--al-line); background: #fff; }
.al-marq__logo img { display: block; width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.al-marq__logo--photo img { object-fit: cover; padding: 0; }
.al-marq__logo--wire { background: var(--al-paper); }
.al-marq__logo--wire img { opacity: .7; padding: 18px; }
.al-marq__name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font: 600 13px/1.25 var(--al-sans); }
.al-marq__n { font: 500 12px/1.2 var(--al-sans); color: var(--al-muted); margin-top: -4px; }
@media (hover: hover) { .al-marq__a:hover .al-marq__name { color: var(--al-moss); } }
@media (min-width: 921px) {
  .al-marq { --g: 28px; margin-inline: 0; }
  .al-marq__i { width: 132px; }
  .al-marq__logo { width: 96px; height: 96px; border-radius: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .al-marq { display: block; margin-inline: 0; }
  .al-marq__track { animation: none; flex-wrap: wrap; justify-content: center; row-gap: 12px; }
  .al-marq__track[aria-hidden="true"] { display: none; }
}
.al-pcta__band {
  display: grid; gap: 20px; margin-top: 36px; padding: 28px 24px; border-radius: var(--al-r);
  background: var(--al-paper);
}
.al-pcta__h { font: 700 24px/1.15 var(--al-display); letter-spacing: -.02em; color: var(--al-ink); }
.al-pcta__p { margin-top: 10px; max-width: 56ch; font-size: 16px; line-height: 1.55; color: var(--al-body); }
.al-pcta__acts { margin-top: 0; }
@media (min-width: 921px) {
  .al-pcta__band { grid-template-columns: 1fr auto; align-items: center; padding: 36px 40px; }
  .al-pcta__h { font-size: 28px; }
}

/* Videos: lesson posters with a play mark. */
.al-vidrow { margin: 0; padding-block: 0; list-style: none; }
.al-vid { position: relative; display: grid; gap: 12px; }
.al-vid__pic { aspect-ratio: 16 / 9; background: var(--al-ink); }
.al-vid__pic img { opacity: .92; }
.al-vid__play { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; transform: translate(-50%, -50%); color: var(--al-ink); filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .3)); }
.al-vid__kick { font: 600 12.5px/1.3 var(--al-sans); color: var(--al-moss); letter-spacing: .02em; text-transform: uppercase; }
.al-vid__h { margin-top: 4px; font: 700 18px/1.3 var(--al-display); letter-spacing: -.01em; color: var(--al-ink); }
.al-vid__h a { color: inherit; text-decoration: none; }
.al-vid__h a::after { content: ""; position: absolute; inset: 0; border-radius: var(--al-r); }
.al-vid__meta { margin-top: 6px; font: 500 13px/1.4 var(--al-sans); color: var(--al-muted); }
@media (hover: hover) { .al-vid:hover .al-vid__h a { color: var(--al-moss); } }

/* Staged opening: while Learn is closed the cards are plain text, so they
   lose their hover lift, and an "Opening soon" tag replaces the arrow. */
.al-soon {
  display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--al-paper); color: var(--al-moss);
  font: 600 12px/1 var(--al-sans); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.al-more--soon { color: var(--al-muted); }
.al-ptool--soon { grid-template-columns: 44px 1fr; }
.al-ptool--soon .al-soon { grid-column: 2; justify-self: start; }
@media (min-width: 560px) {
  .al-ptool--soon { grid-template-columns: 44px 1fr auto; }
  .al-ptool--soon .al-soon { grid-column: auto; justify-self: end; }
}
.al-ptool--soon:hover { box-shadow: inset 0 0 0 1px var(--al-line); transform: none; }
.al-close__soon { font: 600 16px/1.4 var(--al-sans); color: var(--al-sage); }

/* Closing band on ink. */
.al-close .al-h2 { max-width: 20ch; }
.al-close__p { margin-top: 18px; max-width: 58ch; font-size: 17px; line-height: 1.6; color: rgba(250, 250, 248, .82); }
.al-close .al-actions { margin-top: 26px; }

/* Figure slots. Each section header sits in .al-sechead with an .al-figslot
   holding its isometric figure (Wren, partials/_fig-<section>.tpl.php, root
   .al-fig, drawn and moved by motion/figures/figures.css: it fills its
   column up to 560px). The figure is always BESIDE the copy, never behind
   it (Eric, 11-02): on a phone it is a contained block between the header
   and the section's content; from 921px it is the right column of the
   header, the copy stacking in the left one. An empty slot takes no room,
   so a section without a figure reads as before. No overflow clip here:
   a figure's parts may slide past its box. */
.al-sechead { display: grid; gap: 20px; }
.al-figslot { position: relative; min-width: 0; }
.al-figslot:empty { display: none; }
body.al-home .al-sechead > .al-head { margin-bottom: 0; }
body.al-home .al-sechead { margin-bottom: 20px; }
@media (max-width: 920.98px) {
  .al-figslot { max-width: 400px; margin-inline: auto; }
}
/* Phones (Eric, 11-23: "smaller intro animations"): the figure drops to
   124px wide, about 41% of its old 300px height, and sits in the header's
   top right corner beside the label and title, which keep that corner
   clear. The lede and the link run full width under both. The closing
   band's figure is centred at the same scale. The figure keeps its motion
   (and stays still under reduced motion, motion/figures/figures.css). */
@media (max-width: 767.98px) {
  .al-sechead:has(> .al-figslot:not(:empty)) { grid-template-columns: minmax(0, 1fr) 124px; }
  .al-sechead:has(> .al-figslot:not(:empty)) > .al-head { grid-column: 1 / -1; grid-row: 1; }
  .al-sechead:has(> .al-figslot:not(:empty)) > .al-head > :first-child { grid-column: 1 / -1; grid-row: 1; min-height: 96px; padding-right: 136px; }
  /* The "All ..." link leaves the title's line (the figure holds that
     corner now) and closes the header, under the lede. */
  body.al-home .al-sechead:has(> .al-figslot:not(:empty)) > .al-head--more .al-lede { grid-row: 2; }
  body.al-home .al-sechead:has(> .al-figslot:not(:empty)) > .al-head--more .al-more { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
  .al-sechead > .al-figslot:not(:empty) { grid-column: 2; grid-row: 1; align-self: start; width: 124px; margin: 0; }
  .al-figslot--closing { width: 148px; margin-inline: auto; }
}
@media (min-width: 921px) {
  .al-sechead { margin-bottom: 56px; }
  .al-sechead > .al-head { margin-bottom: 0; }
  /* With a figure in the slot: two columns, the header's copy stacking in the left one. */
  .al-sechead:has(> .al-figslot:not(:empty)) { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); column-gap: 56px; align-items: end; }
  .al-sechead:has(> .al-figslot:not(:empty)) > .al-head { grid-template-columns: minmax(0, 1fr) auto; }
  .al-sechead:has(> .al-figslot:not(:empty)) > .al-head .al-lede { grid-column: 1 / -1; }
  .al-close__grid { max-width: 880px; }
  .al-close__grid:has(> .al-figslot:not(:empty)) { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); column-gap: 56px; align-items: center; }
}
/* Scrub hooks (motion/scrub.js). Each [data-scrub] track gets --p, each
   [data-scrub-item] its own --ip; the item drifts up and fades in as its
   window opens. The fallback of 1 means the page is finished without JS,
   and the engine itself writes 1 everywhere under reduced motion. Transform
   and opacity only; nothing here moves layout. */
[data-scrub-item] { opacity: var(--ip, 1); transform: translateY(calc((1 - var(--ip, 1)) * 24px)); }
@media (prefers-reduced-motion: reduce), print {
  [data-scrub-item] { opacity: 1; transform: none; }
}
