/* ==========================================================================
   Cart incentive tracker v2 (statement / progress bar / timeline styles)
   Class family .hht-* replaces the old .hh-tracker__* family.

   Shares the front theme tokens from variables.css: no hardcoded colors,
   so the tracker restyles automatically when the brand palette changes.

   STATE MODEL (the fix for "unlocked looks disabled"):
     .is-locked : full ink text on surface - readable, never greyed-out
     .is-done   : success-soft card + ink chip (9.9:1) + success fill
     .just-won  : JS adds this for one beat when a row flips to done:
                  row flash + chip pop (+ ring on timeline nodes)

   ANIMATION CONTRACT (app.js hhtAnimateTracker):
     fills render at width 0 server-side, JS sets the data-w width on the
     next animation frame so the CSS transition actually runs. The shine
   sweep is a solid skewed light bar - no gradients (brand rule).
   Everything disables under prefers-reduced-motion.
   ========================================================================== */

.hht {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px 18px;
    margin: 18px 0;
}

.hht-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.hht-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink);
}

.hht-sub {
    font-size: 11px;
    color: var(--text-faint);
    white-space: nowrap;
}

/* Statements --------------------------------------------------------------- */
.hht-statements {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.hht-statements li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-body);
}

.hht-statements li.is-done {
    color: var(--ink);
}

.hht-dot {
    width: 9px;
    height: 9px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--line-strong);
    flex: 0 0 auto;
}

.hht-statements li.is-done .hht-dot {
    background: var(--success);
}

.hht-statements strong {
    color: var(--ink);
    font-weight: 600;
}

/* Progress bars ------------------------------------------------------------ */
.hht-bars {
    display: grid;
    gap: 10px;
}

.hht-item {
    position: relative;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    padding: 10px 12px 11px;
    background: var(--surface);
    transition: background .4s ease, border-color .4s ease;
}

.hht-item.is-locked .hht-name {
    color: var(--ink);
}

.hht-item.is-done {
    background: var(--success-soft);
    border-color: rgba(19, 129, 92, .35);
}

.hht-line1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

.hht-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
    min-width: 0;
}

.hht-sub-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}

.hht-ic {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: var(--sage-mid);
    display: inline-flex;
}

.hht-ic svg { width: 100%; height: 100%; }

.hht-item.is-done .hht-ic {
    color: var(--success);
}

/* "Add more" pill: the money-first call to action for locked rungs. */
.hht-addmore {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-deep);
    background: var(--gold-soft);
    border: 1px solid var(--gold);
    border-radius: var(--r-pill);
    padding: 2px 10px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* The achieved chip: ink background, white text - the contrast fix */
.hht-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--ink);
    color: var(--on-ink);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-radius: var(--r-pill);
    padding: 3px 10px;
    white-space: nowrap;
}

.hht-chip svg { width: 11px; height: 11px; flex: 0 0 auto; }

.hht-bar {
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--cream);
    overflow: hidden;
    position: relative;
}

.hht-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: var(--r-pill);
    background: var(--ink);
    position: relative;
    transition: width .7s cubic-bezier(.22, 1, .36, 1);
}

.hht-item.is-done .hht-fill {
    background: var(--success);
}

/* Shine sweep: a solid skewed light bar sliding across the achieved fill */
.hht-fill::after {
    content: "";
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 34px;
    left: -50px;
    background: rgba(255, 255, 255, .38);
    transform: skewX(-18deg);
    border-radius: 4px;
}

.hht-item.is-done .hht-fill::after {
    animation: hht-sweep 1.6s .25s ease-in-out 2;
}

@keyframes hht-sweep {
    0%   { left: -50px; }
    100% { left: calc(100% + 26px); }
}

