/* Series UI — sidebar group (left marginalia) + right editorial-tools tab
   + mobile bottom-sheet panel. Centred-column banner has been removed.
   Activated by frontmatter:
     series: { name, slug, order, total }
*/

/* ──────────────────────────────────────────────────────────────────
   Left marginalia "Series" group — quiet, editorial, breathable
   ────────────────────────────────────────────────────────────────── */

.marginalia-group--series {
  gap: 0.5rem;
}
.marginalia-group--series .marginalia-label {
  margin-bottom: 0.1rem;
}

/* Disclosure wrapper — collapsed by default, expand on click */
.marginalia-series-disclose {
  display: block;
}
.marginalia-series-disclose > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.05rem 0;
  border-radius: 4px;
  outline: none;
  transition: background-color 160ms ease;
}
.marginalia-series-disclose > summary::-webkit-details-marker { display: none; }
.marginalia-series-disclose > summary::marker { content: ""; }
.marginalia-series-disclose > summary:focus-visible {
  background: color-mix(in oklab, var(--color-accent, #862122) 6%, transparent);
}
.marginalia-series-summary {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.marginalia-series-summary-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  line-height: 1.3;
}
.marginalia-series-caret {
  width: 10px;
  height: 10px;
  margin-left: auto;
  color: var(--color-ink, #1a1c1b);
  opacity: 0.4;
  transition: transform 220ms ease, opacity 220ms ease;
}
.marginalia-series-disclose[open] .marginalia-series-caret {
  transform: rotate(90deg);
  opacity: 0.7;
}
.marginalia-series-disclose:hover .marginalia-series-caret {
  opacity: 0.75;
}

/* Series name — now a link to the column page */
.marginalia-series-name--link {
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid transparent;
  transition: color 180ms ease, border-color 180ms ease;
}
.marginalia-series-name--link:hover,
.marginalia-series-name--link:focus-visible {
  color: var(--color-accent, #862122);
  border-bottom-color: color-mix(in oklab, var(--color-accent, #862122) 40%, transparent);
  outline: none;
}

/* Expanded list reveal animation */
.marginalia-series-disclose[open] .marginalia-series-list {
  animation: marginalia-series-reveal 240ms ease;
  margin-top: 0.65rem;
}
@keyframes marginalia-series-reveal {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.marginalia-series {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.marginalia-series-head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  line-height: 1.3;
}
.marginalia-series-name {
  font-family: var(--font-display, 'Fraunces', 'Georgia', serif);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-ink, #1a1c1b);
  letter-spacing: 0.01em;
}
:lang(zh) .marginalia-series-name {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', 'PingFang SC', var(--font-body, system-ui), serif;
  font-weight: 500;
}
.marginalia-series-badge {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--color-accent, #862122);
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.marginalia-series-badge-sep {
  opacity: 0.45;
  margin: 0 0.18rem;
}

/* Vertical timeline of the series — single hairline rule, no boxes */
.marginalia-series-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.55rem;
  display: grid;
  gap: 0.32rem;
  border-left: 1px solid color-mix(in oklab, var(--color-ink, #1a1c1b) 14%, transparent);
}
.marginalia-series-item {
  position: relative;
  padding: 0;
}
.marginalia-series-link {
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  gap: 0.45rem;
  align-items: baseline;
  padding: 0.08rem 0 0.08rem 0;
  text-decoration: none;
  color: inherit;
  border-radius: 3px;
  transition: color 180ms ease, opacity 180ms ease;
}
.marginalia-series-num {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--color-ink, #1a1c1b);
  opacity: 0.4;
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1.55;
  transition: color 180ms ease, opacity 180ms ease;
}
.marginalia-series-title {
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--color-ink, #1a1c1b);
  opacity: 0.7;
  word-break: break-word;
  transition: color 180ms ease, opacity 180ms ease;
}
:lang(zh) .marginalia-series-title {
  font-family: 'PingFang SC', 'Hiragino Sans GB', var(--font-body, system-ui), sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.005em;
}

/* Hover: lift opacity, hint with accent */
.marginalia-series-link:hover .marginalia-series-title,
.marginalia-series-link:focus-visible .marginalia-series-title {
  color: var(--color-accent, #862122);
  opacity: 1;
}
.marginalia-series-link:hover .marginalia-series-num,
.marginalia-series-link:focus-visible .marginalia-series-num {
  color: var(--color-accent, #862122);
  opacity: 0.85;
}

/* Current item: small bullet on the rule, full opacity */
.marginalia-series-item.is-current {
  position: relative;
}
.marginalia-series-item.is-current::before {
  content: "";
  position: absolute;
  left: -0.55rem;
  top: 0.55rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent, #862122);
  transform: translateX(-50%);
}
.marginalia-series-item.is-current .marginalia-series-title {
  color: var(--color-ink, #1a1c1b);
  opacity: 1;
  font-weight: 500;
}
.marginalia-series-item.is-current .marginalia-series-num {
  color: var(--color-accent, #862122);
  opacity: 0.85;
}

/* ──────────────────────────────────────────────────────────────────
   Right editorial-tools "Series" panel — whole row clickable
   ────────────────────────────────────────────────────────────────── */

.rc-series-panel {
  padding: 0.1rem 0;
}
.rc-series-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.1rem 0 0.85rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid color-mix(in oklab, var(--color-ink, #1a1c1b) 10%, transparent);
}
.rc-series-eyebrow {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-ink, #1a1c1b);
  opacity: 0.42;
}
.rc-series-name {
  font-family: var(--font-display, 'Fraunces', 'Georgia', serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-ink, #1a1c1b);
  flex: 1 1 auto;
  min-width: 0;
  letter-spacing: 0.005em;
}
:lang(zh) .rc-series-name {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', 'PingFang SC', var(--font-body, system-ui), serif;
}
.rc-series-badge {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--color-accent, #862122);
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.rc-series-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.rc-series-item {
  margin: 0;
}
.rc-series-link {
  display: grid;
  grid-template-columns: 1.6rem 1fr 0.9rem;
  gap: 0.6rem;
  align-items: start;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
  position: relative;
}
.rc-series-link:hover,
.rc-series-link:focus-visible {
  background: color-mix(in oklab, var(--color-accent, #862122) 5%, transparent);
  outline: none;
}
.rc-series-link:hover .rc-series-arrow,
.rc-series-link:focus-visible .rc-series-arrow {
  opacity: 1;
  transform: translateX(2px);
}
.rc-series-item.is-current .rc-series-link {
  background: color-mix(in oklab, var(--color-accent, #862122) 7%, transparent);
  cursor: default;
}

.rc-series-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--color-ink, #1a1c1b) 18%, transparent);
  background: transparent;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--color-ink, #1a1c1b);
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1;
  margin-top: 0.05rem;
  transition: all 180ms ease;
}
.rc-series-item.is-current .rc-series-num {
  background: var(--color-accent, #862122);
  border-color: var(--color-accent, #862122);
  color: #fff;
  opacity: 1;
}
.rc-series-link:hover .rc-series-num {
  border-color: color-mix(in oklab, var(--color-accent, #862122) 40%, transparent);
  color: var(--color-accent, #862122);
  opacity: 0.9;
}

.rc-series-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.rc-series-title {
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--color-ink, #1a1c1b);
  font-weight: 500;
  word-break: break-word;
}
:lang(zh) .rc-series-title {
  font-family: 'PingFang SC', 'Hiragino Sans GB', var(--font-body, system-ui), sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.005em;
  font-weight: 500;
}
.rc-series-item.is-current .rc-series-title {
  color: var(--color-accent, #862122);
}
.rc-series-desc {
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--color-ink, #1a1c1b);
  opacity: 0.55;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
:lang(zh) .rc-series-desc {
  font-size: 0.72rem;
}
.rc-series-arrow {
  width: 14px;
  height: 14px;
  color: var(--color-ink, #1a1c1b);
  opacity: 0;
  margin-top: 0.35rem;
  transition: opacity 180ms ease, transform 180ms ease;
}

.rc-series-name--link,
.abs-series-name--link {
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid transparent;
  transition: color 180ms ease, border-color 180ms ease;
}
.rc-series-name--link:hover,
.rc-series-name--link:focus-visible,
.abs-series-name--link:active {
  color: var(--color-accent, #862122);
  border-bottom-color: color-mix(in oklab, var(--color-accent, #862122) 40%, transparent);
  outline: none;
}

.rc-ai-chip--series {
  background: color-mix(in oklab, var(--color-accent, #862122) 6%, transparent);
  border-color: color-mix(in oklab, var(--color-accent, #862122) 26%, transparent);
}

/* ──────────────────────────────────────────────────────────────────
   Mobile bottom-sheet "Series" panel
   ────────────────────────────────────────────────────────────────── */

.abs-series {
  padding: 0.3rem 0.15rem 0.6rem;
}
.abs-series-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid color-mix(in oklab, var(--color-ink, #1a1c1b) 10%, transparent);
}
.abs-series-eyebrow {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-ink, #1a1c1b);
  opacity: 0.45;
}
.abs-series-name {
  font-family: var(--font-display, 'Fraunces', 'Georgia', serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-ink, #1a1c1b);
}
:lang(zh) .abs-series-name {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', 'PingFang SC', var(--font-body, system-ui), serif;
}
.abs-series-badge {
  margin-left: auto;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--color-accent, #862122);
  opacity: 0.85;
}
.abs-series-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.abs-series-item {
  margin: 0;
}
.abs-series-link {
  display: grid;
  grid-template-columns: 1.8rem 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.65rem 0.6rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background-color 180ms ease;
}
.abs-series-link:active {
  background: color-mix(in oklab, var(--color-accent, #862122) 9%, transparent);
}
.abs-series-item.is-current .abs-series-link {
  background: color-mix(in oklab, var(--color-accent, #862122) 7%, transparent);
}
.abs-series-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--color-ink, #1a1c1b) 18%, transparent);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-ink, #1a1c1b);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-top: 0.05rem;
}
.abs-series-item.is-current .abs-series-num {
  background: var(--color-accent, #862122);
  border-color: var(--color-accent, #862122);
  color: #fff;
  opacity: 1;
}
.abs-series-title {
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-ink, #1a1c1b);
  font-weight: 500;
  word-break: break-word;
}
:lang(zh) .abs-series-title {
  font-family: 'PingFang SC', 'Hiragino Sans GB', var(--font-body, system-ui), sans-serif;
}
.abs-series-item.is-current .abs-series-title {
  color: var(--color-accent, #862122);
}

/* ──────────────────────────────────────────────────────────────────
   Dark theme
   ────────────────────────────────────────────────────────────────── */

.dark .marginalia-series-name,
.dark .rc-series-name,
.dark .abs-series-name,
.dark .marginalia-series-title,
.dark .rc-series-title,
.dark .abs-series-title,
body.dark .marginalia-series-name,
body.dark .rc-series-name,
body.dark .abs-series-name,
body.dark .marginalia-series-title,
body.dark .rc-series-title,
body.dark .abs-series-title {
  color: var(--primary, #e8e6e3);
}
.dark .marginalia-series-list,
body.dark .marginalia-series-list {
  border-left-color: color-mix(in oklab, var(--primary, #e8e6e3) 18%, transparent);
}
.dark .rc-series-head,
.dark .abs-series-head,
body.dark .rc-series-head,
body.dark .abs-series-head {
  border-bottom-color: color-mix(in oklab, var(--primary, #e8e6e3) 14%, transparent);
}
.dark .rc-series-num,
.dark .abs-series-num,
body.dark .rc-series-num,
body.dark .abs-series-num {
  border-color: color-mix(in oklab, var(--primary, #e8e6e3) 22%, transparent);
  color: var(--primary, #e8e6e3);
}
