/*
 * Coding Ireland proprietary interactive activity
 * Copyright (c) 2017-2026 Coding Ireland. All rights reserved.
 *
 * Part of the Coding Ireland online learning platform. Licensed for use only
 * as delivered on the platform. Copying, redistributing, or adapting this
 * file, in whole or in part, for use in any other product or service is not
 * permitted. Ref: CI-maths-word-problem
 */
/*
 * word-problem activity skin. Layered on the shared maths-activity.css.
 * Three steps stacked: the story card, the operation chooser, the number
 * sentence with an answer slot. Display mode folds to a read-only worked card.
 */

.wp-mode-chip {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--maths-surface-alt);
    color: var(--maths-primary-dark);
    font-weight: 800;
    font-size: 0.8rem;
}

.wp-stage {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 760px;
    margin: 0 auto;
}

/* Explore-mode story strip: the stories this step reads with the class,
 * workable one at a time. Quieter than the challenge runner — nothing scored. */
.wp-stories {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    max-width: 760px;
    margin: 0 auto 0.75rem;
    padding: 0.45rem 0.6rem;
    background: var(--maths-surface-alt, #EEF3F9);
    border: 1px solid var(--maths-border, #C7CFDB);
    border-radius: 10px;
}
.wp-stories[hidden] { display: none; }
.wp-stories-count {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--maths-ink-muted, #6b7280);
    white-space: nowrap;
}
.wp-stories-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.wp-story-chip {
    min-height: 36px;
    padding: 0.3rem 0.7rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--maths-ink, #1F2933);
    background: #fff;
    border: 1px solid var(--maths-border, #C7CFDB);
    border-radius: 999px;
    cursor: pointer;
}
.wp-story-chip:hover { border-color: var(--maths-accent, #E86A33); }
.wp-story-chip.is-active {
    color: #fff;
    background: var(--maths-accent, #E86A33);
    border-color: var(--maths-accent, #E86A33);
}
.wp-stories-next { min-height: 36px; padding: 0.3rem 0.75rem; font-size: 0.9rem; }
/* A display step embeds one interactive per story; no stepper there. */
body.display-mode .wp-stories { display: none; }

/* ---- Problem card ---- */
.wp-card {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-left: 6px solid var(--maths-primary);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
}

.wp-context {
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--maths-accent-dark);
    margin-bottom: 0.4rem;
}

.wp-text {
    font-size: 1.3rem;
    line-height: 1.5;
    color: var(--maths-ink);
    margin: 0;
}

.wp-action-word {
    cursor: pointer;
    border-radius: 6px;
    padding: 0 0.15em;
    text-decoration: underline dotted var(--maths-ink-muted);
    text-underline-offset: 3px;
    transition: background-color 120ms ease;
}

.wp-action-word:hover { background: #fff3df; }

.wp-action-word.spotted {
    background: #ffe7b3;
    text-decoration: none;
    font-weight: 800;
    color: #8a5a00;
}

/* ---- Step blocks ---- */
.wp-step { }

.wp-step-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--maths-ink-muted);
    margin-bottom: 0.5rem;
}

.wp-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--maths-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
}

/* ---- Operation chooser ---- */
.wp-ops {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.wp-op-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    min-width: 84px;
    padding: 0.6rem 0.9rem;
    border: 2px solid var(--maths-border);
    border-radius: 12px;
    background: var(--maths-surface);
    color: var(--maths-ink);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    min-height: 64px;
}

.wp-op-btn:hover { border-color: var(--maths-primary); background: var(--maths-surface-alt); }

.wp-op-btn.chosen {
    border-color: var(--maths-primary);
    background: var(--maths-primary);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(31, 111, 178, 0.2);
}

.wp-op-symbol { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.wp-op-label { font-size: 0.85rem; font-weight: 700; }

/* ---- Number sentence ---- */
.wp-sentence {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    background: var(--maths-surface-alt);
    border: 1px solid var(--maths-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--maths-primary-dark);
    font-variant-numeric: tabular-nums;
}

.wp-answer-input {
    width: 6rem;
    font-size: 1.6rem !important;
    font-weight: 800;
    text-align: center;
    padding: 0.3rem 0.5rem !important;
    min-height: 48px;
}

.wp-answer-value {
    min-width: 3rem;
    text-align: center;
    color: var(--maths-success);
}

/* ---- Check + result ---- */
.wp-action-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.875rem;
}

.wp-action-row[hidden] { display: none; }

.wp-check-btn { white-space: nowrap; }

/* ---- Worked panel (display mode) ---- */
.wp-worked {
    border: 1px solid var(--maths-border);
    border-radius: 12px;
    overflow: hidden;
}

.wp-worked[hidden] { display: none; }

.wp-worked-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--maths-grid-line);
}

.wp-worked-row:last-child { border-bottom: none; }

.wp-worked-key { font-weight: 700; color: var(--maths-ink-muted); }
.wp-worked-val { font-weight: 800; color: var(--maths-ink); text-align: right; }

.wp-worked-row-answer {
    background: #e8f5e9;
}
.wp-worked-row-answer .wp-worked-val { color: #1b5e20; font-size: 1.2rem; }

/* ---- Your turn ---- */
.wp-your-turn {
    max-width: 760px;
    margin: 1rem auto 0;
    background: #fff8e1;
    border: 1px solid #f0c14b;
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
}

.wp-your-turn[hidden] { display: none; }

.wp-your-turn-label {
    font-weight: 800;
    color: #8a5a00;
    margin-bottom: 0.4rem;
}

.wp-your-turn-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--maths-ink);
}

.wp-your-turn-list li { margin: 0.2rem 0; }

/* ---- Display mode ---- */
body.display-mode .wp-step,
body.display-mode .wp-action-row {
    display: none;
}

body.display-mode .wp-stage {
    gap: 0.75rem;
}

body.display-mode .wp-card {
    border-left-width: 6px;
}

@media (max-width: 640px) {
    .wp-text { font-size: 1.15rem; }
    .wp-sentence { font-size: 1.4rem; }
}
