/*!
 * cz-calc-3887.css — Term comparison calculator (post 3887)
 * Version: 4.0.0 (2026-05-29) — clean rebuild
 *
 * Loaded by cz-calc-restore.php mu-plugin only on post 3887.
 *
 * ARCHITECTURE: SELF-CONTAINED FORM PATTERN
 * ─────────────────────────────────────────
 * This calculator uses cz-3887-* form classes that do NOT inherit from
 * .cz-calculator__field / __label / __input / __hint / __select. The site-wide
 * form pattern in cz-design.css is bypassed entirely for this calculator.
 *
 * WHY: cz-design.css defines form spacing tuned for Bankrate-style "loose"
 * production calculators. When mockup-fidelity matters (custom spacing,
 * tightly-anchored labels), the only clean path is self-contained classes
 * to avoid specificity battles + inherited cascade leaks.
 *
 * Other calculator posts (2598, 3167, 3204, 3226, 3301, 3452, 2925, 2888, 2664)
 * continue using cz-design.css form pattern — they are not affected by this file.
 *
 * Header override (.cz-calculator__header etc.) IS still inherited because we
 * keep that part of the markup; we override only the bits that need to change.
 *
 * See README.md in drafts/84-month-auto-loan-true-cost-by-credit-tier-usa/
 * for DEC-AR (self-contained form pattern decision) + lessons learned.
 *
 * IMPORTANT: pairs with cz-calc-3887.js (DOM element IDs are stable).
 * IMPORTANT: !important is used only where genuinely required to defeat
 * inline <style> blocks injected by the theme into <head>.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   1. HEADER OVERRIDE — match design mockup (gradient + sans-serif title)
   cz-design.css ".cz-calculator--sober" variant sets a solid dark header.
   We override with the mockup gradient. !important is required because
   .cz-calculator--sober has higher specificity than #cz-calc-3887 alone.
   ═══════════════════════════════════════════════════════════════════════════ */
#cz-calc-3887 .cz-calculator__header {
    background: linear-gradient(135deg, #1e40af 0%, #3730a3 100%) !important;
    padding: 1.5rem 1.75rem 1.25rem;
    color: #ffffff;
}
#cz-calc-3887 .cz-calculator__title {
    font-family: "DM Sans", -apple-system, "Segoe UI", Roboto, sans-serif !important;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.01em;
}
#cz-calc-3887 .cz-calculator__subtitle {
    font-family: "DM Sans", -apple-system, "Segoe UI", Roboto, sans-serif !important;
    font-size: 0.875rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   2. FORM — self-contained cz-3887-* classes (no inheritance from cz-design.css)
   ═══════════════════════════════════════════════════════════════════════════ */

#cz-calc-3887 {
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#cz-calc-3887 .cz-3887-form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1rem;
}

#cz-calc-3887 .cz-3887-field {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
}

/* Label tight to input.
   Negative margin-bottom compensates for the browser's internal whitespace
   in the label box (line-height padding the visible text doesn't fill).
   This is the cleanest way to make the visible bottom edge of the text
   sit close to the input border. */
#cz-calc-3887 .cz-3887-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
    margin: 0 0 -6px 0 !important;
    padding: 0 !important;
}

#cz-calc-3887 .cz-3887-input,
#cz-calc-3887 .cz-3887-select {
    display: block;
    width: 100%;
    margin: 0 !important;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: #111827;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#cz-calc-3887 .cz-3887-input:focus,
#cz-calc-3887 .cz-3887-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
#cz-calc-3887 .cz-3887-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
}

/* Hint text below input.
   Negative margin-top pulls hint up close to the input bottom border,
   same reasoning as label margin. */
#cz-calc-3887 .cz-3887-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.3;
    margin: -4px 0 0 0 !important;
    padding: 0 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   3. RESULT CARDS — hero monthly payment, tradeoff box, donut, secondary stats
   ═══════════════════════════════════════════════════════════════════════════ */

