/* ==========================================================================
   Hawk Lane — Load workflow hero animation (shared)
   Pure CSS loop — no JavaScript required. Used on homepage + landing pages.
   ========================================================================== */

:root {
    --ha-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ha-dur-ui: 350ms;
    --ha-hero-loop: 14s;
}

.ha-workflow {
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(245, 183, 0, 0.08);
    overflow: hidden;
}

.ha-workflow__chrome {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: #2a2a2a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
}

.ha-workflow__dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #444;
    margin-right: 4px;
}

.ha-workflow__body {
    padding: 1rem;
    min-height: 300px;
    position: relative;
}

@media (min-width: 960px) {
    .ha-workflow__body { min-height: 360px; }
}

.ha-load-card {
    background: #262626;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
}

.ha-load-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.ha-load-card__id {
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
}

.ha-status {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(245, 183, 0, 0.2);
    color: var(--color-gold);
    white-space: nowrap;
}

.ha-status--transit { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.ha-status--done { background: rgba(34, 197, 94, 0.2); color: #86efac; }

.ha-load-card__lane {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 0.35rem;
}

.ha-load-card__meta {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
}

.ha-route {
    position: relative;
    height: 60px;
    margin: 0.85rem 0;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.ha-route__pin {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
}

.ha-route__pin--start { left: 3%; }
.ha-route__pin--end { right: 3%; }

.ha-route__line {
    position: absolute;
    left: 16%;
    right: 16%;
    top: 50%;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.12);
}

.ha-route__progress {
    position: absolute;
    left: 16%;
    top: 50%;
    height: 3px;
    border-radius: 3px;
    width: 68%;
    background: var(--color-gold);
    transform: scaleX(0);
    transform-origin: left;
}

.ha-route__truck {
    position: absolute;
    top: 50%;
    left: 16%;
    transform: translate(-50%, -50%);
    width: 26px;
    height: 26px;
    opacity: 0;
}

.ha-route__truck svg {
    width: 26px;
    height: 26px;
    max-width: 26px;
    max-height: 26px;
    fill: var(--color-gold);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.ha-chip-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin: 0.35rem 0.35rem 0 0;
    opacity: 0;
    transform: translateY(4px);
}

.ha-workflow__extras { min-height: 1.6rem; }

.ha-chip-badge--pod { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.ha-chip-badge--invoice { background: rgba(34, 197, 94, 0.2); color: #86efac; }

.ha-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.ha-timeline__chip {
    font-size: 0.65rem;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid transparent;
}

.ha-status-stack {
    position: relative;
    display: inline-block;
    min-width: 104px;
    height: 1.15rem;
    flex-shrink: 0;
}

.ha-status-stack .ha-status {
    position: absolute;
    top: 0;
    right: 0;
    opacity: 0;
}

.ha-status-stack .ha-status--s1 { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
    .ha-load-card { animation: haCard var(--ha-hero-loop) linear infinite; }
    .ha-load-card__meta--driver {
        overflow: hidden;
        animation: haDriver var(--ha-hero-loop) linear infinite;
    }
    .ha-route__progress { animation: haProgress var(--ha-hero-loop) linear infinite; }
    .ha-route__truck { animation: haTruck var(--ha-hero-loop) linear infinite; }
    .ha-chip-badge--pod { animation: haPod var(--ha-hero-loop) linear infinite; }
    .ha-chip-badge--invoice { animation: haInvoice var(--ha-hero-loop) linear infinite; }

    .ha-timeline__chip { animation: haChip var(--ha-hero-loop) linear infinite; }
    .ha-timeline__chip:nth-child(1) { animation-delay: calc(var(--ha-hero-loop) * -0.97); }
    .ha-timeline__chip:nth-child(2) { animation-delay: calc(var(--ha-hero-loop) * -0.88); }
    .ha-timeline__chip:nth-child(3) { animation-delay: calc(var(--ha-hero-loop) * -0.84); }
    .ha-timeline__chip:nth-child(4) { animation-delay: calc(var(--ha-hero-loop) * -0.48); }
    .ha-timeline__chip:nth-child(5) { animation-delay: calc(var(--ha-hero-loop) * -0.34); }
    .ha-timeline__chip:nth-child(6) { animation-delay: calc(var(--ha-hero-loop) * -0.18); }

    .ha-status--s1 { animation: haS1 var(--ha-hero-loop) linear infinite; }
    .ha-status--s2 { animation: haS2 var(--ha-hero-loop) linear infinite; }
    .ha-status--s3 { animation: haS3 var(--ha-hero-loop) linear infinite; }
    .ha-status--s4 { animation: haS4 var(--ha-hero-loop) linear infinite; }
    .ha-status--s5 { animation: haS5 var(--ha-hero-loop) linear infinite; }
    .ha-status--s6 { animation: haS6 var(--ha-hero-loop) linear infinite; }
}

@media (prefers-reduced-motion: reduce) {
    .ha-load-card { opacity: 1; transform: none; }
    .ha-load-card__meta--driver { opacity: 1; max-height: 2rem; }
    .ha-route__progress { transform: scaleX(1); }
    .ha-route__truck { opacity: 1; left: 84%; }
    .ha-chip-badge { opacity: 1; transform: none; }
    .ha-timeline__chip {
        border-color: rgba(245, 183, 0, 0.35);
        color: rgba(245, 183, 0, 0.7);
    }
    .ha-status--s6 { opacity: 1; }
}

@keyframes haCard {
    0% { opacity: 0; transform: translateY(8px); }
    3%, 97% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(8px); }
}
@keyframes haDriver {
    0%, 10% { opacity: 0; max-height: 0; }
    14%, 97% { opacity: 1; max-height: 2rem; }
    100% { opacity: 0; max-height: 0; }
}
@keyframes haProgress {
    0%, 14% { transform: scaleX(0); }
    40%, 97% { transform: scaleX(1); }
    100% { transform: scaleX(0); }
}
@keyframes haTruck {
    0%, 14% { opacity: 0; left: 16%; }
    16% { opacity: 1; }
    40%, 97% { opacity: 1; left: 84%; }
    100% { opacity: 0; left: 16%; }
}
@keyframes haPod {
    0%, 50% { opacity: 0; transform: translateY(4px); }
    54%, 97% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(4px); }
}
@keyframes haInvoice {
    0%, 80% { opacity: 0; transform: translateY(4px); }
    84%, 97% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(4px); }
}
@keyframes haChip {
    0%, 2% { border-color: transparent; color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.06); }
    3%, 97% { border-color: rgba(245, 183, 0, 0.5); color: var(--color-gold); background: rgba(245, 183, 0, 0.1); }
    100% { border-color: transparent; color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.06); }
}
@keyframes haS1 { 0%, 10% { opacity: 1; } 12%, 100% { opacity: 0; } }
@keyframes haS2 { 0%, 12% { opacity: 0; } 13%, 15% { opacity: 1; } 16%, 100% { opacity: 0; } }
@keyframes haS3 { 0%, 16% { opacity: 0; } 17%, 51% { opacity: 1; } 52%, 100% { opacity: 0; } }
@keyframes haS4 { 0%, 52% { opacity: 0; } 53%, 65% { opacity: 1; } 66%, 100% { opacity: 0; } }
@keyframes haS5 { 0%, 66% { opacity: 0; } 67%, 81% { opacity: 1; } 82%, 100% { opacity: 0; } }
@keyframes haS6 { 0%, 82% { opacity: 0; } 83%, 98% { opacity: 1; } 100% { opacity: 0; } }

