/* ==========================================================================
   Persona Quiz Styles (BEM)
   ========================================================================== */

/* Variables
   ========================================================================== */
:root {
    --pq-primary: #b83426;
    --pq-primary-hover: #9a2b20;
    --pq-primary-ring: rgba(184, 52, 38, 0.3);
    --pq-text: #3a3a3a;
    --pq-text-light: #666666;
    --pq-border: #e0e0e0;
    --pq-bg: #ffffff;
    --pq-bg-light: #f5f5f5;
    --pq-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    --pq-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
    --pq-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --pq-overlay: rgba(255, 255, 255, 0.15);
    --pq-overlay-hover: rgba(255, 255, 255, 0.25);
    --pq-radius: 16px;
    --pq-radius-sm: 4px;
    --pq-heading-font: 'Playfair Display', serif;
    --pq-font: 'Montserrat', sans-serif;
    --pq-transition: 0.3s ease;
}

/* Base Container
   ========================================================================== */
.pq {
    font-family: var(--pq-font);
    color: var(--pq-text);
}

.pq :is(h1, h2, h3, h4, h5, h6) {
    font-family: var(--pq-heading-font);
}

/* Backdrop
   ========================================================================== */
.pq__backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

.pq__backdrop--enter {
    transition: opacity 0.3s ease;
}

.pq__backdrop--enter-start {
    opacity: 0;
}

.pq__backdrop--enter-end {
    opacity: 1;
}

.pq__backdrop--leave {
    transition: opacity 0.3s ease;
}

.pq__backdrop--leave-start {
    opacity: 1;
}

.pq__backdrop--leave-end {
    opacity: 0;
}

/* Modal
   ========================================================================== */
.pq__modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #1a1a1a;
    background-size: cover;
    background-position: center;
    z-index: 10000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pq__modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.6) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1;
}

