/* Copyright (c) 2026 ttldtor.
 * SPDX-License-Identifier: BSL-1.0
 * Loaded after the native Turbo fallback. No JavaScript leaves it untouched.
 */
html { --tv-scrollbars-ready: 1; }
.tv-scrollbar { display: none; }
@media screen and (min-width: 768px) and (pointer: fine) and (forced-colors: none) {
  html.turbo-mode .tv-scrollbars-enhanced { scrollbar-width: none !important; box-sizing: border-box !important; }
  /* The gutter must also override Doxygen's ID-based padding shorthand. */
  html.turbo-mode .tv-scrollbars-y { padding-right: calc(var(--tv-original-padding-right, 0px) + 16px) !important; }
  html.turbo-mode .tv-scrollbars-x { padding-bottom: calc(var(--tv-original-padding-bottom, 0px) + 16px) !important; }
  html.turbo-mode .tv-scrollbars-enhanced::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
  html.turbo-mode .tv-scrollbar {
    position: fixed;
    z-index: 99;
    display: flex;
    box-sizing: border-box;
    background: var(--tv-scroll-track, var(--tv-paper, #c0c0c0));
    color: var(--tv-scroll-ink, var(--tv-blue, #000080));
    font: inherit;
    user-select: none;
  }
  html.turbo-mode .tv-scrollbar[hidden] { display: none; }
  html.turbo-mode .tv-scrollbar[data-axis="y"] { flex-direction: column; }
  html.turbo-mode .tv-scrollbar button.tv-scrollbar-arrow,
  html.turbo-mode .tv-scrollbar .tv-scrollbar-arrow:is(:hover, :active, :focus) {
    all: unset;
    position: relative;
    display: block;
    flex: 0 0 16px;
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    min-height: 0;
    border: 1px solid var(--tv-scroll-ink, #000080);
    background: var(--tv-scroll-arrow, var(--tv-paper, #c0c0c0));
    color: inherit;
    cursor: pointer;
    box-shadow: none;
    transform: none;
  }
  html.turbo-mode .tv-scrollbar-arrow::after {
    content: "";
    position: absolute;
    inset: 3px;
    background: currentColor;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
  }
  html.turbo-mode .tv-scrollbar[data-axis="y"] .tv-scrollbar-arrow[data-direction="1"]::after { transform: rotate(180deg); }
  html.turbo-mode .tv-scrollbar[data-axis="x"] .tv-scrollbar-arrow[data-direction="-1"]::after { transform: rotate(-90deg); }
  html.turbo-mode .tv-scrollbar[data-axis="x"] .tv-scrollbar-arrow[data-direction="1"]::after { transform: rotate(90deg); }
  html.turbo-mode .tv-scrollbar-track {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    background-color: var(--tv-scroll-track, var(--tv-paper, #c0c0c0));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Cpath fill='%23808080' d='M0 0h1v1H0zM2 2h1v1H2z'/%3E%3C/svg%3E");
  }
  html.turbo-mode .tv-scrollbar-thumb {
    position: absolute;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    border: 1px solid var(--tv-scroll-track, var(--tv-paper, #c0c0c0));
    background: var(--tv-scroll-thumb, var(--tv-blue, #000080));
    touch-action: none;
    cursor: grab;
  }
  html.turbo-mode .tv-scrollbar-thumb:active { cursor: grabbing; }
  html.turbo-mode .tv-scrollbar :is(button, [role="scrollbar"]):focus-visible { outline: 2px solid var(--tv-yellow, #ffff00); outline-offset: -3px; }
  html.turbo-mode.turbo2-mode .tv-scrollbar-track {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Cpath fill='%231616aa' d='M0 0h2v2H0zM2 2h2v2H2z'/%3E%3C/svg%3E");
  }
}
@media print { .tv-scrollbar { display: none !important; } }
