/* Wayfinding chrome (round 4, P2.2): breadcrumb-back top-left, theme
   key top-right. Constants are the lab's measured ones — keycap magnify
   spring(420, 26) to 1.28 with the (1-v)*14 lift, icon bite-morph
   spring(280, 34) — see chrome.js for the derivations. */

/* classic-scrollbar platforms reserve the gutter on every page, so the
   fixed chrome (keycap right inset) sits at the same x whether or not
   the page scrolls; overlay-scrollbar platforms are unaffected */
html {
  scrollbar-gutter: stable;
}

.crumbs {
  position: fixed;
  top: 20px;
  left: 28px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-family: var(--fonts-body);
}
.crumbs .arrow-btn {
  border: 0;
  background: none;
  padding: 3px 4px 3px 0;
  margin-right: 1px;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: inherit;
}
.crumbs .arrow-btn {
  position: relative;
  isolation: isolate;
}
.crumbs .arrow-btn svg {
  width: 30px;
  height: 13px;
  display: block;
  overflow: visible;
}
/* the blurred echo: no plate to clip it, so it spills the way ink
   bleeds off a nib */
.crumbs .arrow-btn svg.arrow-bloom {
  position: absolute;
  /* minus 2px: the button's padding is 3px 4px 3px 0, and an abspos
     child centres against the PADDING box while the crisp svg (a grid
     item) centres in the CONTENT box — 50% alone sat the echo 2px
     right of its glyph */
  left: calc(50% - 2px);
  top: 50%;
  width: 46px;
  height: 20px;
  transform: translate(-50%, -50%);
  filter: blur(6px);
  opacity: 0.42;
  pointer-events: none;
  z-index: -1;
  transition: opacity 180ms ease-out;
}
.crumbs .arrow-btn:hover svg.arrow-bloom,
.crumbs .arrow-btn:focus-visible svg.arrow-bloom {
  opacity: 0.85;
}
@media (prefers-reduced-motion: reduce) {
  .crumbs .arrow-btn svg.arrow-bloom { transition-duration: 0.01ms; }
}
.crumbs .arrow-btn path {
  stroke: var(--red-accent, #ff484c);
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.crumbs .crumb {
  color: var(--colors-gray11);
  text-decoration: none;
  border-radius: 6px;
}
.crumbs a.crumb:hover { color: var(--colors-gray12); }
.crumbs .sep {
  color: var(--colors-gray8);
  user-select: none;
}
.crumbs .here { color: var(--colors-gray12); }
/* entrance: crumbs cascade in on springs (chrome.js drives transform);
   this is only the resting state and the pre-entrance one */
.crumbs [data-cascade] {
  opacity: 0;
  will-change: transform, opacity;
}
.crumbs .arrow-btn:focus-visible,
.crumbs a.crumb:focus-visible {
  outline: 2px solid var(--colors-focus);
  outline-offset: 3px;
}

/* the back tooltip, in the spatial-tooltip voice: a small floating card
   under the control, fading + settling upward into place */
.crumbs .back-tip {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--card-bg, #fff);
  box-shadow: var(--shadow-dock);
  color: var(--colors-gray11);
  font-size: 12.5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 150ms ease, transform 150ms ease;
}
.crumbs .back-tip b {
  color: var(--colors-gray12);
  font-weight: 500;
}
.crumbs .back-tip[data-show="true"] {
  opacity: 1;
  transform: translateY(0);
}

/* ---- liquid swipe (swipe.js): the back gesture ----
   horizontal overscroll containment is set from swipe.js, and only on
   pages that actually carry the tongue — the menu keeps the browser's
   native history swipe */
.ls-svg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 70; /* over the page, under the radial menu's 80 */
  pointer-events: none;
  visibility: hidden;
}
.ls-edge {
  position: fixed;
  left: 0;
  top: 0;
  width: 14px;
  height: 100vh;
  z-index: 71;
  cursor: e-resize;
  /* fingers scroll and edge-swipe natively (swipe.js ignores touch
     pointers); only the mouse drives the liquid */
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
/* touch-first devices keep the system back gesture and their dock
   corner: no strip at all */
@media (pointer: coarse) {
  .ls-edge { display: none; }
}
/* nor on a window too narrow for the dock to stay out of its way: a
   magnified key reaches x=-5 at 390px and x=20 at 440px, so under 460
   the strip would sit on top of a real control. Measured on the paper
   dock with each of the two leftmost keys hovered. */
@media (max-width: 459px) {
  .ls-edge { display: none; }
}

/* ---- theme key ---- */
.theme-key {
  position: fixed;
  top: 20px;
  right: 28px;
  z-index: 40;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 0;
  padding: 0;
  background: var(--card-bg, #fff);
  box-shadow: var(--shadow-dock);
  color: var(--colors-gray11);
  display: grid;
  place-items: center;
  cursor: pointer;
  transform-origin: 50% 100%;
  will-change: transform;
  /* its own transition group: the bite-morph stays live above the
     theme wave instead of being frozen into the root snapshots */
  view-transition-name: theme-key;
}
.theme-key svg {
  width: 16px;
  height: 16px;
  display: block;
}
/* the lab's Blurred Icons on the keycap: the sun/moon's blown-up echo
   floods the plate from behind, morphing in step with the crisp glyph */
.theme-key {
  isolation: isolate;
  overflow: hidden;
}
.theme-key svg.key-bloom {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 27px;
  height: 27px;
  transform: translate(-50%, -50%);
  filter: blur(7px);
  opacity: 0.4;
  pointer-events: none;
  z-index: -1;
  transition: opacity 180ms ease-out;
}
.theme-key:hover svg.key-bloom,
.theme-key:focus-visible svg.key-bloom {
  opacity: 0.8;
}
@media (prefers-reduced-motion: reduce) {
  .theme-key svg.key-bloom { transition-duration: 0.01ms; }
}
.theme-key:focus-visible {
  outline: 2px solid var(--colors-focus);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .crumbs { left: 16px; }
  .theme-key { right: 16px; }
}
