/* Book gallery: layout and the few pieces MADS doesn't cover. Colours, type, buttons, cards, chips and stats come
   from mads.css (the MA Design System), so the gallery follows the site's light and dark themes. */

body { margin: 0; min-height: 100vh; color: var(--mads-theme-text); font: var(--mads-text-default); }
.bg-nav, .bg-wrap { max-width: 1360px; margin: 0 auto; box-sizing: border-box; padding-inline: clamp(16px, 4vw, 56px); }

/* Top bar: the MA logo back to the home page, and the theme toggle */
.bg-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 18px; }
.bg-home { display: inline-flex; border-radius: var(--mads-radius-small); }
.bg-home:focus-visible { outline: 2px solid var(--mads-color-neon-pink); outline-offset: 4px; }
.bg-logo { display: block; width: 56px; height: auto; }

.bg-wrap { padding-block: clamp(24px, 4vw, 40px) clamp(24px, 4vw, 56px); display: flex; flex-direction: column; gap: 24px; }

/* Heading */
.bg-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; }
.bg-intro { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bg-eyebrow { font: var(--mads-label-xsmall); letter-spacing: .12em; text-transform: uppercase; color: var(--mads-theme-text-muted); }
.bg-h1 { margin: 0; font-family: var(--mads-font-display); font-weight: 800; font-size: clamp(2.25rem, 5vw, 4.25rem); line-height: .95; letter-spacing: -.03em; }
.bg-lede { margin: 0; font: var(--mads-text-large); color: var(--mads-theme-text-muted); max-width: 52ch; }
.bg-head-side { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 28px; }
.bg-kit-toggle { min-height: 44px; }

/* The island and the panel beside it */
.bg-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.bg-stage { flex: 999 1 640px; min-width: 0; position: relative; aspect-ratio: 16 / 9; max-height: 680px; border-radius: var(--mads-radius-xlarge); overflow: hidden; background: #17122B; box-shadow: 0 30px 60px -30px rgb(23 18 43 / .55); transition: background-color .8s; }
.bg-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
.bg-stage canvas:active { cursor: grabbing; }
.bg-fail { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 32px; text-align: center; color: #F4F0FB; font: var(--mads-text-large); }
.bg-fail[hidden] { display: none; }
.bg-overlay { position: absolute; left: 16px; right: 16px; bottom: 14px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; pointer-events: none; }
.bg-pill { font: var(--mads-label-xsmall); letter-spacing: .08em; color: rgb(255 255 255 / .88); background: rgb(16 12 32 / .5); padding: 6px 10px; border-radius: var(--mads-radius-full); }
.bg-pill[hidden] { display: none; }

.bg-info { flex: 1 1 300px; min-width: 0; padding: 1.75rem; align-content: start; gap: 20px; }
.bg-info-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bg-when { font: var(--mads-label-xsmall); letter-spacing: .06em; color: var(--mads-theme-text-muted); }
.bg-titles { display: flex; flex-direction: column; gap: 6px; }
.bg-title { margin: 0; font: var(--mads-heading-xxlarge); letter-spacing: -.02em; overflow-wrap: anywhere; }
.bg-byline { margin: 0; font: var(--mads-text-xlarge); color: var(--mads-theme-text-muted); }
.bg-series { align-self: flex-start; margin-top: 4px; }
.bg-series[hidden], .bg-setting[hidden], .bg-rating[hidden] { display: none; }
.bg-setting { margin: 4px 0 0; font: var(--mads-text-default); color: var(--mads-theme-text-muted); }
.bg-rating { margin: 0; font: var(--mads-label-small); color: var(--mads-theme-text-amber-gold); }
.bg-keywords { display: flex; flex-direction: column; gap: 10px; }
.bg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bg-kw { transition: border-color .35s, color .35s; }
.bg-kw i { width: 7px; height: 7px; border-radius: 2px; transform: rotate(45deg); flex: none; }
.bg-kw.is-hit { color: var(--mads-theme-text); }
.bg-kw.is-miss { color: var(--mads-theme-text-faint); border-style: dashed; }
.bg-note { font: var(--mads-text-small); color: var(--mads-theme-text-faint); }
.bg-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-top: 16px; border-top: 1px solid var(--mads-theme-line); }
.bg-stats .mads-stat b { font: var(--mads-heading-xlarge); }

/* Timeline */
.bg-timeline { display: flex; align-items: center; gap: 12px; padding: 1.25rem 1.25rem 1rem; }
.bg-timeline .mads-button-round { flex: none; }
.bg-track { position: relative; flex: 1 1 auto; min-width: 0; height: 116px; margin: 0 14px; }
.bg-line, .bg-progress { position: absolute; left: 0; bottom: 26px; height: 4px; border-radius: 2px; }
.bg-line { right: 0; background: var(--mads-theme-line); }
.bg-progress { width: 0; background: var(--mads-gradient-brand); transition: width .6s var(--mads-motion-easing-standard); }
.bg-tick { position: absolute; bottom: 22px; width: 1px; height: 12px; background: var(--mads-theme-line); }
.bg-month { position: absolute; bottom: 0; transform: translateX(-50%); font: var(--mads-label-xsmall); color: var(--mads-theme-text-faint); }
.bg-month.is-past { color: var(--mads-theme-text-muted); }
.bg-order-note { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font: var(--mads-label-xsmall); letter-spacing: .06em; color: var(--mads-theme-text-faint); }
.bg-order-note[hidden] { display: none; }
/* The covers sit 12px above the progress line (which ends 30px from the bottom). */
.bg-mark { -webkit-appearance: none; appearance: none; position: absolute; bottom: 42px; width: 44px; height: 56px; margin-left: -22px; padding: 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: end center; }
.bg-thumb { display: block; overflow: hidden; width: 26px; height: 38px; border-radius: 3px 5px 5px 3px; box-shadow: inset 3px 0 0 rgb(0 0 0 / .25), 0 4px 10px -4px rgb(0 0 0 / .5); transform-origin: 50% 100%; transition: transform .35s var(--mads-motion-easing-spring), box-shadow .35s; }
.bg-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bg-mark:hover .bg-thumb { transform: translateY(-3px) scale(1.1); }
.bg-mark.is-on .bg-thumb { transform: translateY(-6px) scale(1.45); box-shadow: 0 0 0 2px var(--mads-theme-background), 0 0 0 4px var(--mads-color-neon-pink), 0 10px 18px -6px rgb(255 0 110 / .55); }
.bg-mark.is-on { z-index: 1; }
.bg-mark:focus-visible { outline: 2px solid var(--mads-color-neon-pink); outline-offset: 2px; border-radius: 8px; }

/* How the islands are built */
.bg-kit { padding: 1.75rem; gap: 20px; }
.bg-kit[hidden] { display: none; }
.bg-kit-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.bg-kit-intro { display: flex; flex-direction: column; gap: 6px; }
.bg-kit-title { margin: 0; font: var(--mads-heading-large); }
.bg-kit-text { margin: 0; font: var(--mads-text-large); color: var(--mads-theme-text-muted); max-width: 70ch; }
.bg-kit-text b { color: var(--mads-theme-text); }
.bg-kit-body { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.bg-kit-grid { flex: 999 1 560px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.bg-kit-tile b { display: flex; align-items: center; gap: 8px; }
.bg-kit-tile b i { width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); background: var(--mads-theme-line); flex: none; }
.bg-kit-tile.is-used { border-color: var(--mads-color-neon-pink); }
.bg-kit-tile.is-used b i { background: var(--mads-color-neon-pink); }
.bg-kit-tile .bg-kit-zone { font: var(--mads-text-small); color: var(--mads-theme-text-faint); }
.bg-kit-tile .bg-kit-tags { font: var(--mads-text-small); }
.bg-kit-data { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.bg-kit-data pre { margin: 0; padding: 16px; border-radius: var(--mads-radius-medium); background: var(--mads-theme-fill-soft); border: 1px solid var(--mads-theme-line); font: 500 12px/1.6 var(--mads-font-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--mads-theme-text); max-height: 520px; overflow: auto; }

/* Without JavaScript: a plain list of the books */
.bg-list { padding: 1.75rem; }
.bg-list ol { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; font: var(--mads-text-large); }
.bg-list li span { color: var(--mads-theme-text-muted); }

.bg-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; font: var(--mads-label-xsmall); color: var(--mads-theme-text-faint); padding-top: 8px; }
.bg-foot a { color: var(--mads-theme-text-muted); text-decoration: none; }
.bg-foot a:hover { color: var(--mads-theme-text); text-decoration: underline; }

@media (max-width: 620px) {
  .bg-timeline { padding-inline: .75rem; gap: 4px; }
  .bg-track { margin: 0 6px; }
  .bg-mark { width: 28px; margin-left: -14px; }
  .bg-thumb { width: 18px; height: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-thumb, .bg-progress, .bg-stage, .bg-kw { transition: none; }
}
