/* ============================================================
   LEARNING PATHS — /paths/
   Builds on css/style.css, css/tools.css, and css/facilitate.css
   (reuses .tools-header, .fac-section, .fac-btn, .fac-chip).
   Print styles at the bottom render the completion certificate —
   they deliberately override facilitate.css's handout-only print
   rule, which otherwise hides the whole page.
   ============================================================ */

/* ---- Diagnostic ---- */
.diagnostic-card {
    background:
        radial-gradient(80% 120% at 100% 0%, rgba(61, 139, 255, 0.08), transparent 60%),
        var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}

.diagnostic-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
}

.diagnostic-intro h2 {
    margin: 0 0 var(--space-2);
    font-size: var(--text-h3, 24px);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--tracking-snug);
    color: var(--text-primary);
}

.diagnostic-intro p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    max-width: 520px;
}

.diagnostic-progress {
    font-size: 12px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3D8BFF;
    margin-bottom: var(--space-3);
}

.diagnostic-question {
    margin: 0 0 var(--space-4);
    font-size: var(--text-h4, 20px);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
}

.diagnostic-answers {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.diagnostic-answer {
    text-align: left;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md, 10px);
    color: var(--text-primary);
    font: 400 14px/1.5 var(--font-sans);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
}

.diagnostic-answer:hover {
    border-color: #3D8BFF;
    background: rgba(61, 139, 255, 0.08);
}

.diagnostic-result h3 {
    margin: var(--space-2) 0;
    font-size: var(--text-h3, 24px);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
}

.diagnostic-result p {
    margin: 0 0 var(--space-4);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    max-width: 560px;
}

.diagnostic-result-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* ---- Table of contents ---- */
.paths-toc {
    margin-bottom: var(--space-6);
    padding: var(--space-5);
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

.paths-toc:empty {
    display: none;
}

.paths-toc-label {
    font-size: 12px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.paths-toc-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: paths-toc;
}

.paths-toc-item {
    counter-increment: paths-toc;
}

.paths-toc-link {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md, 10px);
    text-decoration: none;
    transition: border-color var(--dur-fast) var(--ease-out),
        background var(--dur-fast) var(--ease-out);
}

.paths-toc-link:hover {
    border-color: #3D8BFF;
    background: rgba(61, 139, 255, 0.08);
}

.paths-toc-link::before {
    content: counter(paths-toc);
    flex: none;
    font-size: 12px;
    font-weight: var(--fw-semibold);
    font-variant-numeric: tabular-nums;
    color: var(--text-tertiary, var(--text-secondary));
}

.paths-toc-title {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: var(--fw-medium);
    color: var(--text-primary);
}

.paths-toc-progress {
    flex: none;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.paths-toc-link.is-complete .paths-toc-progress {
    color: #3dd68c;
    font-weight: var(--fw-medium);
}

@media (max-width: 640px) {
    .paths-toc-list {
        grid-template-columns: 1fr;
    }
}

/* ---- Path cards ---- */
.paths-list {
    display: grid;
    gap: var(--space-6);
}

.path-block {
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--dur-fast) var(--ease-out);
}

.path-block.is-complete {
    border-color: rgba(61, 214, 140, 0.45);
}

.path-block-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-4);
    padding: var(--space-6);
    align-items: start;
}

.path-block-head h3 {
    margin: var(--space-2) 0;
    font-size: var(--text-h3, 24px);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--tracking-snug);
    color: var(--text-primary);
}

.path-promise {
    margin: 0 0 var(--space-3);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    max-width: 640px;
}

.path-audience {
    font-size: 13px;
    color: var(--text-tertiary, var(--text-secondary));
    margin: 0;
}

.path-block-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-3);
    min-width: 220px;
}

.path-progress-wrap {
    width: 100%;
    text-align: right;
}

.path-progress-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}

.path-progress-track {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}

.path-progress-fill {
    height: 100%;
    width: 0%;
    background: #3D8BFF;
    border-radius: 3px;
    transition: width var(--dur-fast) var(--ease-out);
}

.path-block.is-complete .path-progress-fill {
    background: #3dd68c;
}

.path-outcomes {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 0 var(--space-6) var(--space-4);
    margin: 0;
    list-style: none;
}

.path-outcomes li {
    font-size: 12px;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill, 9999px);
    padding: 4px 12px;
}

.path-outcomes li::before {
    content: '✓ ';
    color: #3dd68c;
}

.path-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border-subtle);
}

.path-step-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.path-step-row:last-child {
    border-bottom: none;
}

.path-step-row.is-done .path-step-title {
    text-decoration: line-through;
    color: var(--text-tertiary, var(--text-secondary));
}

