@layer components {
  /* Bottom tab bar -- mobile primary navigation */
  .tab-bar {
    --tab-bar-bg: var(--color-canvas);

    align-items: stretch;
    background-color: var(--tab-bar-bg);
    border-block-start: var(--border);
    display: flex;
    height: var(--tab-bar-height);
    justify-content: space-around;
    padding-bottom: var(--safe-inset-bottom);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-tab-bar);
  }

  @media (min-width: 800px) {
    .tab-bar {
      display: none;
    }
  }

  .tab-bar__item {
    align-items: center;
    color: var(--color-ink-muted);
    display: flex;
    flex: 1;
    flex-direction: column;
    font-size: var(--text-xs);
    gap: 0.15rem;
    justify-content: center;
    text-decoration: none;
    transition: color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
  }

  .tab-bar__item:hover,
  .tab-bar__item--active {
    color: var(--color-link);
  }

  .tab-bar__icon {
    inline-size: 1.25rem;
    block-size: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .tab-bar__label {
    font-weight: 500;
    line-height: 1;
  }

  /* Flash indicator -- pulsing dot on the Bible tab when new records
     arrive while the Story Bible drawer is closed. Cleared when the
     author opens the drawer. */
  @keyframes tab-bar-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
  }

  .tab-bar__item--flash {
    position: relative;
  }

  .tab-bar__item--flash::after {
    animation: tab-bar-flash 1.5s ease-in-out infinite;
    background-color: var(--color-accent);
    block-size: 6px;
    border-radius: 50%;
    content: "";
    inline-size: 6px;
    inset-block-start: 4px;
    inset-inline-end: calc(50% - 12px);
    position: absolute;
  }

  @media (prefers-reduced-motion: reduce) {
    .tab-bar__item--flash::after {
      animation: none;
    }
  }
}