.cz-calc-3887-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.cz-calc-3887-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.cz-calc-3887-card[data-term="60"] {
    background: linear-gradient(180deg, #fff 0%, #eff6ff 100%);
    border-color: #bfdbfe;
}
.cz-calc-3887-card[data-term="84"] {
    background: linear-gradient(180deg, #fff 0%, #fef2f2 100%);
    border-color: #fecaca;
}

.cz-calc-3887-card-header {
    width: calc(100% + 2rem);
    margin: 0 -1rem 1rem;
    padding: 0 1rem 0.75rem;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
    border-bottom: 2px solid #e5e7eb;
}

/* Hero monthly payment — biggest type on the card */
.cz-calc-3887-hero {
    width: 100%;
    margin-bottom: 0.5rem;
    text-align: center;
}
.cz-calc-3887-hero-label {
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cz-calc-3887-hero-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    color: #0f172a;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.cz-calc-3887-hero-suffix {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
}

/* Tradeoff box — the actual decision, loud + color-coded per term */
.cz-calc-3887-tradeoff {
    width: 100%;
    margin: 0.75rem 0;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}
.cz-calc-3887-card[data-term="60"] .cz-calc-3887-tradeoff {
    background: #dbeafe;
    color: #1e3a8a;
}
.cz-calc-3887-card[data-term="72"] .cz-calc-3887-tradeoff {
    background: #fef3c7;
    color: #78350f;
}
.cz-calc-3887-card[data-term="84"] .cz-calc-3887-tradeoff {
    background: #fee2e2;
    color: #7f1d1d;
}
.cz-calc-3887-tradeoff-line {
    display: block;
    margin: 0.125rem 0;
}
.cz-calc-3887-tradeoff-emph {
    font-weight: 800;
}

/* Compact donut + side legend.
   Donut colors are set by JS (5 distinct hues: blue/red/purple/cyan/green)
   so each slice is visually distinguishable at a glance. */
.cz-calc-3887-donut-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}
.cz-calc-3887-donut {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
}
.cz-calc-3887-donut svg {
    display: block;
    width: 100%;
    height: 100%;
}
.cz-calc-3887-donut-legend {
    flex: 1;
    font-size: 0.75rem;
    color: #475569;
}
.cz-calc-3887-donut-legend ul {
    margin: 0;
    padding: 0;
    list-style: none;
    line-height: 1.7;
}
.cz-calc-3887-donut-legend li {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.cz-calc-3887-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.cz-calc-3887-legend-text {
    flex: 1;
}
.cz-calc-3887-legend-pct {
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

/* Secondary stats footer (Total interest / Total paid) */
.cz-calc-3887-secondary {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 0.75rem;
    padding-top: 0.625rem;
    font-size: 0.75rem;
    color: #64748b;
    border-top: 1px dotted #cbd5e1;
}
.cz-calc-3887-secondary-val {
    font-weight: 600;
    color: #334155;
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════════
   4. VERDICT BAR — full-width tinted box below result cards
   Uses cz-3887-verdict-wrap (the <div>) + cz-3887-verdict-text (the <p> inside).
   The post HTML originally had .cz-calculator__result/__result-detail classes
   but cz-design.css has multiple conflicting rules on those (incl. display:none),
   so we use unique classes here.
   ═══════════════════════════════════════════════════════════════════════════ */
#cz-calc-3887 .cz-3887-verdict-wrap {
    display: block !important;
    box-sizing: border-box;
    width: 100%;
    margin: 1.5rem 0 0.5rem 0;
    padding: 1rem 1.25rem;
    background: #dbeafe;
    color: #1e3a8a;
    border-radius: 8px;
    text-align: center;
}
#cz-calc-3887 .cz-3887-verdict-text {
    margin: 0;
    padding: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
    color: #1e3a8a;
}

/* ═══════════════════════════════════════════════════════════════════════════
   5. MOBILE (< 720px) — stack everything + bigger tap targets + iOS-safe fonts
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 720px) {
    #cz-calc-3887 .cz-3887-form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Bigger padding for touch (44px+ tap target) + 16px font prevents iOS auto-zoom */
    #cz-calc-3887 .cz-3887-input,
    #cz-calc-3887 .cz-3887-select {
        padding: 0.75rem 0.875rem;
        font-size: 1rem;
        border-radius: 8px;
    }
    #cz-calc-3887 .cz-3887-select {
        padding-right: 2.25rem;
        background-position: right 0.75rem center;
    }

    /* Result cards: stack vertically */
    .cz-calc-3887-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .cz-calc-3887-card {
        padding: 1rem 0.875rem;
    }
    .cz-calc-3887-hero-value {
        font-size: 1.75rem;
    }
    .cz-calc-3887-donut {
        width: 80px;
        height: 80px;
    }
    .cz-calc-3887-tradeoff {
        font-size: 0.8125rem;
    }
}

/* Tiny phones (< 380px): shrink hero so monthly payment doesn't wrap */
@media (max-width: 380px) {
    .cz-calc-3887-hero-value {
        font-size: 1.5rem;
    }
    .cz-calc-3887-card-header {
        font-size: 0.9375rem;
    }
}
