/*
 * Achievements — the badge wall and the reveal.
 *
 * Every class here is es_ach_ prefixed on purpose. The theme claims bare
 * Bootstrap names: `.badge` is styled white-on-transparent and would render an
 * invisible badge, which on a celebration modal is the worst possible first
 * impression. Nothing below relies on a Bootstrap component class except the
 * modal shell itself.
 */

/* ---------------------------------------------------------------- the wall */

.es_ach_wall_head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.es_ach_wall_title {
    margin: 0;
    font-size: 1.15rem;
}

.es_ach_count {
    font-size: .8rem;
    font-weight: 400;
    color: #6c757d;
    margin-left: 6px;
}

.es_ach_points {
    text-align: right;
    line-height: 1.2;
}

.es_ach_points_num {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1c4966;
}

.es_ach_points_label {
    font-size: .8rem;
    color: #6c757d;
}

.es_ach_points_sub {
    display: block;
    font-size: .75rem;
    color: #6c757d;
}

.es_ach_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.es_ach_item {
    text-align: center;
    padding: 16px 10px 14px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    background: #fff;
}

.es_ach_medal {
    width: 62px;
    height: 62px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.es_ach_name {
    font-weight: 700;
    font-size: .92rem;
    line-height: 1.25;
}

.es_ach_blurb {
    font-size: .78rem;
    color: #495057;
    margin-top: 6px;
    line-height: 1.35;
}

.es_ach_meta {
    font-size: .72rem;
    color: #868e96;
    margin-top: 6px;
}

/* Earned. */
.es_ach_held .es_ach_medal {
    background: linear-gradient(160deg, #2b7ea1, #1c4966);
    color: #fff;
    border: 2px solid #1c4966;
}

.es_ach_held {
    border-color: #b6d4e0;
}

/*
 * Not earned yet — a mystery rather than a preview.
 *
 * The dashed silhouette says a badge belongs here without saying which one: no
 * name, no icon, just a question mark in the ring it will eventually fill. The
 * name and icon are not merely hidden, they are never rendered (see
 * Achievements::wall_rows), so the page source keeps the secret too.
 *
 * What does stay is the goal and the progress bar. A mystery with nothing to
 * act on is only frustrating; the goal tells you what moves it, and the bar
 * shows it moving.
 */
.es_ach_locked {
    border-style: dashed;
    background: #f8f9fa;
}

.es_ach_locked .es_ach_medal {
    background: transparent;
    border: 2px dashed #adb5bd;
    color: #adb5bd;
    /* The glyph, not an icon font — nothing here should depend on Font Awesome
       having loaded, and a text ? scales with the ring. */
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
}

.es_ach_goal {
    font-size: .8rem;
    font-style: italic;
    color: #6c757d;
    line-height: 1.3;
    /* Occupies the space the name would, so earned and unearned tiles keep the
       same rhythm across the grid. */
    min-height: 2.4em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.es_ach_progress {
    height: 4px;
    border-radius: 2px;
    background: #dee2e6;
    margin-top: 8px;
    overflow: hidden;
}

.es_ach_progress_bar {
    display: block;
    height: 100%;
    background: #2b7ea1;
}

/* ------------------------------------------------- dashboard "latest badge" */

.es_ach_latest {
    text-align: center;
}

/*
 * The card inside the Tasks widget, which core's tasks/widget.twig wraps in
 * this class. It sits directly under the last task row and needs air, or the
 * medal reads as part of the list rather than as its own thing.
 *
 * Only here: the standalone dashboard widget already has the widget's own
 * padding around it and does not want a second gap.
 */
.es_ach_tasks_strip {
    margin-top: 15px;
}

.es_ach_medal_lg {
    width: 84px;
    height: 84px;
    font-size: 34px;
    margin-bottom: 12px;
}

.es_ach_latest .es_ach_medal_lg {
    background: linear-gradient(160deg, #2b7ea1, #1c4966);
    color: #fff;
    border: 2px solid #1c4966;
}

/* The no-badges-yet state borrows the locked ring, so an empty dashboard reads
   as "not yet" rather than as something broken. */
.es_ach_latest .es_ach_medal_empty {
    background: transparent;
    border: 2px dashed #adb5bd;
    color: #adb5bd;
    font-weight: 700;
    line-height: 1;
}

.es_ach_latest_name {
    font-weight: 700;
    font-size: 1.05rem;
}

.es_ach_latest_blurb {
    font-size: .82rem;
    color: #495057;
    margin-top: 4px;
    line-height: 1.35;
}

.es_ach_next {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #dee2e6;
}

.es_ach_next_head {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6c757d;
}

.es_ach_next_goal {
    font-size: .85rem;
    font-style: italic;
    color: #495057;
    margin: 3px 0 7px;
}

.es_ach_latest_foot {
    margin-top: 14px;
    font-size: .78rem;
    color: #6c757d;
}

.es_ach_kudos {
    color: #2b7ea1;
}

/* --------------------------------------------------------------- the reveal */

.es_ach_reveal_content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
}

.es_ach_reveal .modal-body {
    padding: 34px 30px 28px;
}

.es_ach_reveal_medal {
    width: 108px;
    height: 108px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 46px;
    color: #fff;
    background: linear-gradient(160deg, #2b7ea1, #1c4966);
    box-shadow: 0 0 0 8px rgba(43, 126, 161, .15);
    animation: es_ach_pop .45s cubic-bezier(.2, .9, .3, 1.3) both;
}

.es_ach_reveal_kicker {
    text-transform: uppercase;
    letter-spacing: .09em;
    font-size: .7rem;
    color: #2b7ea1;
    margin: 0 0 2px;
}

.es_ach_reveal_title {
    font-size: 1.7rem;
    margin: 0 0 10px;
}

.es_ach_reveal_first {
    font-weight: 600;
    margin: 0 0 8px;
}

.es_ach_reveal_blurb {
    color: #495057;
    margin: 0 0 22px;
}

@keyframes es_ach_pop {
    from { transform: scale(.4); opacity: 0; }
    to   { transform: scale(1);  opacity: 1; }
}

/*
 * The modal still appears and still says the thing — it just does not fly.
 */
@media (prefers-reduced-motion: reduce) {
    .es_ach_reveal_medal {
        animation: none;
    }
}

/* ------------------------------------------------------------- gifting */

/*
 * The call to action on somebody else's wall. Only rendered when the viewer
 * has something to send, so it never appears as a control that always refuses.
 */
.es_ach_gift_cta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 16px;
}

.es_ach_gift_cta_sub,
.es_ach_gift_balance,
.es_ach_gift_optional {
    font-size: .8rem;
    color: #6c757d;
}

.es_ach_gift_title {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

.es_ach_gift_row {
    margin-bottom: 14px;
}

.es_ach_gift_row label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.es_ach_gift_points {
    width: 90px;
    display: inline-block;
    margin-right: 8px;
}

/*
 * The reassurance is the point of the whole feature: gifting spends balance and
 * never earned, so it cannot cost a badge. People do not believe that until it
 * is written down next to the button.
 */
.es_ach_gift_reassure {
    font-size: .82rem;
    color: #495057;
    background: #f1f5f9;
    border-left: 3px solid #94a3b8;
    padding: 8px 10px;
    margin: 0 0 16px;
}

.es_ach_gift_actions {
    text-align: right;
}

.es_ach_gift_error {
    color: #842029;
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    border-radius: 4px;
    padding: 8px 10px;
    margin: 0 0 14px;
}

.es_ach_gift_notice {
    padding: 6px 2px;
}

/*
 * Said on the refreshed wall after a gift. Deliberately not .alert — the theme
 * claims bare Bootstrap names, and .badge is already invisible under it.
 */
.es_ach_flash {
    border-radius: 4px;
    padding: 9px 12px;
    margin: 0 0 14px;
    font-size: .9rem;
}

.es_ach_flash_success {
    color: #0f5132;
    background: #d1e7dd;
    border: 1px solid #badbcc;
}

.es_ach_flash_error {
    color: #842029;
    background: #f8d7da;
    border: 1px solid #f5c2c7;
}

/* --------------------------------------------------------- leaderboard */

.es_ach_board_head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}

.es_ach_board_title {
    margin: 0;
    font-size: 1.15rem;
}

.es_ach_board_sub,
.es_ach_board_note,
.es_ach_board_unit {
    font-size: .8rem;
    color: #6c757d;
}

.es_ach_board_list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
}

.es_ach_board_row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid #e9ecef;
}

.es_ach_board_rank {
    flex: 0 0 2em;
    font-weight: 700;
    color: #6c757d;
    text-align: right;
}

.es_ach_board_name {
    flex: 1 1 auto;
}

.es_ach_board_badges {
    flex: 0 0 auto;
    font-size: .8rem;
    color: #6c757d;
}

.es_ach_board_score {
    flex: 0 0 auto;
    font-weight: 700;
    min-width: 5.5em;
    text-align: right;
}

/* The viewer's own row, so it can be found without counting down the list. */
.es_ach_board_you {
    background: #eef4f8;
    border-radius: 4px;
}

/*
 * es_ach_ prefixed like everything else here: the theme styles bare `.badge`
 * white-on-transparent, so a Bootstrap name would render this invisible.
 */
.es_ach_board_flag {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #fff;
    background: #2d6a8e;
    border-radius: 3px;
    padding: 1px 6px;
    margin-left: 6px;
}

/* Separated from the top of the board, which it is not contiguous with. */
.es_ach_board_yours {
    margin-top: -4px;
    border-top: 2px dashed #dee2e6;
    padding-top: 8px;
}

.es_ach_board_empty {
    color: #495057;
    background: #f1f5f9;
    border-left: 3px solid #94a3b8;
    padding: 10px 12px;
    margin: 0 0 14px;
}

.es_ach_board_link {
    margin: 14px 0 0;
    font-size: .9rem;
}

/* The second board on the leaderboard page, set apart from the monthly one. */
.es_ach_hall_head {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid #e9ecef;
}
