/* ==========================================================================
   SPIDER-VISION — COMPUTER VISION & AR MASK LAB
   Vidyuttam 6.0 — The Electric Comic
   ========================================================================== */

.spider-vision-section {
    position: relative;
    padding: 100px 5vw 120px;
    background: #090a0f;
    border-top: 4px solid var(--black);
    border-bottom: 4px solid var(--black);
    overflow: hidden;
}

/* Background comic grid & ambient glows */
.sv-bg-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.15;
    background-image: 
        linear-gradient(to right, rgba(0, 245, 230, 0.12) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 16, 24, 0.12) 1px, transparent 1px);
    background-size: 40px 40px;
}

.sv-ambient-red {
    position: absolute;
    top: -10%;
    left: -5%;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 16, 24, 0.18) 0%, transparent 70%);
    pointer-events: none;
    filter: blur(60px);
}

.sv-ambient-cyan {
    position: absolute;
    bottom: -10%;
    right: -5%;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 245, 230, 0.15) 0%, transparent 70%);
    pointer-events: none;
    filter: blur(60px);
}

/* Section Header */
.sv-header {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
    gap: 30px;
    flex-wrap: wrap;
}

.sv-kicker {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: var(--cyan);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sv-kicker:before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    background: var(--red);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    animation: svPulse 1.5s ease-in-out infinite;
}

@keyframes svPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.sv-title {
    font-family: Anton, sans-serif;
    font-size: clamp(2.6rem, 5.5vw, 4.8rem);
    line-height: 0.95;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.sv-title em {
    font-style: normal;
    color: var(--red);
    text-shadow: 3px 3px 0 var(--cyan), -3px -3px 0 rgba(0, 0, 0, 0.8);
}

.sv-desc {
    max-width: 480px;
    font-size: 1rem;
    line-height: 1.6;
    color: #b5b5bc;
    margin: 0;
}

.sv-badge-box {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sv-badge {
    background: #141721;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--yellow);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    padding: 6px 14px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sv-badge.live i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff66;
    display: inline-block;
    box-shadow: 0 0 8px #00ff66;
    animation: svBlink 1s infinite alternate;
}

@keyframes svBlink {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

/* SFX stickers */
.sv-sfx {
    position: absolute;
    font-family: Bangers, cursive;
    font-size: 2.2rem;
    color: var(--yellow);
    text-shadow: 3px 3px 0 var(--red), -2px -2px 0 var(--ink);
    transform: rotate(-12deg);
    pointer-events: none;
    z-index: 10;
}

.sv-sfx-1 { top: 20px; right: 5%; transform: rotate(14deg); }
.sv-sfx-2 { bottom: 30px; left: 3%; transform: rotate(-8deg); }

/* Main AR Workbench Grid */
.sv-workbench {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}

@media (max-width: 1080px) {
    .sv-workbench {
        grid-template-columns: 1fr;
    }
}

/* Viewport / Stage Container */
.sv-viewport-wrapper {
    position: relative;
    background: #000;
    border: 3px solid var(--ink);
    box-shadow: 8px 8px 0 var(--red), 16px 16px 0 rgba(0, 245, 230, 0.35);
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    max-height: 680px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .sv-viewport-wrapper {
        aspect-ratio: 4 / 3;
    }
}

/* The Canvas & Video */
#svVideo {
    display: none;
}

#svCanvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: grab;
}

#svCanvas:active {
    cursor: grabbing;
}

/* Mirror mode is handled in canvas drawing, NOT css transform, to preserve text readability */
.sv-mirrored #svCanvas {
    /* Handled on video draw call */
}

/* Start / Standby Screen */
.sv-standby-screen {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, #151824 0%, #08090d 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 30px;
    text-align: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.sv-standby-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sv-standby-logo-wrap {
    width: 150px;
    height: 105px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sv-standby-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(0, 245, 230, 0.65)) drop-shadow(0 0 35px rgba(255, 16, 24, 0.45));
    animation: svHover 3.5s ease-in-out infinite;
}

.sv-standby-sub {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    letter-spacing: 0.22em;
    color: var(--cyan);
    font-size: 1.1rem;
    margin: -4px 0 14px;
    text-transform: uppercase;
}

@keyframes svHover {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.sv-standby-title {
    font-family: Anton, sans-serif;
    font-size: 2.2rem;
    letter-spacing: 0.05em;
    margin: 0 0 6px;
    color: var(--white);
}

.sv-standby-desc {
    max-width: 440px;
    font-size: 0.95rem;
    color: #9da3b4;
    line-height: 1.5;
    margin-bottom: 26px;
}

.sv-btn-group {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.sv-btn-primary {
    background: var(--red);
    color: #fff;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.1em;
    padding: 14px 28px;
    border: 2px solid var(--white);
    border-radius: 0;
    cursor: pointer;
    box-shadow: 4px 4px 0 var(--cyan);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.sv-btn-primary:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--cyan);
}

.sv-btn-primary:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--cyan);
}

