/* ─── Line Drawing Widget ─────────────────────────────────────────────────── */

.ercw-line-drawing {
    position: relative;
    overflow: hidden;
    width: 100%;
    line-height: 0;
}

/* ─── Main SVG ────────────────────────────────────────────────────────────── */

.ercw-line-drawing__svg-wrap {
    position: relative;
    width: 100%;
    display: block;
}

.ercw-line-drawing__svg-wrap > svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ─── Hover Overlay Image ─────────────────────────────────────────────────── */

.ercw-ld-hover-overlay {
    position: absolute;
    display: block;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 4;
    object-fit: cover;
}

.ercw-ld-hover-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ─── Overlay (tint behind sidebar) ───────────────────────────────────────── */

.ercw-ld-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 8;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */

.ercw-ld-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 30%;
    height: 100vh;
    height: 100dvh;
    background-color: #ffffff;
    color: #111111;
    transform: translateX(100%);
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform; /* GPU layer — prevents layout reflow during animation */
    z-index: 10000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ercw-ld-sidebar.is-open {
    transform: translateX(0);
}

/* Close button — simple bare X, black by default */
.ercw-ld-sidebar__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #111111;
    cursor: pointer;
    padding: 4px;
    transition: opacity 0.2s ease;
    opacity: 0.6;
    z-index: 2;
}

.ercw-ld-sidebar__close:hover {
    opacity: 1;
}

.ercw-ld-sidebar__inner {
    padding: 56px 32px 40px;
}

/* ─── Panel ───────────────────────────────────────────────────────────────── */

.ercw-ld-panel {
    display: none;
}

.ercw-ld-panel.is-active {
    display: block;
    animation: ercw-ld-fade-in 0.3s ease forwards;
}

@keyframes ercw-ld-fade-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Title */
.ercw-ld-panel__title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 16px;
    color: inherit;
    line-height: 1.3;
}

/* Content */
.ercw-ld-panel__content {
    font-size: 15px;
    line-height: 1.75;
    color: inherit;
    opacity: 0.85;
}

.ercw-ld-panel__content p {
    margin: 0 0 12px;
}

.ercw-ld-panel__content p:last-child {
    margin-bottom: 0;
}

/* Button */
.ercw-ld-panel__btn {
    display: inline-block;
    margin-top: 24px;
    padding: 12px 24px;
    background-color: #111111;
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-radius: 4px;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.ercw-ld-panel__btn:hover {
    opacity: 0.8;
    color: #ffffff;
    text-decoration: none;
}

/* ─── Mobile: horizontal scroll ───────────────────────────────────────────── */

@media (max-width: 768px) {

    /* Scroll container */
    .ercw-line-drawing {
        contain: none;           /* let position:fixed children escape to viewport */
        overflow-x: auto;        /* horizontal scroll */
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        /* hide the scrollbar for a clean look */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .ercw-line-drawing::-webkit-scrollbar {
        display: none;
    }

    /* SVG wrap width is set by JS (item-count / 1.2 * containerWidth) */
    .ercw-line-drawing__svg-wrap {
        min-width: 100%;
    }

    /* Sidebar: full-width on mobile */
    .ercw-ld-sidebar {
        width: 100%;
    }

    .ercw-ld-sidebar__inner {
        padding: 52px 24px 32px;
    }

    .ercw-ld-panel__title {
        font-size: 18px;
    }
}

button.ercw-ld-sidebar__close {
    padding: 0;
    border: 0;
}