
/* ============================================================
   SpotTake — Strategic Questions
   ============================================================

   All selectors are scoped to .stq to avoid conflicts with
   existing SpotTake panel, table, and component styles.

   ============================================================ */


/* ------------------------------------------------------------
   1. Variables and Base Styles
   ------------------------------------------------------------ */

.stq {
    --stq-border: #dce1e8;
    --stq-muted: #657083;
    --stq-surface: #f7f9fc;
    --stq-accent: #6756a8;
    --stq-ink: inherit;

    color: var(--stq-ink);
    max-width: 1240px;
    margin: 0 auto;

    font: inherit;
    line-height: 1.55;
}

.stq * {
    box-sizing: border-box;
}

.stq [hidden] {
    display: none !important;
}

.stq button,
.stq input,
.stq select {
    font: inherit;
}

.stq button {
    cursor: pointer;
}

.stq button:focus-visible,
.stq input:focus-visible,
.stq select:focus-visible,
.stq a:focus-visible {
    outline: 2px solid var(--stq-accent);
    outline-offset: 3px;
}


/* ------------------------------------------------------------
   2. Header
   ------------------------------------------------------------ */

.stq-header {
    margin: 0 0 1.4rem;
}

.stq-eyebrow {
    margin: 0 0 .25rem;

    color: var(--stq-muted);
    font-size: .74rem;
    font-weight: 750;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.stq-header h2 {
    margin: 0 0 .4rem;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
}


/* ------------------------------------------------------------
   3. Summary Statistics and Progress
   ------------------------------------------------------------ */

.stq-stat {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.stq-stat strong {
    font-size: 1.75rem;
    line-height: 1.2;
    font-weight: 750;
}

.stq-stat strong small {
    color: var(--stq-muted);
    font-size: .85rem;
}

.stq-stat span {
    color: var(--stq-muted);
    font-size: .83rem;
}

.stq-progress {
    height: 7px;
    grid-column: 1 / -1;

    background: var(--stq-border);
    border-radius: 9px;
    overflow: hidden;
}

.stq-progress span {
    display: block;
    height: 100%;

    background: var(--stq-accent);
    border-radius: inherit;
}


/* ------------------------------------------------------------
   4. Search and Filter Tools
   ------------------------------------------------------------ */

.stq-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .75rem;

    margin-bottom: 1.3rem;
}

.stq-tools label {
    display: flex;
    flex-direction: column;
    gap: .3rem;

    color: var(--stq-muted);
    font-size: .8rem;
    font-weight: 600;
}

.stq-search-label {
    flex: 1;
    min-width: 200px;
}

.stq-tools input,
.stq-tools select {
    min-height: 40px;
    max-width: 100%;
    padding: .5rem .7rem;

    background: transparent;
    color: inherit;

    border: 1px solid var(--stq-border);
    border-radius: 9px;
}


/* ------------------------------------------------------------
   5. Results Heading and Question Groups
   ------------------------------------------------------------ */

.stq-results-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;

    margin-bottom: 1.25rem;
}

.stq-results-heading h3 {
    margin: 0;
    font-size: 1.25rem;
}

.stq-results-heading p {
    margin: .25rem 0 0;

    color: var(--stq-muted);
    font-size: .86rem;
}

.stq-results-heading > span {
    color: var(--stq-muted);
    font-size: .8rem;
    white-space: nowrap;
}

.stq-group-section {
    margin-bottom: 1.7rem;
}

.stq-section-title {
    margin: 0 0 .7rem;
}

.stq-section-title h4 {
    margin: 0;
    font-size: 1rem;
}

.stq-section-title p {
    margin: .2rem 0;
    color: var(--stq-muted);
    font-size: .82rem;
}


/* ------------------------------------------------------------
   6. Question Cards
   ------------------------------------------------------------ */

.stq-card {
    margin-bottom: .75rem;
    padding: 1.1rem 1.25rem;

    background: transparent;
    border: 1px solid var(--stq-border);
    border-radius: 13px;

    scroll-margin-top: 1rem;
}

/* Question ID and dimension pairing */

.stq-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.stq-qid {
    color: var(--stq-muted);
    font-size: .71rem;
    font-weight: 750;
    letter-spacing: .035em;
    text-transform: uppercase;
}

/* Question heading */

.stq-card h5 {
    margin: .45rem 0 .6rem;

    font-size: 1.08rem;
    line-height: 1.4;
    font-weight: 700;
}

/* Answer preview and full answer */

.stq-answer {
    margin: .45rem 0 .85rem;
    line-height: 1.65;
}

/* Pending questions */

.stq-awaiting {
    margin: .4rem 0;

    color: var(--stq-muted);
    font-style: italic;
}

.stq-pending-label {
    color: var(--stq-muted);
    font-size: .7rem;
}

.stq-card.is-pending {
    background: var(--stq-surface);
}



/* ------------------------------------------------------------
   7. Metadata Tags and Expand / Close Button
   ------------------------------------------------------------ */

/*
   The metadata container and button share a flex row.

   Metadata tags remain on the left.
   The action button is pushed to the right.
   The button wraps when insufficient space is available.
*/

.stq-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;

    margin: .6rem 0;
}

