/**
 * Floating admin-tab region.
 *
 * Vertical strip of local-task tabs (Edit / Delete / Revisions / etc.)
 * stuck to the left edge of the viewport, centered vertically. Position
 * is `fixed` so the tabs never push site content down or shift layout.
 * Empty for anonymous users (no local tasks to show) - so this CSS is
 * a no-op in that case. Hidden entirely on mobile per the
 * "Drupal admin isn't made for mobile" stance.
 */

.region-admin-tab {
  position: fixed;
  /* Position the TOP EDGE (no translateY trick here). max() takes the
   * larger of two candidates:
   *   - Floor: 91px + Drupal's displaced top offset (the admin toolbar
   *     sets --drupal-displace-offset-top on <html> when active). This
   *     guarantees the strip never covers the header / toolbar.
   *   - Centered: 50vh minus an estimate of half the strip's height
   *     (--admin-tab-half-height, default 200px ~= half of a 5-tab
   *     strip of rotated text). When the viewport is tall enough this
   *     wins and the strip appears roughly centered.
   * If the strip grows beyond ~10 tabs the centering will drift but the
   * floor still holds. Bump --admin-tab-half-height per project if needed. */
  top: max(
    calc(91px + var(--drupal-displace-offset-top, 0px)),
    calc(50vh - var(--admin-tab-half-height, 200px))
  );
  left: 0;
  z-index: 1020;
  padding: 0;       /* flush to screen edge - tab text starts at x=0 */
  background: #fff;
  border-radius: 0 0.375rem 0.375rem 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Bootstrap5 base theme rewrites the markup as:
 *   <nav class="tabs"><nav class="tabs-wrapper tabs-primary">
 *     <ul class="nav nav-tabs flex-column flex-md-row primary">
 * The flex-md-row utility class uses !important to force horizontal at
 * >=768px - so we have to fight !important with !important on
 * flex-direction. Same reason for align-items. */
.region-admin-tab .nav-tabs,
.region-admin-tab .tabs.primary,
.region-admin-tab .tabs.secondary {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 0;       /* kill Bootstrap's nav-tabs underline */
  flex-wrap: nowrap !important;
}

/* Hide Bootstrap5's "collapse tabs to dropdown" toggle - irrelevant
 * for a vertical floating strip. */
.region-admin-tab .tab-toggle,
.region-admin-tab .dropdown-toggle {
  display: none;
}

.region-admin-tab .nav-item,
.region-admin-tab .tabs__tab {
  margin: 0;
}

/* Rotate labels 90 deg clockwise so they read top-to-bottom. Tight
 * padding to keep the strip compact but not cramped. */
.region-admin-tab .nav-link,
.region-admin-tab .tabs__tab a {
  display: inline-block;
  writing-mode: vertical-rl;
  padding: 0.5rem 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  color: #777;                /* inactive: slightly grey text */
  background: #f6f6f6;        /* inactive: slightly grey background */
  border: 0 !important;       /* kill all Bootstrap nav-tabs border states */
  border-radius: 0;
}

.region-admin-tab .nav-link:hover,
.region-admin-tab .tabs__tab a:hover {
  color: #222;
  background: #ececec;
}

/* Active tab: full colour, normal weight. No bottom-border indicator
 * (Bootstrap5 uses border-color to "underline" the active tab, which
 * makes no sense in a vertical strip - the colour difference is the
 * indicator now). */
.region-admin-tab .nav-link.active,
.region-admin-tab .tabs__tab.is-active a {
  color: #111;
  background: #fff;
  font-weight: 600;
}

@media (max-width: 767.98px) {
  .region-admin-tab { display: none; }
}

@media print {
  .region-admin-tab { display: none; }
}
