/* ===========================================================
   Courier Tracking Pro — Widget Styles
   Design direction: a physical parcel label / waybill stub.
   Scoped entirely under .ctp-widget so it never leaks into
   the host brand site's own styles.
   =========================================================== */

.ctp-widget {
    --ctp-ink: #211f1a;
    --ctp-paper: #fbf7ee;
    --ctp-kraft: #efe4cc;
    --ctp-line: #cdb98d;
    --ctp-amber: #b0740a;
    --ctp-amber-bg: #f7ecd4;
    --ctp-teal: #2c6a5a;
    --ctp-teal-bg: #e4efe9;
    --ctp-rust: #9c3b2c;
    --ctp-rust-bg: #f6e6e0;
    --ctp-slate: #6b6355;

    --ctp-font-display: 'Fraunces', Georgia, serif;
    --ctp-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --ctp-font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    all: initial;
    display: block;
    font-family: var(--ctp-font-body);
    color: var(--ctp-ink);
    max-width: 480px;
    margin: 0 auto;
    box-sizing: border-box;
}
.ctp-widget * { box-sizing: border-box; font-family: inherit; }

.ctp-ticket {
    background: var(--ctp-kraft);
    border-radius: 4px;
    padding: 6px;
    box-shadow: 0 1px 2px rgba(33,31,26,0.06), 0 12px 32px -12px rgba(33,31,26,0.28);
}

.ctp-ticket-header {
    padding: 28px 26px 18px;
}

.ctp-eyebrow {
    font-family: var(--ctp-font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ctp-amber);
    margin-bottom: 6px;
}

.ctp-brand-name {
    font-family: var(--ctp-font-display);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
    color: var(--ctp-ink);
    letter-spacing: -0.01em;
}

.ctp-search-row {
    display: flex;
    gap: 8px;
    padding: 0 26px 24px;
}

.ctp-search-input {
    flex: 1;
    padding: 13px 14px;
    border-radius: 3px;
    border: 1.5px solid var(--ctp-line);
    background: var(--ctp-paper);
    font-family: var(--ctp-font-mono);
    font-size: 14px;
    letter-spacing: 0.02em;
    color: var(--ctp-ink);
    outline: none;
    transition: border-color 0.15s ease;
}
.ctp-search-input::placeholder { color: var(--ctp-slate); font-family: var(--ctp-font-body); }
.ctp-search-input:focus { border-color: var(--ctp-amber); }

.ctp-search-btn {
    padding: 13px 22px;
    border-radius: 3px;
    border: none;
    background: var(--ctp-ink);
    color: var(--ctp-paper);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background 0.15s ease;
}
.ctp-search-btn:hover { background: #3a362c; }

.ctp-not-found {
    margin: 0 26px 24px;
    background: var(--ctp-rust-bg);
    color: var(--ctp-rust);
    padding: 14px 16px;
    border-radius: 3px;
    font-size: 13.5px;
    line-height: 1.5;
}

.ctp-mono { font-family: var(--ctp-font-mono); }

/* ---- The result stub: designed like a torn parcel-label ticket ---- */
.ctp-result {
    position: relative;
    background: var(--ctp-paper);
    margin: 0 6px 6px;
    border-radius: 3px;
    overflow: hidden;
}

.ctp-perforation {
    height: 0;
    border-top: 2px dashed var(--ctp-line);
    margin: 0 26px;
}

.ctp-stub-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 22px 26px 0;
    gap: 16px;
}

.ctp-stub-row-split {
    padding-top: 18px;
    padding-bottom: 22px;
    flex-wrap: wrap;
    row-gap: 16px;
}

.ctp-stub-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ctp-stub-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ctp-slate);
}

.ctp-stub-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--ctp-ink);
    word-break: break-word;
}

.ctp-stub-value.ctp-mono,
span.ctp-mono.ctp-stub-value {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* Rotated ink-stamp badge, the signature element */
.ctp-stamp {
    flex-shrink: 0;
    font-family: var(--ctp-font-display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 7px 14px;
    border-radius: 2px;
    border: 2px solid currentColor;
    transform: rotate(-4deg);
    white-space: nowrap;
}
.ctp-stamp-pending          { color: var(--ctp-amber); background: var(--ctp-amber-bg); }
.ctp-stamp-dispatched       { color: var(--ctp-amber); background: var(--ctp-amber-bg); }
.ctp-stamp-out_for_delivery { color: var(--ctp-teal);  background: var(--ctp-teal-bg); }
.ctp-stamp-delivered        { color: var(--ctp-teal);  background: var(--ctp-teal-bg); }
.ctp-stamp-cancelled        { color: var(--ctp-rust);  background: var(--ctp-rust-bg); }

/* ---- Route progress: dashed mail-route with postmark stops ---- */
.ctp-route {
    padding: 6px 26px 26px;
}

.ctp-route-line {
    position: relative;
    height: 2px;
    background-image: linear-gradient(to right, var(--ctp-line) 60%, transparent 0%);
    background-size: 10px 2px;
    background-repeat: repeat-x;
    margin: 0 9px 14px;
}

.ctp-route-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    background: var(--ctp-teal);
    transition: width 0.3s ease;
}

.ctp-route-stops {
    display: flex;
    justify-content: space-between;
}

.ctp-route-stop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    text-align: center;
}

.ctp-route-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ctp-paper);
    border: 2px solid var(--ctp-line);
    margin-top: -15px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.ctp-route-stop.is-passed .ctp-route-dot {
    background: var(--ctp-teal);
    border-color: var(--ctp-teal);
}

.ctp-route-stop.is-current .ctp-route-dot {
    background: var(--ctp-paper);
    border-color: var(--ctp-teal);
    box-shadow: 0 0 0 4px var(--ctp-teal-bg);
}

.ctp-route-label {
    font-size: 11px;
    color: var(--ctp-slate);
    font-weight: 500;
    line-height: 1.3;
}

.ctp-route-stop.is-passed .ctp-route-label {
    color: var(--ctp-ink);
    font-weight: 600;
}

.ctp-cancelled-note {
    margin: 6px 26px 26px;
    background: var(--ctp-rust-bg);
    color: var(--ctp-rust);
    padding: 12px 14px;
    border-radius: 3px;
    font-size: 13.5px;
    font-weight: 600;
    text-align: center;
}

.ctp-footnote {
    text-align: center;
    font-size: 12px;
    color: var(--ctp-slate);
    padding: 18px 26px 22px;
    margin: 0;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .ctp-brand-name { font-size: 25px; }
    .ctp-ticket-header,
    .ctp-search-row { padding-left: 18px; padding-right: 18px; }
    .ctp-perforation { margin: 0 18px; }
    .ctp-stub-row,
    .ctp-route { padding-left: 18px; padding-right: 18px; }
    .ctp-stamp { transform: rotate(-3deg); font-size: 11.5px; padding: 6px 11px; }
    .ctp-route-stops { flex-wrap: nowrap; }
    .ctp-route-label { font-size: 9.5px; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .ctp-route-fill,
    .ctp-route-dot,
    .ctp-search-input,
    .ctp-search-btn { transition: none; }
}

/* ---- Focus visibility for accessibility ---- */
.ctp-widget a:focus-visible,
.ctp-widget button:focus-visible,
.ctp-widget input:focus-visible {
    outline: 2px solid var(--ctp-amber);
    outline-offset: 2px;
}
