/* Recent activity on the Badge (ActivityTile.razor): a tile with the last few lines, and a sheet with the whole feed.
   Still sprites only, and motion is transform and opacity, once. */

/* ---------- Where it sits on the dashboard ---------- */
/* After the Hall of Fame (same order, later in the page), before My creations */
.hq-tile.is-activity { order: 6; }

/* Phones: two across. With the Monthly tile there are 7 half tiles, so this is the 8th; without it, it takes the row. */
.hq-grid:not(:has(> .is-monthly)) > .hq-tile.is-activity {
    grid-column: 1 / -1;
}

/* Desktop: three across, Challenges taking two. Whatever else is there, it takes what's left of the last row. */
@media (min-width: 900px) {
    .hq-grid > .hq-tile.is-activity,
    .hq-grid:not(:has(> .is-monthly)) > .hq-tile.is-activity {
        grid-column: 1 / -1;
    }

    .hq-grid:has(> .is-monthly):has(> .is-creations) > .hq-tile.is-activity {
        grid-column: span 2;
    }

    .hq-grid:not(:has(> .is-monthly)):not(:has(> .is-creations)) > .hq-tile.is-activity {
        grid-column: auto;
    }
}

/* ---------- The tile ---------- */
.act-peek-row,
.act-row {
    --tone: var(--sc-primary);
}

:is(.act-peek-row, .act-row).is-good { --tone: var(--sc-success); }
:is(.act-peek-row, .act-row).is-bad { --tone: var(--sc-danger); }
:is(.act-peek-row, .act-row).is-gold { --tone: var(--sc-gold); }
:is(.act-peek-row, .act-row).is-social { --tone: #7aa7ff; }

.hq-tile.is-activity .hq-tile-label {
    padding-right: 14px;
}

.hq-tile.is-activity .hq-tile-body {
    align-items: stretch;
}

.act-peek {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-width: 0;
}

.act-peek-row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.25;
}

.act-peek-icon {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--tone) 20%, transparent);
    color: var(--tone);
    font-size: 11px;
}

.act-peek-text {
    overflow: hidden;
    color: var(--sc-text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.act-peek-row.is-new .act-peek-text {
    color: var(--sc-text);
    font-weight: 600;
}

.act-peek-row time {
    color: var(--sc-text-faint);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.act-peek.is-loading .act-peek-row {
    height: 14px;
    border-radius: var(--sc-radius-pill);
    background: var(--sc-surface-3);
    opacity: 0.5;
}

.act-peek.is-loading .act-peek-row:nth-child(2) { width: 85%; }
.act-peek.is-loading .act-peek-row:nth-child(3) { width: 65%; }

.act-peek-empty {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    color: var(--sc-text-muted);
    font-size: 12px;
    line-height: 1.3;
}

.act-peek-empty ion-icon {
    flex: none;
    color: var(--tile);
    font-size: 26px;
    opacity: 0.7;
}

/* Something new since the feed was last opened: a quiet dot, not a count */
.act-new-dot {
    position: absolute;
    top: 13px;
    right: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tile);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tile) 25%, transparent);
    animation: act-dot 0.4s var(--sc-ease-spring) both;
}

@keyframes act-dot {
    from { transform: scale(0); }
}

/* Wider on desktop when it spans the row: room for a bigger line */
@media (min-width: 900px) {
    .act-peek-row {
        grid-template-columns: 24px minmax(0, 1fr) auto;
        gap: 8px;
        font-size: 14px;
    }

    .act-peek-icon {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }

    .act-peek-row time {
        font-size: 12px;
    }

    .act-new-dot {
        top: 17px;
        right: 16px;
    }
}

/* ---------- The sheet ---------- */
.act-chips {
    position: sticky;
    top: -6px;
    z-index: 1;
    display: flex;
    gap: 6px;
    margin: -6px -12px 4px;
    padding: 8px 12px;
    overflow-x: auto;
    background: var(--sc-bg-elevated);
    scrollbar-width: none;
}

.act-chips::-webkit-scrollbar {
    display: none;
}

.act-chip {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius-pill);
    background: var(--sc-surface-2);
    color: var(--sc-text-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, border-color 0.2s ease;
}

.act-chip small {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

.act-chip:active {
    transform: scale(0.95);
}

.act-chip.is-on {
    border-color: color-mix(in srgb, var(--sheet-accent) 70%, transparent);
    background: color-mix(in srgb, var(--sheet-accent) 20%, var(--sc-surface-2));
    color: var(--sc-text);
}

.act-feed {
    display: flex;
    flex-direction: column;
}

.act-day {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.act-day-head {
    margin: 12px 2px 2px;
    color: var(--sc-text-muted);
    font-family: var(--sc-font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.act-day:first-child .act-day-head {
    margin-top: 4px;
}

.act-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 60px;
    padding: 8px 12px 8px 8px;
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius);
    background: var(--sc-surface);
    color: var(--sc-text);
    text-align: left;
    animation: act-in 0.3s var(--sc-ease-out) both;
    animation-delay: calc(var(--i, 0) * 22ms);
}

.act-row.is-tappable {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, border-color 0.2s ease;
}

.act-row.is-tappable:hover {
    border-color: color-mix(in srgb, var(--tone) 55%, transparent);
}

.act-row.is-tappable:active {
    transform: scale(0.98);
}

.act-row.is-tappable:focus-visible {
    outline: 2px solid var(--tone);
    outline-offset: 2px;
}

.act-row.is-skeleton {
    background: var(--sc-surface-2);
    opacity: 0.5;
}

@keyframes act-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

.act-art {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: calc(12px * var(--sc-radius-scale, 1));
    background: color-mix(in srgb, var(--tone) 16%, var(--sc-surface-3));
    color: var(--tone);
    font-size: 21px;
}

.act-art img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.act-art-badge {
    position: absolute;
    right: -5px;
    bottom: -5px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 2px solid var(--sc-surface);
    border-radius: 50%;
    background: var(--tone);
    color: #11141c;
    font-size: 11px;
}

.act-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.act-title,
.act-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.act-title {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.25;
}

.act-meta {
    color: var(--sc-text-muted);
    font-size: 12.5px;
    line-height: 1.25;
}

.act-when {
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--sc-text-faint);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* New since last time: a dot by the time */
.act-row.is-new .act-when::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--tone);
}

.act-go {
    font-size: 16px;
}

.act-go.is-off {
    visibility: hidden;
}

.act-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 48px 24px;
    color: var(--sc-text-muted);
    text-align: center;
}

.act-empty ion-icon {
    color: var(--sheet-accent);
    font-size: 40px;
    opacity: 0.8;
}

.act-empty strong {
    color: var(--sc-text);
    font-size: 16px;
}

.act-empty p {
    max-width: 280px;
    margin: 0;
    font-size: 13px;
}

.act-foot {
    margin: 14px 0 0;
    color: var(--sc-text-faint);
    font-size: 12px;
    text-align: center;
}

/* A Skanimal's card, opened from its line */
.act-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: act-in 0.25s var(--sc-ease-out) both;
}

.act-back {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 4px;
    padding: 6px 12px 6px 8px;
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius-pill);
    background: var(--sc-surface-2);
    color: var(--sc-text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    .act-row, .act-card, .act-new-dot { animation: none; }
    .act-row.is-tappable, .act-chip { transition: none; }
}
