/*
 * Coding Ireland proprietary interactive activity
 * Copyright (c) 2017-2026 Coding Ireland. All rights reserved.
 * Ref: CI-see-record-extractor
 *
 * Budget: a FIXED 620px iframe in explore. The split MUST stay horizontal —
 * the record image beside the form is the whole working posture, and stacking
 * them is what breaks this one. Pooling swaps the view rather than adding to it.
 * Palette + [hidden] fix: ../shared/css/see-activity.css
 * Pan/zoom chrome: ../shared/css/see-viewport.css
 */

.re-container { display: flex; flex-direction: column; gap: .35rem; }

.re-picker { display: flex; flex-wrap: wrap; gap: .25rem; }

.re-chip {
    min-height: 34px;
    padding: .15rem .65rem;
    border-radius: 999px;
    border: 2px solid var(--maths-border);
    background: #fff;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: .82rem;
    color: var(--see-ink);
    cursor: pointer;
}

.re-chip.is-active { background: var(--see-accent); border-color: var(--see-accent); color: #fff; }
.re-chip.is-done { border-style: dashed; }
.re-chip.is-done::after { content: " \2713"; color: var(--see-accent); }
.re-chip.is-active.is-done::after { color: #fff; }

/* 55/45, and it stays that way down to a narrow tablet. */
.re-split {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: .5rem;
    align-items: start;
}

.re-left, .re-right { min-width: 0; }

.re-stage { min-height: 290px; max-height: 340px; }
.re-stage .sv-viewport { min-height: 274px; }

.re-transcript {
    margin: .25rem 0 0;
    max-height: 110px;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--maths-border);
    border-radius: 8px;
    padding: .35rem .5rem;
    font-family: 'Nunito', sans-serif;
    font-size: .8rem;
    white-space: pre-wrap;
}

.re-transcript-img { width: 100%; height: auto; }

/* A record with words and no picture: the words take the picture's place, at a size
   the class can read on the board. */
.re-words-only .re-transcript {
    margin: 0;
    min-height: 290px;
    max-height: 340px;
    font-size: 1.05rem;
    line-height: 1.45;
    padding: .75rem .9rem;
}

/* --------------------------------------------------------------- the form */
.re-form {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    max-height: 290px;
    overflow-y: auto;
}

.re-field { display: flex; flex-direction: column; gap: .05rem; }

.re-field-label {
    font-size: .74rem;
    font-weight: 800;
    color: var(--maths-ink-muted);
}

.re-input {
    min-height: 36px;
    border-radius: 8px;
    border: 2px solid var(--maths-border);
    padding: .2rem .5rem;
    font-family: 'Nunito', sans-serif;
    font-size: .9rem;
    background: #fff;
}

.re-input:focus-visible { outline: 3px solid var(--maths-focus-ring); outline-offset: 1px; }

.re-add { width: 100%; min-height: 42px; margin-top: .35rem; }

/* ------------------------------------------------------------- the table */
.re-pooled-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.re-pooled-title { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--see-ink); }

.re-table-wrap { overflow: auto; max-height: 290px; }

.re-table { width: 100%; border-collapse: collapse; font-family: 'Nunito', sans-serif; }

.re-table th, .re-table td {
    border: 1px solid var(--maths-grid-line);
    padding: .2rem .45rem;
    text-align: left;
    font-size: .84rem;
}

.re-table thead th {
    background: var(--see-subtle);
    color: var(--see-ink);
    font-weight: 800;
    position: sticky;
    top: 0;
}

.re-th-rec, .re-row-rec { font-weight: 800; color: var(--see-ink); }

/* A household nobody could find is SHOWN, not omitted. The absence is the
 * evidence: people older, people gone, people arrived. */
