﻿/* ===============================
   One Event, Multiple Paths — Component Styles
   Uses PageShell for layout, .eqn-img for images
   =============================== */

/* ====== Legacy wrapper kept harmless (optional) ====== */
.oemp-wrapper {
    min-height: 100svh;
    box-sizing: border-box;
    padding: 0.75rem;
    background: #fff;
    font-family: 'Inter','Segoe UI',system-ui,sans-serif;
}

/* ====== Sizing variables ====== */
:root {
    --oemp-header-gap: 0.5rem;
    --oemp-footer-h: 72px; /* for inner scroll padding below */
}

/* ====== Scenario header (image + prompt; vertical stack) ====== */
.oemp-scenario {
    display: grid;
    grid-auto-rows: max-content;
    justify-items: center;
    align-content: start; /* prevents crowding in v-centered panes */
    gap: var(--oemp-header-gap);
    text-align: center;
    margin-bottom: 0.25rem;
}

    /* Allow a bit more image height in picker (options below);
   tighten in path view (stepper/feedback below). */
    .oemp-scenario.in-picker {
        --eqn-img-max-svh: 30;
    }

    .oemp-scenario.in-path {
        --eqn-img-max-svh: 22;
    }

    .oemp-scenario .eqn-img {
        width: 100%;
        max-width: 520px; /* keeps the image box from getting too wide */
    }

        /* Ensure correct proportions — do NOT force width/height 100% */
        .oemp-scenario .eqn-img > img {
            max-width: 100%;
            max-height: 100%;
            width: auto;
            height: auto;
            object-fit: contain;
        }

/* Prompt text below the image */
.oemp-prompt {
    margin: 0.15rem 0 0.35rem;
    font-size: clamp(1.1rem, 2.5vw, 1.05rem);
    font-weight: 600;
    line-height: 1.4;
    padding: 0 0.5rem;
    font-size: 1.1rem;
}

.oemp-scenario.in-path .oemp-prompt {
    font-size: clamp(1.10rem, 2.3vw, 1rem);
    margin-bottom: 0.25rem;
}

/* ====== Content containers (prevent overlap with footer area) ====== */
/* Options can keep overflow hidden; feedback needs room for glow */
.oemp-options,
.oemp-path-view {
    min-height: 0; /* grid fix */
    align-content: start;
    padding-top: 0.25rem;
}

.oemp-options {
    overflow: hidden;
}

.oemp-path-view {
    overflow: visible;
}
/* allow feedback glow to be visible */

/* ====== Thought options (Picker) ====== */
.oemp-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    max-width: 720px;
    width: 100%;
    justify-self: center;
    justify-items: center;
}

