/* CaseStudyNavigator — shared by every design case study. Tokens from tokens.css. */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.csn {
  position: fixed;
  z-index: 900;                  /* below the site header/menu (1001+) and lightbox (3000) */
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: "Montserrat", sans-serif;
  transition: opacity var(--motion-standard, .28s) var(--ease-standard, ease), transform var(--motion-standard, .28s) var(--ease-standard, ease), visibility var(--motion-standard, .28s);
}
@media (min-width: 900px) { .csn { right: 24px; bottom: 24px; } }
.csn.is-hidden { opacity: 0; transform: translateY(12px); visibility: hidden; pointer-events: none; }

/* collapsed pill */
.csn__btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  min-height: 48px;
  padding: 6px 6px 6px 18px;
  font: inherit;
  color: var(--ink-900, #141313);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-med, rgba(43, 111, 145, .2));
  border-radius: var(--radius-pill, 999px);
  box-shadow: var(--shadow-md, 0 12px 30px rgba(0,0,0,.1));
  cursor: pointer;
  transition: transform var(--motion-fast, .18s) var(--ease-standard, ease), box-shadow var(--motion-fast, .18s) var(--ease-standard, ease), border-color var(--motion-fast, .18s);
}
.csn__label { min-width: 0; overflow: hidden; }
.csn__text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}
.csn__text.is-swap { animation: csnSwap .32s var(--ease-soft, ease); }
@keyframes csnSwap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.csn__icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-fill, #2b6f91);
  color: #fff;
  transition: background-color var(--motion-fast, .18s);
}
.csn__bars { position: relative; width: 16px; height: 12px; display: block; }
.csn__bars i { position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor; transition: transform .28s var(--ease-soft, ease), opacity .2s, top .28s var(--ease-soft, ease); }
.csn__bars i:nth-child(1) { top: 0; }
.csn__bars i:nth-child(2) { top: 5px; }
.csn__bars i:nth-child(3) { top: 10px; }
.csn.is-open .csn__bars i:nth-child(1) { top: 5px; transform: rotate(45deg); }
.csn.is-open .csn__bars i:nth-child(2) { opacity: 0; }
.csn.is-open .csn__bars i:nth-child(3) { top: 5px; transform: rotate(-45deg); }

.csn__sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* expanded panel — opens upward */
.csn__panel {
  order: -1;                      /* sits above the pill */
  width: min(280px, calc(100vw - 32px));
  max-height: min(62vh, 440px);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--surface, #fff);
  border: 1px solid var(--line-soft, rgba(20,19,19,.08));
  border-radius: var(--radius-lg, 18px);
  box-shadow: var(--shadow-lg, 0 16px 44px rgba(0,0,0,.14));
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(.97);
  transition: opacity .22s var(--ease-soft, ease), transform .22s var(--ease-soft, ease), visibility .22s;
}
.csn.is-open .csn__panel { opacity: 1; visibility: visible; transform: none; }

.csn__list { list-style: none; margin: 0; padding: 0; }
.csn__sep { height: 1px; margin: 6px 8px; background: var(--line-soft, rgba(20,19,19,.08)); }

.csn__link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;                 /* comfortable touch target */
  padding: 0 14px;
  border-radius: var(--radius-md, 14px);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-700, #383737);
  text-decoration: none;
  transition: background-color var(--motion-fast, .18s), color var(--motion-fast, .18s);
}
.csn__link svg { width: 16px; height: 16px; flex: 0 0 16px; }
.csn__link--top { color: var(--blue-deep, #2b6f91); }
.csn__link.is-active { background: rgba(57, 143, 186, .12); color: var(--blue-deep, #2b6f91); font-weight: 700; }
.csn__link.is-active::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--coral, #ff6c63); flex: 0 0 6px; margin-left: -2px; }

@media (hover: hover) {
  .csn__btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg, 0 16px 44px rgba(0,0,0,.14)); border-color: var(--blue, #398fba); }
  .csn__btn:hover .csn__icon { background: var(--blue-darker, #235a75); }
  .csn__link:hover { background: var(--surface-sunken, #f4f5f7); color: var(--ink-900, #141313); }
  .csn__link.is-active:hover { background: rgba(57, 143, 186, .18); color: var(--blue-deep, #2b6f91); }
}
.csn__btn:focus-visible, .csn__link:focus-visible { outline: 3px solid var(--blue, #398fba); outline-offset: 3px; }
.csn__link:focus-visible { outline-offset: -3px; }

@media (max-width: 560px) {
  .csn__btn { min-height: 44px; gap: 10px; padding-left: 14px; }
  .csn__text { max-width: 46vw; font-size: 0.85rem; }
  .csn__icon { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .csn, .csn__btn, .csn__panel, .csn__bars i, .csn__link { transition: none; }
  .csn__text.is-swap { animation: none; }
}