.pq__modal--enter {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.pq__modal--enter-start {
    opacity: 0;
    transform: scale(0.95);
}

.pq__modal--enter-end {
    opacity: 1;
    transform: scale(1);
}

.pq__modal--leave {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.pq__modal--leave-start {
    opacity: 1;
    transform: scale(1);
}

.pq__modal--leave-end {
    opacity: 0;
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .pq__modal {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding-bottom: 24px;
    }
}

/* Modal Header
   ========================================================================== */
.pq__header {
    position: absolute;
    top: calc(0px + var(--wp-admin--admin-bar--height, 0px));
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 40px;
    z-index: 5;
}

.pq__logo {
    display: flex;
    align-items: center;
}

.pq__logo-img {
    height: 45px;
    width: auto;
}

@media (max-width: 768px) {
    .pq__header {
        padding: 16px;
        position: sticky;
        top: calc(0px + var(--wp-admin--admin-bar--height, 0px));
        z-index: 10;
        flex-shrink: 0;
    }

}

/* Close Button
   ========================================================================== */
.pq__close {
    background: var(--pq-overlay);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    transition: background-color var(--pq-transition), color var(--pq-transition);
    flex-shrink: 0;
}

.pq__close:hover {
    background: var(--pq-overlay-hover);
    color: #ffffff;
}

.pq__close:focus {
    outline: 2px solid var(--pq-primary);
    outline-offset: 2px;
}

.pq__header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pq__header-back-short {
    display: none;
}

@media (max-width: 768px) {
    .pq__header-back-full {
        display: none;
    }

    .pq__header-back-short {
        display: inline;
    }

    .pq__header-retake-text {
        display: none;
    }

    .pq__header-back-full,
    .pq__header-back-short {
        display: none;
    }

    .pq__header-back,
    .pq__btn--ghost[aria-label="Retake Quiz"] {
        width: 40px;
        height: 40px;
        border-radius: 50% !important;
        padding: 0 !important;
        padding-block: 0 !important;
        padding-inline: 0 !important;
        justify-content: center;
    }
}

/* Content Area
   ========================================================================== */
.pq__content {
    position: relative;
    z-index: 2;
    background-color: var(--pq-bg);
    border-radius: var(--pq-radius);
    max-width: 970px;
    width: 100%;
    height: fit-content;
    max-height: calc(100% - 80px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    outline: none;
}

@media (max-width: 768px) {
    .pq__content {
        max-width: calc(100% - 32px);
        max-height: none;
        overflow-y: visible;
        align-self: center;
        z-index: 10;
        top: calc(0px + var(--wp-admin--admin-bar--height, 0px));
        margin-bottom: 24px;
    }
}

/* Screens
   ========================================================================== */
.pq__screen {
    animation: pqFadeIn 0.3s ease;
}

@keyframes pqFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Split Layout (shared by intro + results)
   ========================================================================== */
.pq__screen--split {
    display: grid;
    grid-template-columns: 1fr 355px;
    gap: 48px;
    align-items: stretch;
    height: 100%;
    padding: 16px;
}

.pq__screen--split__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: start;
    padding: 48px 32px;
    text-align: left;
}

.pq__screen--split__image {
    position: relative;
    overflow: hidden;
    border-radius: var(--pq-radius);
}

.pq__screen--split__image img {
    width: 100%;
    height: 100%;
    border-radius: var(--pq-radius);
    object-fit: cover;
}

/* Video wrapper – layered above the fallback image */
.pq__screen--split__image [x-ref] {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.pq__screen--split__image [x-ref].pq__video-ready {
    opacity: 1;
}

/* Swarmify/Video.js player wrapper and inner video */
.pq__screen--split__image smartvideo,
.pq__screen--split__image .video-js,
.pq__split-video {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    inset: 0;
    border-radius: var(--pq-radius);
    object-fit: cover;
    display: block;
}

.pq__screen--split__image video {
    object-fit: cover;
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 768px) {
    .pq__screen--split {
        grid-template-columns: 1fr;
        gap: 0;
        text-align: center;
        padding: 16px;
    }

    .pq__screen--split__content {
        align-items: center;
        order: 1;
        padding: 16px 8px;
    }

    .pq__screen--split__content .pq__btn--primary {
        width: 100%;
        justify-content: center;
    }

    .pq__screen--split__image {
        order: 0;
        position: relative;
        aspect-ratio: 16/9;
    }

    .pq__screen--split__image smartvideo,
    .pq__screen--split__image .video-js,
    .pq__split-video {
        max-width: 100%;
    }
}

/* Padded Screen (shared by question + explore)
   ========================================================================== */
.pq__screen--padded {
    padding-block: 40px;
    padding-inline: 56px;
}

@media (max-width: 768px) {
    .pq__screen--padded {
        --pq-padded-inline: 24px;
        padding-block: 24px;
        padding-inline: var(--pq-padded-inline);
    }
}

/* Intro Screen
   ========================================================================== */
.pq__intro-meta {
    margin-top: 16px;
    font-size: 14px;
    color: var(--pq-text-light);
}

/* Typography
   ========================================================================== */
.pq__heading {
    font-size: 47px;
    margin: 0 0 16px 0;
    font-family: var(--pq-heading-font);
    font-weight: 400;
    letter-spacing: 0px;
    line-height: 130%;
}

.pq__description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--pq-text-light);
    margin-bottom: 24px;
}

.pq__description p {
    margin: 0 0 16px 0;
}

.pq__description p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .pq__heading {
        font-size: 24px;
    }

    .pq__description {
        font-size: 14px;
    }
}

/* Buttons
   ========================================================================== */
.pq__btn {
    --_pq-btn-border-color: #E0E0E0;
    --_pq-btn-background-color: #FFFFFF;
    --_pq-btn-color: #3A3A3A;
    font-family: var(--pq-font);
    height: 44px;
    gap: 8px;
    padding-block: 8px;
    padding-inline: 16px;
    border-radius: var(--pq-radius-sm);
    border: 1px solid var(--_pq-btn-border-color);
    background-color: var(--_pq-btn-background-color);
    color: var(--_pq-btn-color);
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all var(--pq-transition);
}

.pq__btn--primary {
    --_pq-btn-border-color: var(--pq-primary);
    --_pq-btn-background-color: var(--pq-primary);
    --_pq-btn-color: #FFFFFF;
}

.pq__btn--primary:hover:not(:disabled),
.pq__btn--primary:focus:not(:disabled) {
    --_pq-btn-border-color: var(--pq-primary-hover);
    --_pq-btn-background-color: var(--pq-primary-hover);
    --_pq-btn-color: #FFFFFF;
}

a.pq__btn--primary,
a.pq__btn--primary:hover,
a.pq__btn--primary:focus,
a.pq__btn--primary:visited {
    color: #FFFFFF;
    text-decoration: none;
}

.pq__btn--primary:disabled {
    --_pq-btn-border-color: var(--pq-border);
    --_pq-btn-background-color: var(--pq-border);
    --_pq-btn-color: var(--pq-text-light);
    cursor: not-allowed;
}

