/* ─────────────────────────────────────────────────────────────
   Paper Aviation — demo module (shared GWT HTML engine)
   Mobile-first. Desktop overrides under min-width breakpoints.

   The token names below are accent slots (--brand-purple* etc.) whose VALUES
   carry the Paper Aviation palette (dusty blue → cyan → pale green), so
   redefining them here reskins the whole module at once. This is the engine's
   single reskin point — swap these values to rebrand a build.
───────────────────────────────────────────────────────────── */

:root {
    /* Paper Aviation dusty blue — primary accent */
    --brand-purple: #5c87a8;   /* primary */
    --brand-cyan:   #93b8d6;   /* mid accent */
    --brand-green:  #c3dae9;   /* pale tint */
    --brand-ink:    #221F1F;

    /* Derivatives */
    --brand-purple-dark: #4a7090;
    --brand-purple-deep: #3d5f7a;  /* headings / hero text */
    --brand-purple-soft: #e3edf4;  /* pill / tint backgrounds */
    --brand-purple-tint: #f1f6f9;  /* subtle callout backgrounds */

    /* Neutrals */
    --ink:       #221F1F;
    --ink-soft:  #4b5563;
    --muted:     #6b7280;
    --mute-soft: #6b7280;   /* was #9ca3af (2.5:1, failed WCAG AA); darkened for the locked cheat-sheet label */
    --line:      #e5e7eb;
    --line-soft: #f3f4f6;
    --surface:   #ffffff;
    --canvas:    #f4f5f7;
    --canvas-2:  #f9fafb;

    /* Status */
    --success:      #15803d;   /* was #16a34a (3.3:1); darkened to pass WCAG AA as text */
    --success-soft: #dcfce7;
    --danger:       #dc2626;
    --danger-soft:  #fee2e2;
    --warn:         #b45309;   /* was #d97706 (3.2:1); darkened to pass WCAG AA as text */
    --warn-soft:    #fef3c7;

    /* Brand gradients */
    /* Full logo gradient (purple → cyan → green) — used for thin accents/progress bars only */
    --brand-gradient: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-cyan) 55%, var(--brand-green) 100%);
    --brand-gradient-soft: linear-gradient(135deg, #e3edf4 0%, #dbe7f0 55%, #eef4f8 100%);
    /* Hero gradient — deep dusty blue holding, then a lighter corner */
    --brand-gradient-hero: linear-gradient(135deg, #3d5f7a 0%, #3d5f7a 60%, #5c87a8 82%, #93b8d6 100%);

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 30px rgba(0,0,0,0.10);

    /* Radius */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-xl: 24px;

    /* Typography scale — mobile-first, scales up on larger screens */
    --step-0: 1rem;
    --step-1: 1.125rem;
    --step-2: 1.25rem;
    --step-3: 1.5rem;
    --step-4: 1.875rem;
    --step-5: 2.25rem;
}

* { box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--canvas);
    color: var(--ink);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; color: var(--ink); }
h1 { font-size: var(--step-4); font-weight: 700; }
h2 { font-size: var(--step-3); font-weight: 700; }
h3 { font-size: var(--step-2); font-weight: 600; }
h4 { font-size: var(--step-1); font-weight: 600; }
p  { margin: 0 0 1em; }

a { color: var(--brand-purple-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; display: block; }

/* ─── Top Bar ───────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    min-height: 52px;
}
.topbar-logo {
    display: flex; align-items: center; gap: 10px;
    color: var(--ink); text-decoration: none;
    justify-self: center;
}
.topbar-logo img { height: 26px; width: auto; }
.topbar-logo-text {
    font-size: 0.72rem; font-weight: 600;
    color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px;
    display: none;
}
.topbar-back {
    color: var(--muted); font-size: 0.85rem; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-radius: var(--r-sm);
    transition: background 0.15s;
    justify-self: start;
    white-space: nowrap;
}
.topbar-back:hover { background: var(--canvas-2); text-decoration: none; color: var(--ink); }
.topbar-back .topbar-text { display: none; }

/* Clean line arrows for all nav (topbar back + bottom prev/next) */
.nav-arrow { width: 18px; height: 18px; flex-shrink: 0; display: block; }

@media (min-width: 640px) {
    .topbar { padding: 10px 16px; }
    .topbar-logo img { height: 28px; }
    .topbar-logo-text { display: inline; }
    .topbar-back .topbar-text { display: inline; }
}

/* ─── Layout Container ──────────────────────────────────── */
.module-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px 120px;
}