.re-notfound td { color: #a1140f; font-style: italic; }
.re-notfound { background: rgba(161, 20, 15, .05); }

.re-chart { width: 100%; height: auto; max-height: 170px; }
.re-chart-wrap { max-width: 640px; }

.re-empty {
    display: flex; align-items: center; justify-content: center;
    gap: .5rem; padding: 1rem; color: var(--maths-ink-muted);
}

/* ---------------------------------------------------------- display mode */
body.display-mode .re-work { display: none !important; }
body.display-mode .re-container { gap: .25rem; }
body.display-mode .re-table th, body.display-mode .re-table td { font-size: .95rem; padding: .28rem .5rem; }
body.display-mode .re-table-wrap { max-height: 400px; }
body.display-mode .re-pooled-title { width: 100%; text-align: center; }

@media (max-width: 720px) {
    .re-stage { min-height: 200px; max-height: 240px; }
    .re-stage .sv-viewport { min-height: 184px; }
    .re-form { max-height: 200px; }
}


.re-why { margin: .3rem 0 0; font-size: .85rem; font-weight: 700; color: var(--see-accent); text-align: center; }
.re-add:disabled { opacity: .55; cursor: not-allowed; }

/* =====================================================================
 * Forms pass (31 Oct 2026): 44px targets, readable type, fits the frame
 * The record picker was 34px high and the box labels 12px. Laptop and board
 * frames get 44px targets and 14px+ labels, and the record and the form share
 * the frame height rather than stopping at 340px. Display mode is not touched
 * (the working view is hidden there).
 * ===================================================================== */
@media (min-width: 700px) {
    body.maths-activity:not(.display-mode) .re-chip { min-height: 44px; font-size: .95rem; padding: .15rem .9rem; }
    body.maths-activity:not(.display-mode) .re-field-label { font-size: .9rem; }
    body.maths-activity:not(.display-mode) .re-input { min-height: 44px; font-size: 1rem; }
    body.maths-activity:not(.display-mode) .re-add { min-height: 48px; }
    body.maths-activity:not(.display-mode) .re-transcript { font-size: .95rem; }
    body.maths-activity:not(.display-mode) .re-table th,
    body.maths-activity:not(.display-mode) .re-table td { font-size: 1rem; padding: .35rem .6rem; }
    body.maths-activity:not(.display-mode) .re-pooled-title { font-size: 1.15rem; }
}
@media (min-width: 1000px) and (min-height: 600px) {
    body.maths-activity:not(.display-mode) .re-container {
        height: 100vh; height: 100dvh; box-sizing: border-box; overflow: hidden;
        padding-top: .6rem; padding-bottom: .6rem;
    }
    body.maths-activity:not(.display-mode) .activity-header { flex: 0 0 auto; }
    body.maths-activity:not(.display-mode) .re-work:not([hidden]) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: .35rem; }
    body.maths-activity:not(.display-mode) .re-picker { flex: 0 0 auto; }
    body.maths-activity:not(.display-mode) .re-split { flex: 1 1 auto; min-height: 0; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
    body.maths-activity:not(.display-mode) .re-left { min-height: 0; display: flex; flex-direction: column; }
    body.maths-activity:not(.display-mode) .re-stage { flex: 1 1 auto; min-height: 0; max-height: none; }
    body.maths-activity:not(.display-mode) .re-stage .sv-host { height: 100%; box-sizing: border-box; }
    body.maths-activity:not(.display-mode) .re-stage .sv-viewport { min-height: 0; }
    body.maths-activity:not(.display-mode) .re-words-only .re-transcript { flex: 1 1 auto; min-height: 0; max-height: none; }
    body.maths-activity:not(.display-mode) .re-right { min-height: 0; display: flex; flex-direction: column; }
    body.maths-activity:not(.display-mode) .re-form { flex: 1 1 auto; min-height: 0; max-height: none; }
    body.maths-activity:not(.display-mode) .re-pooled:not([hidden]) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: .35rem; }
    body.maths-activity:not(.display-mode) .re-table-wrap { flex: 0 1 auto; max-height: none; min-height: 0; }
}
@media (min-width: 1500px) and (min-height: 760px) {
    body.maths-activity:not(.display-mode) .re-split { gap: 1.2rem; }
    body.maths-activity:not(.display-mode) .re-chip { min-height: 52px; font-size: 1.1rem; padding: .2rem 1.1rem; }
    body.maths-activity:not(.display-mode) .re-form { gap: .55rem; }
    body.maths-activity:not(.display-mode) .re-field-label { font-size: 1.05rem; }
    body.maths-activity:not(.display-mode) .re-input { min-height: 52px; font-size: 1.15rem; padding: .35rem .7rem; }
    body.maths-activity:not(.display-mode) .re-add { min-height: 60px; font-size: 1.2rem; }
    body.maths-activity:not(.display-mode) .re-why { font-size: 1rem; }
    body.maths-activity:not(.display-mode) .re-transcript { font-size: 1.1rem; }
    body.maths-activity:not(.display-mode) .re-words-only .re-transcript { font-size: 1.3rem; }
    body.maths-activity:not(.display-mode) .re-pooled-title { font-size: 1.5rem; }
    body.maths-activity:not(.display-mode) .re-table th,
    body.maths-activity:not(.display-mode) .re-table td { font-size: 1.15rem; padding: .55rem .8rem; }
    body.maths-activity:not(.display-mode) .re-chart-wrap { max-width: 900px; }
    body.maths-activity:not(.display-mode) .re-chart { max-height: 300px; }
}

/* The class chart's labels use the shared chart's classes, whose label styling lives in
   field-survey.css and was never in this page: the category name rendered unanchored and
   was covered by its own bar ("All of them" showed as "A"). Same rules as field-survey. */
body.maths-activity:not(.display-mode) .re-chart .fs-chart-label { font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 700; fill: var(--see-ink, #3a2a14); }
body.maths-activity:not(.display-mode) .re-chart .fs-chart-label.end { text-anchor: end; }
body.maths-activity:not(.display-mode) .re-chart .fs-chart-label.start { text-anchor: start; }
body.maths-activity:not(.display-mode) .re-chart .fs-chart-label.muted { fill: var(--maths-ink-muted); font-weight: 600; }
