/*
 * The review stack: a deck of cards with the next few peeking out below, one
 * on the face, advancing on a timer you can see.
 *
 * ONE component, TWO surfaces. The homepage band and the Voices section of
 * every program landing page render the same markup from NYPL_Stack, so the
 * two can never drift apart. That is why this lives in its own file rather
 * than in rail.css: rail.css is registered by the homepage class and never
 * loads on a landing page.
 *
 * Differences between the two surfaces are data, not CSS: the homepage shows
 * the program name on each card (the cards come from different programs) and
 * the landing page does not (they are all the same program, so the label would
 * just repeat the page back at the reader).
 */

.nyh-sk{
  --sk-purple:#8D22C3;
  --sk-indigo:#534AB7;
  /* Darker than the brand coral so 17px initials clear 4.5:1 on the peach
     tint. Same hue, just taken down. */
  --sk-terra:#B04A24;
  --sk-gold:#F2B23B;
  --sk-deep:#261A48;
  --sk-ink:#2c2440;
  --sk-line:rgba(38,26,72,.12);
  --sk-lilac:#F1E4FA;
  --sk-peach:#FBE7DE;
  --sk-peri:#E4E0F5;
  --sk-paper:#FFFDFB;
  font-family:'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color:var(--sk-ink);
  padding-block:44px 40px;
}
.nyh-sk *{box-sizing:border-box}
.nyh-sk p,.nyh-sk figure,.nyh-sk blockquote,.nyh-sk figcaption{margin:0}
.nyh-sk button{font:inherit;color:inherit}
.nyh-sk :focus-visible{outline:2.5px solid var(--sk-purple);outline-offset:3px;border-radius:4px}

.nyh-sk-say{text-align:center;max-width:860px;margin:0 auto 18px}
/*
 * The heading WRAPS. An earlier draft held it on one line with white-space:
 * nowrap, which works for the homepage's fixed 34-character line and breaks
 * on a landing page, where the heading is written per program in the editor
 * and runs to twice that: at 4.2vw it would still render ~38px and overflow
 * the container at any viewport under about 1200px.
 */
.nyh-sk-say h3{
  margin:0 auto;
  font-weight:700;letter-spacing:-.02em;line-height:1.14;
  font-size:clamp(27px,3.1vw,44px);color:var(--sk-deep);
}

/*
 * The pile reserves its own depth. The deepest card sits 80px down and scaled,
 * so a deck occupies rather more than one card's height; the height here is
 * set by fit() to the tallest card PLUS that depth, so the controls below can
 * never be crowded however tall the longest review turns out to be. The value
 * below is only the pre-measurement fallback.
 */
.nyh-sk-pile{position:relative;height:400px;max-width:760px;margin:0 auto 14px}
.nyh-sk-card{
  position:absolute;top:0;left:0;right:0;
  border-radius:20px;padding:26px 34px;
  display:flex;flex-direction:column;background:var(--sk-paper);
  /*
   * Three layers rather than one: a hairline contact shadow, a short mid
   * shadow for the lift off the band, and a wide ambient one that fades out
   * instead of stopping. The single 44px blur at .55 it replaces pooled into
   * a dark bar right under the card and read as a smudge rather than depth.
   */
  box-shadow:
    0 1px 2px rgba(38,26,72,.05),
    0 7px 14px -8px rgba(38,26,72,.11),
    0 22px 44px -22px rgba(38,26,72,.20);
  transform-origin:50% 0;
  transition:transform .46s cubic-bezier(.16,1,.3,1),opacity .46s ease;
}
/*
 * The cards BEHIND carry a far lighter shadow. They used to inherit the face
 * card's, so four elevation shadows stacked 28px apart compounded into one
 * dark mass at the edges - the muddiness was four shadows deep, not one
 * shadow too strong. Each one now only has to separate its own sliver from
 * the sliver beneath it, and they fade back as they recede.
 */
