/* Save Image capture card (rendered off-screen, captured by html2canvas) */
.capture-card {
    position: fixed;
    left: -10000px;
    top: 0;
    z-index: 0;
    width: 800px;
    height: 1000px;
    display: flex;
    flex-direction: column;
    --ticket-hole-top: 22px;
    --ticket-hole-size: 24px;
    --ticket-hole-shadow-y: -2px;
    --ticket-hole-shadow-blur: 4px;
    --ticket-hole-shadow-alpha: .18;
    --ticket-hole-bg: var(--cream);
    background: var(--ticket-bg);
    font-family: var(--font-app);
    color: var(--ink);
    padding: 58px 48px 42px;
    box-sizing: border-box;
    pointer-events: none;
    overflow: hidden;
    filter: drop-shadow(0 2px 1px rgba(60,42,30,.06)) drop-shadow(0 12px 22px rgba(60,42,30,.13));
    animation: none;
}
.capture-card::before {
    content: "";
    position: absolute;
    top: var(--ticket-hole-top);
    left: 50%;
    width: var(--ticket-hole-size);
    height: var(--ticket-hole-size);
    border-radius: 50%;
    background: var(--ticket-hole-bg);
    box-shadow: 0 var(--ticket-hole-shadow-y) var(--ticket-hole-shadow-blur) rgba(60,42,30,var(--ticket-hole-shadow-alpha));
    transform: translateX(-50%);
    pointer-events: none;
}
.capture-card.capture-card--canvas-hole::before {
    display: none;
}
.capture-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 18px;
    pointer-events: none;
    background:
        linear-gradient(135deg, var(--cream) 25%, transparent 25%) 0 0 / 15px 18px repeat-x,
        linear-gradient(225deg, var(--cream) 25%, transparent 25%) 7.5px 0 / 15px 18px repeat-x;
}
.capture-card .cap-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.capture-card .cap-order-no {
    margin: 0 0 22px;
    color: var(--stone);
    font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 1.3px;
    line-height: 1.15;
    text-align: center;
}
.capture-card .cap-order-main,
.capture-card .cap-order-date {
    display: block;
}
.capture-card .cap-order-main {
    text-transform: uppercase;
}
.capture-card .cap-order-date {
    margin-top: 4px;
    color: var(--ticket-meta);
    font-size: inherit;
    letter-spacing: 0;
    text-transform: none;
}
.capture-card .cap-source-card,
.capture-card .cap-empty-card {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    column-gap: 20px;
    align-items: center;
    margin-bottom: 12px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.capture-card .cap-empty-card {
    display: block;
}
.capture-card .cap-source-card:not(.has-thumb) {
    grid-template-columns: 1fr;
}
.capture-card .cap-thumb {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 1px solid rgba(var(--ink-rgb), .10);
    background-color: var(--sand);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    overflow: hidden;
}
.capture-card .cap-name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 46px;
    font-weight: var(--font-display-weight, 400);
    line-height: 1.04;
    color: var(--rust);
}
.capture-card .cap-tagline {
    margin: 10px 0 20px;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: var(--cap-tagline-size, 18px);
    font-style: italic;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}
.capture-card .cap-divider {
    border: 0;
    border-top: 1px dashed var(--ticket-rule);
    margin: 0 0 24px;
}
.capture-card .cap-section {
    padding: 0;
    margin: 0 0 22px;
}
.capture-card .cap-section-label {
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--rust);
    margin: 0 0 10px;
}
.capture-card .cap-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 34px;
}
/* Save-image and print chips mirror Build's Family state grammar. A transparent
   resting edge reserves the added border without changing wrap. */
.capture-card .cap-chip {
    display: inline-flex;
    position: relative;
    align-items: center;
    gap: 6px;
    padding: 7px 15px 7px 17px;
    border: 1px solid transparent;
    font-family: var(--font-app);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.1;
    border-radius: 999px;
    background: rgba(var(--sage-rgb), .13);
    color: var(--ink);
}
.capture-card .cap-chip.added {
    border-color: rgba(var(--sage-rgb), .46);
    background: rgba(var(--sage-rgb), .34);
    color: var(--ink);
}
/* Lora italic is the custom state cue. The half-pixel metric correction keeps
   its optical height aligned with adjacent 16px Manrope labels. */
