/* ============================================================
   3D Filament Cost Calculator — Front-end Styles v6
   Matches the Blocksy theme: every color, the font, field and
   button sizes read Blocksy's Customizer settings. The value after
   each comma is Blocksy's default, used only if the theme variable
   is missing (e.g. on another theme).
   ============================================================ */

.filament-calculator-container {
    /* Design tokens, scoped so nothing leaks into the theme */
    --fc-surface:     var(--theme-palette-color-8, #ffffff);
    --fc-panel:       var(--theme-palette-color-6, #f2f5f7);
    --fc-ink:         var(--theme-palette-color-4, #192a3d);
    --fc-ink-2:       var(--theme-palette-color-3, #3A4F66);
    --fc-ink-3:       color-mix(in srgb, var(--theme-palette-color-3, #3A4F66) 85%, #ffffff); /* opaque, 5.1:1 on the grey panel (WCAG AA) */
    --fc-line:        var(--theme-border-color, var(--theme-palette-color-5, #e1e8ed));
    --fc-line-strong: color-mix(in srgb, var(--theme-palette-color-3, #3A4F66) 28%, var(--theme-palette-color-5, #e1e8ed));
    --fc-blue:        var(--theme-palette-color-1, #2872fa);
    --fc-blue-hover:  var(--theme-palette-color-2, #1559ed);
    --fc-blue-soft:   color-mix(in srgb, var(--theme-palette-color-1, #2872fa) 9%, transparent);
    --fc-radius:      3px;
    --fc-radius-sm:   3px;
    --fc-font:        var(--theme-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
    --fc-ease:        cubic-bezier(0.4, 0, 0.2, 1);

    max-width: 960px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: var(--fc-font);
    color: var(--fc-ink-2);
    line-height: 1.6;
}

.filament-calculator-container *,
.filament-calculator-container *::before,
.filament-calculator-container *::after { box-sizing: border-box; }

/* Card holding both columns */
.calculator-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    background: var(--fc-surface);
    border: 1px solid var(--fc-line);
    border-radius: var(--fc-radius);
    overflow: hidden;
    align-items: stretch;
}

/* ---- Left column: inputs ---- */

.calculator-inputs-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    padding: 32px;
    min-width: 0;
}

.calculator-inputs {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--fc-ink);
    margin: 0;
}

.filament-calculator-container .calculator-select {
    width: 100%;
    height: var(--theme-form-field-height, 40px);
    min-height: var(--theme-form-field-height, 40px);
    margin: 0;
    padding: 0 36px 0 12px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    color: var(--fc-ink-2);
    background-color: var(--fc-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%233A4F66' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
    border: 1px solid var(--fc-line);
    border-radius: var(--theme-form-field-border-radius, 3px);
    box-shadow: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color .15s var(--fc-ease), box-shadow .15s var(--fc-ease);
}

.filament-calculator-container .calculator-select:focus {
    outline: none;
    border-color: var(--fc-blue);
    box-shadow: none;
}
.filament-calculator-container .calculator-select:disabled {
    background-color: var(--fc-panel);
    color: var(--fc-ink-3);
    border-color: var(--fc-line);
    box-shadow: none;
    cursor: not-allowed;
}

/* ---- CTA ---- */

.calc-cta-area {
    padding-top: 24px;
    border-top: 1px solid var(--fc-line);
    text-align: left;
}

.calc-cta-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--fc-ink);
    line-height: 20px;
    margin: 0 0 12px;
}
.calc-cta-label:empty { display: none; }

/* Same look and arrow pop-out as the site's hero buttons.
   script.js replaces the button's text, so the arrow is drawn with ::after.
   It reserves 26px (20px + 6px gap); at rest the left padding carries that
   extra 26px so the label sits centred, and on hover the padding evens out
   so the label slides 13px left as the arrow fades in. Width never changes. */
.filament-calculator-container .calc-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--theme-button-min-height, 40px);
    padding: 5px 7px 5px 33px;
    background: #1559ed; /* matches the homepage buttons; 5.7:1 with white text */
    color: #fff !important;
    border: none;
    border-radius: var(--theme-button-border-radius, 3px);
    font-family: var(--fc-font);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
    transition: background-color .12s cubic-bezier(.455,.03,.515,.955), padding .3s ease;
}
.filament-calculator-container .calc-cta-btn::after {
    content: "→";
    display: inline-block;
    width: 20px;
    margin-left: 6px;
    text-align: center;
    font-size: 15px;
    line-height: 1;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity .3s ease, transform .3s ease;
}
.filament-calculator-container .calc-cta-btn:hover,
.filament-calculator-container .calc-cta-btn:focus-visible {
    background: #0f47c4; /* matches the homepage buttons' hover */
    color: #fff !important;
    text-decoration: none;
    padding-left: 20px;
    padding-right: 20px;
}
.filament-calculator-container .calc-cta-btn:hover::after,
.filament-calculator-container .calc-cta-btn:focus-visible::after {
    opacity: 1;
    transform: translateX(0);
}
.filament-calculator-container .calc-cta-btn:focus-visible {
    outline: 2px solid #1559ed;
    outline-offset: 2px;
}

/* ---- Right column: results ---- */

.calculator-results {
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: var(--fc-panel);
    border-left: 1px solid var(--fc-line);
    padding: 32px;
    position: relative;
    min-width: 0;
}

.results-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-placeholder {
    text-align: center;
    color: var(--fc-ink-3);
}

.results-placeholder svg {
    display: block;
    margin: 0 auto 16px;
    width: 48px;
    height: 48px;
    color: var(--fc-line-strong);
}

.results-placeholder p {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 auto;
    max-width: 240px;
    color: var(--fc-ink-3);
}

.results-display {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ---- Headline number ---- */

.savings-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--fc-ink-2);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.savings-amount {
    text-align: center;
    padding: 0;
    margin-top: -14px;
}

.savings-dollar {
    font-size: 56px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--fc-ink);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: baseline;
    justify-content: center;
}

.savings-dollar .currency {
    font-size: inherit;
    font-weight: 500;
    color: var(--fc-ink-3);
    margin-right: 1px;
}

/* Percentage reduction, shown as a pill */
.reduction-line {
    align-self: center;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    color: var(--fc-blue);
    background: var(--fc-blue-soft);
    border: none;
    border-radius: 3px;
    padding: 3px 10px;
    text-align: center;
}

.reduction-line .pct {
    color: var(--fc-blue);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* OEM vs open-market, side by side in one split panel */
.cost-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    background: var(--fc-surface);
    border: 1px solid var(--fc-line);
    border-radius: var(--fc-radius-sm);
    flex: 1 1 auto;          /* grows to fill the panel's spare height */
    min-height: 120px;
}

.breakdown-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 22px 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    text-align: left;
    align-items: flex-start;
    min-width: 0;
}
.breakdown-card + .breakdown-card { border-left: 1px solid var(--fc-line); }

.breakdown-card.tp-card {
    background: transparent;
    border-color: var(--fc-line);
}

.breakdown-card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fc-ink-2);
}

.breakdown-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--fc-blue);
    letter-spacing: 0;
    line-height: 1.2;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.breakdown-card.tp-card .breakdown-card-value {
    color: var(--fc-ink);
}

.breakdown-card-material {
    font-size: 13px;
    font-weight: 400;
    color: var(--fc-ink-3);
    line-height: 1.4;
}

/* ---- Disclaimer & explain link ---- */

/* Footnote and calculation link share one line, pinned to the bottom of the
   panel. The row is as tall as the Shop button, so it sits level with it. */
.results-disclaimer {
    margin-top: auto;
    min-height: var(--theme-button-min-height, 40px);
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    justify-content: center;
    text-align: center;
    gap: 2px 6px;
    background: none;
    border: none;
    border-radius: 0;
    font-size: 13px;
    line-height: 20px;
}

.results-disclaimer #disclaimer-text {
    display: inline;
    font-size: 13px;
    line-height: 20px;
    color: var(--fc-ink-3);
}

.filament-calculator-container .calc-explain-link {
    display: inline-block;
    min-height: 0;
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
    color: var(--fc-blue);
    text-align: left;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
    text-underline-offset: 3px;
    background: none;
    border: none;
    box-shadow: none;
    letter-spacing: 0;
    cursor: pointer;
}
.filament-calculator-container .calc-explain-link:hover {
    color: var(--fc-blue-hover);
    background: none;
    text-decoration-color: currentColor;
}
.filament-calculator-container .calc-explain-link:focus-visible {
    outline: 2px solid var(--fc-blue);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ---- Modal ---- */
/* The modal is rendered outside .filament-calculator-container, so it carries its own tokens. */

.calc-modal-overlay {
    --fc-surface:     var(--theme-palette-color-8, #ffffff);
    --fc-panel:       var(--theme-palette-color-6, #f2f5f7);
    --fc-ink:         var(--theme-palette-color-4, #192a3d);
    --fc-ink-2:       var(--theme-palette-color-3, #3A4F66);
    --fc-ink-3:       color-mix(in srgb, var(--theme-palette-color-3, #3A4F66) 85%, #ffffff); /* opaque, 5.1:1 on the grey panel (WCAG AA) */
    --fc-line:        var(--theme-border-color, var(--theme-palette-color-5, #e1e8ed));
    --fc-line-strong: color-mix(in srgb, var(--theme-palette-color-3, #3A4F66) 28%, var(--theme-palette-color-5, #e1e8ed));
    --fc-blue:        var(--theme-palette-color-1, #2872fa);
    --fc-blue-hover:  var(--theme-palette-color-2, #1559ed);
    --fc-blue-soft:   color-mix(in srgb, var(--theme-palette-color-1, #2872fa) 9%, transparent);
    --fc-radius:      3px;
    --fc-radius-sm:   3px;
    --fc-font:        var(--theme-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
    --fc-ease:        cubic-bezier(0.4, 0, 0.2, 1);

    display: none;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--theme-palette-color-4, #192a3d) 45%, transparent);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: var(--fc-font);
}
.calc-modal-overlay *,
.calc-modal-overlay *::before,
.calc-modal-overlay *::after { box-sizing: border-box; }
.calc-modal-overlay.open { display: flex; animation: modalFadeIn 0.2s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.calc-modal {
    background: var(--fc-surface);
    border: 1px solid var(--fc-line);
    border-radius: 3px;
    box-shadow: 0 24px 48px -16px rgba(25,42,61,.30);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    color: var(--fc-ink);
    animation: modalSlideUp 0.25s ease;
}
@keyframes modalSlideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.calc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 0;
    border-bottom: none;
}
.calc-modal-header::before {
    content: "How your savings are calculated";
    padding-left: 8px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--fc-ink);
}

.calc-modal-overlay .calc-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin-left: auto;
    background: none;
    border: none;
    border-radius: var(--fc-radius-sm);
    color: var(--fc-ink-3);
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: color .15s, background .15s;
}
.calc-modal-overlay .calc-modal-close svg { width: 16px; height: 16px; }
.calc-modal-overlay .calc-modal-close:hover { color: var(--fc-ink); background: var(--fc-panel); }
.calc-modal-overlay .calc-modal-close:focus-visible { outline: 2px solid var(--fc-blue); outline-offset: 1px; }

.calc-modal-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: 16px 24px 0;
    padding: 0;
    background: var(--fc-surface);
    border: 1px solid var(--fc-line);
    border-radius: var(--fc-radius-sm);
}
.legend-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    min-width: 0;
}
.legend-item:nth-child(even) { border-left: 1px solid var(--fc-line); }
.legend-item:nth-child(n+3)  { border-top: 1px solid var(--fc-line); }
.legend-key { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fc-ink-2); }
.legend-val { font-size: 15px; font-weight: 700; color: var(--fc-ink); font-variant-numeric: tabular-nums; }
.legend-val.blue { color: var(--fc-blue); }

.calc-modal-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 0; }

.calc-step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-radius: var(--fc-radius-sm);
    background: var(--fc-panel);
    border: 1px solid var(--fc-line);
}
.calc-step-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--fc-ink-2);
    line-height: 1.5;
    min-width: 0;
}
.calc-step-label code {
    display: inline-block;
    margin-top: 2px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    color: var(--fc-ink);
    background: var(--fc-surface);
    border: 1px solid var(--fc-line);
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: none;
    letter-spacing: 0;
}
.calc-step-value {
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--fc-ink);
    white-space: nowrap;
    margin-left: 0;
    font-variant-numeric: tabular-nums;
}
.calc-step.neutral { background: var(--fc-panel); border-color: var(--fc-line); }
.calc-step.neutral .calc-step-label { color: var(--fc-ink-2); }
.calc-step.neutral .calc-step-value { color: var(--fc-ink); }

.calc-step.result { background: var(--fc-blue); border-color: var(--fc-blue); }
.calc-step.result .calc-step-label { color: rgba(255,255,255,.85); font-weight: 600; font-size: 14px; }
.calc-step.result .calc-step-value { color: #fff; font-family: inherit; font-size: 20px; font-weight: 700; letter-spacing: 0; }

.calc-operator {
    text-align: center;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--fc-ink-3);
    padding: 4px 0;
    line-height: 1;
}

/* ---- Animation ---- */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .filament-calculator-container *,
    .filament-calculator-container *::after,
    .calc-modal-overlay,
    .calc-modal { transition: none !important; animation: none !important; }
}

/* ---- Responsive ---- */

@media (max-width: 860px) {
    .calculator-wrapper { grid-template-columns: minmax(0, 1fr); }
    .calculator-inputs-col { justify-content: flex-start; }
    .calculator-results {
        border-left: none;
        border-top: 1px solid var(--fc-line);
        min-height: 300px;
    }
}

@media (max-width: 520px) {
    .calculator-inputs-col,
    .calculator-results { padding: 24px 20px; }
    .savings-dollar { font-size: 44px; }
    .cost-breakdown { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .breakdown-card-value { font-size: 28px; }
    .breakdown-card + .breakdown-card { border-left: none; border-top: 1px solid var(--fc-line); }
    .calc-modal-legend { margin: 16px 16px 0; }
    .calc-modal-body { padding: 16px; }
    .calc-step { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ============================================================
   Theme-proofing
   Blocksy (and most themes) style every <button>, <a>, <p> and <select>
   globally: min-heights, padding, nowrap, hover backgrounds, lifts,
   paragraph spacing, link underlines. These rules undo that inside the
   calculator so it looks the same on any theme.
   ============================================================ */

.filament-calculator-container .calculator-wrapper,
.filament-calculator-container .calculator-inputs-col,
.filament-calculator-container .calculator-results,
.filament-calculator-container .results-display {
    margin: 0;
    float: none;
}

.filament-calculator-container p,
.filament-calculator-container .calc-cta-label {
    margin-top: 0;
    margin-bottom: 0;
}
.filament-calculator-container .calc-cta-label:not(:empty) { margin-bottom: 12px; }

/* Stray <br>/<p> a page builder may still inject */
.filament-calculator-container br,
.filament-calculator-container p:empty { display: none; }

/* Shop button */
.filament-calculator-container a.calc-cta-btn,
.filament-calculator-container a.calc-cta-btn:visited {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    white-space: normal;
    word-break: normal;
    box-shadow: none;
    transform: none;
    border: 0;
    outline-offset: 2px;
    text-decoration: none !important;
    background-image: none;
}
.filament-calculator-container a.calc-cta-btn:hover,
.filament-calculator-container a.calc-cta-btn:focus,
.filament-calculator-container a.calc-cta-btn:active {
    transform: none;
    box-shadow: none;
    text-decoration: none !important;
    background-image: none;
}

/* "How this value was calculated" link: a text link, not a theme button */
.filament-calculator-container button.calc-explain-link,
.filament-calculator-container button.calc-explain-link:hover,
.filament-calculator-container button.calc-explain-link:focus,
.filament-calculator-container button.calc-explain-link:active {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    max-width: 100%;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
    white-space: normal;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
    overflow-wrap: anywhere;
}
.filament-calculator-container button.calc-explain-link { color: var(--fc-blue); text-align: center; }
.filament-calculator-container button.calc-explain-link:hover { color: var(--fc-blue-hover); }

/* Selects: drop theme chevrons, heights and shadows */
.filament-calculator-container select.calculator-select {
    max-width: 100%;
    line-height: 1.4;
    text-indent: 0;
}

/* Modal close button */
.calc-modal-overlay button.calc-modal-close,
.calc-modal-overlay button.calc-modal-close:hover,
.calc-modal-overlay button.calc-modal-close:focus {
    -webkit-appearance: none;
    appearance: none;
    min-height: 0;
    min-width: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    box-shadow: none;
    transform: none;
    flex: none;
}
.calc-modal-overlay button.calc-modal-close { background: transparent; color: var(--fc-ink-3); }
.calc-modal-overlay button.calc-modal-close:hover { background: var(--fc-panel); color: var(--fc-ink); }
.calc-modal-overlay p { margin: 0; }

