/* The phone's tab bar floats: a rounded card centred at the bottom of the screen (AppShell.css), as wide as its tabs
   need and no wider, over the page that scrolls under it, at the scale of an app's own (Instagram's: a 49pt bar, icons
   of 25 to 28pt, each tab a wide target). Each tab is its icon alone, 28px (--size-icon-lg) in a 64px-wide
   (--space-16) and 52px-high (--wi-bottom-tab-height, AppShell.css) touch target; its name is there for screen readers
   only. The open tab sits on a tinted pill, its corners following the bar's: the pill is the tab's ::before, so it
   moves alone and the icon above it stays put. A press dims and shrinks the icon (the browser's grey flash is off) and
   paints no pill, so the pill never leaves the open tab before its page arrives. A finger can also swipe across the bar
   (tab_swipe_controller.js, which is why the bar takes no scrolling touch of its own): the pill follows it from tab
   to tab, and the tab it is over opens on release. The bar takes taps back from the see-through strip around it. Its
   shadow is a medium one: it reaches 12px below the bar, the gap Safari leaves above its toolbar's flat strip, so the
   strip never cuts it. When a page opens, the pill glides to the new open tab (a view transition, ViewTransitions.css:
   the pill springs past it and settles, the icon pops) in three layers of their own, the card under, the pill above
   it, the tabs' icons on top, so only the pill moves; a swipe's own pill glides on from where the finger left it. */
.wi-bottom-tab-bar {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--space-16);
  width: fit-content;
  padding: var(--space-0-5);
  border: var(--border-1) solid transparent;
  pointer-events: auto;
  view-transition-name: wi-bottom-bar;
}
/* The card (its background, border and shadow) is a layer of its own, under the pill's. */
.wi-bottom-tab-bar::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--border-1));
  z-index: -1;
  border: var(--wi-bottom-tab-bar-card-border);
  border-radius: var(--wi-bottom-tab-bar-card-radius);
  background-color: var(--wi-bottom-tab-bar-card-background);
  box-shadow: var(--wi-bottom-tab-bar-card-shadow);
  pointer-events: none;
  view-transition-name: wi-bottom-bar-card;
}
.wi-bottom-tab-bar__item {
  position: relative;
  isolation: isolate;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  min-height: var(--wi-bottom-tab-height);
  border-radius: var(--radius-2xl);
  color: var(--text-secondary);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}
.wi-bottom-tab-bar__item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
/* A mouse over a narrow window gets a quiet hover; a finger doesn't, or a tap would flash grey again. */
@media (hover: hover) {
  .wi-bottom-tab-bar__item[data-hovered]:not([aria-current=page], [data-opening]) {
    background-color: var(--background-sunken);
    color: var(--text-primary);
  }
}
/* The open tab's pill, and the tab of a page while it opens when there is no view transition to glide (tab_bar_controller.js). */
.wi-bottom-tab-bar__item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: var(--radius-2xl);
  background-color: transparent;
  pointer-events: none;
}
.wi-bottom-tab-bar__item[aria-current=page]::before,
.wi-bottom-tab-bar__item[data-opening]::before {
  background-color: var(--background-accent-subtle);
}
/* The tab that shows as open also draws its icon bolder (internal/NavIcon.css explains `--wi-nav-icon-stroke`). */
.wi-bottom-tab-bar__item[aria-current=page],
.wi-bottom-tab-bar__item[data-opening] {
  color: var(--brand-secondary-bg);
  --wi-nav-icon-stroke: 2.5;
}
.wi-bottom-tab-bar:has([data-opening]) .wi-bottom-tab-bar__item[aria-current=page]:not([data-opening]) {
  color: var(--text-secondary);
  --wi-nav-icon-stroke: initial; /* back to the nav's own stroke (application.css) */
}
.wi-bottom-tab-bar:has([data-opening]) .wi-bottom-tab-bar__item[aria-current=page]:not([data-opening])::before {
  background-color: transparent;
}
/* A press: the icon dims and shrinks a little, on the tab itself, so nothing moves between tabs. */
.wi-bottom-tab-bar__item .wi-bottom-tab-bar__icon {
  transition: transform 100ms ease-out, opacity 100ms ease-out;
}
.wi-bottom-tab-bar__item[data-pressed] .wi-bottom-tab-bar__icon {
  opacity: 0.6;
  transform: scale(0.88);
}

/* A swipe across the bar: the pill is its own element, moved under the tab the finger is over (tab_swipe_controller.js
   sets where and how wide), so the tabs themselves keep no background while it lasts. */
