/**
 * Trevenque FAQs - Front Styles
 *
 * Accessible accordion styling compatible with Bootstrap 4.
 * High contrast, focus states, responsive.
 *
 * @author    Trevenque
 * @copyright Trevenque
 * @license   AFL-3.0
 */

.trevenque-faqs-widget {
    margin: 2rem 0;
    max-width: 100%;
}

.trevenque-faqs-title {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #232323;
}

/* Card overrides */
.trevenque-faq-card {
    border: 1px solid #dee2e6;
    border-radius: 0;
    margin-bottom: -1px;
}

.trevenque-faq-card:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.trevenque-faq-card:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    margin-bottom: 0;
}

.trevenque-faq-card .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0;
}

/* Question button */
.trevenque-faq-question {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #333;
    text-align: left;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1.4;
    transition: background-color 0.15s ease-in-out;
}

.trevenque-faq-question:hover {
    background-color: #e9ecef;
    text-decoration: none;
    color: #333;
}

.trevenque-faq-question:focus {
    outline: 2px solid #007bff;
    outline-offset: -2px;
    z-index: 1;
    text-decoration: none;
    color: #333;
}

/* Expand/collapse icon */
.trevenque-faq-icon {
    display: inline-block;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin-right: 0.75rem;
    position: relative;
}

.trevenque-faq-icon::before,
.trevenque-faq-icon::after {
    content: '';
    position: absolute;
    background-color: #495057;
    transition: transform 0.2s ease;
}

.trevenque-faq-icon::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

.trevenque-faq-icon::after {
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

/* When expanded, hide vertical line to show minus */
.trevenque-faq-question[aria-expanded="true"] .trevenque-faq-icon::after {
    transform: translateX(-50%) rotate(90deg);
}

/* Answer area */
.trevenque-faq-answer {
    padding: 1rem 1.25rem 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #555;
}

.trevenque-faq-answer p:last-child {
    margin-bottom: 0;
}

.trevenque-faq-answer a {
    color: #007bff;
    text-decoration: underline;
}

.trevenque-faq-answer a:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 767px) {
    .trevenque-faq-question {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .trevenque-faq-answer {
        padding: 0.75rem 1rem 1rem;
        font-size: 0.875rem;
    }
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.faq-item {
    padding: var(--space-2) 0;
}

.faq-item summary {
    list-style: none;
    cursor: pointer;
    outline: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-q {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
    justify-content: space-between;
}

.faq-a-preview {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

details[open] .faq-a-preview {
    display: none;
}

.faq-lbl--r {
    flex-shrink: 0;
    font-size: 0.9em;
}

.faq-q .question {
    flex: 1;
    font-weight: 400;
    color: var(--dark);
    line-height: 1.4;
}

.faq-teaser {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9em;
}

.faq-chevron {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: .2rem;
}

.faq-chevron::before {
    content: '';
    display: block;
    width: .45rem;
    height: .45rem;
    border-right: 2px solid var(--dark);
    border-bottom: 2px solid var(--dark);
    transform: rotate(45deg);
    margin-top: -.2rem;
    transition: transform .2s ease, margin-top .2s ease;
}

details[open] .faq-chevron::before {
    transform: rotate(-135deg);
    margin-top: .15rem;
}

.faq-body {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-color);
    font-size: 1rem;
    color: var(--neutral-700);
    line-height: 1.6;
}