/* ============================================================
   Magnetic Pull Force Calculator (v2) — Dura Magnetics theme
   Eurostile Extended display + Lato body. Dura blue palette.
   Theme tokens mirrored from the site stylesheet:
     dark-blue        #001f56
     blue             #2c72cf
     light-blue       #6bd8fe
     very-light-blue  #c9defc
     red              #cd1722
     grey             #2c2c2c
     bright-grey      #acacac
     light-grey       #e9e9e9
     white-grey       #707070
   Theme fonts (eurostile-extd, lato-regular, etc.) are declared
   by the theme via @font-face; we reference family names directly.
   ============================================================ */

.mpfc-v2,
.mpfc-v2 * {
    box-sizing: border-box;
}

.mpfc-v2 {
    --d-dark-blue:        #001f56;
    --d-blue:             #2c72cf;
    --d-light-blue:       #6bd8fe;
    --d-very-light-blue:  #c9defc;
    --d-red:              #cd1722;
    --d-grey:             #2c2c2c;
    --d-bright-grey:      #acacac;
    --d-light-grey:       #e9e9e9;
    --d-white-grey:       #707070;
    --d-dark-grey:        #252a3c;
    --d-white:            #ffffff;

    max-width: 640px;
    margin: 28px auto;
    background: var(--d-white);
    color: var(--d-grey);
    border: 1px solid var(--d-bright-grey);
    border-radius: 6px;
    box-shadow: 0 4px 28px rgba(0, 31, 86, 0.10);
    font-family: 'lato-regular', 'Lato', Helvetica, Arial, sans-serif !important;
    font-size: 16px;
    line-height: 1.5;
    overflow: hidden;
}

.mpfc-v2 a {
    color: inherit;
}

/* ---------- Header ---------- */

.mpfc-v2-header {
    background: var(--d-dark-blue) !important;
    color: var(--d-white) !important;
    padding: 16px 24px 16px;
    position: relative;
}

.mpfc-v2-header::after {
    content: "";
    position: absolute;
    bottom: 0; left: 24px;
    width: 48px;
    height: 3px;
    background: var(--d-red);
}

.mpfc-v2-header-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 8px;
    min-width: 0;
}

.mpfc-v2-eyebrow {
    font-family: 'eurostile-extd', 'Eurostile', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    letter-spacing: 0.20em !important;
    text-transform: uppercase !important;
    color: var(--d-light-blue) !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    flex: 1;
    min-width: 0;
}

.mpfc-v2-version {
    font-family: 'eurostile-extd', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 10px !important;
    letter-spacing: 0.16em !important;
    text-transform: uppercase !important;
    color: var(--d-very-light-blue) !important;
    opacity: 0.75;
    line-height: 1 !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.mpfc-v2-header h2 {
    font-family: 'eurostile-extd', 'Eurostile', Arial, sans-serif !important;
    font-weight: 900 !important;
    font-size: 22px !important;
    line-height: 1.12 !important;
    letter-spacing: 0.035em !important;
    text-transform: uppercase !important;
    color: var(--d-white) !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
}

.mpfc-v2-subtitle {
    font-family: 'lato-regular', 'Lato', Arial, sans-serif !important;
    font-weight: 400 !important;
    font-size: 11px !important;
    letter-spacing: 0.5px !important;
    color: var(--d-very-light-blue) !important;
    background: transparent !important;
    margin: 6px 0 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    opacity: 0.85;
}

/* ---------- Step header + tabs row ---------- */

.mpfc-v2-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px 16px;
}

.mpfc-v2-step-label {
    position: relative;
    padding-bottom: 6px;
    font-family: 'eurostile-extd', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    color: var(--d-grey) !important;
    line-height: 1 !important;
    flex-shrink: 0;
}

.mpfc-v2-step-label::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 32px;
    height: 0;
    border-bottom: 2px solid var(--d-red);
}

.mpfc-v2-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--d-bright-grey);
    border-radius: 4px;
    overflow: hidden;
    background: var(--d-light-grey);
    flex: 1;
    min-width: 0;
}

