﻿/* ===========================================
   EQ Ninjas — Activity Map (Stepper Cards)
   Header/home layout mirrors badge page header/settings
   =========================================== */

.am-progress {
    width: 100%;
    height: clamp(6px, 1vmin, 8px);
    border-radius: 999px;
    overflow: hidden;
    background: #e6eef7;
}
.am-progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width .25s ease;
}
.am-progress-label {
    font-size: var(--meta);
    color: #0f172a;
    opacity: .85;
}

.am-continue {
    justify-self: start;
    padding: .55rem .9rem;
    border-radius: 999px;
    border: 0;
    background: #6366f1;
    color: #fff;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(99,102,241,.25);
}

.am-done { color: #065f46; font-weight: 700; }

.map-page-shell {
    position: relative;
}

/* Printable module resources */
.printable-resources {
    position: absolute;
    right: clamp(12px, 3vw, 20px);
    bottom: calc(62px + env(safe-area-inset-bottom, 0px));
    width: auto;
    margin: 0;
    z-index: 30;
}

.printable-toggle {
    position: relative;
    width: auto;
    min-width: 58px;
    min-height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 10px;
    background: #ffbf00;
    color: #1f2a3d;
    padding: 7px 10px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .2);
    text-align: center;
    cursor: pointer;
}

.printable-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex: 0 0 auto;
}

.printable-fa-icon {
    display: block;
    color: #fff7e6;
    font-size: 2.25rem;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .22));
}

.printable-title,
.printable-resource-kind,
.printable-resource-title,
.printable-resource-description {
    display: block;
}

.printable-title {
    max-width: 74px;
    font-weight: 900;
    font-size: .78rem;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.printable-count {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #10b981;
    color: #fff;
    font-size: .72rem;
    font-weight: 900;
    line-height: 1;
}

.printable-modal-layer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 24px);
}

.printable-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    border-radius: 0;
    background: rgba(15, 23, 42, .42);
    padding: 0;
    cursor: pointer;
}

.printable-modal {
    position: relative;
    z-index: 1;
    width: min(100%, 390px);
    max-height: min(84vh, 620px);
    display: grid;
    gap: 12px;
    overflow: hidden;
    border: 1px solid rgba(92, 111, 139, .16);
    border-radius: 16px;
    background: #fffaf0;
    padding: 14px;
    box-shadow: 0 22px 50px rgba(15, 23, 42, .3);
}

.printable-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.printable-modal-header h2 {
    margin: 0;
    color: #1f2a3d;
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.05;
}

.printable-modal-header p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.15;
}

.printable-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    background: #fef3c7;
    color: #1f2a3d;
    padding: 0;
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.printable-list {
    display: grid;
    gap: 8px;
    overflow: auto;
    padding: 0 2px 16px 0;
}

.printable-resource {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(92, 111, 139, .18);
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    padding: 10px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .1);
}

.printable-resource-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #eef6ff;
    font-size: 2.4rem;
    line-height: 1;
}

.printable-resource-copy {
    min-width: 0;
}

.printable-resource-kind {
    color: #6b7280;
    font-size: .68rem;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
}

.printable-resource-title {
    margin-top: 3px;
    color: #1f2a3d;
    font-size: .9rem;
    font-weight: 900;
    line-height: 1.1;
}

.printable-resource-description {
    margin-top: 3px;
    color: #64748b;
    font-size: .72rem;
    line-height: 1.2;
}

.printable-resource-action {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 12px;
    background: #2d6cdf;
    color: #fff;
    font-size: .84rem;
    font-weight: 900;
    box-shadow: 0 6px 14px rgba(45, 108, 223, .24);
}

.printable-toggle:focus-visible,
.printable-close:focus-visible,
.printable-resource-action:focus-visible {
    outline: 3px solid rgba(45, 108, 223, .35);
    outline-offset: 2px;
}