.sv-btn-secondary {
    background: #191c28;
    color: var(--white);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    padding: 14px 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.sv-btn-secondary:hover {
    background: #242838;
    border-color: var(--yellow);
}

/* On-screen Quick Controls (Floating over Canvas) */
.sv-floating-toolbar {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 15;
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.sv-icon-btn {
    background: rgba(13, 16, 26, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 245, 230, 0.4);
    color: var(--white);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.sv-icon-btn:hover {
    background: var(--cyan);
    color: var(--ink);
    border-color: var(--white);
    transform: scale(1.06);
}

.sv-icon-btn.active {
    background: var(--red);
    color: var(--white);
    border-color: var(--yellow);
}

.sv-icon-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Snap Photo Floating Button (Docked bottom right so face/chest is unblocked) */
.sv-snap-btn-wrapper {
    position: absolute;
    bottom: 18px;
    right: 18px;
    z-index: 15;
    pointer-events: auto;
}

/* Drag & Reposition Hint */
.sv-drag-hint {
    position: absolute;
    bottom: 18px;
    left: 18px;
    background: rgba(13, 16, 26, 0.88);
    border: 1px solid rgba(0, 245, 230, 0.5);
    color: var(--cyan);
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 7px 14px;
    border-radius: 2px;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 14;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.sv-drag-hint i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 6px var(--yellow);
    animation: svBlink 1.2s infinite alternate;
}

.sv-snap-btn {
    background: var(--yellow);
    color: var(--ink);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    padding: 12px 24px;
    border: 2px solid var(--ink);
    box-shadow: 4px 4px 0 var(--red);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sv-snap-btn:hover {
    transform: scale(1.05);
    box-shadow: 6px 6px 0 var(--red);
}

.sv-snap-btn:active {
    transform: scale(0.96);
}

.sv-snap-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Target Lock Flash Animation */
.sv-flash-overlay {
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transition: opacity 0.08s ease;
}

.sv-flash-overlay.flashing {
    opacity: 0.9;
}

/* Control Panel / Sidebar */
.sv-control-panel {
    background: #11131c;
    border: 2px solid var(--ink);
    border-radius: 4px;
    box-shadow: 6px 6px 0 var(--cyan);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.sv-panel-section-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    color: var(--cyan);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 6px;
}

.sv-panel-section-title small {
    font-size: 0.75rem;
    color: #838896;
}

/* Vision Filter Buttons */
.sv-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.sv-filter-btn {
    background: #171a26;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--white);
    padding: 8px 10px;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    border-radius: 2px;
    text-align: center;
    transition: all 0.2s ease;
}

.sv-filter-btn:hover {
    border-color: var(--yellow);
    background: #202434;
}

.sv-filter-btn.active {
    background: var(--cyan);
    color: var(--ink);
    border-color: var(--white);
    font-weight: 800;
}

/* Layer Toggle Buttons (Full Suit / Mask Only / HUD Only) */
.sv-layer-tabs {
    display: flex;
    background: #141620;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3px;
    border-radius: 3px;
}

.sv-layer-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: #9297a7;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    padding: 8px 4px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.sv-layer-tab:hover {
    color: var(--white);
}

.sv-layer-tab.active {
    background: var(--red);
    color: var(--white);
}

/* Sliders / Calibration */
.sv-calibration-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sv-slider-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sv-slider-label {
    display: flex;
    justify-content: space-between;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: #a4aab9;
    letter-spacing: 0.06em;
}

.sv-slider-label span {
    color: var(--cyan);
}

.sv-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    background: #262a3a;
    outline: none;
    border-radius: 2px;
}

.sv-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--cyan);
    cursor: pointer;
    box-shadow: 0 0 6px var(--cyan);
}

.sv-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--cyan);
    cursor: pointer;
    box-shadow: 0 0 6px var(--cyan);
}

/* Telemetry Status Bar */
.sv-telemetry-bar {
    background: #0b0c13;
    border: 1px solid rgba(0, 245, 230, 0.25);
    padding: 10px 14px;
    font-family: 'Barlow Condensed', monospace;
    font-size: 0.8rem;
    color: #6dffc4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 2px;
}

.sv-telemetry-item {
    display: flex;
    gap: 6px;
}

.sv-telemetry-label {
    color: #798094;
}

/* Snapshot Preview Modal */
.sv-modal {
    position: fixed;
    inset: 0;
    z-index: 2500;
    background: rgba(8, 9, 14, 0.88);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sv-modal.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sv-modal-card {
    background: #141722;
    border: 3px solid var(--white);
    box-shadow: 10px 10px 0 var(--red);
    max-width: 640px;
    width: 100%;
    padding: 24px;
    border-radius: 4px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sv-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.sv-modal-close:hover {
    color: var(--red);
}

.sv-modal-img {
    width: 100%;
    border: 2px solid var(--ink);
    border-radius: 2px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.sv-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
