/* ============================================================
   Sidebar Cliffhanger — Frontend Styles
   ============================================================ */

/* ── Base tab ── */
.sch-tab {
    position: fixed;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.3;
    letter-spacing: 0.03em;
    transition: transform 0.22s cubic-bezier(.34,1.56,.64,1),
                box-shadow 0.22s ease,
                opacity 0.22s ease,
                background 0.2s ease,
                color 0.2s ease;
    /* Dynamic values injected via JS */
    background: var(--sch-bg);
    color: var(--sch-fg);
    font-size: var(--sch-fs);
    font-weight: var(--sch-fw);
    width: var(--sch-width);
    padding: var(--sch-padding) 0;
    border-radius: var(--sch-radius);
    box-shadow: var(--sch-shadow);
}

/* ── Hover colour fix — overrides ALL browser link default colours ── */
.sch-tab:hover,
.sch-tab:visited:hover,
.sch-tab:active,
.sch-tab:focus {
    background: var(--sch-hover-bg, #cc0000) !important;
    color:       var(--sch-hover-fg, #ffffff) !important;
    text-decoration: none !important;
}

/* Also force colour on the inner span (belt-and-braces) */
.sch-tab:hover .sch-tab-inner,
.sch-tab:active .sch-tab-inner,
.sch-tab:focus .sch-tab-inner {
    color: var(--sch-hover-fg, #ffffff) !important;
}

/* Add colour transition to the base tab */

.sch-tab-inner {
    writing-mode: vertical-rl;
    transform: rotate(var(--sch-rotation));
    white-space: nowrap;
    display: block;
    pointer-events: none;
}

/* ── Side positioning ── */
.sch-side-right {
    right: 0;
    border-radius: var(--sch-radius) 0 0 var(--sch-radius);
}
.sch-side-left {
    left: 0;
    border-radius: 0 var(--sch-radius) var(--sch-radius) 0;
}

/* ── Vertical positioning ── */
.sch-vpos-top    { top: var(--sch-offset); }
.sch-vpos-bottom { bottom: var(--sch-offset); }
.sch-vpos-middle {
    top: 50%;
    transform: translateY(-50%);
}

/* ── Entrance animations ── */

/* slide */
@keyframes sch-slide-right {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes sch-slide-left {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}
.sch-anim-slide.sch-side-right { animation: sch-slide-right 0.55s cubic-bezier(.22,1,.36,1) both; }
.sch-anim-slide.sch-side-left  { animation: sch-slide-left  0.55s cubic-bezier(.22,1,.36,1) both; }

/* fade */
@keyframes sch-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.sch-anim-fade { animation: sch-fade-in 0.7s ease both; }

/* bounce */
@keyframes sch-bounce-right {
    0%   { transform: translateX(120%); }
    60%  { transform: translateX(-12px); }
    80%  { transform: translateX(6px); }
    100% { transform: translateX(0); }
}
@keyframes sch-bounce-left {
    0%   { transform: translateX(-120%); }
    60%  { transform: translateX(12px); }
    80%  { transform: translateX(-6px); }
    100% { transform: translateX(0); }
}
.sch-anim-bounce.sch-side-right { animation: sch-bounce-right 0.7s cubic-bezier(.22,1,.36,1) both; }
.sch-anim-bounce.sch-side-left  { animation: sch-bounce-left  0.7s cubic-bezier(.22,1,.36,1) both; }

/* ── Middle position + animation ── */
.sch-vpos-middle.sch-anim-slide.sch-side-right,
.sch-vpos-middle.sch-anim-bounce.sch-side-right {
    animation-name: sch-slide-right;
    /* translateY(-50%) must stay — apply via separate wrapper or JS */
}
.sch-vpos-middle.sch-anim-slide.sch-side-left,
.sch-vpos-middle.sch-anim-bounce.sch-side-left {
    animation-name: sch-slide-left;
}

/* ── Hover effects ── */

/* grow */
.sch-hover-grow:hover {
    transform: scale(1.1);
}
.sch-vpos-middle.sch-hover-grow:hover {
    transform: translateY(-50%) scale(1.1);
}

/* glow */
.sch-hover-glow:hover {
    box-shadow: 0 0 0 4px var(--sch-bg), 0 0 18px 6px var(--sch-bg) !important;
}

/* lift */
.sch-hover-lift.sch-side-right:hover {
    transform: translateX(-6px);
}
.sch-hover-lift.sch-side-left:hover {
    transform: translateX(6px);
}
.sch-vpos-middle.sch-hover-lift.sch-side-right:hover {
    transform: translateY(-50%) translateX(-6px);
}
.sch-vpos-middle.sch-hover-lift.sch-side-left:hover {
    transform: translateY(-50%) translateX(6px);
}

/* ── Hidden state (scroll-hide) ── */
.sch-tab.sch-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(var(--sch-hide-dir));
}
.sch-vpos-middle.sch-tab.sch-hidden {
    transform: translateY(-50%) translateX(var(--sch-hide-dir));
}

/* ── Mobile hide ── */
@media (max-width: 767px) {
    .sch-hide-mobile {
        display: none !important;
    }
}

/* ── Accessibility: focus ring ── */
.sch-tab:focus-visible {
    outline: 3px solid var(--sch-fg);
    outline-offset: 3px;
}

/* ── Icon support ── */
.sch-tab-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Horizontal icon positions (left/right) — override writing-mode for inline layout */
.sch-icon-pos-left  .sch-tab-inner,
.sch-icon-pos-right .sch-tab-inner {
    flex-direction: row;
    writing-mode: horizontal-tb;
    transform: rotate(var(--sch-rotation));
}

.sch-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.sch-icon.dashicons {
    font-family: dashicons;
}

.sch-icon-svg svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: currentColor;
}

.sch-tab-text {
    display: block;
}

/* When icon is left/right, keep text in normal writing mode inside the rotated container */
.sch-icon-pos-left  .sch-inline,
.sch-icon-pos-right .sch-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