.module-shell > header {
    margin-bottom: 24px;
}

.eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--brand-purple-deep);
    background: var(--brand-purple-soft);
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 12px;
}

/* Compact section marker for card-carousel pages */
.section-marker {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    color: var(--brand-purple-deep);
    background: var(--brand-purple-soft);
    padding: 6px 14px;
    border-radius: 100px;
    margin: 0 0 18px;
    line-height: 1.4;
}
.section-marker strong {
    color: var(--ink);
    font-weight: 700;
    margin-left: 2px;
}

/* ─── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px 18px;
    box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card h3:first-child, .card h2:first-child { margin-top: 0; }

.card.brand-bar {
    position: relative;
    overflow: hidden;
}
.card.brand-bar::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0;
    height: 4px; background: var(--brand-gradient);
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
    appearance: none;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s, border-color 0.15s;
    text-decoration: none;
    min-height: 44px; /* touch target */
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--brand-purple);
    color: #fff;
    border-color: var(--brand-purple);
}
.btn-primary:hover { background: var(--brand-purple-dark); text-decoration: none; color: #fff; }

.btn-ghost {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
}
.btn-ghost:hover { background: var(--canvas-2); text-decoration: none; color: var(--ink); }

.btn-block { width: 100%; }

/* ─── Progress Bar ──────────────────────────────────────── */
.progress {
    height: 6px;
    background: var(--line-soft);
    border-radius: 100px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--brand-gradient);
    transition: width 0.4s ease;
}

/* ─── Hero Block (for onboarding-style pages) ───────────── */
.hero {
    background: var(--brand-gradient-hero);
    color: #fff;
    border-radius: var(--r-xl);
    padding: 36px 22px 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.hero h1 {
    color: #fff;
    font-size: var(--step-4);
    margin-bottom: 10px;
}
.hero p { color: rgba(255,255,255,0.92); margin-bottom: 0; }
.hero .eyebrow {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

/* ─── Section Launcher Cards (index.html) ───────────────── */
.section-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.section-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px 16px 18px;
    text-decoration: none;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    position: relative;
    overflow: hidden;
}
.section-card:hover {
    border-color: var(--brand-purple);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: var(--ink);
}
.section-card-num {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
}
.section-card h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--ink);
}
.section-card p {
    margin: 0;
    font-size: 0.92rem;
    color: var(--ink-soft);
    line-height: 1.5;
}
.section-card-meta {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--muted);
}
.section-card.completed .section-card-num::after {
    content: "  ✓ Complete";
    color: var(--success);
}

/* ─── Callouts ──────────────────────────────────────────── */
.callout {
    border-radius: var(--r-md);
    padding: 14px 16px;
    border-left: 4px solid var(--brand-purple);
    background: var(--brand-purple-tint);
    margin: 16px 0;
}
.callout h4 { margin: 0 0 6px; color: var(--brand-purple-deep); font-size: 0.95rem; }
.callout p:last-child { margin-bottom: 0; }

.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.warn h4 { color: var(--warn); }

.callout.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.callout.danger h4 { color: var(--danger); }

.callout.success { border-left-color: var(--success); background: var(--success-soft); }
.callout.success h4 { color: var(--success); }

