/*!
 * Engoory Gpost — tracking panel, 3.1.0
 *
 * Same token contract as the checkout rate row: Engoory Checkout's --ec-*
 * values when that plugin is active, identical neutral fallbacks otherwise.
 * Typography is inherited from the theme; only numeric alignment and the
 * panel's own geometry are owned here.
 */

.gpost-track {
    --gp-surface: var(--ec-surface, #ffffff);
    --gp-sunken: var(--ec-page, #f7f7f5);
    --gp-text: var(--ec-text, #141414);
    --gp-muted: var(--ec-muted, #6e6e6e);
    --gp-border: var(--ec-border, #e6e6e2);
    --gp-accent: var(--ec-accent, #111111);
    --gp-accent-soft: var(--ec-accent-soft, rgba(17, 17, 17, .055));
    --gp-positive: var(--ec-positive, #0f7b4f);
    --gp-positive-soft: var(--ec-positive-soft, #e9f6ef);
    --gp-positive-border: var(--ec-positive-border, #cbe7d8);
    --gp-critical: var(--ec-critical, #b3261e);
    --gp-critical-soft: #fdecea;
    --gp-radius: var(--ec-radius, 14px);
    --gp-fs-sm: var(--ec-fs-sm, 13px);
    --gp-fs-xs: var(--ec-fs-xs, 11.5px);

    box-sizing: border-box;
    margin: 0 0 2.5em;
    padding: 22px 24px;
    border: 1px solid var(--gp-border);
    border-radius: var(--gp-radius);
    background: var(--gp-surface);
    color: var(--gp-text);
}

.gpost-track *,
.gpost-track *::before,
.gpost-track *::after { box-sizing: inherit; }

.gpost-track p { margin: 0; }

/* ==========================================================================
   1. Header
   ========================================================================== */

.gpost-track__head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--gp-border);
}

.gpost-track__identity {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.gpost-track .woocommerce-gpost-logo-mark {
    display: inline-block;
    flex: 0 0 42px;
    width: 42px;
    height: 20px;
    background: url('../gpost.svg') center/contain no-repeat;
}

.gpost-track__title {
    margin: 0;
    color: var(--gp-text);
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -.012em;
    line-height: 1.3;
}

.gpost-track__code { margin-top: 3px; }

.gpost-track__code code {
    padding: 0;
    background: none;
    color: var(--gp-muted);
    font-size: var(--gp-fs-sm);
    font-variant-numeric: tabular-nums;
    letter-spacing: .06em;
}

.gpost-track__status {
    padding: 5px 12px;
    border: 1px solid var(--gp-border);
    border-radius: 999px;
    background: var(--gp-sunken);
    font-size: var(--gp-fs-sm);
    font-weight: 600;
    line-height: 1.35;
}

.gpost-track__status--delivered {
    border-color: var(--gp-positive-border);
    background: var(--gp-positive-soft);
    color: var(--gp-positive);
}

.gpost-track__status--exception {
    border-color: #f0c2be;
    background: var(--gp-critical-soft);
    color: var(--gp-critical);
}

/* ==========================================================================
   2. Progress rail
   ==========================================================================
   Four equal segments with the connector drawn behind the markers. Labels are
   allowed to wrap rather than truncate: a translated stage name is often
   longer than the English one.
   ========================================================================== */

.gpost-track__rail {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.gpost-track__step {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    margin: 0;
    padding: 0;
    text-align: center;
}

/* Connector runs from this marker to the next one. */
.gpost-track__step::before {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--gp-border);
    content: "";
}

.gpost-track__step:last-child::before { display: none; }
.gpost-track__step.is-done::before { background: var(--gp-accent); }

.gpost-track__marker {
    position: relative;
    z-index: 1;
    width: 14px;
    height: 14px;
    border: 2px solid var(--gp-border);
    border-radius: 50%;
    background: var(--gp-surface);
}

.gpost-track__step.is-done .gpost-track__marker {
    border-color: var(--gp-accent);
    background: var(--gp-accent);
}

.gpost-track__step.is-current .gpost-track__marker {
    border-color: var(--gp-accent);
    background: var(--gp-surface);
    box-shadow: 0 0 0 4px var(--gp-accent-soft);
}

.gpost-track__step-label {
    color: var(--gp-muted);
    font-size: var(--gp-fs-xs);
    line-height: 1.35;
}

.gpost-track__step.is-done .gpost-track__step-label,
.gpost-track__step.is-current .gpost-track__step-label {
    color: var(--gp-text);
    font-weight: 600;
}

/* ==========================================================================
   3. Timeline
   ========================================================================== */

.gpost-track__timeline {
    margin: 22px 0 0;
    padding: 0 0 0 4px;
    list-style: none;
}

.gpost-track__event {
    position: relative;
    margin: 0;
    padding: 0 0 18px 22px;
}

.gpost-track__event:last-child { padding-bottom: 0; }

/* Vertical thread joining consecutive events. */
.gpost-track__event::before {
    position: absolute;
    top: 12px;
    bottom: 0;
    left: 4px;
    width: 1px;
    background: var(--gp-border);
    content: "";
}

.gpost-track__event:last-child::before { display: none; }

.gpost-track__dot {
    position: absolute;
    top: 5px;
    left: 0;
    width: 9px;
    height: 9px;
    border: 2px solid var(--gp-border);
    border-radius: 50%;
    background: var(--gp-surface);
}

.gpost-track__event.is-latest .gpost-track__dot {
    border-color: var(--gp-accent);
    background: var(--gp-accent);
}

.gpost-track__event-label {
    color: var(--gp-muted);
    font-size: var(--gp-fs-sm);
    line-height: 1.45;
}

.gpost-track__event.is-latest .gpost-track__event-label {
    color: var(--gp-text);
    font-weight: 600;
}

.gpost-track__event-meta {
    margin-top: 2px !important; /* Beats theme paragraph resets inside lists. */
    color: var(--gp-muted);
    font-size: var(--gp-fs-xs);
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
}

.gpost-track__event-note {
    margin-top: 4px !important; /* Beats theme paragraph resets inside lists. */
    color: var(--gp-muted);
    font-size: var(--gp-fs-xs);
    font-style: italic;
    line-height: 1.4;
}

.gpost-track__empty {
    margin-top: 20px !important; /* Beats theme paragraph resets. */
    padding: 16px 18px;
    border: 1px dashed var(--gp-border);
    border-radius: 10px;
    color: var(--gp-muted);
    font-size: var(--gp-fs-sm);
}

/* ==========================================================================
   4. Parcel facts
   ========================================================================== */

.gpost-track__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--gp-border);
}

.gpost-track__facts > div { min-width: 0; }

.gpost-track__facts dt {
    margin: 0;
    color: var(--gp-muted);
    font-size: var(--gp-fs-xs);
    font-weight: 400;
    line-height: 1.4;
}

.gpost-track__facts dd {
    margin: 2px 0 0;
    color: var(--gp-text);
    font-size: var(--gp-fs-sm);
    font-weight: 600;
    line-height: 1.4;
}

/* The picker stylesheet is not loaded here, so the panel carries its own copy
   of the visually-hidden utility used for the tracking-number label. */
.gpost-track .gpost-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ==========================================================================
   5. Responsive
   ========================================================================== */

@media (max-width: 560px) {
    .gpost-track { padding: 18px 16px; }

    /* Four abbreviated columns become unreadable on a phone, so the rail keeps
       only the current step's label and reduces the rest to markers. */
    .gpost-track__step-label { font-size: 10.5px; }
    .gpost-track__facts { gap: 10px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .gpost-track * { transition: none; }
}
