/*
 * Really Helpful TOC - Front-end Styles v1.8.0
 * All dimensions, markers, position modes, collapsible, and theme inheritance
 */

/* -------------------------------------------------------------------------
   Custom properties — override via Settings > RHL TOC or theme CSS
   Used only when color_mode = "custom"
   ------------------------------------------------------------------------- */
.rhl-toc {
    --rhl-link-color:   #333333;
    --rhl-link-hover:   #111111;
    --rhl-accent:       #999999;
    --rhl-bg:           #ffffff;
    --rhl-border:       #e0e0e0;
    --rhl-title-color:  #333333;
}

/* -------------------------------------------------------------------------
   Theme inheritance mode — picks up whatever the theme provides
   ------------------------------------------------------------------------- */
.rhl-toc--inherit {
    --rhl-link-color:   inherit;
    --rhl-link-hover:   inherit;
    --rhl-accent:       currentColor;
    --rhl-bg:           transparent;
    --rhl-border:       currentColor;
    --rhl-title-color:  inherit;
    border-color: rgba(128,128,128,0.3);
    border-top-color: rgba(128,128,128,0.5);
}

/* -------------------------------------------------------------------------
   Base container
   ------------------------------------------------------------------------- */
.rhl-toc {
    background-color: var(--rhl-bg);
    border: 1px solid var(--rhl-border);
    border-top: 3px solid var(--rhl-accent);
    border-radius: 4px;
    padding: 16px 20px;
    margin: 0 0 24px;
    font-size: inherit;
    line-height: 1.5;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

/* -------------------------------------------------------------------------
   Title
   ------------------------------------------------------------------------- */
.rhl-toc__title {
    font-weight: 400;
    font-size: 1em;
    color: var(--rhl-title-color);
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rhl-border);
}

/* -------------------------------------------------------------------------
   List
   ------------------------------------------------------------------------- */
.rhl-toc__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rhl-toc__list li {
    margin: 0;
    padding: 0;
}

/* -------------------------------------------------------------------------
   Buttons — look like links, behave like buttons
   ------------------------------------------------------------------------- */
.rhl-toc-button {
    background:      none !important;
    border:          none;
    padding:         4px 0;
    margin:          0;
    font:            inherit;
    font-size:       inherit;
    font-weight:     normal;
    text-align:      left;
    cursor:          pointer;
    display:         block;
    width:           100%;
    color:           var(--rhl-link-color);
    text-decoration: none;
    transition:      color 0.15s ease;
}

.rhl-toc-button:hover {
    color:            var(--rhl-link-hover);
    text-decoration:  underline;
    background:       none !important;
    background-color: transparent !important;
}

.rhl-toc-button:focus {
    outline:          none;
    background:       none !important;
    background-color: transparent !important;
}

.rhl-toc-button:focus-visible {
    outline:        2px solid var(--rhl-link-color);
    outline-offset: 2px;
    border-radius:  2px;
}

/* -------------------------------------------------------------------------
   Marker: Numbered — works at ALL nesting depths
   ------------------------------------------------------------------------- */
.rhl-toc--numbered .rhl-toc__list {
    counter-reset: rhl-toc-counter;
}

.rhl-toc--numbered .rhl-toc__list li {
    counter-increment: rhl-toc-counter;
}

.rhl-toc--numbered .rhl-toc__list li > .rhl-toc-button::before {
    content:      counter(rhl-toc-counter) ". ";
    color:        var(--rhl-accent);
    font-weight:  600;
    margin-right: 2px;
}

/* -------------------------------------------------------------------------
   Marker: Bullets — works at ALL nesting depths
   ------------------------------------------------------------------------- */
.rhl-toc--bullets .rhl-toc__list li > .rhl-toc-button::before {
    content:      "\2022 ";
    color:        var(--rhl-accent);
    font-weight:  700;
    margin-right: 5px;
}

/* -------------------------------------------------------------------------
   Marker: Arrows — works at ALL nesting depths
   ------------------------------------------------------------------------- */
.rhl-toc--arrows .rhl-toc__list li > .rhl-toc-button::before {
    content:      "\2192 ";
    color:        var(--rhl-accent);
    margin-right: 5px;
}

/* -------------------------------------------------------------------------
   Bold items — per-post option to bold TOC entries
   ------------------------------------------------------------------------- */