@media (max-width: 420px) {
    .printable-resources {
        right: 12px;
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    }

    .printable-title {
        display: none;
    }
}

/* List */
.am-list {
    padding: clamp(8px, 1.8vmin, 14px) clamp(12px, 3vmin, 20px) var(--safe-bottom);
    display: grid;
    gap: clamp(8px, 1.6vmin, 12px);
}

/* Stepper card */
.am-item {
    position: relative;
    display: grid;
    grid-template-columns: clamp(4px, .9vmin, 6px) 1fr;
    align-items: center;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 6px 18px var(--shadow);
    padding: var(--pad-y) var(--pad-x);
    gap: var(--gap);
    cursor: pointer;
    outline: none;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, opacity .12s ease;
    min-height: clamp(64px, 12vmin, 84px);
}
.am-item:active { transform: scale(.99); }
.am-item:focus-visible { box-shadow: 0 0 0 3px var(--focus), 0 6px 18px var(--shadow); }
.am-item.locked { opacity: .95; cursor: default; }
.am-item.completed { border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }

/* Content */
.am-content { min-width: 0; padding: 7px; margin: 10px 0 10px 0; }

.map-container.activity-stack {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    gap: clamp(4px, 1.2vh, 10px);
    padding: clamp(8px, 1.8vh, 16px) 0;
}