.mpfc-v2-tabs li {
    margin: 0 !important;
    padding: 0;
    list-style: none;
}

.mpfc-v2-tabs a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    font-family: 'eurostile-extd', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase !important;
    color: var(--d-grey) !important;
    background: var(--d-light-grey) !important;
    text-decoration: none !important;
    border-right: 1px solid var(--d-bright-grey) !important;
    transition: background-color 180ms ease, color 180ms ease;
    line-height: 1.1;
    text-align: center;
}

.mpfc-v2-tabs li:last-child a {
    border-right: 0 !important;
}

.mpfc-v2-tabs a:hover {
    background: var(--d-very-light-blue) !important;
    color: var(--d-dark-blue) !important;
}

.mpfc-v2-tabs a.active {
    background: var(--d-dark-blue) !important;
    color: var(--d-white) !important;
}

/* ---------- Tab body (stacked: diagram on top, inputs below) ---------- */

.mpfc-v2-panel-body {
    padding: 4px 24px 18px;
}

.mpfc-v2-diagram-wrap {
    margin: 0 0 16px;
    padding: 16px 20px 12px;
    background: var(--d-light-grey);
    border-radius: 4px;
    color: var(--d-grey);
    text-align: center;
}

.mpfc-v2-diagram {
    display: block;
    width: 100%;
    max-width: 380px;
    height: auto;
    margin: 0 auto;
}

.mpfc-v2-field-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.mpfc-v2-field {
    margin: 0;
    min-width: 0;
}

.mpfc-v2-field-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.mpfc-v2-field-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.mpfc-v2-field-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin: 0 0 6px !important;
    font-family: 'eurostile-extd', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase !important;
    color: var(--d-grey) !important;
    line-height: 1;
}

.mpfc-v2-field-unit {
    font-family: 'lato-regular', Arial, sans-serif !important;
    font-weight: 400 !important;
    font-size: 10px !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: var(--d-bright-grey) !important;
}

.mpfc-v2-input,
.mpfc-v2-grade {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-family: 'lato-regular', 'Lato', Arial, sans-serif !important;
    font-weight: 400 !important;
    font-size: 15px !important;
    letter-spacing: 0.4px !important;
    line-height: 1.3 !important;
    color: var(--d-grey) !important;
    background: var(--d-white) !important;
    border: 1px solid var(--d-grey) !important;
    border-radius: 4px !important;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: none;
    margin: 0;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.mpfc-v2-input::placeholder {
    color: var(--d-bright-grey) !important;
    font-weight: 400 !important;
}

.mpfc-v2-input:focus,
.mpfc-v2-grade:focus {
    border-color: var(--d-dark-blue) !important;
    box-shadow: 0 0 0 3px rgba(0, 31, 86, 0.14) !important;
}

.mpfc-v2-grade {
    padding-right: 34px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7' fill='none' stroke='%23001f56' stroke-width='1.8'><polyline points='1,1 6,6 11,1'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    cursor: pointer;
}

/* ---------- Calculate button ---------- */

.mpfc-v2-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
    height: 48px !important;
    margin: 4px 0 0 !important;
    padding: 0 16px !important;
    font-family: 'lato-bold', 'Lato', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    color: var(--d-white) !important;
    background: var(--d-dark-blue) !important;
    border: 2px solid var(--d-white) !important;
    border-radius: 4px !important;
    outline: 1px solid var(--d-dark-blue) !important;
    outline-offset: -1px;
    box-shadow: none !important;
    cursor: pointer !important;
    transition: opacity 180ms ease, transform 60ms ease !important;
    text-decoration: none !important;
    line-height: 1 !important;
}

.mpfc-v2-button:hover {
    opacity: 0.92 !important;
}

.mpfc-v2-button:active {
    transform: translateY(1px) !important;
}

.mpfc-v2-button::after {
    content: "→";
    font-family: 'lato-regular', Arial, sans-serif;
    font-weight: 400;
    font-size: 18px;
    letter-spacing: 0;
    line-height: 1;
}

