/* =====================================================================
   FAQ Knowledge Hub — searchable accordion
   Used by: /youve-asked-we-answered.php and /sl/youve-asked-we-answered.php
   Brand: "The Clear Signal" — white/navy field, azure as the one signal.
   Progressive enhancement: without JS every answer is visible (crawler-safe);
   the .faq-enhanced hook (added by faq-hub.js) turns rows into an accordion.
   ===================================================================== */

/* --- Hero ----------------------------------------------------------- */
.faq-hero {
    background-image: linear-gradient(135deg, rgba(9, 18, 35, 0.92), rgba(15, 43, 88, 0.88)), url('/assets/img/banner/quality-hell.webp');
    background-size: cover;
    background-position: center;
}
.faq-pill {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(0, 123, 255, 0.18);
    color: #8fc4ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 18px;
}

/* --- Intro band ----------------------------------------------------- */
.faq-intro-card { margin-bottom: 10px; }
.faq-intro-card h2 { color: #003366; margin-bottom: 16px; }
.faq-intro-card p { color: #4a4a6a; max-width: 70ch; }

.faq-aside {
    background: #f7f7f7;
    border: 1px solid #e7e7e7;
    border-radius: 10px;
    padding: 28px;
}
.faq-aside h3 { color: #003366; font-size: 20px; margin-bottom: 16px; }
.faq-aside ol { margin: 0; padding-left: 20px; color: #4a4a6a; }
.faq-aside li { margin-bottom: 12px; line-height: 1.65; }
.faq-aside li:last-child { margin-bottom: 0; }

/* Visually-hidden but screen-reader accessible */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Glossary (native disclosure) ----------------------------------- */
.faq-glossary {
    margin: 4px 0 28px;
    border: 1px solid #e7e7e7;
    border-radius: 10px;
    background: #fff;
    padding: 0 24px;
}
.faq-glossary > summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 0;
    color: #0056b3;
    font-weight: 700;
}
.faq-glossary > summary::-webkit-details-marker { display: none; }
.faq-glossary > summary::before {
    content: "+";
    display: inline-block;
    width: 1.2em;
    color: #007bff;
    font-weight: 700;
}
.faq-glossary[open] > summary::before { content: "\2212"; }
.faq-glossary dl {
    margin: 0;
    padding: 4px 0 22px;
    border-top: 1px solid #f0f0f0;
}
.faq-glossary dt { color: #003366; font-weight: 700; margin-top: 16px; }
.faq-glossary dd { color: #4a4a6a; margin: 4px 0 0; line-height: 1.65; }

/* --- Search --------------------------------------------------------- */
.faq-search { position: relative; margin: 10px 0 6px; }
.faq-search input {
    width: 100%;
    padding: 16px 20px 16px 54px;
    border: 1px solid #e7e7e7;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    color: #1a1a1a;
    background: #fff
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%230056b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E")
        no-repeat 18px center;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.faq-search input::placeholder { color: #8a90a6; }
.faq-search input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.15);
}
.faq-search-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    align-items: baseline;
    margin: 12px 2px 0;
}
.faq-search-count { color: #6b7280; font-size: 14px; }
.faq-search-clear {
    background: none;
    border: 0;
    padding: 0;
    color: #0056b3;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.faq-search-clear:hover { text-decoration: underline; }
.faq-search-clear[hidden] { display: none; }

/* --- Anchor jump list ---------------------------------------------- */
.faq-anchor-list { display: flex; flex-wrap: wrap; }
.faq-anchor-list a {
    display: inline-block;
    margin: 0 10px 10px 0;
    padding: 9px 16px;
    border-radius: 999px;
    background: rgba(0, 66, 153, 0.06);
    color: #003366;
    border: 1px solid rgba(0, 66, 153, 0.18);
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.faq-anchor-list a:hover {
    background: rgba(0, 66, 153, 0.12);
    color: #003366;
}
.faq-anchor-list a.is-active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}
.faq-anchor-list a[hidden] { display: none; }

/* --- Sections ------------------------------------------------------- */
.faq-section { margin-bottom: 56px; scroll-margin-top: 110px; }
.faq-section-title { margin-bottom: 22px; }
/* The eyebrow pill duplicated each section heading — suppress it; the H2 names the theme. */
.faq-section-title .faq-pill { display: none; }
.faq-section-title h2 { color: #003366; margin-bottom: 10px; }
.faq-section-title p { color: #4a4a6a; max-width: 72ch; margin: 0; }
.faq-section-count {
    color: #007bff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Card grid collapses to a single-column accordion list */
.faq-section .row { display: block; margin: 0; }
.faq-section .col-lg-6,
.faq-section .col-md-6 {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    padding: 0;
    margin: 0;
}

/* --- Q&A row (base / no-JS: open, readable) ------------------------- */
.faq-card {
    background: #fff;
    border: 1px solid #e7e7e7;
    border-radius: 10px;
    padding: 22px 26px;
    margin-bottom: 12px;
    height: auto;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.faq-card h3 {
    color: #003366;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.45;
    margin: 0 0 12px;
}
.faq-card p {
    color: #4a4a6a;
    line-height: 1.8;
    margin: 0;
}

/* --- Enhanced (JS present): accordion ------------------------------ */
.faq-enhanced .faq-card { padding: 0; overflow: hidden; }
.faq-enhanced .faq-card:hover { border-color: #cdd9e5; }
.faq-enhanced .faq-card.is-open {
    border-color: #bcd6f5;
    box-shadow: 0 2px 12px 0 #e7e7e7;
}
.faq-enhanced .faq-card h3 { margin: 0; }

.faq-q {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    width: 100%;
    text-align: left;
    margin: 0;
    padding: 20px 24px;
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    color: #003366;
}
.faq-q:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: -3px;
    border-radius: 10px;
}
.faq-q-text { flex: 1 1 auto; }
.faq-q::after {
    content: "";
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-top: 7px;
    border-right: 2px solid #007bff;
    border-bottom: 2px solid #007bff;
    transform: rotate(45deg);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.faq-card.is-open .faq-q::after { transform: rotate(225deg); }

.faq-enhanced .faq-a {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.faq-card.is-open .faq-a { grid-template-rows: 1fr; }
.faq-a-inner { overflow: hidden; }
.faq-enhanced .faq-a p { padding: 0 24px 22px; }

.faq-card[hidden] { display: none; }

/* Highlighted search matches */
.faq-mark { background: rgba(0, 123, 255, 0.18); color: #003366; border-radius: 2px; }

/* --- Empty state ---------------------------------------------------- */
.faq-empty {
    text-align: center;
    padding: 48px 24px;
    border: 1px dashed #cdd9e5;
    border-radius: 10px;
    color: #4a4a6a;
}
.faq-empty[hidden] { display: none; }
.faq-empty strong { color: #003366; }
.faq-empty a { color: #0056b3; font-weight: 700; }

/* --- CTA ------------------------------------------------------------ */
.faq-cta-box {
    background: linear-gradient(135deg, #11284b, #0d1f39);
    border-radius: 18px;
    padding: 40px;
    color: #fff;
    box-shadow: 0 18px 50px rgba(5, 16, 34, 0.16);
}
.faq-cta-box h2 { color: #fff; margin-bottom: 12px; }
.faq-cta-box p { color: #d9e4f2; max-width: 60ch; }

/* --- Back to top ---------------------------------------------------- */
.faq-totop {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: #007bff;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s, background-color 0.2s ease;
    z-index: 40;
}
.faq-totop.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.faq-totop:hover { background: #0056b3; }
.faq-totop:focus-visible { outline: 2px solid #003366; outline-offset: 3px; }
.faq-totop svg { width: 20px; height: 20px; }

/* --- Responsive ----------------------------------------------------- */
@media (max-width: 767px) {
    .faq-card { padding: 18px 20px; }
    .faq-q { padding: 18px 18px; gap: 12px; }
    .faq-enhanced .faq-a p { padding: 0 18px 18px; }
    .faq-cta-box { padding: 28px; }
    .faq-totop { right: 16px; bottom: 16px; }
}

/* --- Reduced motion ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .faq-q::after,
    .faq-enhanced .faq-a,
    .faq-totop,
    .faq-anchor-list a,
    .faq-card { transition: none; }
}
