/**
 * JavocSoft Portfolio - Achievements
 * Toast shown when a badge is unlocked, and the list of badges.
 */

.ach-toast {
    position: fixed;
    left: 1.5rem;
    bottom: 1.5rem;
    z-index: 3500;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    max-width: min(360px, calc(100vw - 3rem));
    padding: 0.75rem 1.1rem 0.75rem 0.75rem;
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(245, 158, 11, 0.5);
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(245, 158, 11, 0.12);
    font: inherit;
    text-align: left;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ach-toast.show {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.ach-toast-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    font-size: 1.15rem;
}

.ach-toast-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

.ach-toast-text small {
    font-size: 0.68rem;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ach-toast-text strong {
    font-size: 0.95rem;
}

.ach-toast-text span {
    font-size: 0.8rem;
    color: #cbd5e1;
}

/* List of achievements */
.ach-dialog {
    margin: auto;   /* the site's reset removes the browser's centring */
    width: min(680px, calc(100vw - 2rem));
    max-height: min(86vh, 760px);
    padding: 0;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--color-light-gray);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
}

.ach-dialog:focus,
.ach-dialog:focus-visible {
    outline: none;
}

.ach-dialog::backdrop {
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
}

.ach-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #ffffff;
}

.ach-head h2 {
    font-size: 1.25rem;
    color: #ffffff;
}

.ach-close {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.ach-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.ach-progress {
    padding: 1rem 1.25rem 0.25rem;
}

.ach-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--color-light-gray);
    overflow: hidden;
}

.ach-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    transition: width 0.5s ease;
}

.ach-summary {
    margin-top: 0.45rem;
    font-size: 0.85rem;
    color: var(--color-gray);
}

.ach-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
}

.ach-item {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 0.75rem;
    border: 1px solid var(--color-light-gray);
    border-radius: var(--border-radius);
    background: var(--color-bg);
}

.ach-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #ffffff;
}

.ach-item.is-locked .ach-icon {
    background: var(--color-light-gray);
    color: var(--color-gray);
}

.ach-item.is-locked strong {
    color: var(--color-gray);
}

.ach-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    line-height: 1.35;
}

.ach-text strong {
    font-size: 0.92rem;
}

.ach-text > span {
    font-size: 0.8rem;
    color: var(--color-gray);
}

.ach-text small {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: var(--color-gray);
}

.ach-mini {
    display: inline-block;
    width: 70px;
    height: 5px;
    border-radius: 999px;
    background: var(--color-light-gray);
    overflow: hidden;
}

.ach-mini span {
    display: block;
    height: 100%;
    background: #f59e0b;
}

.ach-foot {
    padding: 0.5rem 1.25rem 1.1rem;
    font-size: 0.78rem;
    color: var(--color-gray);
}

.ach-reset {
    margin-left: 0.4rem;
    padding: 0;
    background: none;
    border: 0;
    color: var(--color-gray);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.ach-reset:hover {
    color: #ef4444;
}

@media (max-width: 640px) {
    .ach-toast {
        left: 0.75rem;
        right: 4.75rem;
        bottom: 1rem;
        gap: 0.6rem;
        padding: 0.55rem 0.9rem 0.55rem 0.55rem;
        border-radius: 18px;
    }

    .ach-toast-icon {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    .ach-toast-text small {
        font-size: 0.6rem;
    }

    .ach-toast-text strong {
        font-size: 0.88rem;
    }

    .ach-toast-text span {
        font-size: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ach-toast,
    .ach-bar span {
        transition: none;
    }
}