.nyh-sk-card:not([data-pos="0"]){
  box-shadow:0 1px 2px rgba(38,26,72,.04),0 10px 20px -14px rgba(38,26,72,.14);
}
.nyh-sk-card[data-pos="2"]{box-shadow:0 1px 2px rgba(38,26,72,.035),0 10px 20px -15px rgba(38,26,72,.11)}
.nyh-sk-card[data-pos="3"]{box-shadow:0 1px 2px rgba(38,26,72,.03),0 10px 20px -16px rgba(38,26,72,.08)}

/* Each depth is one line. The translate has to outrun the scale, or the cards
   behind shrink out of sight instead of peeking. */
.nyh-sk-card[data-pos="0"]{transform:translateY(0) scale(1);opacity:1;z-index:4}
.nyh-sk-card[data-pos="1"]{transform:translateY(28px) scale(.955);opacity:1;z-index:3}
.nyh-sk-card[data-pos="2"]{transform:translateY(54px) scale(.912);opacity:1;z-index:2}
.nyh-sk-card[data-pos="3"]{transform:translateY(80px) scale(.872);opacity:.92;z-index:1}
.nyh-sk-card[data-pos="4"]{transform:translateY(100px) scale(.84);opacity:0;z-index:0}

/* A single review is not a deck: no pile behind it, and the card sits in the
   flow at its own height rather than being pinned. */
.nyh-sk--one .nyh-sk-pile{height:auto}
.nyh-sk--one .nyh-sk-card{position:relative;height:auto !important;transform:none;opacity:1}

.nyh-sk-head{
  display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;
  margin-bottom:18px;
}
/* With no program name the head row holds only the stars, so it stops being a
   row and the border under it would be a line under nothing. */
.nyh-sk--noprog .nyh-sk-head{justify-content:flex-start}
.nyh-sk-prog{font-weight:700;font-size:14px;letter-spacing:.07em;text-transform:uppercase;color:var(--sk-purple)}
.nyh-sk-stars{display:flex;gap:4px;flex:none}
.nyh-sk-stars svg{width:18px;height:18px;flex:none;color:var(--sk-gold)}
.nyh-sk-stars svg.off{color:rgba(38,26,72,.16)}

/* The quote is a <blockquote>, which themes love to decorate: a left rule, an
   indent, an italic lean, a big punched quote glyph. None of that is ours and
   all of it arrives from outside, so the element is reset rather than styled. */
.nyh-sk-q{
  font-size:20px;line-height:1.6;color:var(--sk-ink);text-wrap:pretty;
  border:0;padding:0;margin:0;font-style:normal;quotes:none;background:none;
  /*
   * CLAMPED, and it has to be. stack.js pins every card in a deck to the
   * tallest one so the peeking edges stay straight, so WITHOUT this a single
   * long review sets the height of the whole deck: one member writing six
   * paragraphs left every other card a short quote stranded at the top of a
   * 900px box, and nothing ever cut a quote off despite the publish screen
   * warning that cards do. Five lines rather than eight: the clamp is the
   * one lever that shortens the whole band, because the tallest card sets
   * the height of every card, the pile and the section around it.
   */
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5;
  overflow:hidden;
}
.nyh-sk-q::before,.nyh-sk-q::after{content:none;display:none}
.nyh-sk-q p{margin:0}

.nyh-sk-foot{margin-top:auto;display:flex;align-items:center;gap:13px;padding-top:22px}
.nyh-sk-av{
  width:48px;height:48px;border-radius:50%;flex:none;
  display:flex;align-items:center;justify-content:center;
  font-weight:600;font-size:17px;background:var(--sk-lilac);color:var(--sk-purple);
}
.nyh-sk-name{font-weight:600;font-size:17px;color:var(--sk-deep)}
/* One identity colour per card, carried by both the circle and the programme.
   Bound to the card's place in the DOM, not its depth, so a card keeps its
   colour as the deck turns. */
.nyh-sk-card:nth-child(3n+2) .nyh-sk-av{background:var(--sk-peach);color:var(--sk-terra)}
.nyh-sk-card:nth-child(3n+2) .nyh-sk-prog{color:var(--sk-terra)}
.nyh-sk-card:nth-child(3n+3) .nyh-sk-av{background:var(--sk-peri);color:var(--sk-indigo)}
.nyh-sk-card:nth-child(3n+3) .nyh-sk-prog{color:var(--sk-indigo)}

