/* Gallery series selector (/gallery/ with more than one series).
   Markup comes from tools/build_where_flowers_wander.py; behavior from
   js/gallery-series.js. Without JS every series just shows stacked with its
   own heading, so nothing is ever unreachable.
   Look = the hamburger nav's links (.mimic-nav-panel a in nav-inquire.css):
   same font, weight, spacing, and highlight color. Only the size is smaller. */

:root {
  --series-on: oklch(72% 0.1 45);   /* = .mimic-nav-panel a.is-active */
  --series-off: oklch(46% 0.01 75); /* the "greyed out" other series */
}

/* <main> is a flex item (see .gallery-page in nav-inquire.css); without this
   the tab row's full width props the whole page wider than a phone screen */
main[data-series-mode] { min-width: 0; }

/* ---- the selector bar ---- */
.series-bar {
  position: sticky; top: 73px; z-index: 5; /* header: 14+44+14+1 */
  margin: -56px -32px 40px; padding: 22px 0 18px;
  background: var(--page-bg);
  overflow: hidden;
  /* names running off either edge fade out instead of being chopped */
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.series-tabs {
  position: relative; display: flex; width: max-content; gap: 44px;
  transition: transform 0.6s var(--ease);
}
.series-tab {
  position: relative; padding: 4px 0 8px;
  font-family: var(--font-body); font-weight: 300; letter-spacing: 0.02em;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  color: var(--series-off); white-space: nowrap; text-decoration: none;
  transition: color 0.4s ease;
}
.series-tab:hover { color: var(--series-on); }
.series-tab::after {
  content: ""; position: absolute; left: 50%; right: 50%; bottom: 0;
  height: 1px; background: var(--series-on);
  transition: left 0.5s var(--ease), right 0.5s var(--ease);
}
.series-tab.is-active { color: var(--series-on); }
.series-tab.is-active::after { left: 0; right: 0; }
.series-tab:focus-visible { outline: 1px solid var(--series-on); outline-offset: 6px; }

/* ---- panels ---- */
.series-panel__heading {  /* only seen without JS; same look as the tabs */
  font-family: var(--font-body); font-weight: 300; letter-spacing: 0.02em;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem); text-align: center;
  color: var(--series-on); margin: 0 0 32px;
}
.series-panel + .series-panel { margin-top: 96px; }

/* Once JS is running: one series at a time, the tab is its title */
.js-series .series-panel:not(.is-active) { display: none; }
.js-series .series-panel__heading { display: none; }
.js-series .series-panel + .series-panel { margin-top: 0; }

.series-panel.is-leaving { opacity: 0; transition: opacity 0.18s ease; }
.series-panel.is-entering .gallery-card {
  animation: series-card-in 0.6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes series-card-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ---- the series blurb, between the names and the paintings ----
   Copies the About page's body text (.about-page p: weight 300, 16px,
   1.75 line height), left-aligned in a ~560px column that sits centered
   on the page (2026-11-15: tried fully centered, went back to left). */
.series-blurb {
  max-width: 560px; margin: 0 auto 56px;
  color: oklch(90% 0.012 80);
}
/* pretty = no line ending on a lone word (like the cards' balanced captions) */
.series-blurb p { font-size: 16px; line-height: 1.75; font-weight: 300; margin: 0 0 22px; text-wrap: pretty; }
/* The subtitle (first line, "# " in the text file): the title font at 22px
   (2026-11-15; tried 16px and 18px first), lines set closer than the
   body text (1.35 vs 1.75). */
.series-blurb .series-blurb__lead { font-family: var(--font-title); font-weight: 400; font-size: 22px; line-height: 1.35; }
/* Variant: the whole blurb in the title font (Amiri). 19px Amiri reads the
   same size as the 16px body text - its lowercase letters are shorter. */
.series-blurb--title-font p {
  font-family: var(--font-title); font-weight: 400; font-size: 19px; line-height: 1.6;
}

/* Option: "Read more" opens the whole blurb in an overlay. Look copied from
   the Inquire overlay (.inquire-overlay-* in nav-inquire.css): dark panel,
   thin light border, x in the corner - but see-through, with the page
   blurred behind it. Native <dialog>: Esc closes it for free. */
.blurb-overlay {
  width: min(600px, calc(100vw - 32px)); max-height: 80vh; overflow-y: auto;
  padding: 44px 40px 28px;
  background: rgba(24, 24, 24, 0.78);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px;
  color: oklch(90% 0.012 80);
}
.blurb-overlay::backdrop { background: rgba(0, 0, 0, 0.45); }
.blurb-overlay p { font-size: 16px; line-height: 1.75; font-weight: 300; margin: 0 0 22px; text-wrap: pretty; }
.blurb-overlay__close {
  position: absolute; top: 14px; right: 14px; padding: 6px;
  background: none; border: none; cursor: pointer;
  color: oklch(80% 0.02 75); font-size: 20px; line-height: 1;
}
.blurb-overlay__close:hover { color: oklch(97% 0.012 80); }
.blurb-overlay[open] { animation: blurb-overlay-in 0.25s ease; }
@keyframes blurb-overlay-in { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 640px) { .blurb-overlay { padding: 40px 22px 18px; } }

/* Option: side column. The blurb is the grid's first item. Folded, it spans
   the whole row (same look as the main version). Opened on a wide screen,
   js/gallery-series.js adds .is-beside: it takes the left half of the grid
   for as many rows as its text needs, and "dense" lets the paintings fill
   the space beside it, then carry on full-width below. */
.gallery-grid:has(> .series-blurb--side) { grid-auto-flow: row dense; }
.gallery-grid:has(> .series-blurb--side) > .gallery-card { align-self: start; }
.gallery-grid > .series-blurb--side {
  grid-column: 1 / -1; justify-self: center; width: 100%; margin: 0 0 24px;
}
.gallery-grid > .series-blurb--side.is-beside {
  grid-column: 1 / span var(--blurb-cols, 2); grid-row: 1 / span var(--blurb-rows, 1);
  max-width: none; justify-self: stretch; align-self: start; margin: 0; padding-right: 16px;
}

/* "Read more" / "Read less": inline at the end of the sentence, same look
   as the site's Inquire buttons (.inquire-trigger), just smaller. Folding
   is done by js/gallery-series.js (.is-folded); without JS it all shows. */
.series-blurb__toggle {
  display: inline; margin-left: 0.35em; padding: 0;
  font: 700 12px/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase;
  color: oklch(72% 0.1 45); background: none; border: none; cursor: pointer;
  white-space: nowrap;
}
.series-blurb__toggle:hover { color: oklch(97% 0.012 80); }
.series-blurb__toggle:focus-visible { outline: 1px solid oklch(72% 0.1 45); outline-offset: 4px; } /* = .series-tab */
.series-blurb__toggle[hidden] { display: none; } /* display:inline above would beat [hidden] */
.series-blurb.is-folded .series-blurb__rest,
.series-blurb.is-folded .series-blurb__more,
.series-blurb.is-folded [data-blurb="close"],
.series-blurb:not(.is-folded) [data-blurb="open"] { display: none; }
/* folded, the cut paragraph is the last thing showing: no gap below it */
.series-blurb.is-folded p:has([data-blurb="open"]) { margin-bottom: 0; }

@media (max-width: 640px) {
  .series-bar { top: 61px; margin: -40px -20px 28px; } /* header: 12+36+12+1 */
  .series-tabs { gap: 28px; }
  .series-blurb { margin-bottom: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .series-tabs, .series-tab::after { transition: none; }
  .series-panel.is-entering .gallery-card { animation: none; }
  .series-panel.is-leaving { transition: none; }
}