.pq__btn--outline {
    --_pq-btn-border-color: var(--pq-border);
    --_pq-btn-background-color: transparent;
    --_pq-btn-color: var(--pq-primary);
}

.pq__btn--outline:hover:not(:disabled),
.pq__btn--outline:focus:not(:disabled) {
    --_pq-btn-background-color: var(--pq-border);
}

.pq__btn--secondary {
    --_pq-btn-border-color: var(--pq-border);
    --_pq-btn-background-color: transparent;
    --_pq-btn-color: var(--pq-text);
}

.pq__btn--secondary:hover {
    --_pq-btn-border-color: var(--pq-text);
    --_pq-btn-background-color: var(--pq-text);
    --_pq-btn-color: #FFFFFF;
}

.pq__btn--ghost {
    --_pq-btn-border-color: transparent;
    --_pq-btn-background-color: var(--pq-overlay);
    --_pq-btn-color: #FFFFFF;
}

.pq__btn--ghost:hover:not(:disabled),
.pq__btn--ghost:focus:not(:disabled) {
    --_pq-btn-background-color: var(--pq-overlay-hover);
}

.pq__btn:focus {
    outline: 2px solid var(--pq-primary);
    outline-offset: 2px;
}

/* Links
   ========================================================================== */
.pq__link {
    font-family: var(--pq-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--pq-primary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    transition: color var(--pq-transition);
}

.pq__link:hover {
    color: var(--pq-primary-hover);
}

/* Progress Bar
   ========================================================================== */
.pq__progress {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
}

.pq__progress-bar {
    flex: 1;
    height: 6px;
    background-color: var(--pq-bg-light);
    border-radius: 3px;
    overflow: hidden;
}

.pq__progress-fill {
    height: 100%;
    background-color: var(--pq-primary);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.pq__progress-text {
    flex-shrink: 0;
    font-size: 14px;
    color: var(--pq-text);
    white-space: nowrap;
    background: var(--pq-border);
    padding: 4px 16px;
    border-radius: 100vw;
    font-weight: 500;
}

@media (max-width: 768px) {
    .pq__progress {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 24px;
    }

    .pq__progress-bar {
        flex: none;
    }

    .pq__progress-text {
        font-size: 12px;
        align-self: center;
    }
}

/* Question Screen
   ========================================================================== */
.pq__question {
    font-size: 47px;
    max-width: 690px;
    color: var(--pq-text);
    margin-bottom: 24px;
    line-height: 1.2;
}

.pq__selection-hint {
    font-size: 14px;
    color: var(--pq-text-light);
    margin: 0 0 24px 0;
}

@media (max-width: 768px) {
    .pq__question {
        font-size: 28px;
        margin-bottom: 10px;
    }
}

/* Selectable Cards (shared by choices + style cards)
   ========================================================================== */
.pq__card {
    background-color: var(--pq-bg);
    border: 1px solid var(--pq-border);
    border-radius: var(--pq-radius-sm);
    cursor: pointer;
    transition: all var(--pq-transition);
    text-align: left;
    padding: 0;
}

.pq__card:is(:hover, :focus) {
    background-color: var(--pq-border);
    box-shadow: var(--pq-shadow-sm);
}

.pq__card--selected {
    border-color: var(--pq-primary);
    box-shadow: var(--pq-shadow-md);
}

.pq__card:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--pq-primary-ring);
}

.pq__card__image {
    position: relative;
    overflow: hidden;
}

.pq__card__image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color var(--pq-transition);
    pointer-events: none;
}

.pq__card--selected .pq__card__image::after {
    background-color: rgba(0, 0, 0, 0.3);
}

.pq__card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pq__card__check {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    background-color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pq-text);
    z-index: 1;
}

/* Answer Choices
   ========================================================================== */
.pq__choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 600px) {
    .pq__choices {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 0px;
    }
}

.pq__choice {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 8px;
}

.pq__choice .pq__card__image {
    flex-shrink: 0;
    width: 180px;
    aspect-ratio: 4/3;
    border-radius: var(--pq-radius-sm);
}

.pq__choice-label {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--pq-text);
    line-height: 1.4;
}

