/* Modern World Library  --  series identity
   Spine colors line up like a physical shelf (01 -> 11).
   Series mark = mini bookshelf: 11 micro-spines; "you are here" stands taller.
*/

:root {
  /* Full-shelf spectrum (collection complete) */
  --spine-01: #c43b3b; /* Receipt War  --  crimson ink */
  --spine-02: #e07a3a; /* Shot Across the Bow  --  warning ember */
  --spine-03: #3d8fd1; /* Read the Document  --  primary blue */
  --spine-04: #d4a84b; /* Civilization Brief  --  heritage bronze */
  --spine-05: #c47a9e; /* Hard Conversations  --  human rose */
  --spine-06: #4fae78; /* After the Alarm  --  builder green */
  --spine-07: #8b6bc9; /* Lens Problem  --  prism violet */
  --spine-08: #2f9b88; /* Appropriation  --  ledger teal */
  --spine-09: #b85a42; /* Whole Case  --  copper case (≠ 01) */
  --spine-10: #5b6f8c; /* Entrenchment  --  steel slate */
  --spine-11: #c4a35a; /* Drop & Document  --  free-bridge gold */

  --series-total: 11;
}

/*  --  --  Mini bookshelf mark (nav)  --  --  */
.series-shelf {
  --shelf-h: 14px;
  --tick-w: 3px;
  --tick-gap: 2px;
  display: inline-flex;
  align-items: flex-end;
  gap: var(--tick-gap);
  height: var(--shelf-h);
  padding-bottom: 1px;
  flex-shrink: 0;
  /* baseline "shelf board" */
  border-bottom: 1px solid color-mix(in srgb, var(--accent, #c4a35a) 35%, transparent);
}
.series-shelf i {
  display: block;
  width: var(--tick-w);
  height: calc(var(--shelf-h) * 0.55);
  border-radius: 1px 1px 0 0;
  opacity: 0.38;
  font-style: normal;
  transition: height 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
/* Each tick is that book's spine color  --  collection tease */
.series-shelf i:nth-child(1)  { background: var(--spine-01); }
.series-shelf i:nth-child(2)  { background: var(--spine-02); }
.series-shelf i:nth-child(3)  { background: var(--spine-03); }
.series-shelf i:nth-child(4)  { background: var(--spine-04); }
.series-shelf i:nth-child(5)  { background: var(--spine-05); }
.series-shelf i:nth-child(6)  { background: var(--spine-06); }
.series-shelf i:nth-child(7)  { background: var(--spine-07); }
.series-shelf i:nth-child(8)  { background: var(--spine-08); }
.series-shelf i:nth-child(9)  { background: var(--spine-09); }
.series-shelf i:nth-child(10) { background: var(--spine-10); }
.series-shelf i:nth-child(11) { background: var(--spine-11); }

/* Current volume: taller, full color, soft glow */
.series-shelf i.is-here {
  height: var(--shelf-h);
  opacity: 1;
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent, currentColor) 70%, transparent);
}

/* Optional: hover whole mark lifts ghosts slightly */
.nav-brand:hover .series-shelf i:not(.is-here) {
  opacity: 0.55;
  height: calc(var(--shelf-h) * 0.7);
}

/* Legacy single square still works if present */
.nav-mark {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

/*  --  --  Large collection shelf (hub / page footers)  --  --  */
.collection-shelf {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 52px;
  padding: 0.35rem 0 0.5rem;
  border-bottom: 2px solid rgba(246, 241, 232, 0.12);
  margin: 0.5rem 0 1rem;
}
.collection-shelf a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 0;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.collection-shelf .spine {
  width: 100%;
  max-width: 28px;
  height: 36px;
  border-radius: 2px 2px 0 0;
  opacity: 0.72;
  transition: height 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  box-shadow: inset -2px 0 0 rgba(0, 0, 0, 0.18);
}
.collection-shelf a:hover .spine,
.collection-shelf a.is-here .spine {
  height: 48px;
  opacity: 1;
  transform: translateY(-2px);
}
.collection-shelf a.is-here .spine {
  box-shadow:
    inset -2px 0 0 rgba(0, 0, 0, 0.2),
    0 0 16px color-mix(in srgb, var(--a, #c4a35a) 45%, transparent);
}
.collection-shelf .spine-label {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: #8b93a7;
}
.collection-shelf a:hover .spine-label,
.collection-shelf a.is-here .spine-label {
  color: #f6f1e8;
}

/* Book body class hooks for export HTML accents */
body.book-01 { --accent: var(--spine-01); }
body.book-02 { --accent: var(--spine-02); }
body.book-03 { --accent: var(--spine-03); }
body.book-04 { --accent: var(--spine-04); }
body.book-05 { --accent: var(--spine-05); }
body.book-06 { --accent: var(--spine-06); }
body.book-07 { --accent: var(--spine-07); }
body.book-08 { --accent: var(--spine-08); }
body.book-09 { --accent: var(--spine-09); }
body.book-10 { --accent: var(--spine-10); }
body.book-11 { --accent: var(--spine-11); }

@media (max-width: 640px) {
  .series-shelf {
    --shelf-h: 12px;
    --tick-w: 2.5px;
    --tick-gap: 1.5px;
  }
  .collection-shelf { gap: 3px; }
  .collection-shelf .spine-label { font-size: 0.55rem; }
}

/*  --  --  Series picker (horizontal book selector on each book page)  --  --  */
.mwl-series-picker-host {
  margin-top: 1rem;
}
.mwl-series-picker {
  --mwl-accent: #c4a35a;
  margin: 0.25rem 0 0;
}
.mwl-series-picker-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.mwl-series-picker-status {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.mwl-series-picker-status .vol {
  display: block;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mwl-accent, #c4a35a);
  margin-bottom: 0.15rem;
}
.mwl-series-picker-status .title {
  display: block;
  font-weight: 600;
  color: #f6f1e8;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mwl-series-picker-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(246, 241, 232, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #f6f1e8;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.mwl-series-picker-btn:hover {
  border-color: var(--mwl-accent, #c4a35a);
  color: var(--mwl-accent, #c4a35a);
}
.mwl-series-picker-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(118px, 28%);
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.35rem 0.1rem 0.85rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.mwl-series-card {
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  border: 1px solid rgba(246, 241, 232, 0.1);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.55rem 0.55rem 0.7rem;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}
.mwl-series-card:hover {
  border-color: color-mix(in srgb, var(--card-a, #c4a35a) 55%, transparent);
  transform: translateY(-2px);
}
.mwl-series-card.is-here {
  border-color: color-mix(in srgb, var(--card-a, #c4a35a) 70%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--card-a, #c4a35a) 35%, transparent),
    0 12px 28px rgba(0, 0, 0, 0.35);
  background: color-mix(in srgb, var(--card-a, #c4a35a) 10%, transparent);
}
.mwl-series-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}
.mwl-series-card .vol {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--card-a, #c4a35a);
}
.mwl-series-card .name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f6f1e8;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mwl-series-card .job {
  font-size: 0.72rem;
  color: #8b93a7;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mwl-series-card .here-pill {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0b0d12;
  background: var(--card-a, #c4a35a);
  border-radius: 4px;
  padding: 0.12rem 0.35rem;
  width: fit-content;
}
.mwl-series-picker-hint {
  margin: 0.15rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: #8b93a7;
  font-family: "IBM Plex Mono", Consolas, monospace;
  letter-spacing: 0.04em;
}
@media (min-width: 900px) {
  .mwl-series-picker-track {
    grid-auto-columns: minmax(130px, 15%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .mwl-series-picker-track { scroll-behavior: auto; }
  .mwl-series-card:hover { transform: none; }
}

/*  --  --  Cover carousel (hub + book rails)  --  --  */
.mwl-carousel {
  --mwl-accent: #c4a35a;
  position: relative;
  margin: 1.25rem 0 0.5rem;
  padding: 0.5rem 0 1rem;
  user-select: none;
  touch-action: pan-y;
}
.mwl-carousel-stage {
  position: relative;
  height: clamp(280px, 42vw, 380px);
  perspective: 1200px;
  overflow: hidden;
  border-radius: 16px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 80%, color-mix(in srgb, var(--mwl-accent) 18%, transparent), transparent 70%),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(246, 241, 232, 0.1);
}
.mwl-carousel-track {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mwl-slide {
  position: absolute;
  width: min(200px, 42vw);
  aspect-ratio: 2 / 3;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transform-style: preserve-3d;
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease,
    filter 0.35s ease,
    z-index 0s;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  outline: none;
}
.mwl-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  pointer-events: none;
  border: 1px solid rgba(246, 241, 232, 0.12);
}
.mwl-slide.is-active {
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.55),
    0 0 0 2px color-mix(in srgb, var(--mwl-accent) 65%, transparent),
    0 0 32px color-mix(in srgb, var(--mwl-accent) 28%, transparent);
}
.mwl-slide.is-active img {
  border-color: color-mix(in srgb, var(--mwl-accent) 50%, transparent);
}
.mwl-slide:focus-visible {
  box-shadow: 0 0 0 3px var(--mwl-accent);
}
.mwl-carousel-meta {
  text-align: center;
  margin-top: 1.15rem;
  min-height: 5.5rem;
}
.mwl-carousel-meta .num {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mwl-accent);
  margin: 0 0 0.35rem;
}
.mwl-carousel-meta h3 {
  margin: 0 0 0.35rem;
  font-family: Fraunces, Georgia, serif;
  font-weight: 450;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  color: #f6f1e8;
}
.mwl-carousel-meta .job {
  margin: 0 0 0.25rem;
  color: #8b93a7;
  font-size: 0.95rem;
}
.mwl-carousel-meta .sticky {
  margin: 0;
  color: #f6f1e8;
  font-size: 0.92rem;
  opacity: 0.92;
}
.mwl-carousel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 0.9rem;
}
.mwl-carousel-actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(246, 241, 232, 0.14);
  color: #f6f1e8;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.mwl-carousel-actions a:hover {
  border-color: var(--mwl-accent);
  color: var(--mwl-accent);
}
.mwl-carousel-actions a.primary {
  background: color-mix(in srgb, var(--mwl-accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--mwl-accent) 45%, transparent);
  color: var(--mwl-accent);
}
.mwl-carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.mwl-carousel-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(246, 241, 232, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #f6f1e8;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.mwl-carousel-btn:hover {
  border-color: var(--mwl-accent);
  color: var(--mwl-accent);
  transform: scale(1.05);
}
.mwl-carousel-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  max-width: 22rem;
}
.mwl-carousel-dots button {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(246, 241, 232, 0.22);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.mwl-carousel-dots button[aria-current="true"] {
  background: var(--mwl-accent);
  transform: scale(1.25);
}
.mwl-carousel-hint {
  text-align: center;
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: #8b93a7;
  font-family: "IBM Plex Mono", Consolas, monospace;
  letter-spacing: 0.04em;
}

/* Library rail on book sites */
.mwl-library-rail {
  border-top: 1px solid rgba(246, 241, 232, 0.1);
  background: #0e1118;
  padding: 2rem 0 2.25rem;
  margin-top: 0;
}
.mwl-library-rail .wrap {
  width: min(1040px, calc(100% - 2rem));
  margin: 0 auto;
}
.mwl-library-rail .rail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.35rem;
}
.mwl-library-rail .rail-head h2 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-weight: 450;
  font-size: 1.35rem;
  color: #f6f1e8;
}
.mwl-library-rail .rail-head a {
  color: var(--accent, #c4a35a);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.mwl-library-rail .rail-head a:hover { text-decoration: underline; }
.mwl-library-rail .rail-lede {
  margin: 0 0 0.5rem;
  color: #8b93a7;
  font-size: 0.92rem;
  max-width: 52ch;
}
.mwl-library-rail .mwl-carousel-stage {
  height: clamp(220px, 36vw, 300px);
}
.mwl-library-rail .mwl-slide {
  width: min(150px, 36vw);
}
.mwl-prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.mwl-prev-next a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(246, 241, 232, 0.12);
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}
.mwl-prev-next a:hover { border-color: var(--accent, #c4a35a); }
.mwl-prev-next .pn-label {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b93a7;
}
.mwl-prev-next .pn-title {
  font-weight: 600;
  color: #f6f1e8;
  font-size: 0.95rem;
}
.mwl-prev-next a:last-child { text-align: right; }
.mwl-studio-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}
.mwl-studio-links a {
  color: var(--accent, #c4a35a);
  font-weight: 600;
  text-decoration: none;
}
.mwl-studio-links a:hover { text-decoration: underline; }

@media (max-width: 520px) {
  .mwl-prev-next { grid-template-columns: 1fr; }
  .mwl-prev-next a:last-child { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .mwl-slide { transition: none; }
  .mwl-carousel-btn:hover { transform: none; }
}