@media (min-width: 520px) {
    .oemp-options {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 860px) {
    .oemp-options {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.oemp-card {
    position: relative;
    display: block;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    background: #fafafa;
    border: 2px solid #e5e5ef;
    border-radius: 16px;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

    .oemp-card:hover {
        transform: translateY(-1px);
    }

    .oemp-card:disabled {
        opacity: 0.6;
        cursor: default;
        transform: none;
    }

    .oemp-card.active {
        border-color: #7c8cff;
        box-shadow: 0 0 0 3px rgba(124,140,255,0.25);
        animation: oempGlow 1.2s ease-in-out infinite alternate;
    }

    .oemp-card.visited {
        border-color: #9dd89d;
    }

.oemp-card-text {
    font-size: 0.98rem;
    line-height: 1.45;
    color: #222;
}

.oemp-visited-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    font-weight: 800;
    color: #2a7d2a;
}

/* ====== Path view (Stepper or Feedback) ====== */
.oemp-path-view {
    width: 100%;
    max-width: 720px;
    justify-self: center;
    display: grid;
    gap: 0.75rem;
}

.oemp-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.oemp-step {
    border: 2px solid #e6e9ff;
    border-radius: 14px;
    background: #fff;
    padding: 0.7rem 0.9rem;
}

.oemp-step-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.oemp-step-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #cfd5ff;
    border: 2px solid #7c8cff;
}

.oemp-step-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: #5c64c5;
    letter-spacing: 0.02em;
}

.oemp-step-text {
    font-size: 1rem;
    line-height: 1.5;
    color: #1a1a1a;
}

/* Step states */
.oemp-step.pending {
    opacity: 0.65;
}

.oemp-step.done {
    border-color: #9dd89d;
}

.oemp-step.playing {
    border-color: #7c8cff;
    box-shadow: 0 0 0 3px rgba(124,140,255,0.22);
    animation: oempGlow 1.2s ease-in-out infinite alternate;
}

/* Feedback (only after stages complete) */
.oemp-feedback {
    border: 2px solid #e6e9ff;
    border-radius: 14px;
    background: #f8f9ff;
    padding: 0.75rem 0.9rem;
}

.oemp-feedback-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: #5c64c5;
    letter-spacing: 0.02em;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.oemp-feedback-text {
    font-size: 1rem;
    line-height: 1.5;
    color: #1a1a1a;
}

/* NEW: Feedback highlight while audio is playing */
.oemp-feedback.oemp-feedback--reading,
.oemp-feedback.glow {
    border-color: #7c8cff; /* same accent as cards */
    box-shadow: 0 0 0 3px rgba(124,140,255,0.22); /* visible halo */
    animation: oempGlow 1.2s ease-in-out infinite alternate;
    transition: border-color .15s ease, box-shadow .15s ease;
}

/* Path actions */
.oemp-path-actions {
    display: grid;
    justify-items: center;
}

.oemp-secondary {
    appearance: none;
    border: 2px solid #cfd5ff;
    background: #fff;
    color: #3941b5;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    cursor: pointer;
}

    .oemp-secondary:disabled {
        opacity: 0.6;
        cursor: default;
    }

/* ====== PageShell Footer content ====== */
.oemp-footer-stack {
    width: min(720px, 100%);
    display: grid;
    grid-auto-rows: min-content;
    gap: 0.6rem;
    justify-items: center;
}

.oemp-progress {
    width: 100%;
    display: grid;
    gap: 0.35rem;
}

.oemp-progress-label {
    font-size: 0.85rem;
    text-align: center;
    color: #444;
}

.oemp-progress-bar {
    height: 8px;
    width: 100%;
    background: #f1f2f7;
    border-radius: 999px;
    overflow: hidden;
}

.oemp-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8ea3ff, #6fd0a8);
    border-radius: 999px;
    transition: width 200ms ease;
}

/* Footer actions (button) */
.oemp-footer-actions {
    width: 100%;
    display: grid;
    justify-items: center;
}

    .oemp-footer-actions .oemp-primary {
        width: 100%;
        max-width: 480px;
    }

/* Primary action button — uses visibility classes to keep space reserved */
.oemp-primary {
    appearance: none;
    border: none;
    background: linear-gradient(90deg, #5d69ff, #8ea3ff);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(93,105,255,0.25);
    cursor: pointer;
}

    .oemp-primary:disabled {
        opacity: 0.55;
        cursor: default;
        box-shadow: none;
    }

    /* Keep footer button space reserved even when "hidden" */
    .oemp-primary.is-hidden {
        visibility: hidden; /* occupies layout space */
        opacity: 0;
        pointer-events: none;
    }

    .oemp-primary.is-visible {
        visibility: visible;
        opacity: 1;
        transition: opacity 0.2s ease;
    }

/* If your PageShell footer has multiple children, give it breathing room */
.eqn-footer {
    gap: 0.25rem;
}

/* ====== Very short screens: reduce image allowance slightly ====== */
@media (max-height: 680px) {
    .oemp-scenario.in-picker {
        --eqn-img-max-svh: 26;
    }

    .oemp-scenario.in-path {
        --eqn-img-max-svh: 20;
    }

    .oemp-prompt {
        line-height: 1.3;
    }
}

/* ====== Border glow animation ====== */
@keyframes oempGlow {
    from {
        box-shadow: 0 0 0 3px rgba(124,140,255,0.12);
    }

    to {
        box-shadow: 0 0 0 6px rgba(124,140,255,0.32);
    }
}

.oemp-footer-actions .oemp-footer-btn {
    width: 100%;
    max-width: 480px;
}

/* Opacity states: keep space reserved */
.oemp-footer-btn.is-opaque {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.oemp-footer-btn.is-transparent {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Footer button width */
.oemp-footer-actions .footer-fade {
    width: 100%;
    max-width: 480px;
}

/* Opacity states — keep space reserved */
.footer-fade.is-opaque {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.footer-fade.is-transparent {
    opacity: 0;
    pointer-events: none; /* inert while transparent */
    transition: opacity 0.3s ease;
}