/* Metadata tag container */

.stq-meta {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;

    min-width: 0;
    margin: 0;
}

/* Individual metadata tags */

.stq-pill {
    display: inline-flex;
    align-items: center;

    padding: .18rem .55rem;

    color: var(--stq-muted);
    font-size: .74rem;
    line-height: 1.5;

    border: 1px solid var(--stq-border);
    border-radius: 999px;
}

/* Expand and Explore / Close button */

.stq-meta-row > .stq-expand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;

    width: auto;
    min-height: 28px;
    max-height:28px;
    margin: 0 0 0 auto;
    padding: .25rem .8rem;

    background: var(--blue);
    color: #fff;

    border: 0;
    border-radius: 999px;

    font-size: .74rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    text-align: center;
}

/* Button hover and active states */

.stq-meta-row > .stq-expand:hover {
    filter: brightness(.92);
}

.stq-meta-row > .stq-expand:active {
    filter: brightness(.85);
}

/* Button focus accessibility */

.stq-meta-row > .stq-expand:focus-visible {
    outline: 2px solid var(--stq-accent);
    outline-offset: 3px;
}

/* ------------------------------------------------------------
   17. Answer Preview and Expansion
   ------------------------------------------------------------ */

/* Collapsed answer preview */

.stq-answer-preview {
    display: block;
}

/* Full answer displayed when expanded */

.stq-answer-full {
    display: block;
}

/* Hide whichever answer state is inactive */

.stq-answer-preview[hidden],
.stq-answer-full[hidden] {
    display: none !important;
}

/* Expanded question details */

.stq-card.is-expanded .stq-details {
    padding-top: .6rem;
}

/* ------------------------------------------------------------
   8. Expanded Details
   ------------------------------------------------------------ */

.stq-details {
    padding: .6rem 0 0;
}

.stq-detail-section {
    margin: 1.1rem 0;
}

.stq-detail-section h5,
.stq-detail-section h6 {
    margin: 0 0 .4rem;

    font-size: .86rem;
    font-weight: 750;
}

.stq-detail-section p {
    margin: .4rem 0;
}


/* ------------------------------------------------------------
   9. Lists and Supporting Evidence
   ------------------------------------------------------------ */

.stq-list {
    margin: .35rem 0;
    padding-left: 1.2rem;
}

.stq-list li {
    margin: .4rem 0;
}

.stq-muted,
.stq-source {
    color: var(--stq-muted);
    font-size: .82rem;
}

.stq-source {
    overflow-wrap: anywhere;
}

.stq-source a {
    color: var(--stq-accent);
}


/* ------------------------------------------------------------
   10. Discovered Insights
   ------------------------------------------------------------ */

.stq-insight {
    margin: .7rem 0;
    padding: .85rem 1rem;

    background: var(--stq-surface);
    border-left: 3px solid #b5a8dd;
    border-radius: 0 9px 9px 0;
}

.stq-insight > h6 {
    margin: 0 0 .45rem;
    font-size: 1rem;
}

.stq-insight > p {
    margin: .3rem 0 .6rem;
}


/* ------------------------------------------------------------
   11. Options to Consider
   ------------------------------------------------------------ */

.stq-option {
    padding: .6rem 0;
    border-top: 1px solid var(--stq-border);
}


/* ------------------------------------------------------------
   12. Empty Results and Debugging
   ------------------------------------------------------------ */

.stq-empty {
    padding: 2rem;

    color: var(--stq-muted);
    text-align: center;
}

.stq-debug {
    margin-top: 2rem;
    font-size: .8rem;
}


/* ------------------------------------------------------------
   13. Card Highlight Animation
   ------------------------------------------------------------ */

.stq-card.is-highlighted {
    animation: stq-highlight 1.2s ease-out;
}

@keyframes stq-highlight {
    from {
        box-shadow: 0 0 0 4px #a98bdf88;
    }

    to {
        box-shadow: none;
    }
}


/* ------------------------------------------------------------
   14. Responsive Layout — Tablet
   ------------------------------------------------------------ */

@media (max-width: 850px) {

    .stq-layout {
        grid-template-columns: 1fr;
    }

    .stq-sidebar {
        position: static;
    }

    .stq-group-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stq-map-details {
        max-width: 350px;
    }
}


/* ------------------------------------------------------------
   15. Responsive Layout — Mobile
   ------------------------------------------------------------ */

@media (max-width: 550px) {

    .stq-summary {
        gap: .5rem;
        padding: .8rem;
    }

    .stq-stat strong {
        font-size: 1.35rem;
    }

    .stq-stat span {
        font-size: .7rem;
    }

    .stq-group-nav {
        grid-template-columns: 1fr;
    }

    .stq-card {
        padding: .9rem;
    }

    .stq-results-heading {
        flex-direction: column;
        gap: .35rem;
    }

    /*
       Allow the action button to wrap naturally beneath
       the metadata pills while remaining right-aligned.
    */

    .stq-meta > .stq-expand {
        margin-left: auto;
    }
}


/* ------------------------------------------------------------
   16. Reduced Motion Accessibility
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {

    .stq-card.is-highlighted {
        animation: none;
    }
}
