/* DH Experience — chapter pill for articles. */
.dhx-chap {
  --c-bg: var(--bg, #F3F3F3); --c-text: var(--text, #0C0B14); --c-line: var(--line, rgba(12, 11, 20, .12));
  --c-accent: var(--accent, #6C60BF); --c-muted: var(--muted, rgba(12, 12, 12, .58));
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 90;
  display: grid; justify-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 32px);
  translate: -50% 140%; opacity: 0; pointer-events: none;
  transition: translate .6s cubic-bezier(.22, 1, .36, 1), opacity .35s;
}
.dhx-chap.is-on { translate: -50% 0; opacity: 1; pointer-events: auto; }

.dhx-chap__pill {
  display: inline-flex; align-items: center; gap: 12px; height: 48px; max-width: 100%; padding: 0 18px 0 8px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--c-text) 92%, transparent); color: var(--c-bg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(8, 7, 14, .25);
  transition: box-shadow .35s, transform .35s cubic-bezier(.22, 1, .36, 1);
}
.dhx-chap__pill:hover, .dhx-chap__pill:focus-visible { color: var(--c-bg) !important; background: color-mix(in srgb, var(--c-text) 92%, transparent) !important; transform: translateY(-2px); box-shadow: 0 0 0 6px rgba(var(--accent-rgb, 108, 96, 191), .16), 0 18px 46px rgba(8, 7, 14, .3); }
.dhx-chap__ring { flex: none; width: 32px; height: 32px; rotate: -90deg; }
.dhx-chap__ring circle { fill: none; stroke: color-mix(in srgb, var(--c-bg) 22%, transparent); stroke-width: 3; }
.dhx-chap__ring .dhx-chap__arc { stroke: var(--c-accent); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .2s linear; }
.dhx-chap__num { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .1em; font-variant-numeric: tabular-nums; opacity: .62; }
.dhx-chap__title {
  min-width: 0; max-width: 34ch; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-family: var(--font-display, "Syne", system-ui, sans-serif); font-size: 15px; font-weight: 700; letter-spacing: -.02em;
}
.dhx-chap__chev { flex: none; width: 8px; height: 8px; margin-left: 2px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; rotate: -45deg; translate: 0 2px; opacity: .7; transition: rotate .35s, translate .35s; }
.dhx-chap.is-open .dhx-chap__chev { rotate: 135deg; translate: 0 -2px; }

.dhx-chap__panel {
  width: min(380px, calc(100vw - 32px)); max-height: min(62vh, 520px); overflow: auto; padding: 18px 10px 10px;
  background: var(--c-bg); color: var(--c-text); border: 1px solid var(--c-line); border-radius: 22px;
  box-shadow: 0 24px 70px rgba(8, 7, 14, .22);
  transform-origin: 50% 100%; animation: dhx-chap-in .45s cubic-bezier(.22, 1, .36, 1);
}
.dhx-chap__panel[hidden] { display: none; }
@keyframes dhx-chap-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.dhx-chap__head { display: flex; justify-content: space-between; margin: 0 12px 10px; color: var(--c-muted); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.dhx-chap__list { list-style: none; margin: 0; padding: 0; }
.dhx-chap__list li { margin: 0; }
.dhx-chap__list a {
  display: grid; grid-template-columns: 2.4em minmax(0, 1fr); gap: 10px; align-items: baseline;
  padding: 11px 12px; border-radius: 12px; color: var(--c-text) !important; text-decoration: none !important;
  font-family: var(--font-display, "Syne", system-ui, sans-serif); font-size: 16px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em;
  transition: background-color .25s, color .25s;
}
.dhx-chap__list i { font-style: normal; color: var(--c-muted); font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 11px; font-weight: 800; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.dhx-chap__list a.is-read { color: var(--c-muted) !important; }
.dhx-chap__list a.is-current { background: rgba(var(--accent-rgb, 108, 96, 191), .1); color: var(--c-accent) !important; }
.dhx-chap__list a.is-current i { color: var(--c-accent); }
.dhx-chap__list a:hover, .dhx-chap__list a:focus-visible { background: rgba(var(--accent-rgb, 108, 96, 191), .08); outline: none; }

@media (max-width: 760px) {
  .dhx-chap { left: 16px; right: 16px; width: auto; max-width: none; translate: 0 140%; justify-items: stretch; }
  .dhx-chap.is-on { translate: 0 0; }
  .dhx-chap__pill { width: 100%; }
  .dhx-chap__title { flex: 1; max-width: none; }
  .dhx-chap__panel { width: auto; }
}
@media (prefers-reduced-motion: reduce) { .dhx-chap, .dhx-chap__panel { transition: none; animation: none; } }

/* long chapter titles: "…" in the pill, full text (wrapped) in the list */
.dhx-chap { grid-template-columns: minmax(0, 1fr); }
.dhx-chap > * { min-width: 0; max-width: 100%; }
.dhx-chap__pill { min-width: 0; overflow: hidden; }
.dhx-chap__title { flex: 1 1 auto; }
.dhx-chap__list a span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }

/* "scroll" cue on the article header (same as the homepage and About me) */
.ha-header .dhx-cue {
  position: absolute; left: 50%; bottom: 2vh; translate: -50% 0; z-index: 5; pointer-events: none;
  display: grid; justify-items: center; gap: 8px;
  color: var(--muted, rgba(12, 12, 12, .58)); font-family: var(--font-body, "Inter", system-ui, sans-serif);
  font-size: 11px; font-weight: 800; line-height: 1; letter-spacing: .2em; text-transform: uppercase;
}
.ha-header .dhx-cue i { display: block; width: 1px; height: 32px; background: linear-gradient(var(--text, #0C0B14), transparent); transform-origin: top; animation: dhx-cue-a 2.2s var(--ease, cubic-bezier(.22, 1, .36, 1)) infinite; }
@keyframes dhx-cue-a { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }
@media (max-width: 760px) { .ha-header .dhx-cue { gap: 8px; } .ha-header .dhx-cue i { height: 34px; } }
@media (prefers-reduced-motion: reduce) { .ha-header .dhx-cue i { animation: none; } }