.mpfc-v2-button:focus-visible {
    outline: 2px solid var(--d-light-blue) !important;
    outline-offset: 3px;
}

/* ---------- Result panel ---------- */

.mpfc-v2-result-display {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 8px 0 0;
    padding: 16px 24px;
    background: var(--d-dark-blue) !important;
    color: var(--d-white) !important;
    position: relative;
    min-height: 60px;
}

.mpfc-v2-result-display::before {
    content: "";
    position: absolute;
    top: 0; left: 24px;
    width: 48px;
    height: 3px;
    background: var(--d-red);
}

.mpfc-v2-result-label {
    flex-shrink: 0;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    line-height: 1 !important;
    font-family: 'eurostile-extd', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    letter-spacing: 0.16em !important;
    text-transform: uppercase !important;
    color: var(--d-light-blue) !important;
}

.mpfc-v2-result-value {
    flex: 1;
    text-align: right;
    font-family: 'lato-black', 'Lato', Arial, sans-serif !important;
    font-weight: 900 !important;
    font-size: 30px !important;
    line-height: 1 !important;
    letter-spacing: 0.02em !important;
    color: var(--d-white) !important;
    word-break: break-all;
    min-height: 30px;
}

.mpfc-v2-result-value:not(:empty):not(.mpfc-v2-error)::after {
    content: " lbf";
    margin-left: 6px;
    font-family: 'eurostile-extd', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    color: var(--d-light-blue) !important;
}

.mpfc-v2-result-value:empty::before {
    content: "—";
    opacity: 0.45;
    color: var(--d-very-light-blue) !important;
    font-size: 28px;
    letter-spacing: 0;
}

.mpfc-v2-result-value.mpfc-v2-error {
    font-family: 'lato-regular', 'Lato', Arial, sans-serif !important;
    font-weight: 400 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    letter-spacing: 0.4px !important;
    color: #ffc4ab !important;
    word-break: normal;
}

/* ---------- Footer ---------- */

.mpfc-v2-footer {
    padding: 12px 24px 14px;
    background: var(--d-white);
    border-top: 1px solid var(--d-light-grey);
    font-family: 'lato-regular', 'Lato', Arial, sans-serif !important;
    font-size: 11px !important;
    line-height: 1.5 !important;
    letter-spacing: 0.3px !important;
    color: var(--d-white-grey) !important;
}

.mpfc-v2-clear {
    clear: both;
}

/* ---------- Responsive: stack diagram + fields below 640px ---------- */

@media (max-width: 640px) {
    .mpfc-v2 { margin: 16px; }
    .mpfc-v2-header {
        padding: 14px 18px 14px;
    }
    .mpfc-v2-header::after { left: 18px; }
    .mpfc-v2-header h2 {
        font-size: 19px !important;
    }
    .mpfc-v2-subtitle { font-size: 10px !important; }
    .mpfc-v2-section { padding: 14px 18px; gap: 12px; }
    .mpfc-v2-step-label { font-size: 12px !important; }
    .mpfc-v2-tabs a {
        padding: 10px 4px;
        font-size: 11px !important;
        letter-spacing: 0.08em !important;
    }
    .mpfc-v2-panel-body {
        padding: 0 18px 16px;
    }
    .mpfc-v2-diagram-wrap {
        padding: 12px 12px 8px;
        margin-bottom: 14px;
    }
    .mpfc-v2-diagram {
        max-width: 320px;
    }
    .mpfc-v2-result-display {
        padding: 14px 18px;
    }
    .mpfc-v2-result-display::before { left: 18px; }
    .mpfc-v2-result-value { font-size: 26px !important; }
    .mpfc-v2-footer { padding: 12px 18px 14px; }
}

@media (max-width: 420px) {
    .mpfc-v2-subtitle { display: none; }
    .mpfc-v2-section {
        flex-direction: column;
        align-items: stretch;
    }
}
