/* Video Comparison Slider CSS */
.video-compare-container {
    position: relative;
    width: 100%;
    /* Aspect ratio placeholder, adjusted via JS or fixed if known */
    overflow: hidden;
    border-radius: 8px;
    background: #000;
    margin-bottom: 20px;
}

.video-compare-container video {
    width: 100%;
    height: auto;
    display: block;
}

.video-wrapper {
    width: 100%;
    height: 100%;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    /* Initial split position */
    height: 100%;
    overflow: hidden;
    border-right: 2px solid #fff;
    z-index: 2;
}

.video-overlay video {
    /* Important: width needs to be set to the full container width 
       to ensure the overlay video isn't squashed, but clipped */
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Or contain, depending on requirement */
    /* We need to counteract the container width being 50% */
    /* However, simpler approach with JS is usually setting width to container's width manually */
    max-width: none;
}

/* Slider Handle */
/* Slider Handle */
.video-compare-slider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 20px;
    transform: translateX(-50%);
    z-index: 10;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-handle {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    /* Ensure icon scales down */
}

.slider-handle::after {
    content: '\f337';
    /* FontAwesome arrows-alt-h or similar */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #333;
}

.compare-label {
    position: absolute;
    top: 10px;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 10px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
    font-weight: bold;
}

.label-left {
    left: 10px;
}

.label-right {
    right: 10px;
}

.comparison-title-row {
    position: relative;
    margin: 48px 0 24px;
    /* Symmetric horizontal padding keeps the title optically centered; button sits in the right inset. */
    padding: 0 5.75rem;
    box-sizing: border-box;
}

.comparison-title-row .comparison-title {
    margin: 0;
    text-align: center;
}

.comparison-title-row .control-signal-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.control-signal-toggle {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.35);
    background: #3a3a3c;
    color: rgba(255, 255, 255, 0.94);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.control-signal-toggle:hover {
    background: #48484a;
    border-color: rgba(0, 0, 0, 0.45);
}

.control-signal-toggle[aria-pressed="true"] {
    background: #555558;
    border-color: rgba(0, 0, 0, 0.5);
}

#video-demos .container {
    max-width: 1280px;
}

#video-demos .demo-grid {
    max-width: 1240px;
    gap: 24px;
}

.comparison-card-with-meta {
    display: block;
    padding: 14px;
}

.comparison-card-with-meta .video-compare-container {
    margin-bottom: 0;
    position: relative;
}

.comparison-meta-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
    align-items: stretch;
    grid-auto-rows: 1fr;
}

.meta-box {
    height: 100%;
    min-height: 176px;
    background: #f7f7f9;
    border: 1px solid #e1e1e6;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.meta-box-title {
    margin: 0 0 8px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #3a3a3c;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.model-viewer-wrapper {
    background: #ededf0;
    border-radius: 8px;
    overflow: hidden;
    flex: 1 1 auto;
}

.ref-model-viewer {
    width: 100%;
    height: 140px;
    background: linear-gradient(160deg, #f9f9fa 0%, #e4e4e8 100%);
}

.ref-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
    flex: 1 1 auto;
    height: 140px;
    min-height: 0;
}

.ref-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dedee3;
    background: #ececf0;
}

.ref-gallery img.ref-image-missing {
    opacity: 0.38;
}

.prompt-content {
    margin: 0;
    min-height: 0;
    max-height: none;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.78rem;
    line-height: 1.35;
    color: #2f2f31;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    flex: 1 1 auto;
}

.video-overlay-toggle {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 12;
    width: auto;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(14, 14, 16, 0.52);
    color: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px) saturate(135%);
    -webkit-backdrop-filter: blur(8px) saturate(135%);
}

.video-overlay-toggle:hover {
    background: rgba(14, 14, 16, 0.64);
    border-color: rgba(255, 255, 255, 0.36);
}

.video-overlay-toggle[aria-pressed="true"] {
    background: rgba(34, 34, 38, 0.72);
    border-color: rgba(255, 255, 255, 0.42);
}

@media (max-width: 1200px) {
    #video-demos .demo-grid {
        max-width: 1120px;
        gap: 20px;
    }

    .comparison-meta-panel {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }
}

@media (max-width: 980px) {
    .comparison-meta-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .comparison-meta-panel {
        grid-template-columns: 1fr;
    }

    .meta-box {
        min-height: 164px;
    }
}