.capture-card .cap-chip.unknown {
    font-family: var(--font-accent);
    font-size: 16.5px;
    font-style: italic;
    color: var(--ink);
}
.capture-card .cap-chip.removed {
    border-color: rgba(var(--sage-rgb), .30);
    background: transparent;
    color: var(--stone-light);
    opacity: 1;
}
.capture-card .cap-chip-strike {
    position: absolute;
    left: 13px;
    right: 13px;
    top: 50%;
    height: 0;
    border-top: 1.5px solid currentColor;
    opacity: .72;
    transform: translateY(-50%);
    pointer-events: none;
}
.capture-card .cap-empty {
    font-family: var(--font-prose);
    font-size: 16px;
    color: var(--stone-light);
    font-style: italic;
}
.capture-card .cap-warn {
    font-family: var(--font-app);
    font-size: 15px;
    color: var(--rust-muted);
    margin: -12px 0 18px;
}
.capture-card .cap-balance-title {
    margin: 0 0 14px;
    padding-top: 16px;
    border-top: 1px solid var(--ticket-rule);
    font-family: var(--font-app);
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--rust);
}
.capture-card .cap-meter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 9px;
}
.capture-card .cap-meter-label {
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    width: var(--cap-meter-label-width, max-content);
    padding-right: 2px;
    box-sizing: border-box;
    text-align: right;
    flex-shrink: 0;
}
.capture-card .cap-meter-ticks {
    display: flex;
    gap: 4px;
    flex: 1;
}
.capture-card .cap-meter-tick {
    height: 10px;
    flex: 1;
    border-radius: 2px;
    background: var(--ticket-meter-empty);
}
.capture-card .cap-meter-tick.filled {
    background: var(--ticket-meter-mid);
}
.capture-card .cap-meter-tick.high {
    background: var(--ticket-meter-high);
}
.capture-card .cap-suggestion {
    margin-top: 6px;
    padding: 5px 10px;
    background: var(--section-bg);
    border: 1px solid #e8e2d9;
    border-radius: 6px;
    font-size: 11px;
    color: #6b5e53;
}
.capture-card .cap-suggestion-text {
    font-weight: 600;
}
/* Footer logo mark */
.capture-card .cap-footer-mark {
    text-align: center;
    margin-top: auto;
    padding-top: 0;
    padding-bottom: 0;
    border-top: 0;
}
.capture-card .cap-footer-mark img {
    display: block;
    width: auto;
    height: 38px;
    opacity: 0.88;
    margin: 0 auto;
}
.capture-card .cap-footer {
    margin-top: 5px;
    padding-top: 0;
    border-top: none;
    font-size: 17px;
    font-weight: 600;
    color: rgba(var(--rust-rgb), .66);
    text-align: center;
    letter-spacing: .35px;
}
/* When logo mark is hidden, footer gets its own top border */
.capture-card .cap-footer.no-mark {
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid #e8e2d9;
}

/* Image preview overlay (mobile save-to-photos) */
.image-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0,0,0,.85);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.image-preview-overlay.open {
    display: flex;
}
.image-preview-overlay img {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,.4);
}
.image-preview-hint {
    margin-top: 16px;
    font-family: var(--font-app);
    font-size: 14px;
    color: rgba(255,255,255,.8);
    text-align: center;
}
.image-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

/* Print the authored 800 x 1000 ticket at a single uniform scale. Keeping
   the export geometry intact prevents print-only reflow from clipping the
   fitted tagline or pushing the footer onto a second Letter page. */
#print-build-card {
    position: fixed;
    left: -20000px;
    top: 0;
    pointer-events: none;
}
@media print {
    body.printing-build {
        margin: 0 !important;
    }
    body.printing-build > *:not(#print-build-card) {
        display: none !important;
    }
    body.printing-build #print-build-card {
        position: absolute !important;
        top: 0 !important;
        left: 50% !important;
        width: 688px !important;
        height: 860px !important;
        margin: 0 !important;
        overflow: hidden !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        transform: translateX(-50%) !important;
    }
    body.printing-build #print-build-card .capture-card {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        width: 800px !important;
        max-width: none !important;
        height: 1000px !important;
        min-height: 1000px !important;
        overflow: hidden !important;
        zoom: .86 !important;
        transform: none !important;
        filter: none !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    body.printing-build #print-build-card .cap-suggestion {
        font-size: 12px !important;
    }
    /* Custom is an operational state in a printed production ticket, not an
       editorial accent. Keep it aligned with the other ingredient chips. */
    body.printing-build #print-build-card .cap-chip.unknown {
        font-family: var(--font-app) !important;
        font-size: 16px !important;
        font-style: normal !important;
    }
}