/* ─── Numbered Reminder List ────────────────────────────── */
ol.reminders {
    list-style: none; padding: 0; margin: 0;
    counter-reset: reminders;
}
ol.reminders li {
    position: relative;
    padding: 12px 12px 12px 48px;
    background: var(--canvas-2);
    border-radius: var(--r-md);
    margin-bottom: 8px;
    counter-increment: reminders;
    font-size: 0.95rem;
    color: var(--ink-soft);
    line-height: 1.5;
}
ol.reminders li::before {
    content: counter(reminders);
    position: absolute;
    left: 12px; top: 50%; transform: translateY(-50%);
    width: 26px; height: 26px;
    background: var(--brand-purple);
    color: #fff;
    font-size: 0.8rem; font-weight: 700;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
ol.reminders li strong { color: var(--ink); }

/* ─── Bottom Nav (prev/next) ────────────────────────────── */
.page-nav {
    display: flex; gap: 10px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.page-nav .btn { flex: 1; }

/* ─── Persistent Part Nav (fixed bottom, full-width) ──── */
.part-nav-wrap {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-top: 1px solid var(--line);
}
/* Reserve space at the bottom of the page so fixed nav doesn't cover content */
body:has(.part-nav-wrap) { padding-bottom: 78px; }
.part-nav {
    max-width: 960px;
    margin: 0 auto;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.part-nav-audio { display: flex; align-items: center; min-width: 0; }
.part-nav-buttons { display: flex; align-items: center; gap: 8px; }
.part-nav a, .part-nav button, .part-nav span.disabled {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 12px;
    border-radius: var(--r-md);
    border: 0;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    min-height: 40px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.part-nav button:focus { outline: none; }
.part-nav button:focus-visible { outline: 2px solid var(--brand-purple); outline-offset: 2px; }
.part-nav-prev {
    background: var(--canvas-2);
    color: var(--ink-soft);
}
.part-nav-prev:hover { background: var(--line-soft); text-decoration: none; color: var(--ink); }
.part-nav-next {
    background: var(--brand-purple);
    color: #fff;
}
.part-nav-next:hover { background: var(--brand-purple-dark); text-decoration: none; color: #fff; }
/* Gated: clearly inactive (gray) but still clickable so it surfaces the "finish this step" toast. */
.part-nav-next.is-gated, .part-nav-next.is-gated:hover { background: #d1d5db; color: #9ca3af; cursor: not-allowed; box-shadow: none; }
.part-nav span.disabled {
    background: transparent;
    color: var(--mute-soft);
    cursor: not-allowed;
}

/* On mobile, keep only arrows visible in the side buttons */
.part-nav-text { display: none; }
@media (min-width: 640px) {
    .part-nav-text { display: inline; }
    .part-nav a, .part-nav button, .part-nav span.disabled { padding: 9px 14px; }
}

/* Part dots (progress through parts) */
.part-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 4px;
}
.part-dots span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--line);
}
.part-dots span.done { background: var(--brand-purple-soft); }
.part-dots span.current {
    background: var(--brand-purple);
    width: 20px;
    border-radius: 100px;
}

@media (min-width: 768px) {
    .part-nav { padding: 12px 24px; }
}


/* ─── Topbar cheat-sheet link (conditional) ────────────── */
.topbar-cheat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--r-md);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--mute-soft);
    background: var(--canvas-2);
    border: 1px solid var(--line);
    pointer-events: none;
    cursor: not-allowed;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    justify-self: end;
    white-space: nowrap;
}
.topbar-cheat svg { width: 15px; height: 15px; flex-shrink: 0; }
.topbar-cheat .topbar-cheat-text { display: none; }
@media (min-width: 640px) {
    .topbar-cheat { padding: 6px 12px; }
    .topbar-cheat .topbar-cheat-text { display: inline; }
}
body.cheat-unlocked .topbar-cheat {
    color: var(--brand-purple-deep);
    background: var(--brand-purple-tint);
    border-color: var(--brand-purple-soft);
    pointer-events: auto;
    cursor: pointer;
}
body.cheat-unlocked .topbar-cheat:hover {
    background: var(--brand-purple-soft);
    text-decoration: none;
}

/* Hide the cheat-sheet link on the cheat sheet itself */
body.is-cheat-sheet .topbar-cheat { display: none; }

/* ─── Lightbox overlay (click any photo to view full-size) ── */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 6, 18, 0.88);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    opacity: 0;
    cursor: zoom-out;
    transition: opacity 0.18s ease-out;
}
.lightbox-overlay.open { opacity: 1; }
.lightbox-overlay img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    cursor: default;
    user-select: none;
}
.lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.28);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.lightbox-close:hover {
    background: rgba(255,255,255,0.24);
}
.lightbox-trigger { cursor: zoom-in; }

/* ─── Card Deck (carousel of focused topic cards) ───────── */
.card-deck { position: relative; }
.card-slide {
    display: none;
}
.card-slide.active {
    display: block;
    animation: cardFade 0.22s ease;
}
@keyframes cardFade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.card-slide > h2:first-child { margin-top: 0; }

/* ─── Work Type Blocks (section 2 plain language) ───────── */
.work-block {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 18px;
    margin-bottom: 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}
