/* ═══════════════════════════════════════════════════════════
   faq.css — SPIDER-VERSE
   Interactive Background-Based FAQ Section
═══════════════════════════════════════════════════════════ */

.section--faq {
    position: relative;
    background-image: url('../assets/milesandpetr.jpeg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    overflow: hidden;
    height: 120vh;
}

/* Dark overlay for text readability */
.section--faq::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.section--faq .section__heading,
.section--faq .section__sub {
    position: relative;
    z-index: 2;
}

.section--faq .section__heading {
    position: relative;
    z-index: 3;
    /* --- TWEAK THIS: Change margin-top to move the headings UP (more negative) or DOWN (less negative/positive) --- */
    margin-top: -60px;
    margin-bottom: var(--sp-sm);
    /* Keep spacing consistent */
}

.section--faq .section__sub {
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 3;
    margin-bottom: var(--sp-xl);
    /* Keep consistent spacing below subtext */
}

.faq-comic-container {
    position: relative;
    width: 100%;
    height: 600px;
    /* Space for absolute bubbles */
    margin: 0 auto;
    max-width: 1200px;
    z-index: 3;
}

/* --- Speech Bubbles --- */
.speech-bubble {
    position: absolute;
    background: #fff;
    border: 4px solid var(--c-border-dark);
    border-radius: 12px;
    padding: var(--sp-md);
    z-index: 3;
    max-width: 90%;
    box-shadow: 4px 4px 0 var(--c-cyan);
}

/* Left Side: Peter Parker */
/* The user said "Peter Parker on the LEFT side" and "Speech bubble ABOVE Peter's head" */
.speech-bubble--peter {
    /* --- TWEAK THIS: Change top value to move Peter's bubble UP (smaller px) or DOWN (larger px) --- */
    top: 0%;
    /* Adjusted to sit ABOVE Peter's head visually */
    left: 5%;
    width: 40%;
    transform: rotate(-2deg);
    box-shadow: 4px 4px 0 var(--c-cyan), 0 0 20px rgba(0, 240, 255, 0.5);
    /* Neon cyan outline */
}

/* Right Side: Miles Morales */
/* The user said "Miles Morales on the RIGHT side" and "Speech bubble ABOVE Miles’ head" */
.speech-bubble--miles {
    /* --- TWEAK THIS: Change bottom value to move Miles's bubble UP (larger px) or DOWN (smaller px). 
           Using 'bottom' instead of 'top' ensures the box expands UPWARDS when text wraps! --- */
    bottom: 470px;
    top: auto;
    /* Adjusted to sit ABOVE Miles' head visually */
    right: 5%;
    width: 42%;
    transform: rotate(2deg);
    box-shadow: -4px 4px 0 var(--c-red), 0 0 20px rgba(255, 0, 64, 0.5);
    /* Neon red outline */
}

/* Tails pointing down towards characters */
.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -16px;
    width: 0;
    height: 0;
    border: 16px solid transparent;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -11px;
    width: 0;
    height: 0;
    border: 11px solid transparent;
}

/* Peter left tail down */
.speech-bubble--peter::before {
    left: 20%;
    border-top-color: var(--c-border-dark);
    border-bottom: 0;
}

.speech-bubble--peter::after {
    left: 20%;
    margin-left: 5px;
    border-top-color: #fff;
    border-bottom: 0;
}

/* Miles right tail down */
.speech-bubble--miles::before {
    right: 20%;
    border-top-color: var(--c-border-dark);
    border-bottom: 0;
}

.speech-bubble--miles::after {
    right: 20%;
    margin-right: 5px;
    border-top-color: #fff;
    border-bottom: 0;
}

/* Text Stylings */
.speech-bubble__content {
    font-family: var(--ff-body);
    font-size: 1rem;
    font-weight: 700;
    color: #000;
}

.speech-bubble__default,
.peter-answer {
    margin: 0;
    line-height: 1.5;
}

/* --- Custom Select Dropdown --- */
.faq-custom-select {
    position: relative;
    width: 100%;
    margin-top: 8px;
    font-family: var(--ff-body);
    font-weight: 700;
    font-size: 0.95rem;
}

.faq-custom-select-trigger {
    padding: 10px;
    border: 2px solid var(--c-border-dark);
    border-radius: 6px;
    background-color: var(--c-yellow);
    color: #000;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--c-red);
    outline: none;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 32px;
}

.faq-custom-select-trigger:focus,
.faq-custom-select.open .faq-custom-select-trigger {
    box-shadow: 0 0 0 2px var(--c-cyan);
}

.faq-custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border: 2px solid var(--c-border-dark);
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 4px 4px 0 var(--c-cyan);
    z-index: 100;
    max-height: calc(6 * 44px);
    overflow-y: auto;
    overscroll-behavior: contain;
    display: none;
}

.faq-custom-select.open .faq-custom-select-options {
    display: block;
}

/* Thicker Scrollbar styling */
.faq-custom-select-options::-webkit-scrollbar {
    width: 14px;
}

.faq-custom-select-options::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 0 4px 4px 0;
    border-left: 1px solid #ccc;
}

.faq-custom-select-options::-webkit-scrollbar-thumb {
    background-color: var(--c-red);
    border: 2px solid var(--c-border-dark);
    border-radius: 6px;
}

.faq-custom-option {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    color: #000;
    font-weight: 600;
    text-align: left;
}

.faq-custom-option:hover {
    background-color: var(--c-yellow);
}

.faq-custom-option:last-child {
    border-bottom: none;
}

/* Smooth Typing Animation */
.typing {
    animation: typingPop 0.3s ease forwards;
}

@keyframes typingPop {
    0% {
        opacity: 0;
        transform: translateY(5px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .section--faq {
        min-height: 700px;
        height: auto;
    }

    .section--faq .section__heading {
        margin-top: 2rem;
    }

    .faq-comic-container {
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 2rem;
        padding-bottom: 250px;
        /* Space for the background at bottom */
    }

    .speech-bubble {
        position: relative;
        width: 90%;
        max-width: 90%;
        margin: 0 auto;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        transform: rotate(0) !important;
        /* Remove tilt for mobile readability */
    }

    .speech-bubble--peter {
        align-self: flex-start;
        margin-left: 5%;
        margin-top: 2rem;
    }

    .speech-bubble--miles {
        align-self: flex-end;
        margin-right: 5%;
    }
}