.map-container.stacked > .activity-map-item {
    box-sizing: border-box;
    position: relative;
    inset: auto;
    margin: 0;
    transform: scale(var(--activity-item-scale, .95));
    width: clamp(116px, 32vw, 136px);
    min-width: clamp(116px, 32vw, 136px);
    height: clamp(48px, 12vw, 58px);
    min-height: clamp(48px, 12vw, 58px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    padding: 0;
    border: 1px solid rgba(245, 180, 34, 0.65);
}

@media (max-height: 720px) {
    .map-container.activity-stack {
        gap: clamp(2px, .7vh, 6px);
        padding: clamp(5px, 1vh, 10px) 0;
    }

    .map-container.stacked > .activity-map-item {
        width: clamp(108px, 31vw, 126px);
        min-width: clamp(108px, 31vw, 126px);
        height: clamp(42px, 10.5vw, 50px);
        min-height: clamp(42px, 10.5vw, 50px);
    }

    .activity-map-item .am-content {
        padding: 4px 10px;
    }

    .activity-map-item .am-name {
        font-size: clamp(.72rem, 3vw, .86rem);
    }

    .am-lockstatus {
        height: 12px;
        font-size: clamp(.58rem, 2.1vw, .66rem);
    }
}

.activity-map-item .am-content {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 0;
    padding: 5px 12px;
}

.am-titleline {
    text-align: center;
    min-width: 120px;
}

.activity-map-item .am-titleline {
    width: 100%;
    min-width: 0;
}

.am-name {
    margin: 0;
    font-size: var(--name);
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-map-item .am-name {
    width: 100%;
    font-size: clamp(.78rem, 3.3vw, .95rem);
    line-height: 1.05;
}

.am-lockstatus {
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: clamp(.62rem, 2.4vw, .72rem);
    line-height: 1;
    color: #475569;
    white-space: nowrap;
}

.am-lockmini {
    width: .85rem;
    font-size: .65rem;
    line-height: 1;
}

/* ▶ play icon for unlocked/in-progress */
.am-play {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(1.35rem, 2.6vmin, 1.45rem);
    color: #6366f1;
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

/* ✓ completed (top-right) */
.am-checkcard {
    position: absolute;
    top: clamp(6px, 1.2vmin, 8px);
    right: clamp(6px, 1.2vmin, 8px);
    width: clamp(22px, 5.2vmin, 28px);
    height: clamp(22px, 5.2vmin, 28px);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    font-weight: 900;
    font-size: clamp(.9rem, 2.2vmin, 1rem);
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
    user-select: none;
    pointer-events: none;
}

/* Pulse the *next* unlocked item */
.am-item.pulse {
    animation: amPulse 1.2s ease-out infinite;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 32%, transparent),
                0 8px 22px rgba(0,0,0,.18);
    transform: translateZ(0);
    border-color: var(--accent);
}

@keyframes amPulse {
    0%   { box-shadow: 0 0 0 0  color-mix(in srgb, var(--accent) 40%, transparent); }
    70%  { box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 0%,  transparent); }
    100% { box-shadow: 0 0 0 0  color-mix(in srgb, var(--accent) 0%,  transparent); }
}

/* Motion reduction */
@media (prefers-reduced-motion: reduce) {
    .am-item { transition: none !important; }
    .am-item.pulse { animation: none !important; }
}

/* ============================
   Density auto-adjustments
   - am-cozy: 6 cards (slight tighten)
   - am-compact: 7+ cards (review present)
   ============================ */

/* COZY (6 cards) */
.am-page.am-cozy .am-logo {
    max-width: 300px;
}

.am-page.am-cozy .am-title {
    font-size: clamp(1rem, 2.1vmin, 1.2rem);
    margin-top: .15rem;
}

.am-page.am-cozy .am-controls {
    padding: 0 clamp(12px, 2.5vmin, 18px) clamp(4px, 1.4vmin, 8px);
}

.am-page.am-cozy .am-list {
    padding: clamp(6px, 1.6vmin, 12px) clamp(10px, 2.5vmin, 18px) var(--safe-bottom);
    gap: clamp(6px, 1.4vmin, 10px);
}

.am-page.am-cozy .am-item {
    --pad-x: clamp(10px, 2vmin, 14px);
    --pad-y: clamp(6px, 1.6vmin, 10px);
    --gap: clamp(6px, 1.6vmin, 10px);
    min-height: clamp(58px, 11vmin, 78px);
}

.am-page.am-cozy .am-name {
    font-size: clamp(.95rem, 2vmin, 1.05rem);
}

/* COMPACT (7 cards — review present) */
.am-page.am-compact .am-logo {
    max-width: 260px; /* tighter hero */
}

.am-page.am-compact .am-title {
    font-size: clamp(.95rem, 2vmin, 1.1rem);
    margin-top: 0;
}

.am-page.am-compact .am-controls {
    padding: 0 clamp(10px, 2.2vmin, 16px) clamp(2px, 1.2vmin, 6px);
}

.am-page.am-compact .am-progress-label {
    font-size: clamp(.7rem, 1.4vmin, .8rem);
}

/* tighter list padding + gaps */
.am-page.am-compact .am-list {
    padding: clamp(4px, 1.2vmin, 10px) clamp(8px, 2.2vmin, 16px) var(--safe-bottom);
    gap: clamp(4px, 1.2vmin, 8px);
}

/* smaller cards with slightly reduced padding */
.am-page.am-compact .am-item {
    --pad-x: clamp(8px, 1.8vmin, 12px);
    --pad-y: clamp(5px, 1.4vmin, 9px);
    --gap: clamp(6px, 1.4vmin, 8px);
    min-height: clamp(52px, 10vmin, 72px);
}

/* name size + icon nudge */
.am-page.am-compact .am-name {
    font-size: clamp(.9rem, 1.9vmin, 1rem);
}

.am-page.am-compact .am-play {
    font-size: clamp(.95rem, 2.1vmin, 1.15rem);
}

/* compact badges to avoid overlap */
.am-page.am-compact .am-checkcard {
    width: clamp(20px, 4.6vmin, 24px);
    height: clamp(20px, 4.6vmin, 24px);
    font-size: clamp(.8rem, 2vmin, .95rem);
}

/* compact rail thickness to reclaim a few pixels */
.am-page.am-compact .am-item {
    grid-template-columns: calc(clamp(4px, .9vmin, 6px) * .9) 1fr;
}
