/*
 * The tabs under the title bar of the tablet in portrait: the four sections in a capsule in the middle, like the tab
 * bar of iPadOS 18. The same links as the tab bar of the phone, which is hidden here. Sticky with the title bar.
 */

@layer components {
  /* Only on a tablet in portrait: from 600px to 1023px, and not on a phone on its side (see layout.css). */
  .tabs-top {
    display: none;
    padding: 6px var(--s-4);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  @media (min-width: 600px) and (min-height: 501px), (min-width: 600px) and (pointer: fine) {
    .tabs-top {
      display: block;
    }
  }

  @media (min-width: 1024px) {
    .tabs-top {
      display: none;
    }
  }

  .tabs-top__list {
    display: flex;
    justify-content: center;
    gap: 2px;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    padding: 2px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
  }

  /* Label and icon stay as they are when the text is made larger, like the tab bar of the phone: four of them fit. */
  .tabs-top__tab {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    min-height: var(--tap);
    padding: 0 var(--s-4);
    border-radius: var(--r-pill);
    color: var(--muted);
    font-size: min(0.9375rem, 16px);
    font-weight: 600;
    text-decoration: none;
  }

  .tabs-top__tab .icon {
    width: min(1.375rem, 26px);
    height: min(1.375rem, 26px);
  }

  .tabs-top__tab[aria-current='page'] {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-1);
  }

  /* Pressed: dims under the finger. */
  .tabs-top__tab:active {
    opacity: 0.55;
  }

  /* The number of items on the Mandje tab, as on the tab bar of the phone. */
  .tabs-top__badge {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary);
    color: var(--on-primary);
    font-size: min(0.6875rem, 11px);
    font-weight: 700;
  }

  @media (prefers-reduced-motion: no-preference) {
    .tabs-top__tab {
      transition:
        background-color var(--dur) ease-out,
        color var(--dur) ease-out;
    }
  }
}