/* ---- The rating plate ---------------------------------------------------
   Program pages only. One number at size, five small stars beside it. The
   plate is deliberately NOT five big stars: the card below already carries a
   row of five, and two rows stacked read as the same object repeated.         */
.nyh-sk-ratingwrap{display:flex;justify-content:center}
.nyh-sk-rating{
  display:inline-flex;align-items:center;gap:18px;
  background:var(--sk-purple);border-radius:20px;padding:16px 28px;
  margin:0 auto 26px;
  box-shadow:0 12px 30px -14px rgba(141,34,195,.65);
}
.nyh-sk-rating__n{font-weight:700;font-size:38px;line-height:1;color:#fff}
.nyh-sk-rating__m{display:flex;flex-direction:column;gap:5px}
.nyh-sk-rating__s{display:flex;gap:2px}
.nyh-sk-rating__s svg{width:16px;height:16px;color:#FFC107}
.nyh-sk-rating__t{font-weight:400;font-size:13px;color:#F0E6F8}

.nyh-sk-controls{display:flex;align-items:center;justify-content:center;gap:18px}
.nyh-sk-arrow{
  width:46px;height:46px;border-radius:50%;cursor:pointer;padding:0;flex:none;
  display:flex;align-items:center;justify-content:center;
  border:1.5px solid rgba(38,26,72,.18);background:transparent;color:var(--sk-deep);
  transition:background .2s ease,color .2s ease,border-color .2s ease,transform .2s ease;
}
.nyh-sk-arrow:hover{background:var(--sk-purple);border-color:var(--sk-purple);color:#fff;transform:scale(1.06)}
.nyh-sk-arrow svg{width:17px;height:17px}

/* One element is both the position marker and the clock: the active dot
   stretches into a pill and fills over the interval, and its animationend is
   what deals the next review. */
.nyh-sk-dots{display:flex;align-items:center;gap:8px}
.nyh-sk-dot{
  width:9px;height:9px;flex:none;border:none;padding:0;cursor:pointer;overflow:hidden;
  border-radius:999px;background:rgba(141,34,195,.22);
  transition:width .42s cubic-bezier(.16,1,.3,1),background .3s ease;
}
.nyh-sk-dot:hover{background:rgba(141,34,195,.45)}
.nyh-sk-dot.on{width:36px;background:rgba(141,34,195,.18);cursor:default}
.nyh-sk-dot i{display:block;height:100%;width:0;border-radius:999px;background:var(--sk-purple)}
.nyh-sk-dot.on i{width:100%;animation:nyh-sk-fill 5200ms linear forwards}
@keyframes nyh-sk-fill{from{width:0}to{width:100%}}

@media (max-width:620px){
  .nyh-sk{padding-block:34px 30px}
  .nyh-sk-say{margin-bottom:16px}
  .nyh-sk-card{padding:26px 24px}
  /* A phone card is narrower, so the same eight lines hold far less text and
     cut mid-thought. Ten keeps roughly the same amount of the quote. */
  .nyh-sk-q{font-size:18px;-webkit-line-clamp:7}
  .nyh-sk-head{gap:10px}
  .nyh-sk-prog{font-size:12.5px}
  .nyh-sk-av{width:44px;height:44px;font-size:16px}
  .nyh-sk-name{font-size:16px}
  .nyh-sk-rating{gap:14px;padding:11px 20px;margin-bottom:20px;border-radius:18px}
  .nyh-sk-rating__n{font-size:32px}
  .nyh-sk-rating__s svg{width:14px;height:14px}
  .nyh-sk-rating__t{font-size:12.5px}
}
@media (prefers-reduced-motion:reduce){
  .nyh-sk *{animation-duration:.01ms !important;transition-duration:.01ms !important}
}

/* Inside the catalog's own letters panel, which brings its own padding and
   its own heading above it: the deck only needs to sit in the space. */
.nyh-sk--panel{padding-block:0}
.nyh-sk--panel .nyh-sk-pile{margin-bottom:18px}