.rhl-toc--bold-items .rhl-toc-button {
    font-weight: 700;
}

/* -------------------------------------------------------------------------
   Marker: None — no markers at all
   ------------------------------------------------------------------------- */
.rhl-toc--none .rhl-toc__list li > .rhl-toc-button::before {
    content:      none;
}

/* -------------------------------------------------------------------------
   Style: Flat — single-level list
   ------------------------------------------------------------------------- */
.rhl-toc--flat .rhl-toc__list {
    /* All items at same visual level */
}

/* -------------------------------------------------------------------------
   Style: Nested — hierarchical indentation
   ------------------------------------------------------------------------- */
.rhl-toc--nested .rhl-toc__list .rhl-toc__list {
    margin-left:   20px;
    margin-top:    2px;
    margin-bottom: 2px;
}

/* Sub-level visual hierarchy */
.rhl-toc--nested .rhl-toc__list .rhl-toc__list .rhl-toc-button {
    font-size: 0.93em;
    opacity:   0.9;
}

.rhl-toc--nested .rhl-toc__list .rhl-toc__list .rhl-toc__list .rhl-toc-button {
    font-size: 0.87em;
    opacity:   0.8;
}

/* -------------------------------------------------------------------------
   Position: Left — floated, text wraps around it
   ------------------------------------------------------------------------- */
.rhl-toc--left {
    float:      left;
    margin:     0 24px 20px 0;
    max-width:  340px;
    width:      100%;
}

/* -------------------------------------------------------------------------
   Position: Right — floated, text wraps around it
   ------------------------------------------------------------------------- */
.rhl-toc--right {
    float:      right;
    margin:     0 0 20px 24px;
    max-width:  340px;
    width:      100%;
}

/* -------------------------------------------------------------------------
   Position: Sidebar — sticky inside a floated wrapper so text reflows
   The wrapper reserves float space for the full content height (set by JS).
   The nav sticks inside the wrapper as the user scrolls.
   ------------------------------------------------------------------------- */
.rhl-toc-sidebar-wrap {
    float:      right;
    max-width:  340px;
    width:      340px;
    margin:     0 0 20px 24px;
}

.rhl-toc--sidebar {
    position:   sticky;
    top:        20px;
    max-width:  340px;
}

/* -------------------------------------------------------------------------
   Collapsible TOC
   ------------------------------------------------------------------------- */
.rhl-toc__toggle {
    background:      none !important;
    border:          none;
    padding:         0;
    margin:          0;
    font:            inherit;
    font-size:       inherit;
    font-weight:     inherit;
    color:           inherit;
    cursor:          pointer;
    display:         block;
    width:           100%;
    text-align:      left;
}

.rhl-toc__toggle:hover {
    background:       none !important;
    background-color: transparent !important;
}

.rhl-toc__toggle-arrow {
    display:    inline-block;
    transition: transform 0.2s ease;
    font-size:  0.7em;
}

.rhl-toc--collapsed .rhl-toc__toggle-arrow {
    transform: rotate(-90deg);
}

.rhl-toc--collapsed .rhl-toc__list {
    display: none;
}

.rhl-toc--collapsible .rhl-toc__title {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.rhl-toc--collapsible:not(.rhl-toc--collapsed) .rhl-toc__title {
    border-bottom: 1px solid var(--rhl-border);
    padding-bottom: 8px;
    margin-bottom: 10px;
}

/* -------------------------------------------------------------------------
   Clearfix helper (kept for theme compatibility, not generated by plugin)
   ------------------------------------------------------------------------- */
.rhl-toc-clearfix {
    clear:    both;
    display:  block;
    height:   0;
    overflow: hidden;
}

/* -------------------------------------------------------------------------
   Responsive — stack on mobile
   ------------------------------------------------------------------------- */
@media screen and (max-width: 600px) {
    .rhl-toc--left,
    .rhl-toc--right,
    .rhl-toc--sidebar {
        float:     none;
        max-width: 100%;
        margin:    0 0 20px;
        position:  static;
    }

    .rhl-toc-sidebar-wrap {
        float:      none;
        max-width:  100%;
        width:      auto;
        margin:     0 0 20px;
        height:     auto !important;
    }
}
