/**
 * LAYOUT: SLIDER (opt-in; agilehomedesign.com's "slider"). One large photo at
 * a time, swiped or stepped sideways; the words sit in the start third and
 * the next pieces wait as small previews from the one-third mark to the end
 * edge. The description is not shown. Without the script it is still a row
 * of full-screen photos you can swipe or scroll (scroll snap).
 * Built to dist/fluid-layout-slider.min.css (export "./layout-slider"); link
 * it after core, with assets/js/slider.js. Contract: _docs/layouts.md.
 *
 *   <div class="layout-slider" data-slider data-advance="7000">   (data-advance: ms between slides; "0" or absent: none)
 *     <ol class="layout-slider__track" role="list" tabindex="0" aria-label="The work">
 *       <li class="layout-slider__slide" id="oak-table" aria-label="1 of 12: Oak table">
 *         <picture>…<img src="oak.jpg" alt="…" width="1200" height="900" fetchpriority="high"></picture>
 *         <div class="layout-slider__cap piece-words">
 *           <p class="layout-slider__intro">We build in solid wood.</p>   (first slide only, optional)
 *           <span class="piece-words__kind">Tables</span>
 *           <span class="piece-words__name">Oak table</span>
 *           <span class="piece-words__shown">Shown: white oak, oiled</span>   (optional)
 *           <span class="piece-words__links"><a href="/inquiries/?about=oak-table">Inquire →</a>
 *             <button type="button" data-photos="oak-table">3 photos</button></span>   (2+ photos; assets/js/layouts.js)
 *         </div>
 *         <ul data-lightbox data-for="oak-table" hidden> … </ul>
 *       </li>
 *     </ol>
 *     <div class="layout-slider__rail">
 *       <p class="layout-slider__count" aria-hidden="true"><b data-slider-n>01</b> / 12</p>
 *       <button type="button" class="layout-slider__step" data-step="-1" aria-label="Previous piece">←</button>
 *       <button type="button" class="layout-slider__step" data-step="1" aria-label="Next piece">→</button>
 *     </div>
 *     <nav class="layout-slider__previews" aria-label="All pieces" data-previews>
 *       <a href="#oak-table" data-go="0" aria-label="Oak table"><img src="oak.jpg" alt="" width="1200" height="900" loading="lazy"><span>01</span></a> …
 *     </nav>
 *   </div>
 *
 * A piece with no photo is left out. The rail and previews do nothing
 * without the script; hide them with [data-slider]:not(.is-ready) if a site
 * needs a no-JS look without them (slider.js adds .is-ready).
 * Look hooks, read with fallbacks and never declared: --layout-dark,
 * --layout-light, --layout-shade, --layout-name-font, --layout-rail (the
 * previews' height).
 */
