/*
 * ALTA Cuisenaire Task Library
 * ------------------------------------------------------------
 * BRAND QUICK EDIT:
 * Replace the four --ctl-brand variables below with ALTA's exact
 * corporate hex codes when available. Everything else derives from them.
 */
:root {
    --ctl-brand: #0b7285;
    --ctl-brand-dark: #124559;
    --ctl-accent: #f2b84b;
    --ctl-accent-soft: #fff7df;
    --ctl-ink: #17202a;
    --ctl-muted: #667085;
    --ctl-line: #e4e9ef;
    --ctl-surface: #ffffff;
    --ctl-surface-soft: #f7f9fb;
    --ctl-teacher: #eef7f8;
    --ctl-pupil: #f4f7ff;
    --ctl-reflect: #fff8e8;
    --ctl-radius: 18px;
    --ctl-shadow: 0 14px 36px rgba(20, 40, 60, 0.08);
}

.ctl-page,
.ctl-present-body {
    color: var(--ctl-ink);
    background: #f5f7f9;
}

.ctl-page *,
.ctl-present-body * {
    box-sizing: border-box;
}

.ctl-shell {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 48px 0 72px;
}

.ctl-hero,
.ctl-task-hero {
    margin-bottom: 30px;
}

.ctl-kicker {
    margin: 0 0 8px;
    color: var(--ctl-brand);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.ctl-hero h1,
.ctl-task-hero h1 {
    margin: 0;
    color: var(--ctl-brand-dark);
    font-size: clamp(2.2rem, 5vw, 4.25rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.ctl-lead {
    max-width: 820px;
    margin: 18px 0 0;
    color: var(--ctl-muted);
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    line-height: 1.6;
}

.ctl-library-tools {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 34px 0 24px;
}

.ctl-search {
    flex: 1;
}

.ctl-search input {
    width: 100%;
    min-height: 52px;
    padding: 0 18px;
    border: 1px solid var(--ctl-line);
    border-radius: 14px;
    background: var(--ctl-surface);
    color: var(--ctl-ink);
    font: inherit;
    box-shadow: 0 3px 12px rgba(20, 40, 60, 0.04);
}

.ctl-search input:focus {
    border-color: var(--ctl-brand);
    outline: 3px solid rgba(11, 114, 133, 0.13);
}

.ctl-count {
    margin: 0;
    color: var(--ctl-muted);
    white-space: nowrap;
}

.ctl-task-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.ctl-task-card {
    display: flex;
    min-height: 280px;
    flex-direction: column;
    padding: 24px;
    border: 1px solid var(--ctl-line);
    border-radius: var(--ctl-radius);
    background: var(--ctl-surface);
    box-shadow: 0 6px 24px rgba(20, 40, 60, 0.045);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.ctl-task-card:hover {
    transform: translateY(-3px);
    border-color: rgba(11, 114, 133, 0.4);
    box-shadow: var(--ctl-shadow);
}

.ctl-task-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ctl-task-number {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 12px;
    background: var(--ctl-brand);
    color: white;
    font-weight: 800;
}

.ctl-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.ctl-tags span,
.ctl-duration {
    padding: 6px 9px;
    border-radius: 999px;
    background: var(--ctl-surface-soft);
    color: var(--ctl-muted);
    font-size: 0.73rem;
    font-weight: 700;
}

.ctl-task-card h2 {
    margin: 34px 0 10px;
    color: var(--ctl-brand-dark);
    font-size: 1.45rem;
}

.ctl-task-card p {
    margin: 0;
    color: var(--ctl-muted);
    line-height: 1.6;
}

.ctl-card-link {
    margin-top: auto;
    padding-top: 22px;
    color: var(--ctl-brand);
    font-weight: 800;
    text-decoration: none;
}

.ctl-no-results {
    padding: 32px;
    text-align: center;
    color: var(--ctl-muted);
}

.ctl-backbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
    color: var(--ctl-muted);
    font-size: 0.92rem;
}

.ctl-backbar a {
    color: var(--ctl-brand);
    font-weight: 800;
    text-decoration: none;
}

.ctl-task-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    align-items: end;
}

.ctl-focus-card {
    padding: 20px;
    border: 1px solid rgba(11, 114, 133, 0.16);
    border-radius: 16px;
    background: var(--ctl-teacher);
}

.ctl-focus-card span {
    display: block;
    margin-bottom: 6px;
    color: var(--ctl-brand);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ctl-focus-card strong {
    display: block;
    color: var(--ctl-brand-dark);
    line-height: 1.4;
}

.ctl-task-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.ctl-task-nav {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 16px;
    border: 1px solid var(--ctl-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
}

.ctl-task-nav strong {
    padding: 8px 10px 10px;
    color: var(--ctl-brand-dark);
}

.ctl-task-nav a {
    padding: 8px 10px;
    border-radius: 9px;
    color: var(--ctl-muted);
    font-size: 0.84rem;
    line-height: 1.25;
    text-decoration: none;
}

.ctl-task-nav a:hover {
    background: var(--ctl-surface-soft);
    color: var(--ctl-brand);
}

.ctl-task-content {
    min-width: 0;
}

.ctl-section,
.ctl-rehearse {
    scroll-margin-top: 26px;
    margin-bottom: 22px;
    padding: clamp(22px, 4vw, 34px);
    border: 1px solid var(--ctl-line);
    border-radius: var(--ctl-radius);
    background: var(--ctl-surface);
    box-shadow: 0 5px 20px rgba(20, 40, 60, 0.035);
}

.ctl-section-model {
    border-left: 5px solid var(--ctl-brand);
}

.ctl-section-activity {
    border-left: 5px solid #5b73d5;
}

.ctl-section-reflection,
.ctl-rehearse {
    border-left: 5px solid var(--ctl-accent);
    background: var(--ctl-reflect);
}

.ctl-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.ctl-section-label {
    display: block;
    margin-bottom: 6px;
    color: var(--ctl-muted);
    font-size: 0.71rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ctl-section h2,
.ctl-rehearse h2 {
    margin: 0;
    color: var(--ctl-brand-dark);
    font-size: clamp(1.35rem, 2.5vw, 1.9rem);
    line-height: 1.2;
}

.ctl-prose,
.ctl-student-prompt,
.ctl-teacher-prompts,
.ctl-details,
.ctl-rehearse {
    font-size: 1rem;
    line-height: 1.7;
}

.ctl-prose p:first-child,
.ctl-student-prompt p:first-child {
    margin-top: 0;
}

.ctl-prose li,
.ctl-student-prompt li,
.ctl-teacher-prompts li,
.ctl-present-content li {
    margin-bottom: 0.42em;
}

.ctl-equation,
.ctl-equation-list,
.ctl-equation-grid {
    font-variant-numeric: lining-nums tabular-nums;
}

.ctl-equation {
    display: inline-block;
    padding: 9px 13px;
    border-radius: 9px;
    background: var(--ctl-surface-soft);
    font-size: 1.12em;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.ctl-equation-list li {
    font-size: 1.08em;
    font-weight: 700;
}

.ctl-equation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ctl-equation-grid span {
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--ctl-surface-soft);
    font-weight: 700;
}

.ctl-big-fractions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding-left: 0;
    list-style-position: inside;
}

.ctl-big-fractions li {
    padding: 16px;
    border: 1px solid var(--ctl-line);
    border-radius: 12px;
    background: var(--ctl-surface-soft);
    font-size: 1.3em;
    font-weight: 800;
}

.ctl-activity-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 22px 0 0;
}

.ctl-btn {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border: 1px solid var(--ctl-line);
    border-radius: 10px;
    background: white;
    color: var(--ctl-brand-dark);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.ctl-btn:hover {
    border-color: var(--ctl-brand);
}

.ctl-btn-primary {
    border-color: var(--ctl-brand);
    background: var(--ctl-brand);
    color: white;
}

.ctl-btn-primary:hover {
    background: var(--ctl-brand-dark);
    color: white;
}

.ctl-btn-quiet {
    background: var(--ctl-surface-soft);
}

.ctl-details {
    margin-top: 20px;
    border: 1px solid var(--ctl-line);
    border-radius: 12px;
    background: var(--ctl-surface-soft);
}

.ctl-details summary {
    padding: 13px 15px;
    color: var(--ctl-brand-dark);
    font-weight: 800;
    cursor: pointer;
}

.ctl-details > div {
    padding: 0 15px 15px;
}

.ctl-teacher-prompts {
    margin-top: 20px;
    padding: 18px;
    border-radius: 13px;
    background: var(--ctl-teacher);
}

.ctl-teacher-prompts h3 {
    margin: 0 0 8px;
    color: var(--ctl-brand-dark);
    font-size: 0.92rem;
}

.ctl-teacher-prompts ul {
    margin-bottom: 0;
}

.ctl-rehearse {
    margin-top: 34px;
}

/* ---------------------------
   Standalone Class View
   --------------------------- */
.ctl-present-body {
    min-height: 100vh;
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ctl-present-shell {
    display: flex;
    width: min(1440px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    flex-direction: column;
    padding: clamp(20px, 3vw, 42px);
}

.ctl-present-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 22px;
}

.ctl-present-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ctl-muted);
    font-size: 0.92rem;
}

.ctl-present-brand img {
    width: auto;
    max-width: 140px;
    max-height: 38px;
    object-fit: contain;
}

.ctl-present-brand strong {
    color: var(--ctl-brand-dark);
}

.ctl-present-context {
    color: var(--ctl-muted);
    font-weight: 700;
}

.ctl-present-card {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 6vw, 82px);
    border: 1px solid var(--ctl-line);
    border-radius: 26px;
    background: white;
    box-shadow: var(--ctl-shadow);
}

.ctl-present-card h1 {
    max-width: 1100px;
    margin: 0 0 30px;
    color: var(--ctl-brand-dark);
    font-size: clamp(2.4rem, 6vw, 5.8rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.ctl-present-content {
    max-width: 1150px;
    font-size: clamp(1.05rem, 1.55vw, 1.6rem);
    line-height: 1.45;
}

.ctl-present-content p {
    margin: 0.65em 0;
}

.ctl-present-content ol,
.ctl-present-content ul {
    padding-left: 1.25em;
}

.ctl-present-content .ctl-equation-list,
.ctl-present-content .ctl-big-fractions {
    font-size: 1.08em;
}

.ctl-present-answers {
    margin-top: 34px;
    padding: 24px;
    border: 2px solid var(--ctl-accent);
    border-radius: 18px;
    background: var(--ctl-accent-soft);
    font-size: clamp(1.15rem, 2vw, 1.8rem);
}

.ctl-present-answers h2 {
    margin-top: 0;
    color: var(--ctl-brand-dark);
}

.ctl-present-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding-top: 18px;
}

.ctl-present-controls .ctl-btn {
    min-height: 48px;
    padding: 0 19px;
}

.ctl-copy-success {
    border-color: #2f855a !important;
    color: #2f855a !important;
}

@media (max-width: 980px) {
    .ctl-task-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ctl-task-hero {
        grid-template-columns: 1fr;
    }

    .ctl-focus-card {
        max-width: 560px;
    }

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

    .ctl-task-nav {
        position: static;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .ctl-task-nav strong,
    .ctl-task-nav a {
        display: inline-block;
    }
}

@media (max-width: 680px) {
    .ctl-shell {
        width: min(100% - 24px, 1180px);
        padding-top: 28px;
    }

    .ctl-task-grid {
        grid-template-columns: 1fr;
    }

    .ctl-library-tools,
    .ctl-backbar,
    .ctl-present-header {
        align-items: stretch;
        flex-direction: column;
    }

    .ctl-task-card {
        min-height: 230px;
    }

    .ctl-equation-grid,
    .ctl-big-fractions {
        grid-template-columns: 1fr 1fr;
    }

    .ctl-present-shell {
        padding: 14px;
    }

    .ctl-present-card {
        padding: 24px 20px;
        border-radius: 18px;
    }
}

@media print {
    .ctl-task-nav,
    .ctl-backbar,
    .ctl-activity-actions,
    .ctl-present-controls,
    header.header,
    footer.site-footer {
        display: none !important;
    }

    .ctl-page,
    .ctl-present-body {
        background: white;
    }

    .ctl-section,
    .ctl-task-card,
    .ctl-present-card {
        break-inside: avoid;
        box-shadow: none;
    }
}

/* Interactive relationship table ---------------------------------------- */
.ctl-table-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin: 18px 0 14px;
}

.ctl-table-controls span {
    color: var(--ctl-muted);
    font-size: 0.92em;
}

.ctl-table-wrap {
    overflow-x: auto;
    margin: 12px 0 18px;
    border: 1px solid var(--ctl-line);
    border-radius: 16px;
    background: var(--ctl-surface);
}

.ctl-reveal-table {
    width: 100%;
    min-width: 650px;
    margin: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

.ctl-reveal-table th,
.ctl-reveal-table td {
    padding: 0;
    border-right: 1px solid var(--ctl-line);
    border-bottom: 1px solid var(--ctl-line);
    text-align: center;
}

.ctl-reveal-table tr:last-child th,
.ctl-reveal-table tr:last-child td {
    border-bottom: 0;
}

.ctl-reveal-table th:last-child,
.ctl-reveal-table td:last-child {
    border-right: 0;
}

.ctl-reveal-table thead th {
    padding: 14px 8px;
    background: var(--ctl-teacher);
    color: var(--ctl-brand-dark);
    font-size: 1.02em;
    font-weight: 800;
}

.ctl-reveal-table tbody th {
    padding: 14px 10px;
    background: var(--ctl-surface-soft);
    color: var(--ctl-brand-dark);
    font-weight: 800;
    white-space: nowrap;
}

.ctl-reveal-cell {
    width: 100%;
    min-height: 72px;
    padding: 12px 6px;
    border: 0;
    background: transparent;
    color: var(--ctl-muted);
    font: inherit;
    font-size: 1.08em;
    font-weight: 800;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background 150ms ease, color 150ms ease;
}

.ctl-reveal-cell:hover,
.ctl-reveal-cell:focus-visible {
    background: var(--ctl-teacher);
    outline: none;
}

.ctl-reveal-cell.is-revealed {
    background: var(--ctl-accent-soft);
    color: var(--ctl-brand-dark);
}

.ctl-present-content .ctl-table-controls {
    margin-top: 12px;
}

.ctl-present-content .ctl-reveal-table {
    font-size: 0.78em;
}

.ctl-present-content .ctl-reveal-cell {
    min-height: 58px;
}

@media (max-width: 760px) {
    .ctl-reveal-table {
        min-width: 590px;
    }

    .ctl-reveal-cell {
        min-height: 60px;
    }

    .ctl-table-controls {
        align-items: flex-start;
        flex-direction: column;
    }
}
