/* TBS Helper — Story Scroll widget */

.tbs_helper_story.tbs_helper_story {
    position: relative;
    padding: 64px 24px;
}

/* ── Intro ── */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__intro {
    max-width: 760px;
    margin: 0 auto 56px;
    text-align: center;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__eyebrow {
    margin: 0 0 10px;
    color: var(--tbs-gold-dark);
    font-family: var(--tbs-font-body);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__heading {
    margin: 0 0 14px;
    color: var(--tbs-navy-900);
    font-family: var(--tbs-font-heading);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 700;
    line-height: 1.25;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__intro_desc {
    margin: 0;
    color: var(--tbs-body);
    font-family: var(--tbs-font-body);
    font-size: 1.05rem;
    line-height: 1.7;
}

/* A quiet "there's more, keep scrolling" affordance — pinned sections can
   otherwise read as the page having stalled once the panel stops moving. */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__scroll_cue {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 28px;
    color: var(--tbs-gold-dark);
    animation: tbs_helper_story_scroll_cue 1.8s ease-in-out infinite;
}

@keyframes tbs_helper_story_scroll_cue {
    0%, 100% { transform: translateY(0); opacity: 0.55; }
    50% { transform: translateY(6px); opacity: 1; }
}

/* ── Scroller layout ── */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__scroller {
    display: flex;
    align-items: flex-start;
    gap: 56px;
    max-width: var(--tbs-container-max);
    margin: 0 auto;
}

/* ── Sticky panel ── */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__sticky {
    position: sticky;
    top: 10%;
    flex: 0 0 auto;
    width: 38%;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Ambient glow — a tight rim of color right at the card's edge, recolors
   with the active chapter (--story-active-color set from JS). Kept small
   and low-opacity on purpose: a glow that bleeds far past the card reads
   as a washed-out haze rather than a deliberate light source. */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__glow {
    position: absolute;
    inset: -6%;
    z-index: -1;
    border-radius: var(--tbs-radius-lg);
    background: radial-gradient(circle at 30% 30%, var(--story-active-color, var(--tbs-gold)) 0%, transparent 48%);
    opacity: 0.4;
    filter: blur(22px);
    transition: background 0.8s var(--tbs-ease);
    pointer-events: none;
}

/* The colorful card itself — an asymmetric cut corner instead of a plain
   rounded rectangle gives it a distinct, non-generic silhouette. */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__panel {
    position: relative;
    flex: 1 1 auto;
    aspect-ratio: 4 / 3;
    min-width: 0;
    clip-path: polygon(0 0, calc(100% - 42px) 0, 100% 42px, 100% 100%, 0 100%);
    overflow: hidden;
    box-shadow:
        0 40px 80px -34px rgba(11, 31, 42, 0.5),
        0 1px 0 rgba(255, 255, 255, 0.08) inset;
    transform: perspective(1200px) rotateX(0deg) rotateY(0deg);
    transform-style: preserve-3d;
    will-change: transform;
}

/* Diagonal sheen for depth, sits above the color layers, below the noise */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__panel::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 32%, rgba(0, 0, 0, 0.22) 100%);
    pointer-events: none;
}

/* Soft vignette so text stays legible over any chapter color */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__panel::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: radial-gradient(120% 90% at 20% 100%, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 60%);
    pointer-events: none;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__bg_layers {
    position: absolute;
    inset: 0;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__bg_layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    background-image: linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 55%);
    transition: opacity 0.7s var(--tbs-ease);
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__bg_layer.is-active {
    opacity: 1;
}

/* Fine grain texture — flattens the color into something that feels
   printed/textured rather than a plain flat-fill web gradient. */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__noise {
    position: absolute;
    inset: -20%;
    z-index: 2;
    opacity: 0.5;
    mix-blend-mode: overlay;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* Huge ghost numeral, bottom-right, editorial-magazine touch */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__ghost_num {
    position: absolute;
    right: -0.06em;
    bottom: -0.18em;
    z-index: 1;
    font-family: var(--tbs-font-heading);
    font-size: 42vh;
    font-weight: 800;
    line-height: 1;
    color: rgba(255, 255, 255, 0.1);
    letter-spacing: -0.04em;
    pointer-events: none;
    user-select: none;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__panel_content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 34px 38px;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__panel_top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__kicker {
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--tbs-font-body);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__count {
    font-family: var(--tbs-font-heading);
    font-weight: 800;
    line-height: 1;
    color: var(--tbs-white);
    letter-spacing: -0.02em;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__count_current {
    font-size: 2.4rem;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__count_sep {
    margin: 0 3px;
    font-size: 1.1rem;
    opacity: 0.55;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__count_total {
    font-size: 1.1rem;
    opacity: 0.55;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__panel_bottom {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__panel_title {
    margin: 0;
    color: var(--tbs-white);
    font-family: var(--tbs-font-heading);
    font-size: clamp(1.1rem, 1.9vw, 1.4rem);
    font-weight: 700;
    line-height: 1.35;
}

/* External chapter rail — sits beside the card (not on top of it), on the
   plain page background, so it needs its own light-mode-friendly styling:
   a thin track, evenly-spaced clickable numbered stops, and a small
   continuously-sliding thumb tracking exact scroll progress underneath. */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__rail {
    position: relative;
    flex: 0 0 auto;
    width: 26px;
    height: 78%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__rail_track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background-color: var(--tbs-border-strong);
    border-radius: 999px;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__rail_thumb {
    position: absolute;
    left: 50%;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--story-active-color, var(--tbs-gold));
    box-shadow: 0 0 0 5px rgba(184, 147, 90, 0.18);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__dot {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__dot::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--tbs-border-strong);
    transition: background-color 0.4s var(--tbs-ease), transform 0.4s var(--tbs-ease);
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__dot.is-active::before {
    background-color: var(--story-color, var(--tbs-gold));
    transform: scale(1.5);
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__dot:focus-visible {
    outline: 2px solid var(--tbs-gold);
    outline-offset: 2px;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__dot_num {
    position: absolute;
    left: 32px;
    font-family: var(--tbs-font-body);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--tbs-navy-900);
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.35s var(--tbs-ease), transform 0.35s var(--tbs-ease);
    pointer-events: none;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__dot.is-active .tbs_helper_story__dot_num {
    opacity: 1;
    transform: translateX(0);
}

/* ── Chapters column ── */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__chapters {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 80vh;
    padding: 32px 8px 32px 34px;
    opacity: 0.4;
    filter: grayscale(0.6);
    transition: opacity 0.5s var(--tbs-ease), filter 0.5s var(--tbs-ease), transform 0.5s var(--tbs-ease);
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter.is-active {
    opacity: 1;
    filter: grayscale(0);
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter:last-child {
    min-height: 45vh;
}

/* Colored keyline that grows in behind the active chapter, tinted per
   chapter via the --story-color custom property set inline from PHP. */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__accent {
    position: absolute;
    left: 0;
    top: 50%;
    width: 2px;
    height: 0;
    background-color: var(--story-color, var(--tbs-gold));
    transform: translateY(-50%);
    transition: height 0.6s var(--tbs-ease);
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter.is-active .tbs_helper_story__accent {
    height: 64%;
}

/* Giant ghost chapter number behind the text — same editorial move as the
   sticky panel, tinted with this chapter's own color at low opacity. */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter_ghost {
    position: absolute;
    left: 4px;
    top: 50%;
    z-index: 0;
    font-family: var(--tbs-font-heading);
    font-size: clamp(5rem, 12vw, 9rem);
    font-weight: 800;
    line-height: 1;
    color: var(--story-color, var(--tbs-gold));
    opacity: 0.07;
    letter-spacing: -0.04em;
    transform: translateY(-50%);
    pointer-events: none;
    user-select: none;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter_body {
    position: relative;
    z-index: 1;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__label {
    margin: 0 0 10px;
    color: var(--tbs-gold-dark);
    font-family: var(--tbs-font-body);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__title {
    margin: 0 0 16px;
    color: var(--tbs-navy-900);
    font-family: var(--tbs-font-heading);
    font-size: clamp(1.3rem, 2.4vw, 2rem);
    font-weight: 700;
    line-height: 1.3;
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__image {
    display: block;
    width: 100%;
    max-width: 420px;
    height: auto;
    margin: 0 0 18px;
    border-radius: var(--tbs-radius-md);
}

.tbs_helper_story.tbs_helper_story .tbs_helper_story__desc {
    margin: 0;
    max-width: 520px;
    color: var(--tbs-body);
    font-family: var(--tbs-font-body);
    font-size: 1.02rem;
    line-height: 1.75;
}

@media (prefers-reduced-motion: reduce) {
    .tbs_helper_story.tbs_helper_story .tbs_helper_story__bg_layer,
    .tbs_helper_story.tbs_helper_story .tbs_helper_story__dot,
    .tbs_helper_story.tbs_helper_story .tbs_helper_story__dot::before,
    .tbs_helper_story.tbs_helper_story .tbs_helper_story__dot_num,
    .tbs_helper_story.tbs_helper_story .tbs_helper_story__accent,
    .tbs_helper_story.tbs_helper_story .tbs_helper_story__glow,
    .tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter {
        transition: none;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter {
        filter: none;
        opacity: 1;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__scroll_cue {
        animation: none;
    }
}

/* Mobile wayfinding bar — hidden on desktop (the big sticky panel already
   does this job there). Below the breakpoint the big panel stops being
   sticky and scrolls out of view, so without this, every number/color/
   title update from JS would happen off-screen with nothing on screen to
   show for it. This slim bar takes over as the pinned "where am I" cue. */
.tbs_helper_story.tbs_helper_story .tbs_helper_story__mobile_bar {
    display: none;
}

/* Below this width, side-by-side sticky feels cramped — stack instead and
   drop the sticky mechanic on the big panel; the mobile bar (below) takes
   over as the pinned wayfinding element while chapters scroll. */
@media (max-width: 900px) {
    .tbs_helper_story.tbs_helper_story .tbs_helper_story__scroller {
        flex-direction: column;
        gap: 24px;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__sticky {
        position: relative;
        top: auto;
        width: 100%;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__panel {
        aspect-ratio: 16 / 9;
        transform: none;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__rail {
        display: none;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__ghost_num {
        font-size: 30vh;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__mobile_bar {
        position: sticky;
        top: 0;
        z-index: 5;
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 8px;
        padding: 12px 16px;
        border-radius: var(--tbs-radius-sm);
        background-color: var(--tbs-white);
        box-shadow: 0 10px 24px -16px rgba(11, 31, 42, 0.35);
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__mobile_dot {
        flex: 0 0 auto;
        width: 9px;
        height: 9px;
        border-radius: 50%;
        transition: background-color 0.4s var(--tbs-ease);
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__mobile_count {
        flex: 0 0 auto;
        color: var(--tbs-body-muted);
        font-family: var(--tbs-font-heading);
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.02em;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__mobile_title {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        color: var(--tbs-navy-900);
        font-family: var(--tbs-font-body);
        font-size: 0.85rem;
        font-weight: 700;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter,
    .tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter:last-child {
        min-height: 0;
        padding: 8px 4px 40px 24px;
        filter: none;
        opacity: 1;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__accent {
        height: 64%;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__chapter_ghost {
        font-size: clamp(3.5rem, 18vw, 5.5rem);
    }
}

@media (max-width: 480px) {
    .tbs_helper_story.tbs_helper_story {
        padding: 48px 16px;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__count_current {
        font-size: 1.9rem;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__panel_content {
        padding: 24px;
    }

    .tbs_helper_story.tbs_helper_story .tbs_helper_story__rail {
        display: none;
    }
}