.work-visual {
    background: var(--brand-purple-tint);
    border-radius: var(--r-md);
    aspect-ratio: 5 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
/* SVG illustrations keep a little breathing room; photos fill edge-to-edge */
.work-visual svg {
    width: 100%;
    height: 100%;
    display: block;
    padding: 12px;
    box-sizing: border-box;
}
.work-visual picture,
.work-visual img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.work-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
}
.work-body h3 {
    margin: 0 0 8px;
    font-size: 1.12rem;
    color: var(--ink);
}
.work-what {
    margin: 0 0 12px;
    font-size: 0.94rem;
    color: var(--ink-soft);
    line-height: 1.5;
}
.work-script {
    background: var(--brand-purple-tint);
    border-radius: var(--r-md);
    padding: 12px 14px 14px;
    border-left: 3px solid var(--brand-purple);
}
.work-script-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--brand-purple-deep);
    margin-bottom: 6px;
}
.work-script p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.55;
    font-style: italic;
}
@media (min-width: 640px) {
    .work-block {
        grid-template-columns: 180px 1fr;
        align-items: center;
        padding: 22px;
        gap: 22px;
    }
    .work-visual { aspect-ratio: 1 / 1; }
}
@media (min-width: 1024px) {
    .work-block { grid-template-columns: 220px 1fr; }
}

/* ─── Scenario one-per-screen ──────────────────────────── */
.scenario-runner {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px 20px 24px;
    margin: 16px 0 20px;
}
.scenario-topline {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.scenario-counter {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--brand-purple-deep);
    background: var(--brand-purple-soft);
    padding: 4px 12px;
    border-radius: 100px;
}
.scenario-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--line-soft);
    border-radius: 100px;
    overflow: hidden;
}
.scenario-progress-fill {
    height: 100%;
    background: var(--brand-gradient);
    transition: width 0.35s ease;
}
.scenario-title {
    margin: 0 0 6px;
    font-size: 1.1rem;
    color: var(--ink);
}
.scenario-setup {
    font-size: 0.9rem;
    color: var(--ink-soft);
    margin: 0 0 10px;
}
.scenario-prompt {
    background: var(--canvas-2);
    border-left: 3px solid var(--brand-cyan);
    border-radius: 8px;
    padding: 12px 14px;
    font-style: italic;
    color: var(--ink);
    margin-bottom: 16px;
    position: relative;
}
.scenario-prompt::before {
    content: "👤";
    font-style: normal;
    margin-right: 6px;
}
.scenario-options { display: flex; flex-direction: column; gap: 10px; }
.scenario-option {
    appearance: none;
    font-family: inherit;
    text-align: left;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    padding: 13px 15px;
    font-size: 0.95rem;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    line-height: 1.5;
}
.scenario-option:hover { border-color: var(--brand-purple); background: var(--brand-purple-tint); }
.scenario-option:focus-visible { outline: 2px solid var(--brand-purple-deep); outline-offset: 2px; }
.scenario-option.correct { border-color: var(--success); background: var(--success-soft); }
.scenario-option.incorrect { border-color: var(--danger); background: var(--danger-soft); }
.scenario-feedback {
    display: none;
    margin-top: 14px;
    padding: 13px 15px;
    border-radius: var(--r-md);
    font-size: 0.93rem;
    line-height: 1.55;
}
.scenario-feedback.show { display: block; }
.scenario-feedback.best {
    background: var(--success-soft);
    color: #065f46;
    border-left: 3px solid var(--success);
}
.scenario-feedback.not-best {
    background: var(--warn-soft);
    color: #78350f;
    border-left: 3px solid var(--warn);
}
.scenario-feedback strong { font-weight: 700; }
.scenario-next-row {
    display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 16px;
}
.scenario-next-row .btn-ghost { margin-right: auto; }

