/* Case study index (js/case-index.js) — a second row inside the sticky
   project bar, so it never sits over the page. "08 / 12 · Generative",
   then one segment per chapter: read ones bright, the current one gold and
   filling as you read it, the rest dim. Segments jump to their chapter. */

.cix {
  --cix-ink: rgba(251, 247, 240, .9);
  --cix-dim: rgba(251, 247, 240, .2);
  --cix-gold: var(--accent, #E4BC6B);
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
  height: 30px;
  padding: 0 var(--pad-g, 24px) 2px;
  font-family: var(--body, system-ui, sans-serif);
}

.cix__now {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 42%;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: .06em;
  color: rgba(251, 247, 240, .55);
  white-space: nowrap;
}
.cix__count { flex: none; font-variant-numeric: tabular-nums; }
.cix__count b { font-weight: 500; color: var(--cix-gold); }
.cix__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--cix-ink);
  letter-spacing: .02em;
}

.cix__list {
  flex: 1 1 auto;
  display: flex;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cix__list li { flex: 1 1 0; min-width: 0; }

/* a 14px hit area around a 2px segment */
.cix__a {
  position: relative;
  display: block;
  height: 14px;
  outline: none;
}
.cix__a::before, .cix__a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  height: 2px;
  border-radius: 1px;
}
.cix__a::before { background: var(--cix-dim); transition: background-color 250ms ease; }
.cix__a.is-read::before { background: var(--cix-ink); }
.cix__a::after {
  background: var(--cix-gold);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.cix__a.is-here::after { transform: scaleX(var(--cix-f, 0)); }
.cix__a.is-here::before { background: rgba(228, 188, 107, .3); }
.cix__a:focus-visible::before { box-shadow: 0 0 0 2px var(--cix-gold); }

/* hover: the chapter's name, just under its segment */
.cix__tip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  padding: 6px 9px;
  border-radius: 6px;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--cix-ink);
  font-size: 11px;
  line-height: 1;
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -3px);
  transition: opacity 160ms ease, transform 220ms cubic-bezier(.16, 1, .3, 1);
  pointer-events: none;
}
.cix__list li:first-child .cix__tip { left: 0; transform: translate(0, -3px); }
.cix__list li:last-child .cix__tip { left: auto; right: 0; transform: translate(0, -3px); }
@media (hover: hover) {
  .cix__a:hover .cix__tip, .cix__a:focus-visible .cix__tip { opacity: 1; transform: translate(-50%, 0); }
  .cix__list li:first-child .cix__a:hover .cix__tip,
  .cix__list li:first-child .cix__a:focus-visible .cix__tip,
  .cix__list li:last-child .cix__a:hover .cix__tip,
  .cix__list li:last-child .cix__a:focus-visible .cix__tip { transform: none; }
  .cix__a:hover::before { background: var(--cix-ink); }
}

@media (max-width: 600px) {
  .cix { height: 28px; gap: 12px; }
  .cix__now { max-width: 50%; font-size: 10.5px; gap: 8px; }
  .cix__list { gap: 2px; }
}

/* /dive: the phone reaction buttons sit under the bar, which is now taller */
body:has(.cix) .rx-quick { top: calc(env(safe-area-inset-top, 0px) + 100px); }

@media (prefers-reduced-motion: reduce) {
  .cix *, .cix *::before, .cix *::after { transition: none !important; }
}

/* home, kept in the pinned project bar once the site header has scrolled away */
.projbar__home {
  position: relative;
  z-index: 1;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: calc(-1 * clamp(4px, 1vw, 14px));
  border: 1px solid var(--rule, rgba(255, 255, 255, .16));
  border-radius: 50%;
  color: var(--ink, #fbf7f0);
  background: var(--void, #000);
  transition: border-color 200ms ease, color 200ms ease;
}
.projbar__home svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.projbar__home:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) { .projbar__home:hover { border-color: var(--accent); color: var(--accent); } }
@media (max-width: 600px) { .projbar__home { width: 36px; height: 36px; } }
