/* UBC pilot reading progress — batch 201K.
   Scope: pilot index RU/UA/EN pages only via body.ubc-pilot-reading-progress.
   Does not modify menu state-machine or shared site styles. */

/* Dedicated desktop progress line. It is aligned by the sticky-nav variables
   already maintained by ubc-shell.js. */
.ubc-pilot-desktop-progress {
  position: fixed;
  top: var(--ubc-sticky-nav-height, 30px);
  left: var(--ubc-sticky-nav-left, 40px);
  z-index: 6004;
  display: none;
  width: var(--ubc-sticky-nav-width, calc(100% - 80px));
  height: 2px;
  overflow: hidden;
  background: #fff;
  pointer-events: none;
}
.ubc-pilot-desktop-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: #00009F;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .08s linear;
  will-change: transform;
}

@media (min-width: 901px) {
  body.ubc-pilot-reading-progress.ubc-desktop-nav-stuck .ubc-pilot-desktop-progress {
    display: block;
  }
}

/* Mobile: the existing 4px double rule consists of 1px upper line,
   2px white interior and 1px lower line. The progress fill occupies only
   the 2px white interior, so the historical double rule remains visible. */
@media (max-width: 900px) {
  body.ubc-pilot-reading-progress .header-visual-inner .logo-rule {
    position: relative !important;
    overflow: hidden !important;
  }
  .ubc-pilot-mobile-progress-fill {
    position: absolute;
    top: 1px;
    right: 0;
    bottom: 1px;
    left: 0;
    z-index: 2;
    display: block;
    height: 2px;
    background: #00009F;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .08s linear;
    will-change: transform;
    pointer-events: none;
  }

  /* Date is moved visually from breadcrumbs to the compact utility line. */
  body.ubc-pilot-reading-progress .page-breadcrumbs .breadcrumb-js-date {
    display: none !important;
  }
  .ubc-pilot-utility-date {
    display: inline-block !important;
    flex: 0 0 auto !important;
    margin: 0 2px 0 0 !important;
    padding: 0 2px !important;
    color: #565b63 !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 17px !important;
    white-space: nowrap !important;
  }

  /* Fixed mobile reading header. The placeholder preserves the exact
     original header geometry, so search/content do not jump when it locks. */
  .ubc-pilot-mobile-sticky-placeholder {
    display: none;
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }
  body.ubc-pilot-mobile-header-stuck .ubc-pilot-mobile-sticky-placeholder {
    display: block;
    height: var(--ubc-pilot-mobile-sticky-height, 93px);
  }

  body.ubc-pilot-mobile-header-stuck .header-visual-inner > .utility-row {
    position: fixed !important;
    top: 0 !important;
    left: var(--ubc-pilot-mobile-sticky-left, 10px) !important;
    z-index: 6202 !important;
    width: var(--ubc-pilot-mobile-sticky-width, calc(100% - 20px)) !important;
    margin: 0 !important;
  }
  body.ubc-pilot-mobile-header-stuck .header-visual-inner > .header-brand-row {
    position: fixed !important;
    top: var(--ubc-pilot-mobile-utility-height, 17px) !important;
    left: var(--ubc-pilot-mobile-sticky-left, 10px) !important;
    z-index: 6201 !important;
    width: var(--ubc-pilot-mobile-sticky-width, calc(100% - 20px)) !important;
    margin: 0 !important;
  }
  body.ubc-pilot-mobile-header-stuck .header-visual-inner > .logo-rule {
    position: fixed !important;
    top: calc(var(--ubc-pilot-mobile-utility-height, 17px) + var(--ubc-pilot-mobile-brand-height, 72px)) !important;
    left: var(--ubc-pilot-mobile-sticky-left, 10px) !important;
    z-index: 6203 !important;
    width: var(--ubc-pilot-mobile-sticky-width, calc(100% - 20px)) !important;
    margin: 0 !important;
  }

  /* The old separate post-header stuck hamburger is redundant while the
     complete compact header is fixed. Keep the control in its original host. */
  body.ubc-pilot-mobile-header-stuck .ubc-mobile-header-toggle-host.ubc-mobile-hamburger-stuck {
    position: absolute !important;
    top: 50% !important;
    right: 3px !important;
    left: auto !important;
    width: 44px !important;
    height: 44px !important;
    transform: translateY(-50%) !important;
  }
}