.scenario-complete {
    background: linear-gradient(135deg, var(--success-soft), #fff);
    border: 1px solid var(--success);
    border-radius: var(--r-lg);
    padding: 22px;
    text-align: center;
    margin: 16px 0 20px;
}
.scenario-complete h3 { color: var(--success); margin: 0 0 6px; }
.scenario-complete p { margin: 0 0 14px; color: var(--ink-soft); }

/* ─── Utility ───────────────────────────────────────────── */
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.stack-lg > * + * { margin-top: 24px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

/* ─── Desktop scaling ───────────────────────────────────── */
@media (min-width: 768px) {
    html { font-size: 17px; }
    :root {
        --step-4: 2.25rem;
        --step-5: 2.75rem;
    }
    .module-shell { padding: 32px 24px 120px; }
    .topbar { padding: 12px 24px; }
    .section-grid { grid-template-columns: repeat(3, 1fr); }
    .hero { padding: 56px 44px 48px; }
    .card { padding: 28px 26px; }
}

/* ─── Print (Cheat Sheet) ───────────────────────────────── */
@media print {
    .topbar, .page-nav, .rv-toggle, .rv-panel, .rv-popup, .rv-gate { display: none !important; }
    body { background: #fff; }
    .module-shell { max-width: 100%; padding: 0; }
    .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
    .hero { background: #fff; color: var(--ink); border: 1px solid var(--line); }
    .hero h1, .hero p { color: var(--ink); }
}

/* ─── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
}

/* Visually hidden but available to screen readers (skip-target h1s, etc.) */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* ─── Listen-along narration (narration.js) ───────────────────────────────── */
/* Section label + progress dots in the top bar (replaces the logo on deck pages) */
.topbar.has-progress .topbar-logo { display: none; }
.topbar.has-progress .topbar-back { grid-column: 1; grid-row: 1; }
.topbar.has-progress .topbar-cheat { grid-column: 3; grid-row: 1; }
.topbar-progress {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.topbar-section {
    font-size: 0.8rem; font-weight: 700; color: var(--ink);
    max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    line-height: 1.2;
}
/* Title collapses to its short form ("Module 8") when the full label can't fit. */
.topbar-section .ts-short { display: none; }
@media (max-width: 760px) {
    .topbar-section .ts-full { display: none; }
    .topbar-section .ts-short { display: inline; }
}
.topbar-progress .part-dots { margin: 0; }

/* Adaptive progress: dots when they fit, a continuous fill bar + counter when they don't
   (toggled by .use-bar, which shared.js sets when the dot row would overflow). */
.part-prog { display: none; align-items: center; width: clamp(130px, 38vw, 280px); }
.topbar-progress.use-bar .part-dots { display: none; }
.topbar-progress.use-bar .part-prog { display: flex; }
.part-track { flex: 1; min-width: 60px; height: 5px; background: var(--line); border-radius: 999px; overflow: hidden; }
.part-track > i { display: block; height: 100%; width: 0; background: var(--brand-gradient); border-radius: 999px; transition: width .25s ease; }

/* Gate pulse — briefly rings a gate we won't auto-satisfy (unstarted video, unanswered
   question) so it's obvious what to do. Applied by shared.js gatePulse(). */
@keyframes gatePulse {
    0%   { box-shadow: 0 0 0 0 rgba(92, 135, 168, 0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(92, 135, 168, 0); }
    100% { box-shadow: 0 0 0 0 rgba(92, 135, 168, 0); }
}
.gate-pulse { animation: gatePulse 1.15s ease-out 2; border-radius: var(--r-lg); }
@media (prefers-reduced-motion: reduce) {
    .gate-pulse { animation: none; box-shadow: 0 0 0 3px rgba(92, 135, 168, 0.55); }
}

/* "More below" cue — a bobbing chevron that appears when a card runs past the fold and
   fades as the learner nears the end. Non-interactive; native scroll/swipe does the work. */
.scroll-cue {
    position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.94); color: var(--brand-purple-deep);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
    opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 40;
}
.scroll-cue.show { opacity: 1; }
.scroll-cue .cue-chev { display: flex; animation: scrollCueBob 1.5s ease-in-out infinite; }
@keyframes scrollCueBob { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .scroll-cue .cue-chev { animation: none; } }

/* Audio transport — bottom-left cluster (media icons), distinct from the page nav */
.nb-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nb-controls.is-disabled { opacity: 0.38; pointer-events: none; }
.nb-controls .nb-btn,
.nb-controls .nb-play {
    flex: 0 0 auto;
    border: none;
    background: var(--brand-purple-tint);
    color: var(--brand-purple-deep);
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    line-height: 1; padding: 0;
    min-height: 0;   /* override the generic .part-nav button min-height:40px that squished these */
    box-sizing: border-box;
}
.nb-controls .nb-btn { width: 44px; height: 44px; }   /* 44px min tap target (WCAG 2.5.5) */
.nb-controls .nb-play { width: 48px; height: 48px; background: var(--brand-purple); color: #fff; }
.nb-controls .nb-btn:hover { background: var(--brand-purple); color: #fff; }
.nb-controls .nb-btn:focus-visible,
.nb-controls .nb-play:focus-visible {
    outline: 2px solid var(--brand-purple-deep);
    outline-offset: 2px;
}
.nb-controls .nb-speed {
    width: 44px; height: 44px; min-width: 0; padding: 0;
    border-radius: 50%; font-size: 0.72rem; font-weight: 700; margin-left: 2px;
    background: #e5e7eb; color: #4b5563;   /* gray — distinct from the blue skip/play buttons */
}
.nb-controls .nb-speed:hover { background: #d1d5db; color: #1f2937; }
.nb-controls .nb-time { display: none; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }
@media (min-width: 640px) {
    .nb-controls { gap: 8px; }
    .nb-controls .nb-time { display: inline; }
}

/* Sentence highlight — brand cyan (from the purple→cyan→green gradient). Stays
   visible on white, on purple-tint callouts, and on the solid-purple bubbles,
   where a purple highlight would disappear. */
.nsent { cursor: pointer; border-radius: 3px; transition: background 0.15s ease, color 0.15s ease; }
.nsent:focus-visible { outline: 2px solid var(--brand-purple); outline-offset: 2px; }
.nsent.is-active {
    background: #52cdec;
    color: #0b2733;
    border-radius: 0;
    /* A sentence is several inline spans (split by <strong>/punctuation). Square,
       flush backgrounds read as one continuous bar. (No box-shadow — it used to
       bleed cyan over the neighbouring span's last glyph; no rounding — it left
       faint seams at each internal span boundary.) */
}
@media (hover: hover) {
    .nsent:hover { background: rgba(92, 135, 168, 0.14); }
    .nsent.is-active:hover { background: #52cdec; }
}

/* Video-paired lines — delivered by the clip; tap to play (not TTS-narrated). */
.nvideo { cursor: pointer; }
.nvideo::before {
    content: "▶";
    font-size: 0.66em;
    margin-right: 7px;
    vertical-align: middle;
    opacity: 0.85;
}
.nvideo:hover { box-shadow: 0 0 0 2px var(--brand-cyan); }
.nvideo:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }
/* The caption/bubble whose clip is playing in sequence during listen-along */
.nvideo.is-playing { box-shadow: 0 0 0 3px var(--brand-cyan); border-radius: 6px; }
.nvideo.is-playing::before { content: "⏸"; }

/* First-load "prefer to listen?" coachmark (points at the play button) */
.nb-coach {
    position: fixed;
    z-index: 110;
    background: var(--brand-purple-deep);
    color: #fff;
    padding: 13px 15px 14px;
    border-radius: 12px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28);
}
.nb-coach p { margin: 0 0 11px; font-size: 0.9rem; line-height: 1.45; }
.nb-coach-ok {
    border: none; cursor: pointer;
    background: #fff; color: var(--brand-purple-deep);
    font-weight: 700; font-size: 0.82rem;
    padding: 6px 16px; border-radius: 999px;
}
.nb-coach-arrow {
    position: absolute; top: -6px;
    width: 13px; height: 13px;
    background: var(--brand-purple-deep);
    transform: rotate(45deg); border-radius: 2px;
}
@keyframes nb-pulse-anim {
    0%, 100% { box-shadow: 0 0 0 0 rgba(92, 135, 168, 0.6); }
    50%      { box-shadow: 0 0 0 10px rgba(92, 135, 168, 0); }
}
.nb-pulse { animation: nb-pulse-anim 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .nb-pulse { animation: none; } }

/* "Finish this step first" gate toast (sits just above the bottom nav) */
.part-gate-toast {
    position: fixed;
    left: 50%;
    bottom: 76px;
    transform: translate(-50%, 8px);
    z-index: 70;
    max-width: calc(100% - 32px);
    padding: 9px 16px;
    background: var(--ink);
    color: #fff;
    font-size: 0.86rem;
    font-weight: 600;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.part-gate-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Tap-to-hear feedback (scenario feedback + spot-the-mistakes reveals) */
.nclip { cursor: pointer; }
.nclip::after {
    content: "🔊 Tap to hear";
    display: inline-block; margin-left: 8px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px;
    color: var(--brand-purple-deep); vertical-align: middle; white-space: nowrap;
}
.nclip-playing::after { content: "🔊 Playing — tap to pause"; }
.nclip-playing { box-shadow: 0 0 0 2px var(--brand-cyan); }
