/*
 * Responsible for: how the trail above the Map looks: steps joined by a chevron, every part but the last a
 * pressable step as tall as a finger needs, the last one the place on show.
 *
 * Must never: change its height with the length of the path or the width of the screen's content:
 * the Map below must never move. Values come from tokens.css only.
 */

@layer kit {
  .ia-crumbs {
    height: var(--tap);
    min-width: 0;
    overflow: hidden;
    font-size: var(--t-md);
  }

  .ia-crumbs__list {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    white-space: nowrap;
  }

  .ia-crumbs__item {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    height: 100%;
    min-width: 0;
  }

  .ia-crumbs__item:last-child {
    flex: 0 1 auto;
  }

  .ia-crumbs.is-measuring .ia-crumbs__item:last-child {
    flex: 0 0 auto;
  }

  .ia-crumbs__item + .ia-crumbs__item::before {
    content: "\203A";
    color: var(--faint);
    padding: 0 var(--s-1);
  }

  .ia-crumbs__step,
  .ia-crumbs__here {
    display: block;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 var(--s-2);
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    font: inherit;
    line-height: var(--tap);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ia-crumbs__step {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
  }

  /* The first step stands at the window's edge, as the Map below it does. */
  .ia-crumbs__item:first-child .ia-crumbs__step,
  .ia-crumbs__item:first-child .ia-crumbs__here {
    padding-left: 0;
  }

  .ia-crumbs__step:hover {
    background: var(--hover);
    color: var(--accent-strong);
  }

  .ia-crumbs__step:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }

  .ia-crumbs__here {
    color: var(--ink);
    font-weight: 600;
  }
}