.wi-bottom-tab-bar__pill {
  position: absolute;
  top: var(--space-0-5);
  bottom: var(--space-0-5);
  left: 0;
  width: var(--wi-tab-pill-width, 0);
  translate: var(--wi-tab-pill-x, 0) 0;
  border-radius: var(--radius-2xl);
  background-color: var(--background-accent-subtle);
  opacity: 0;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  transition: translate 150ms ease-out, width 150ms ease-out;
}
.wi-bottom-tab-bar[data-swiping] .wi-bottom-tab-bar__pill {
  opacity: 1;
}
.wi-bottom-tab-bar[data-swiping] .wi-bottom-tab-bar__item {
  background-color: transparent;
  color: var(--text-secondary);
  --wi-nav-icon-stroke: initial; /* back to the nav's own stroke (application.css) */
}
.wi-bottom-tab-bar[data-swiping] .wi-bottom-tab-bar__item::before {
  background-color: transparent;
}
.wi-bottom-tab-bar[data-swiping] .wi-bottom-tab-bar__item[data-swiping-over] {
  color: var(--brand-secondary-bg);
  --wi-nav-icon-stroke: 2.5;
}
@media (prefers-reduced-motion: reduce) {
  .wi-bottom-tab-bar__pill,
  .wi-bottom-tab-bar__item .wi-bottom-tab-bar__icon {
    transition: none;
  }
}

.wi-bottom-tab-bar__icon{width:var(--size-icon-lg);height:var(--size-icon-lg);display:inline-flex}.wi-bottom-tab-bar__icon>svg{width:100%;height:100%}button.wi-bottom-tab-bar__item{cursor:pointer;background:0 0;border:0;padding:0}.wi-bottom-tab-bar-more__dialog{outline:none}.wi-bottom-tab-bar-more__list{gap:var(--space-0-5);padding:var(--space-2) var(--space-3) var(--space-4);flex-direction:column;margin:0;list-style:none;display:flex}.wi-bottom-tab-bar-more__link{align-items:center;gap:var(--space-3);min-height:var(--size-control-lg);padding:0 var(--space-3);border-radius:var(--radius-md);color:var(--text-secondary);font-size:var(--font-size-base);line-height:var(--font-line-height-base);font-weight:var(--font-weight-medium);text-decoration:none;display:flex}.wi-bottom-tab-bar-more__link:hover{background-color:var(--background-sunken);color:var(--text-primary)}.wi-bottom-tab-bar-more__link:focus-visible{box-shadow:var(--focus-ring);outline:none}.wi-bottom-tab-bar-more__link[aria-current=page]{background-color:var(--background-accent-subtle);color:var(--text-primary);font-weight:var(--font-weight-semibold)}.wi-bottom-tab-bar-more__icon{width:var(--size-icon-md);height:var(--size-icon-md);flex:none;display:inline-flex}.wi-bottom-tab-bar-more__icon>svg{width:100%;height:100%}.wi-bottom-tab-bar-more__link[aria-current=page] .wi-bottom-tab-bar-more__icon{color:var(--brand-secondary-bg)}


/* The sheet itself is SheetComponent (Sheet.css); these are its content: each icon on a grey tile, and a check on the
   open page. It is compact, as a phone's own sheets are: one row per link at a finger's height. The sheet's panel pads
   the sides, so the rows add no inline space of their own. */
.wi-bottom-tab-bar-more__icon {
  box-sizing: content-box;
  padding: var(--space-1);
  border-radius: var(--radius-md);
  background-color: var(--background-sunken);
}
.wi-bottom-tab-bar-more__check {
  flex: none;
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
  margin-left: auto;
  color: var(--brand-secondary-bg);
}

.wi-bottom-tab-bar-more__list {
  gap: 0;
  padding: var(--space-1) 0 var(--space-2);
}

.wi-bottom-tab-bar-more__link {
  gap: var(--space-3);
  min-height: var(--size-button-md);
  padding-block: var(--space-1);
}

/* More's account: the person (their avatar, name and e-mail) above the pages, then the account's rows and their choices
   (AccountChoices, `:sheet`), each at a finger's height. */
.wi-bottom-tab-bar-more__account {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-1) var(--space-2);
}
.wi-bottom-tab-bar-more__identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wi-bottom-tab-bar-more__name {
  font-size: var(--font-size-base);
  line-height: var(--font-line-height-base);
  font-weight: var(--font-weight-semibold);
  overflow-wrap: anywhere;
}
.wi-bottom-tab-bar-more__email {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--font-line-height-sm);
  overflow-wrap: anywhere;
}

