﻿/* ===========================================
   EQ Ninjas — Activity Map (Stepper Cards)
   Header/home layout mirrors badge page header/settings
   =========================================== */

html, body {
    height: 100%;
    margin: 0;
}

/* Fluid tokens (aligned with badge page) */
:root {
    --ink: #0f172a;
    --body: #475569;
    --bg: #fff;
    --accent: #22c55e;
    --accent-2: #6366f1;
    --shadow: rgba(0,0,0,.10);
    --focus: #60a5fa;

    --gap: clamp(8px, 1.6vmin, 14px);
    --radius: clamp(10px, 1.6vmin, 14px);
    --pad-x: clamp(10px, 2.2vmin, 16px);
    --pad-y: clamp(8px, 1.8vmin, 12px);
    --rail: clamp(4px, .9vmin, 6px);
    --progress-h: clamp(6px, 1vmin, 8px);
    --safe-bottom: calc(env(safe-area-inset-bottom,0px) + clamp(8px, 2vmin, 20px));

    --title: clamp(1rem, 2.2vmin, 1.25rem);
    --sub: clamp(.88rem, 1.8vmin, .98rem);
    --name: clamp(1rem, 2.1vmin, 1.1rem);
    --meta: clamp(.75rem, 1.6vmin, .85rem);
}

/* Page shell */
.am-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background:
      radial-gradient(900px 420px at 10% -10%, #f3f7ff 0%, var(--bg) 60%, var(--bg) 100%),
      linear-gradient(180deg, var(--bg) 0%, #f8fafc 100%);
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;
}

/* HERO (match badge page spacing & logo size) */
.am-hero {
    position: relative;

    display: grid;
    gap: .5rem;
    text-align: center;
    flex-shrink: 0;
}

.am-hero-art {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
      radial-gradient(420px 180px at 85% -60px, rgba(96,165,250,.28), transparent 60%),
      radial-gradient(480px 220px at -20% -120px, rgba(244,114,182,.22), transparent 60%);
}

/* Centered logo row + pinned home button (mirrors badge page) */
.am-hero-top {
    position: relative;              /* anchor for absolute positioning */
    display: flex;
    justify-content: center;         /* center the logo */
    align-items: center;
    z-index: 1;
}

.am-logo {
    width: 80%;
    max-width: 320px;                /* match badge page */
    height: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.20));
}

/* Home/Dojo button pinned top-right within the top row */
.home-button-hero {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    width: clamp(40px, 6vmin, 48px);
    height: clamp(40px, 6vmin, 48px);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,.15);
    transition: transform .15s ease, box-shadow .15s ease;
}
.home-button-hero img {
    width: 62%;
    height: auto;
}
.home-button-hero:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 14px rgba(0,0,0,.18);
}
.home-button-hero:active { transform: scale(.95); }

.am-hero-content {
    position: relative;
    z-index: 1;
}

.am-title {
    margin-top: .25rem; /* tuck closer under logo */
    font-size: clamp(1.1rem, 2.4vmin, 1.3rem);
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,.35);
}

/* Controls below the hero */
.am-controls {
    padding: 0 clamp(14px, 3vmin, 20px) clamp(6px, 1.6vmin, 10px);
    display: grid;
    gap: .5rem;
}

.am-locked-note {
    color: #991b1b;
    background: #fee2e2;
    border-radius: 12px;
    padding: .6rem .8rem;
    font-weight: 700;
}

.am-progress-wrap { display: grid; gap: .35rem; }

.am-progress {
    width: 100%;
    height: var(--progress-h);
    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: var(--accent-2);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(99,102,241,.25);
}

.am-done { color: #065f46; font-weight: 700; }

/* 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: var(--rail) 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); }

/* Status rail colors by state */
.am-rail {
    height: 100%;
    width: var(--rail);
    border-radius: 999px;
    background: #e5e7eb;
}
.am-item.unlocked .am-rail { background: #dbeafe; } /* blue */
.am-item.completed .am-rail { background: #bbf7d0; } /* green */
.am-item.locked .am-rail { background: #e5e7eb; }    /* gray */

/* Content */
.am-content { min-width: 0; }

.am-titleline {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vmin, 12px);
}

.am-name {
    margin: 0;
    font-size: var(--name);
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ▶ play icon for unlocked/in-progress */
.am-play {
    font-size: clamp(1.05rem, 2.4vmin, 1.25rem);
    color: var(--accent-2);
    line-height: 1;
    transform: translateY(1px);
    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;
}

/* 🔒 locked (bottom-right) */
.am-lockbadge {
    position: absolute;
    bottom: 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: #0f172a;
    color: #fff;
    font-size: clamp(.9rem, 2.2vmin, 1rem);
    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 (check/lock) to avoid overlap */
.am-page.am-compact .am-checkcard,
.am-page.am-compact .am-lockbadge {
    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(var(--rail) * .9) 1fr;
}
