/* help-center-nav.css
 *
 * The sidebar of a PUBLIC help-center article (/help/{provider}/{lang}/articles/…): the category tree of
 * the language, a filter over every title, and the drawer the same element becomes on a phone. Wired by
 * help-center-nav.js. Plain CSS like the rest of the help-center shell (see help-center.css): the filter
 * and the folding toggle states the Tailwind scan never sees in markup.
 *
 * Two layouts, one element. From 860px the sidebar is a sticky column with its own scroll; below it is an
 * off-canvas drawer the path bar above the article opens. The provider's accent marks only the article
 * the reader is on; everything else stays neutral, like the rail on the right.
 */

/* ---------- trigger (phone only) ---------- */

/* The bar above the article that names where the reader is and opens the drawer. It replaces the
   breadcrumb on a phone: both say the same thing, and only one of them can also open the tree. */
.hc-nav-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    background: #ffffff;
    color: #3f3f46;
    font: inherit;
    font-size: 14px;
    text-align: start;
    cursor: pointer;
}

.hc-nav-trigger-path {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hc-nav-trigger-path strong {
    color: #18181b;
    font-weight: 600;
}

@media (min-width: 860px) {
    .hc-nav-trigger {
        display: none;
    }
}


/* ---------- the sidebar ---------- */

.hc-nav {
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.hc-nav-head {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 0 4px 0 16px;
    border-bottom: 1px solid #f4f4f5;
    color: #3f3f46;
    font-size: 15px;
    font-weight: 600;
}

.hc-nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-inline-start: auto;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #52525b;
    cursor: pointer;
}

/* A filled field without a frame: it is a tool of the panel, not a form on the page. The frame appears
   as a ring in the provider's colour while the reader types. */
.hc-nav-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    margin: 10px 10px 6px;
    padding: 0 6px 0 10px;
    border-radius: 10px;
    background: #f4f4f5;
    color: #a1a1aa;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.hc-nav-filter:focus-within {
    background: #ffffff;
    box-shadow: 0 0 0 1px var(--lw-widget-on-light, #4f46e5),
    0 0 0 4px color-mix(in srgb, var(--lw-widget-on-light, #4f46e5) 14%, transparent);
    color: var(--lw-widget-on-light, #4f46e5);
}

.hc-nav-filter input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #18181b;
    font: inherit;
    font-size: 13.5px;
}

.hc-nav-filter input::placeholder {
    color: #71717a;
}

.hc-nav-clear {
    display: flex;
    padding: 5px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #71717a;
    cursor: pointer;
}

.hc-nav-clear:hover {
    background: #e4e4e7;
    color: #18181b;
}

/* Positioned so the links measure their offsetTop from here (help-center-nav.js, revealCurrent). */
.hc-nav-tree {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 8px 12px;
}

/* The frame the tree scrolls in, and the one its own scrollbar is laid over. */
.hc-nav-scroll {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Before help-center-scrollbar.js has taken over, the tree scrolls under the app's own quiet pill
   (scrollbars.css). No scrollbar-width on it: Chrome drops every ::-webkit-scrollbar rule of an element
   that sets it and draws its native bar, arrows included. Only a browser without those rules gets the
   standard pair. */
@supports not selector(::-webkit-scrollbar) {
    .hc-nav-tree {
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
    }

    .dark .hc-nav-tree {
        scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    }
}

/* Once help-center-scrollbar.js runs, the bar of help-center.css takes over from the native one. */

.hc-nav-empty {
    margin: 0;
    padding: 8px 10px;
    color: #52525b;
    font-size: 13.5px;
    line-height: 1.5;
}

/* A category: the native <details> carries the open state, so the tree folds without script and keeps
   working if the module never loads. */
.hc-nav-cat {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 8px;
    color: #3f3f46;
    font-size: 14px;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.hc-nav-cat::-webkit-details-marker {
    display: none;
}

.hc-nav-cat:hover {
    background: #f4f4f5;
    color: #18181b;
}

.hc-nav-cat[data-hc-current] {
    color: #18181b;
    font-weight: 600;
}

.hc-nav-cat-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The count as a small pill, like the one on the category cards (.hc-count): a measurement, not text. */
.hc-nav-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #f4f4f5;
    color: #71717a;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: background-color 0.15s ease;
}

.hc-nav-cat:hover .hc-nav-count {
    background: #e4e4e7;
}

.hc-nav-chev {
    flex: none;
    width: 16px;
    height: 16px;
    padding: 2px;
    color: #a1a1aa;
    transition: transform 0.36s cubic-bezier(0.2, 0.8, 0.2, 1); /* = FOLD_MS in help-center-nav.js */
}

/* Turned by where the category is HEADING: a closing fold keeps the details open until it ends, and the
   chevron must turn back with the click, not after the animation. */
details[open]:not([data-hc-nav-folding="closing"]) > .hc-nav-cat .hc-nav-chev {
    transform: rotate(90deg);
}

/* The box whose height help-center-nav.js animates. Clipped only while it moves: at rest nothing in it
   may be cut, the accent bar on the guide line least of all. */
[data-hc-nav-folding] > .hc-nav-fold {
    overflow: hidden;
}

/* The children hang from a guide line. Spacing is padding, not margin, so it is part of the height the
   fold measures and nothing collapses through the fold when it stops being clipped. */
.hc-nav-children {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-inline-start: 15px;
    padding: 2px 0 6px 8px;
    border-inline-start: 1px solid #ececee;
}

.hc-nav-link {
    position: relative;
    display: block;
    padding: 6px 10px;
    border-radius: 8px;
    color: #71717a;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 20px;
    text-decoration: none;
    /* Titles wrap in full: most of them are questions, and a cut question leaves out the part that
       tells two articles apart. */
    overflow-wrap: anywhere;
    text-wrap: pretty;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.hc-nav-link:hover {
    background: #f4f4f5;
    color: #18181b;
}

/* The one place the provider's colour appears: the article the reader is on, as a tinted pill in the
   accent's ink. */
.hc-nav-link[aria-current="page"] {
    background: var(--lw-widget-tint, #eef2ff);
    color: var(--lw-widget-on-light, #4f46e5);
    font-weight: 600;
}

/* The same position marked on the guide line: the bar covers the line's stretch beside the pill. */
.hc-nav-children > .hc-nav-link[aria-current="page"]::before {
    content: "";
    position: absolute;
    inset-block: 7px;
    inset-inline-start: -10px;
    width: 3px;
    border-radius: 3px;
    background: var(--lw-widget-accent, #4f46e5);
}

.hc-nav-link mark {
    border-radius: 3px;
    background: color-mix(in srgb, var(--lw-widget-on-light, #4f46e5) 14%, transparent);
    color: inherit;
    font-weight: 600;
}

.hc-nav-backdrop {
    display: none;
}

/* Phone: an off-canvas drawer above the header, opened by the trigger. z-index pair 65/66, see the
   table in 07-frontend-css.instructions.md. */
@media (max-width: 859.98px) {
    .hc-nav {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        z-index: 66;
        width: min(328px, 88vw);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
        transform: translateX(-102%);
        /* Visibility keeps the closed drawer out of the tab order; it flips at the END of the slide out,
           so closing animates instead of vanishing. */
        transition: transform 0.2s ease, visibility 0.2s;
        visibility: hidden;
    }

    .hc-nav[data-hc-nav-open] {
        transform: none;
        visibility: visible;
    }

    .hc-nav[data-hc-nav-open] + .hc-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 65;
        background: rgba(0, 0, 0, 0.45);
    }

    .hc-nav-cat {
        min-height: 44px;
    }

    .hc-nav-link {
        padding-block: 10px;
    }
}

/* Desktop: a column flush with the screen's left edge, the way documentation sites hold their tree. It
   runs from under the header (h-16 plus its 1px border) to the bottom of the screen and scrolls on its
   own; sticky rather than fixed, so it gives way to the footer instead of covering it. */
@media (min-width: 860px) {
    .hc-nav {
        position: sticky;
        top: 65px;
        align-self: flex-start;
        flex: none;
        width: 300px;
        height: calc(100vh - 65px);
        border-inline-end: 1px solid #e4e4e7;
    }

    .hc-nav-head {
        display: none;
    }

    .hc-nav-filter {
        margin: 16px 16px 8px;
    }

    .hc-nav-tree {
        padding: 4px 12px 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hc-nav,
    .hc-nav-chev,
    .hc-nav-filter,
    .hc-nav-cat,
    .hc-nav-count,
    .hc-nav-link {
        transition: none;
    }
}


/* ---------- previous / next ---------- */

.hc-pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.hc-pager-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    padding: 16px 20px;
    border: 1px solid #e4e4e7;
    border-radius: 16px;
    background: #ffffff;
    text-decoration: none;
    transition: border-color 0.15s ease;
}

.hc-pager-link:hover {
    border-color: var(--lw-widget-on-light, #4f46e5);
}

.hc-pager-next {
    grid-column: 2;
    align-items: flex-end;
    text-align: end;
}

.hc-pager-label {
    color: #71717a;
    font-size: 12.5px;
    font-weight: 400;
}

.hc-pager-title {
    color: #18181b;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

@media (max-width: 639.98px) {
    .hc-pager {
        grid-template-columns: minmax(0, 1fr);
    }

    .hc-pager-next {
        grid-column: auto;
    }
}


/* ---------- dark scheme ---------- */

.dark .hc-nav,
.dark .hc-nav-trigger {
    background: #18181b;
}

.dark .hc-nav,
.dark .hc-nav-trigger,
.dark .hc-pager-link {
    border-color: #27272a;
}

.dark .hc-nav-head {
    border-color: #27272a;
}

.dark .hc-pager-link {
    background: #09090b;
}

.dark .hc-nav-filter,
.dark .hc-nav-count {
    background: #27272a;
}

.dark .hc-nav-filter:focus-within {
    background: #09090b;
    box-shadow: 0 0 0 1px var(--lw-widget-on-dark, #a5b4fc),
    0 0 0 4px color-mix(in srgb, var(--lw-widget-on-dark, #a5b4fc) 18%, transparent);
    color: var(--lw-widget-on-dark, #a5b4fc);
}

.dark .hc-nav-head,
.dark .hc-nav-cat,
.dark .hc-nav-trigger,
.dark .hc-nav-close {
    color: #d4d4d8;
}

.dark .hc-nav-filter input,
.dark .hc-nav-cat[data-hc-current],
.dark .hc-nav-trigger-path strong,
.dark .hc-pager-title {
    color: #fafafa;
}

.dark .hc-nav-filter input::placeholder,
.dark .hc-nav-count {
    color: #a1a1aa;
}

.dark .hc-pager-link:hover {
    border-color: var(--lw-widget-on-dark, #a5b4fc);
}

.dark .hc-nav-link,
.dark .hc-nav-empty {
    color: #a1a1aa;
}

.dark .hc-nav-cat:hover,
.dark .hc-nav-link:hover,
.dark .hc-nav-clear:hover {
    background: #27272a;
    color: #fafafa;
}

.dark .hc-nav-cat:hover .hc-nav-count {
    background: #3f3f46;
}

.dark .hc-nav-children {
    border-inline-start-color: #2f2f35;
}

/* Same wash as the home cards' icons (help-center.css): the widget's dark tint is mixed into the
   widget's own ground and vanishes on this plate. */
.dark .hc-nav-link[aria-current="page"] {
    background: color-mix(in srgb, var(--lw-widget-on-dark, #a5b4fc) 16%, transparent);
    color: var(--lw-widget-on-dark, #a5b4fc);
}

.dark .hc-nav-children > .hc-nav-link[aria-current="page"]::before {
    background: var(--lw-widget-on-dark, #a5b4fc);
}

.dark .hc-nav-link mark {
    background: color-mix(in srgb, var(--lw-widget-on-dark, #a5b4fc) 22%, transparent);
}