/* A section's label above its group, as iOS Settings has them. */
.wi-bottom-tab-bar-more__label {
  padding: var(--space-3) var(--space-1) var(--space-1);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  line-height: var(--font-line-height-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
}

/* A grouped list: one rounded block on the sunken tone, its rows separated by hairlines. The pages (links) and the
   account's rows are the same block; a row is a finger's height. */
.wi-bottom-tab-bar-more__group {
  margin: 0 0 var(--space-2);
  padding: 0;
  gap: 0;
  border-radius: var(--radius-xl);
  background-color: var(--background-sunken);
  list-style: none;
  overflow: hidden;
}
.wi-bottom-tab-bar-more__group > li + li {
  border-top: var(--border-1) solid var(--border-default);
}
.wi-bottom-tab-bar-more__group .wi-bottom-tab-bar-more__link,
.wi-bottom-tab-bar-more__row {
  min-height: var(--size-control-lg);
  padding: 0 var(--space-4);
  border-radius: 0;
  color: var(--text-primary);
}
.wi-bottom-tab-bar-more__group .wi-bottom-tab-bar-more__icon,
.wi-bottom-tab-bar-more__tile {
  background-color: var(--background-surface);
}
.wi-bottom-tab-bar-more__tile {
  box-sizing: border-box;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--size-avatar-md);
  height: var(--size-avatar-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
}
.wi-bottom-tab-bar-more__chevron {
  flex: none;
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
  color: var(--text-tertiary);
}
.wi-bottom-tab-bar-more__link > .wi-bottom-tab-bar-more__chevron {
  margin-left: auto;
}
.wi-bottom-tab-bar-more__check + .wi-bottom-tab-bar-more__chevron {
  margin-left: 0;
}

/* An account row: a button across the group, its current choice before the chevron. */
.wi-bottom-tab-bar-more__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-size-base);
  line-height: var(--font-line-height-base);
  font-weight: var(--font-weight-medium);
  text-align: start;
  cursor: pointer;
}
.wi-bottom-tab-bar-more__row:hover {
  background-color: var(--background-disabled);
}
.wi-bottom-tab-bar-more__row:focus-visible {
  box-shadow: var(--focus-ring);
  outline: none;
}
.wi-bottom-tab-bar-more__value {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
}
.wi-bottom-tab-bar-more__row--danger {
  color: var(--feedback-error-fg);
}
.wi-bottom-tab-bar-more__group form {
  display: contents;
}

/* The choices of a panel are the popover's own forms and rows (application.css), at a finger's height. */
.wi-bottom-tab-bar-more__choices {
  --wi-popover-font-size: var(--font-size-base);
  --wi-popover-line-height: var(--font-line-height-base);
  padding: 0 0 var(--space-2);
}
.wi-bottom-tab-bar-more__choices .wi-menu-choice {
  min-height: var(--size-button-md);
}

/* The More sheet's panels (SheetPanelsController, which hides all but the open one: Sheet.css). */
.wi-bottom-tab-bar-more__panel {
  outline: none;
}
.wi-bottom-tab-bar-more__back {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--size-button-md);
  padding: 0 var(--space-1);
  border: 0;
  background: transparent;
  color: var(--brand-secondary-bg);
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
}
.wi-bottom-tab-bar-more__back:focus-visible {
  box-shadow: var(--focus-ring);
  outline: none;
}
.wi-bottom-tab-bar-more__back > svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

/* The glide between tabs (a view transition) is three layers of the bar: its card (background, border, shadow), the
   open tab's pill, and the tabs with their icons, stacked in that order, so the browser moves the pill alone from the old
   open tab to the new one: no icon is ever part of what moves, it only takes the new colour. The card's
   pictures don't fade or brighten, and the tabs show their new one alone. A swipe's pill takes the pill's
   name while the finger's state lasts, so the glide starts where the finger left it; the tab it opens takes it back on
   the new page. Durations and easings aren't tokens: the spring is 380ms, overshooting. */
.wi-bottom-tab-bar__item[aria-current=page]::before {
  view-transition-name: wi-bottom-tab-pill;
}
.wi-bottom-tab-bar[data-swiping] .wi-bottom-tab-bar__item[aria-current=page]::before {
  view-transition-name: none;
}
.wi-bottom-tab-bar[data-swiping] .wi-bottom-tab-bar__pill {
  view-transition-name: wi-bottom-tab-pill;
}
::view-transition-group(wi-bottom-bar-card) {
  z-index: 1;
}
::view-transition-group(wi-bottom-tab-pill) {
  z-index: 2;
  animation-duration: 380ms;
  animation-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1);
}
::view-transition-group(wi-bottom-bar) {
  z-index: 3;
}
::view-transition-old(wi-bottom-bar-card),
::view-transition-new(wi-bottom-bar-card),
::view-transition-new(wi-bottom-bar) {
  animation: none;
  mix-blend-mode: normal;
}
/* The tabs layer shows its new picture alone: it has no background, so the old one under it would show through the new
   one's gaps (the old icon beside the new one popping). */
::view-transition-old(wi-bottom-bar) {
  display: none;
}
/* The icon of the tab that opens pops as the pill arrives, in a visit's transition only (view_transitions.js marks the
   page while it plays), not when a page loads or Back shows one. */
@media (prefers-reduced-motion: no-preference) {
  html[data-gliding] .wi-bottom-tab-bar__item[aria-current=page] .wi-bottom-tab-bar__icon {
    animation: wi-bottom-tab-icon-pop 380ms ease-out;
  }
}
@keyframes wi-bottom-tab-icon-pop {
  40% { transform: scale(1.18); }
}
