/* =========================================================================
   Éditions Hashtag — spotlight.css
   « À la une »: the scrolling band of the year's titles (template-parts/
   spotlight.php, inc/ui-spotlight.php, assets/js/spotlight.js).
   Requires base.css; consumes its tokens only. An ink band, as the author
   band of the product page: white text, the red double bar as the only
   colour (red is never small text on ink: 3.9:1).
   Two variants:
     .spotlight--hero     front page: cover + kicker, author, title, a short
                          text, price. One book in front, the next ones wait
                          on the right, dimmed.
     .spotlight--compact  Catalogue: a slim strip, three books across on
                          desktop, no text.
   The track is a native horizontal scroller with scroll snap: it swipes on
   touch screens and works without JavaScript. Every slide starts on the
   container's left edge (--spot-side), the page's own hang line.
   Breakpoints: md 760px · lg 1100px (literal, as in base.css).
   ========================================================================= */
.spotlight {
  --spot-line: rgba(255, 255, 255, .42);  /* control borders, idle ticks (4:1 on ink) */
  --spot-edge: rgba(255, 255, 255, .16);  /* 1px edge so a dark cover never dissolves in the band */
  --spot-dim: .34;                        /* the books waiting their turn */
  --spot-gap: var(--s-4);
  --spot-side: max(var(--margin), calc((100% - var(--max)) / 2)); /* the container's left edge */
  --spot-slide: calc(100% - 2 * var(--margin) - var(--s-6));
  --spot-cover: 112px;
  --spot-delay: 6000ms;                   /* set inline from the template (tick fill = one step) */
  position: relative; overflow: hidden; padding-block: var(--s-4) var(--s-5);
  background: var(--color-inverse-bg); color: var(--color-inverse-text);
}
/* whatever leaves the container's edges fades into the band instead of being cut by the screen */
.spotlight::before, .spotlight::after {
  content: ""; position: absolute; z-index: var(--z-raised); top: 0; bottom: 0; width: var(--spot-side); pointer-events: none;
}
.spotlight::before { left: 0; background: linear-gradient(to right, var(--color-inverse-bg) calc(100% - var(--s-4)), transparent); }
.spotlight::after { right: 0; background: linear-gradient(to left, var(--color-inverse-bg), transparent); }

/* ---------------------------------------------------------------- track */
.spotlight__track {
  display: flex; gap: var(--spot-gap); margin: 0; padding: var(--s-2) 0; list-style: none;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--spot-side);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.spotlight__track::-webkit-scrollbar { display: none; }
/* spacers (flex items, so the end one is never dropped as end padding can be): the first slide starts on
   the container's edge; the last one can still be scrolled to that edge */
.spotlight__track::before, .spotlight__track::after { content: ""; flex: 0 0 max(0px, calc(var(--spot-side) - var(--spot-gap))); }
.spotlight__track::after { flex-basis: max(0px, calc(var(--spot-side) - var(--spot-gap)), calc(100% - var(--spot-side) - var(--spot-slide) - var(--spot-gap))); }
.spotlight__slide { flex: 0 0 var(--spot-slide); min-width: 0; scroll-snap-align: start; transition: opacity var(--dur-slow) var(--ease-out); }
/* once spotlight.js runs: one book in front (hero) */
.spotlight--hero.is-enhanced .spotlight__slide { opacity: var(--spot-dim); }
.spotlight--hero.is-enhanced .spotlight__slide.is-active { opacity: 1; }