@layer components {
  .layout-slider {
    --_rail: var(--layout-rail, clamp(5.25rem, 13vh, 8.25rem));
    --_low: clamp(1.25rem, 4.5vh, 2.75rem);
    position: relative;
    block-size: 100svh;
    overflow: hidden;
    background: var(--layout-dark, #111);
    color: var(--layout-light, oklch(96% 0.012 75));
  }

  .layout-slider picture { display: contents; }

  .layout-slider__track {
    display: flex;
    block-size: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .layout-slider__track::-webkit-scrollbar { display: none; }
  .layout-slider__track:focus-visible { outline: 2px solid currentColor; outline-offset: -6px; }

  .layout-slider__slide {
    position: relative;
    flex: 0 0 100%;
    block-size: 100%;
    margin: 0;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .layout-slider__slide img {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    max-inline-size: none;
    max-block-size: none;
    border-radius: 0;
    object-fit: cover;
  }

  .layout-slider__slide::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: var(--layout-shade, linear-gradient(180deg, rgb(0 0 0 / 0.3), transparent 22%, transparent 55%, rgb(0 0 0 / 0.62)));
  }

  .layout-slider__cap {
    position: absolute;
    z-index: 1;
    inset-inline-start: var(--page-edge);
    inset-block-end: var(--_low);
    inline-size: calc(33.333% - 2 * var(--page-edge));
    text-shadow: 0 1px 12px rgb(0 0 0 / 0.45);
  }

  .layout-slider__intro {
    margin: 0 0 clamp(1rem, 4vh, 2.5rem);
    font-family: var(--layout-name-font, var(--font-display));
    font-weight: var(--weight-light);
    font-size: var(--step-1);
    line-height: 1.45;
  }

  .layout-slider__rail {
    position: absolute;
    z-index: 2;
    inset-inline: 33.333% var(--page-edge);
    inset-block-end: calc(var(--_low) + var(--_rail) + 0.875rem);
    display: flex;
    gap: var(--space-4);
    align-items: center;
    font-size: var(--step--2);
    letter-spacing: var(--tracking-caps);
    text-shadow: 0 1px 10px rgb(0 0 0 / 0.4);
  }

  .layout-slider__count { margin: 0; margin-inline-end: auto; font-variant-numeric: tabular-nums; }
  .layout-slider__count b { font-weight: var(--weight-semibold); }

  .layout-slider__step {
    all: unset;
    /* core's button hover paints the accent; these stay text */
    --_btn-bg-hover: transparent;
    --_btn-color-hover: currentColor;
    cursor: pointer;
    min-inline-size: 2.75rem;
    min-block-size: 2.75rem;
    text-align: center;
    font-size: var(--step-1);
  }

  .layout-slider :is(.layout-slider__step, .layout-slider__previews a):focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

  .layout-slider__previews {
    position: absolute;
    z-index: 2;
    inset-inline: 33.333% 0;
    inset-block-end: var(--_low);
    display: flex;
    gap: var(--space-2);
    block-size: var(--_rail);
    padding-inline-end: var(--page-edge);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .layout-slider__previews::-webkit-scrollbar { display: none; }

  .layout-slider__previews a {
    position: relative;
    flex: 0 0 auto;
    block-size: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    color: inherit;
    opacity: 0.78;
    background: rgb(255 255 255 / 0.08);
  }

  @media (prefers-reduced-motion: no-preference) {
    .layout-slider__previews a { transition: opacity var(--duration-normal) var(--ease-fluid); }
  }

  .layout-slider__previews a:is(:hover, [aria-current]) { opacity: 1; }
  .layout-slider__previews a[aria-current] { box-shadow: inset 0 0 0 1px currentColor; }

  .layout-slider__previews img {
    inline-size: 100%;
    block-size: 100%;
    max-inline-size: none;
    max-block-size: none;
    border-radius: 0;
    object-fit: cover;
  }

  .layout-slider__previews span {
    position: absolute;
    inset-inline-start: var(--space-2);
    inset-block-end: var(--space-1);
    font-size: var(--step--2);
    letter-spacing: var(--tracking-caps);
    font-weight: var(--weight-semibold);
    text-shadow: 0 1px 6px rgb(0 0 0 / 0.6);
  }

  @media (orientation: portrait), (max-width: 47.5rem) {
    .layout-slider { --_rail: var(--layout-rail, 4.75rem); }
    .layout-slider__cap { inline-size: auto; inset-inline-end: var(--page-edge); inset-block-end: calc(var(--_low) + var(--_rail) + 3.25rem); }
    .layout-slider__rail { inset-inline-start: var(--page-edge); }
    .layout-slider__previews a { aspect-ratio: 3 / 4; }
  }

  /* ---------- Piece words (every layout file carries this block) ---------- */
  .piece-words { display: grid; gap: var(--space-1); font-style: normal; text-align: start; }

  .piece-words__kind {
    margin: 0;
    font-size: var(--step--2);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    opacity: 0.85;
  }

  .piece-words__name {
    margin: 0;
    font-family: var(--layout-name-font, var(--font-display));
    font-weight: var(--weight-light);
    font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.6rem);
    line-height: 1.05;
  }

  .piece-words__shown { margin: 0; font-size: var(--step--1); opacity: 0.9; }

  .piece-words__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    align-items: center;
    margin: var(--space-2) 0 0;
    font-size: var(--step--2);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  .piece-words__links a { color: inherit; text-decoration: none; border-block-end: 1px solid currentColor; padding-block-end: 2px; }

  .piece-words__links button {
    all: unset;
    /* core's button hover paints the accent; these stay text */
    --_btn-bg-hover: transparent;
    --_btn-color-hover: currentColor;
    cursor: pointer;
    opacity: 0.85;
    border-block-end: 1px solid transparent;
    padding-block-end: 2px;
  }

  .piece-words__links button:is(:hover, :focus-visible) { opacity: 1; border-block-end-color: currentColor; }
  /* The ring is the words' own colour: light over photos, ink on paper. */
  .piece-words__links :is(a, button):focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
}