@media (min-width: 901px) {
  .ubc-pilot-mobile-progress-fill,
  .ubc-pilot-mobile-sticky-placeholder {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ubc-pilot-desktop-progress-fill,
  .ubc-pilot-mobile-progress-fill {
    transition: none !important;
  }
}

/* Keep the complete mobile utility sentence + full date + language buttons on
   one stable line even on 320px screens. Height stays 17px, only glyph size
   contracts fluidly with viewport width. */
@media (max-width: 900px) {
  body.ubc-pilot-reading-progress .header-visual-inner > .utility-row,
  body.ubc-pilot-reading-progress .main-nav-wrap.menu-open > .ubc-mobile-menu-utility {
    justify-content: flex-end !important;
    font-size: clamp(8px, 2.4vw, 10.5px) !important;
  }
  body.ubc-pilot-reading-progress .header-visual-inner > .utility-row > a,
  body.ubc-pilot-reading-progress .header-visual-inner > .utility-row > span:not(.utility-language-links),
  body.ubc-pilot-reading-progress .main-nav-wrap.menu-open > .ubc-mobile-menu-utility > a,
  body.ubc-pilot-reading-progress .main-nav-wrap.menu-open > .ubc-mobile-menu-utility > span:not(.utility-language-links),
  body.ubc-pilot-reading-progress .header-visual-inner > .utility-row .utility-language-links a,
  body.ubc-pilot-reading-progress .main-nav-wrap.menu-open > .ubc-mobile-menu-utility .utility-language-links a,
  body.ubc-pilot-reading-progress .ubc-pilot-utility-date {
    padding-right: 1px !important;
    padding-left: 1px !important;
    font-size: clamp(8px, 2.4vw, 10.5px) !important;
    line-height: 17px !important;
  }
}

/* Pilot owns its progress indicator; suppress the older longread-only bar if
   it is ever loaded by another script on the same page. */
body.ubc-pilot-reading-progress .ubc-reading-progress {
  display: none !important;
}


/* 201K: compact utility order is intentionally:
   service registration | permits/licences | full JS date | languages.
   The third desktop utility link remains available on desktop only. */
@media (max-width: 900px) {
  body.ubc-pilot-reading-progress .header-visual-inner > .utility-row,
  body.ubc-pilot-reading-progress .main-nav-wrap.menu-open > .ubc-mobile-menu-utility {
    box-sizing: border-box !important;
    padding-right: var(--ubc-pilot-mobile-utility-right-pad, 12px) !important;
  }
  body.ubc-pilot-reading-progress .header-visual-inner > .utility-row > .ubc-pilot-mobile-utility-third-link,
  body.ubc-pilot-reading-progress .main-nav-wrap.menu-open > .ubc-mobile-menu-utility > .ubc-pilot-mobile-utility-third-link {
    display: none !important;
  }
  body.ubc-pilot-reading-progress .ubc-pilot-date-lang-sep {
    display: inline-block !important;
    flex: 0 0 auto !important;
    padding: 0 1px !important;
    color: #777d85 !important;
    font-size: clamp(8px, 2.4vw, 10.5px) !important;
    line-height: 17px !important;
  }
  body.ubc-pilot-reading-progress .utility-language-links > a:last-child {
    margin-right: 0 !important;
    padding-right: 0 !important;
  }
}
@media (min-width: 901px) {
  .ubc-pilot-date-lang-sep { display: none !important; }
}