.hht-line2 {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.hht-item.is-done .hht-line2 {
    color: var(--text-body);
}

.hht-amount {
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Unlock moment: row flash + chip pop (JS adds .just-won) */
.hht-item.just-won {
    animation: hht-flash 1s ease;
}

@keyframes hht-flash {
    0%   { background: var(--surface); }
    30%  { background: var(--success-soft); }
    100% { background: var(--success-soft); }
}

.hht-item.just-won .hht-chip {
    animation: hht-pop .5s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes hht-pop {
    0%   { transform: scale(.4); }
    60%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}

/* Prepaid perk tile: NOT a bar ------------------------------------------------
   The prepaid discount has no threshold to climb; it is a flat benefit
   line. Quiet dashed tile so it never competes with the real climbs. */
.hht-perk {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px dashed var(--line-strong);
    background: var(--surface-soft);
    border-radius: var(--r-md);
    padding: 9px 12px;
    margin-top: 10px;
}

.hht-perk-ic {
    width: 20px;
    height: 20px;
    color: var(--gold-deep);
    flex: 0 0 auto;
    display: inline-flex;
}

.hht-perk-ic svg { width: 100%; height: 100%; }

.hht-perk-body {
    min-width: 0;
    display: grid;
}

.hht-perk-body b {
    font-size: 12.5px;
    color: var(--ink);
    font-weight: 600;
    line-height: 1.35;
}

.hht-perk-body span {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.35;
}

.hht-perk-val {
    margin-left: auto;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--success);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Timeline ----------------------------------------------------------------- */
.hht-tl {
    list-style: none;
    margin: 0;
    padding: 0 0 0 2px;
    position: relative;
}

/* Connector: pale rail + animated success fill up to the last won rung.
   Both sit centered under the 28px node column (left 15px = 2px + 28/2)
   and run node-centre to node-centre (top/bottom 23px = 9px step padding
   + 14px half-node), so the rail never pokes out below the final rung.
   The fill's height is set in pixels by hhtAnimateTracker(). */
.hht-tl::before {
    content: "";
    position: absolute;
    left: 15px;
    top: 23px;
    bottom: 23px;
    width: 3px;
    border-radius: 3px;
    background: var(--cream);
}

.hht-tl-filltrack {
    position: absolute;
    left: 15px;
    top: 23px;
    width: 3px;
    height: 0;
    border-radius: 3px;
    background: var(--success);
    transition: height .7s cubic-bezier(.22, 1, .36, 1);
    z-index: 0;
}

.hht-step {
    position: relative;
    display: flex;
    gap: 14px;
    padding: 9px 0;
    z-index: 1;
}

.hht-node {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--line-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background .35s ease, border-color .35s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}

.hht-node svg {
    width: 13px;
    height: 13px;
    color: var(--text-faint);
}

.hht-step.is-done .hht-node {
    background: var(--success);
    border-color: var(--success);
    transform: scale(1.06);
}

.hht-step.is-done .hht-node svg {
    color: var(--on-ink);
}

/* Node win: scale-in + double pulse ring */
.hht-step.just-won .hht-node {
    animation: hht-pop .55s cubic-bezier(.34, 1.56, .64, 1);
}

.hht-step.just-won .hht-node::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 2px solid var(--success);
    opacity: 0;
    animation: hht-ring 1s .15s ease-out 2;
}

@keyframes hht-ring {
    0%   { transform: scale(.7); opacity: .8; }
    100% { transform: scale(1.5); opacity: 0; }
}

.hht-step-body {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.hht-step-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.35;
}

.hht-step-detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.45;
}

.hht-step.is-done .hht-step-detail {
    color: var(--text-body);
}

/* What the row earns you (coupon display value, set by the service) */
.hht-step-sub {
    font-size: 11.5px;
    color: var(--text-faint);
    margin-top: 1px;
    line-height: 1.4;
}

/* Mobile ------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .hht {
        padding: 13px 14px;
    }

    .hht-title {
        font-size: 12px;
    }

    .hht-sub-label {
        display: none;
    }
}

/* Reduced motion: the numbers stay, the movement goes */
@media (prefers-reduced-motion: reduce) {
    .hht-fill,
    .hht-tl-filltrack,
    .hht-item,
    .hht-node {
        transition: none;
    }

    .hht-item.just-won,
    .hht-item.just-won .hht-chip,
    .hht-item.is-done .hht-fill::after,
    .hht-step.just-won .hht-node,
    .hht-step.just-won .hht-node::after {
        animation: none;
    }
}