/* ---------------------------------------------------------------- one book */
.spot {
  display: grid; grid-template-columns: var(--spot-cover) minmax(0, 1fr); grid-template-rows: auto auto auto;
  grid-template-areas: "cover head" "text text" "foot foot";
  column-gap: var(--s-4); height: 100%; text-decoration: none; color: inherit;
}
.spot:focus-visible { outline: var(--rule-mid) solid var(--c-white); outline-offset: 4px; }
.spot__cover { grid-area: cover; display: block; align-self: start; }
.spot .cover { box-shadow: none; outline: var(--rule-hair) solid var(--spot-edge); outline-offset: -1px; }
.spot__head { grid-area: head; display: flex; flex-direction: column; min-width: 0; }
.spot__kicker {
  position: relative; display: flex; flex-wrap: wrap; gap: 2px var(--s-2); padding-top: calc(var(--double-h) + var(--s-3));
  font: var(--fw-medium) var(--fs-micro)/1.35 var(--font-sans); letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--color-inverse-muted);
}
/* the section opener's red double hairline: the band's only colour */
.spot__kicker::before {
  content: ""; position: absolute; left: 0; top: 0; width: var(--double-w); height: var(--double-h);
  border-top: var(--rule-mid) solid var(--color-accent); border-bottom: var(--rule-mid) solid var(--color-accent);
}
.spot__flag { color: var(--c-white); }
.spot__genre::before { content: "\00B7"; margin-right: var(--s-2); }
.spot__author { margin-top: var(--s-3); font: var(--fw-medium) var(--fs-label)/1.3 var(--font-sans); letter-spacing: var(--track-label); text-transform: uppercase; }
.spot__title {
  margin-top: var(--s-1); font: var(--fw-regular) 1.5rem/1.08 var(--font-serif); font-variation-settings: "opsz" 48; letter-spacing: -.012em;
  overflow-wrap: break-word; hyphens: manual; text-wrap: balance;
  text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 1px; text-underline-offset: .14em;
  transition: text-decoration-color var(--dur-fast);
}
.spot__text {
  grid-area: text; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  margin-top: var(--s-4); font-size: var(--fs-small); line-height: 1.5; color: var(--color-inverse-muted); text-wrap: pretty;
}
.spot__foot { grid-area: foot; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: var(--tap); margin-top: var(--s-2); }
.spot__price { font: var(--fw-medium) var(--fs-ui)/1.2 var(--font-sans); letter-spacing: .03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.spot__price .price-label { color: var(--color-inverse-muted); }
.spot__more {
  display: inline-flex; align-items: center; gap: .5em;
  font: var(--fw-medium) var(--fs-label)/1.2 var(--font-sans); letter-spacing: var(--track-label); text-transform: uppercase; white-space: nowrap;
}
.spot__more .icon { flex: none; color: var(--color-accent); transition: transform var(--dur-mid) var(--ease-out); }
.spot .cover { transition: transform var(--dur-slow) var(--ease-out); }
@media (hover: hover) {
  .spot:hover .cover { transform: translateY(var(--lift)); }
  .spot:hover .spot__title { text-decoration-color: var(--color-accent); }
  .spot:hover .spot__more .icon { transform: translateX(4px); }
}
.spot:focus-visible .spot__title { text-decoration-color: var(--color-accent); }

/* ---------------------------------------------------------------- bar: ticks, count, buttons */
.spotlight__bar { position: relative; z-index: calc(var(--z-raised) + 1); display: flex; align-items: center; gap: var(--s-4); margin-top: var(--s-3); }
.spotlight__bar[hidden] { display: none; }
.spotlight__ticks { display: none; flex: 0 1 380px; gap: var(--s-1); margin: 0; padding: 0; list-style: none; }
.spotlight__ticks > li { flex: 1 1 0; min-width: 0; }
.spotlight__tick { display: flex; align-items: center; width: 100%; height: var(--tap); padding: 0; border: 0; background: none; cursor: pointer; }
.spotlight__tick-line { position: relative; display: block; width: 100%; height: var(--rule-mid); overflow: hidden; background: var(--spot-line); transition: background-color var(--dur-fast); }
.spotlight__tick-fill { position: absolute; inset: 0; background: var(--c-white); transform: scaleX(0); transform-origin: 0 50%; }
.spotlight__tick:hover .spotlight__tick-line { background: var(--color-inverse-muted); }
.spotlight__tick[aria-current="true"] .spotlight__tick-fill { transform: scaleX(1); }
/* while the band moves by itself, the current tick fills during one step */
.spotlight.is-playing .spotlight__tick[aria-current="true"] .spotlight__tick-fill { animation: eh-spot-fill var(--spot-delay) linear both; }
@keyframes eh-spot-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.spotlight__tick:focus-visible { outline: var(--rule-mid) solid var(--c-white); outline-offset: -6px; }
.spotlight__count { margin: 0; font: var(--fw-medium) var(--fs-label)/1 var(--font-sans); letter-spacing: var(--track-label); font-variant-numeric: tabular-nums; color: var(--color-inverse-muted); white-space: nowrap; }
.spotlight__count > span { color: var(--c-white); }
.spotlight__buttons { display: flex; gap: var(--s-2); margin-left: auto; }
.spotlight__btn {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0;
  border: var(--rule-hair) solid var(--spot-line); border-radius: var(--radius-control); background: none; color: var(--c-white); cursor: pointer;
  transition: background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.spotlight__btn:hover { background: var(--c-white); border-color: var(--c-white); color: var(--c-ink); }
.spotlight__btn:focus-visible { outline: var(--rule-mid) solid var(--c-white); outline-offset: 3px; }
.spotlight__btn--toggle .icon--play { display: none; }
.spotlight.is-paused .spotlight__btn--toggle .icon--pause { display: none; }
.spotlight.is-paused .spotlight__btn--toggle .icon--play { display: block; }

/* ---------------------------------------------------------------- hero (front page) */
/* the smallest phones: the genre would wrap under the flag with its dot; the flag alone is enough */
@media (max-width: 359.98px) { .spotlight--hero .spot__genre { display: none; } }
@media (min-width: 760px) {
  .spotlight { --spot-gap: var(--s-7); padding-block: var(--s-6); }
  .spotlight--hero { --spot-slide: min(620px, 78%); --spot-cover: 188px; }
  .spotlight--hero .spot { grid-template-rows: auto auto 1fr; grid-template-areas: "cover head" "cover text" "cover foot"; column-gap: var(--s-6); }
  .spotlight--hero .spot__title { margin-top: var(--s-2); font-size: 2.125rem; line-height: 1.04; font-variation-settings: "opsz" var(--opsz-display); letter-spacing: -.02em; }
  .spotlight--hero .spot__title:is(.t-l, .t-xl) { font-size: 1.75rem; line-height: 1.08; }
  .spotlight--hero .spot__author { font-size: var(--fs-meta); }
  .spotlight--hero .spot__text { font-size: 1.0625rem; }
  .spotlight--hero .spot__foot { align-self: end; justify-content: flex-start; gap: var(--s-5); margin-top: var(--s-3); }
  .spotlight__ticks { display: flex; }
  .spotlight__bar { margin-top: var(--s-4); }
}
@media (min-width: 1100px) {
  .spotlight--hero { --spot-slide: min(800px, 64%); --spot-cover: 232px; padding-block: var(--s-7) var(--s-6); }
  .spotlight--hero .spot { column-gap: var(--s-7); }
  .spotlight--hero .spot__kicker { font-size: var(--fs-label); }
  .spotlight--hero .spot__title { font-size: clamp(2.5rem, 1rem + 2.4vw, 3.375rem); line-height: 1.02; }
  .spotlight--hero .spot__title:is(.t-l, .t-xl) { font-size: clamp(2.125rem, 1rem + 1.8vw, 2.75rem); line-height: 1.05; }
  .spotlight--hero .spot__text { margin-top: var(--s-5); font-size: var(--fs-body); line-height: 1.55; max-width: 30em; }
  .spotlight--hero .spot__more { font-size: var(--fs-small); }
  .spotlight__bar { margin-top: var(--s-5); }
}

/* ---------------------------------------------------------------- compact (Catalogue) */
.spotlight--compact { --spot-cover: 76px; --spot-slide: calc(100% - 2 * var(--margin) - var(--s-8)); display: flex; flex-direction: column; padding-block: var(--s-3) var(--s-4); }
.spotlight--compact .spotlight__bar { order: -1; margin-top: 0; margin-bottom: var(--s-1); }
/* the strip stops when its last book is in view (no empty band after it) */
.spotlight--compact .spotlight__track::after { flex-basis: max(0px, calc(var(--spot-side) - var(--spot-gap))); }
.spotlight--compact .spotlight__count { display: none; }
.spotlight__label {
  display: flex; align-items: center; gap: var(--s-3); margin: 0;
  font: var(--fw-semibold) var(--fs-label)/1.2 var(--font-sans); letter-spacing: var(--track-section); text-transform: uppercase;
}
.spotlight__label::before {
  content: ""; flex: none; width: 28px; height: var(--double-h);
  border-top: var(--rule-mid) solid var(--color-accent); border-bottom: var(--rule-mid) solid var(--color-accent);
}
.spotlight--compact .spot { grid-template-rows: auto 1fr; grid-template-areas: "cover head" "cover foot"; align-items: start; }
.spotlight--compact .spot__kicker { padding-top: 0; }
.spotlight--compact .spot__kicker::before { content: none; }
.spotlight--compact .spot__author { margin-top: var(--s-2); font-size: var(--fs-micro); }
.spotlight--compact .spot__title { font-size: 1.1875rem; line-height: 1.14; font-variation-settings: "opsz" 28; letter-spacing: -.003em; }
.spotlight--compact .spot__foot { align-self: end; min-height: 0; margin-top: var(--s-2); }
.spotlight--compact .spot__price { font-size: var(--fs-small); }
@media (min-width: 760px) {
  .spotlight--compact { --spot-gap: var(--s-6); --spot-slide: calc((100% - 2 * var(--margin) - var(--spot-gap)) / 2.25); padding-block: var(--s-4) var(--s-5); }
}
@media (min-width: 1100px) {
  .spotlight--compact { --spot-cover: 88px; --spot-gap: var(--s-7); --spot-slide: calc((min(100% - 2 * var(--margin), var(--max)) - 2 * var(--spot-gap)) / 3); }
  .spotlight--compact .spot__title { font-size: 1.375rem; }
}

@media (prefers-reduced-motion: reduce) {
  .spotlight.is-playing .spotlight__tick[aria-current="true"] .spotlight__tick-fill { animation: none; }
}
@media print { .spotlight { display: none !important; } }