@media (max-width: 768px) {
    .pq__choice {
        padding: 8px 20px 8px 8px;
    }

    .pq__choice .pq__card__image {
        width: 120px;
    }

    .pq__choice-label {
        font-size: 14px;
        font-weight: 400;
    }

    .pq__card__check {
        width: 20px;
        height: 20px;
        top: 6px;
        left: 6px;
    }
}

/* Navigation
   ========================================================================== */
.pq__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.pq__nav .pq__btn--primary {
    margin-left: auto;
}

@media (max-width: 768px) {
    .pq__nav {
        flex-direction: column-reverse;
        padding: 24px 0;
    }

    .pq__nav--sticky {
        position: sticky;
        bottom: calc(var(--pq-padded-inline) * -1);
        background: linear-gradient(to top, var(--pq-bg) 80%, transparent);
        margin: 0 calc(var(--pq-padded-inline) * -1);
        padding-left: var(--pq-padded-inline);
        padding-right: var(--pq-padded-inline);
        z-index: 10;
    }

    .pq__nav .pq__btn {
        width: 100%;
        justify-content: center;
    }

    .pq__nav .pq__btn--primary {
        margin-left: 0;
    }
}

/* Loading Screen
   ========================================================================== */
.pq__screen--loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 520px;
    padding: 100px 40px;
    text-align: center;
}

.pq__compass {
    position: relative;
    width: 90px;
    height: 90px;
    animation: pqCompassSpin 1.8s linear infinite;
}

.pq__compass-ring {
    width: 100%;
    height: 100%;
}

.pq__compass-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes pqCompassSpin {
    to {
        transform: rotate(360deg);
    }
}

.pq__loading-text {
    font-family: var(--pq-heading-font);
    font-size: 39px;
    line-height: 130%;
    color: var(--pq-text);
    margin-top: 40px;
    max-width: 500px;
}

@media (max-width: 768px) {
    .pq__screen--loading {
        min-height: 300px;
        padding: 60px 24px;
    }

    .pq__compass {
        width: 60px;
        height: 60px;
    }

    .pq__loading-text {
        font-size: 24px;
        margin-top: 24px;
    }
}

/* Results Screen
   ========================================================================== */
.pq__screen--results .pq__heading {
    font-size: 39px;
    line-height: 130%;
}

.pq__screen--results .pq__description {
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--pq-border);
}

.pq__result-cta-short {
    display: none;
}

.pq__result-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

.pq__result-actions-label {
    font-size: 14px;
    font-style: italic;
    color: var(--pq-text-light);
}

@media (max-width: 768px) {
    .pq__screen--results .pq__heading {
        font-size: 28px;
    }

    .pq__screen--results .pq__description {
        font-size: 14px;
    }

    .pq__screen--results .pq__btn--primary svg {
        display: none;
    }

    .pq__result-cta-full {
        display: none;
    }

    .pq__result-cta-short {
        display: inline;
    }

    .pq__result-actions {
        flex-direction: column;
        gap: 16px;
    }
}

/* Explore Screen
   ========================================================================== */
.pq__screen--explore .pq__heading {
    margin-bottom: 16px;
}

.pq__screen--explore .pq__description {
    margin-bottom: 24px;
}

.pq__styles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 768px) {
    .pq__styles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .pq__styles-grid {
        grid-template-columns: 1fr;
    }
}

.pq__style-card {
    display: flex;
    flex-direction: column;
}

.pq__style-card .pq__card__image {
    aspect-ratio: 16/9;
}

.pq__style-content {
    padding: 16px;
}

.pq__style-name {
    font-size: 20px;
    font-weight: 500;
    color: var(--pq-text);
    margin: 0 0 8px 0;
    line-height: 130%;
}

.pq__style-desc * {
    font-size: 13px;
    color: var(--pq-text-light);
    margin: 0;
    line-height: 1.5;
}

.pq__screen--explore .pq__btn--primary {
    display: block;
    margin: 0 auto;
}

/* Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {

    .pq__backdrop--enter,
    .pq__backdrop--leave,
    .pq__modal--enter,
    .pq__modal--leave,
    .pq__screen,
    .pq__compass,
    .pq__btn,
    .pq__card,
    .pq__card__image img {
        animation: none;
        transition: none;
    }

    .pq__compass {
        animation: pqCompassSpin 2s linear infinite;
    }
}

/* Focus visible styles */
.pq__btn:focus-visible,
.pq__card:focus-visible,
.pq__link:focus-visible,
.pq__close:focus-visible {
    outline: 2px solid var(--pq-primary);
    outline-offset: 2px;
}