/* --- Interactive layer (click-to-scrub, hover-pause, live miles) --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ha-workflow__live {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.55);
}

.ha-workflow__live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #86efac;
    box-shadow: 0 0 0 0 rgba(134, 239, 172, 0.6);
}

@media (prefers-reduced-motion: no-preference) {
    .ha-workflow__live-dot { animation: haLivePulse 2s ease-out infinite; }
}

@keyframes haLivePulse {
    0% { box-shadow: 0 0 0 0 rgba(134, 239, 172, 0.55); }
    70% { box-shadow: 0 0 0 6px rgba(134, 239, 172, 0); }
    100% { box-shadow: 0 0 0 0 rgba(134, 239, 172, 0); }
}

.ha-route__miles {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(245, 183, 0, 0.85);
    margin-top: -0.15rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.ha-timeline__chip {
    font-family: inherit;
    cursor: pointer;
    transition: background var(--ha-dur-ui) var(--ha-ease), color var(--ha-dur-ui) var(--ha-ease), border-color var(--ha-dur-ui) var(--ha-ease);
}

.ha-timeline__chip:hover {
    border-color: rgba(245, 183, 0, 0.4);
    color: rgba(255, 255, 255, 0.8);
}

.ha-timeline__chip:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
}

.ha-timeline__chip[aria-pressed="true"] {
    background: rgba(245, 183, 0, 0.18);
    border-color: rgba(245, 183, 0, 0.55);
    color: var(--color-gold);
}

.ha-timeline__hint {
    display: block;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 0.4rem;
}

.ha-resume-btn {
    display: none;
    align-items: center;
    gap: 0.3rem;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-gold);
    background: rgba(245, 183, 0, 0.1);
    border: 1px solid rgba(245, 183, 0, 0.35);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.65rem;
    margin-top: 0.4rem;
    cursor: pointer;
}

.ha-resume-btn:hover { background: rgba(245, 183, 0, 0.18); }

.ha-resume-btn:focus:not(:focus-visible) {
    outline: none;
}

.ha-load-card.is-manual .ha-resume-btn { display: inline-flex; }
.ha-load-card.is-manual .ha-timeline__hint { display: none; }

.ha-workflow.is-hover-paused .ha-load-card,
.ha-workflow.is-hover-paused .ha-load-card__meta--driver,
.ha-workflow.is-hover-paused .ha-route__progress,
.ha-workflow.is-hover-paused .ha-route__truck,
.ha-workflow.is-hover-paused .ha-chip-badge--pod,
.ha-workflow.is-hover-paused .ha-chip-badge--invoice,
.ha-workflow.is-hover-paused .ha-timeline__chip,
.ha-workflow.is-hover-paused .ha-status {
    animation-play-state: paused !important;
}

.ha-load-card.is-manual,
.ha-load-card.is-manual .ha-load-card__meta--driver,
.ha-load-card.is-manual .ha-route__progress,
.ha-load-card.is-manual .ha-route__truck,
.ha-load-card.is-manual .ha-chip-badge--pod,
.ha-load-card.is-manual .ha-chip-badge--invoice,
.ha-load-card.is-manual .ha-status,
.ha-load-card.is-manual .ha-timeline__chip {
    animation-play-state: paused !important;
}

.ha-load-card.is-manual .ha-load-card__meta--driver { opacity: 1; max-height: 2rem; }
.ha-load-card.is-manual .ha-route__truck { transition: left 350ms var(--ha-ease), opacity 350ms var(--ha-ease); }
.ha-load-card.is-manual .ha-route__progress { transition: transform 350ms var(--ha-ease); }
.ha-load-card.is-manual .ha-chip-badge--pod,
.ha-load-card.is-manual .ha-chip-badge--invoice { transition: opacity 250ms var(--ha-ease), transform 250ms var(--ha-ease); }