.path-step-check {
    width: 18px;
    height: 18px;
    accent-color: #3D8BFF;
    cursor: pointer;
}

/* Shown in the checkbox slot when the learner isn't enrolled (or signed out):
   a plain step number instead of a tick box. */
.path-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: var(--fw-medium);
    color: var(--text-tertiary, var(--text-secondary));
}

/* Enrolment/status pill in the progress slot when there's no live progress bar. */
.path-enroll-pill {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    font-size: 12px;
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Transient save/enrol/error status line above the paths list. */
.paths-status {
    min-height: 1.2em;
    margin: 0 0 var(--space-3);
    font-size: 13px;
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
}

.paths-status[data-kind="success"] { color: #1a7f37; }
.paths-status[data-kind="error"] { color: #c0392b; }

.path-step-title {
    font-size: 14px;
    font-weight: var(--fw-medium);
    color: var(--text-primary);
}

.path-step-title a {
    color: inherit;
    text-decoration: none;
}

.path-step-title a:hover {
    color: #3D8BFF;
}

.path-step-why {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.path-step-open {
    font-size: 13px;
    color: #3D8BFF;
    text-decoration: none;
    white-space: nowrap;
}

.path-step-open:hover {
    text-decoration: underline;
}

.path-block-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: var(--space-4) var(--space-6);
    background: var(--surface-2);
    border-top: 1px solid var(--border-subtle);
}

.path-foot-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

.path-foot-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ---- Sign-in nudge ---- */
.paths-signin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    margin-top: var(--space-7);
    padding: var(--space-6);
    background: var(--surface-1);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
}

.paths-signin h3 {
    margin: 0 0 var(--space-2);
    font-size: 16px;
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
}

.paths-signin p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 560px;
}

/* ---- Certificate ---- */
.cert-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: color-mix(in srgb, var(--bg-base) 70%, transparent);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
    overflow-y: auto;
}

.cert-overlay[hidden] {
    display: none;
}

.cert-frame {
    position: relative;
    max-width: 720px;
    width: 100%;
}

.cert-close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.certificate {
    background: #fdfdfb;
    color: #16181d;
    border: 1px solid #d8d8d2;
    border-radius: 12px;
    padding: 48px 56px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.cert-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
    margin-bottom: 28px;
}

.cert-label {
    font-size: 12px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 24px;
}

.cert-name {
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -0.01em;
    border-bottom: 1px solid #d8d8d2;
    display: inline-block;
    padding: 0 24px 8px;
    margin-bottom: 16px;
    min-width: 260px;
}

.cert-line {
    margin: 0 0 8px;
    font-size: 14px;
    color: #6b7280;
}

.cert-path {
    font-size: 24px;
    font-weight: 600;
    color: #1d4ed8;
    margin-bottom: 12px;
}

.cert-desc {
    max-width: 520px;
    margin: 0 auto 20px;
    font-size: 13px;
    line-height: 1.6;
    color: #4b5563;
}

.cert-outcomes {
    list-style: none;
    margin: 0 auto 28px;
    padding: 0;
    max-width: 480px;
    text-align: left;
    font-size: 13px;
    color: #374151;
}

.cert-outcomes li {
    padding: 4px 0;
}

.cert-outcomes li::before {
    content: '✓ ';
    color: #059669;
    font-weight: 700;
}

.cert-foot {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid #d8d8d2;
    font-size: 11px;
    color: #6b7280;
}

.cert-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
    flex-wrap: wrap;
}

.cert-actions input {
    flex: 1;
    min-width: 220px;
    padding: 10px 14px;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md, 10px);
    color: var(--text-primary);
    font: 400 14px/1.3 var(--font-sans);
}

.cert-actions input:focus {
    outline: none;
    border-color: #3D8BFF;
}

/* ---- Responsive ---- */
@media (max-width: 820px) {
    .diagnostic-intro,
    .paths-signin {
        flex-direction: column;
        align-items: flex-start;
    }

    .path-block-head {
        grid-template-columns: 1fr;
    }

    .path-block-side {
        align-items: flex-start;
    }

    .path-progress-wrap {
        text-align: left;
    }

    .certificate {
        padding: 32px 24px;
    }
}

/* ---- Print: certificate only ----
   facilitate.css (loaded before this file) hides everything except
   .handout when printing; these rules re-show the certificate. */
@media print {
    body > .cert-overlay {
        display: flex !important;
        position: static;
        background: none;
        backdrop-filter: none;
        padding: 0;
    }

    .cert-overlay[hidden] {
        display: none !important;
    }

    .cert-close,
    .cert-actions {
        display: none !important;
    }

    .certificate {
        box-shadow: none;
        border-radius: 0;
        border: 2px solid #16181d;
    }
}
