/*////////////////////////////////////////////////////////////////////////////////////////////////////
//  Horsepower & Torque page (horsepower.php)
//  Same look as the part search page and its horsepower popup (tech-tools/part-search/customContent.css):
//  a navy header bar with a red underline, then white cards on a light gray panel. Gear specs on the left,
//  results on the right; one column on phones.
////////////////////////////////////////////////////////////////////////////////////////////////////*/

select {
    font: 12px "Trebuchet MS", Arial, Helvetica, Geneva, sans-serif;
}

#hpLogo {
    display: none;
}

/*////////////////////////////////////////// the panel //////////////////////////////////////////*/
#controls {
    --hp-navy: #1a304d;
    --hp-navy-2: #243f63;
    --hp-red: #cc0033;
    --hp-red-dark: #a3002a;
    --hp-bg: #eef2f6;
    --hp-text: #1d2733;
    --hp-label: #34414f;
    --hp-muted: #5b6776;
    --hp-border: #cfd8e3;
    --hp-input-border: #b9c5d3;
    --hp-focus: #2f80ed;
    --hp-input-h: 38px;
    --hp-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    box-sizing: border-box;
    display: block;
    width: auto;
    max-width: min(1100px, calc(100% - 32px));
    margin: 12px auto 24px;
    padding: 0 0 16px;
    background: var(--hp-bg);
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(26, 48, 77, .18);
    color: var(--hp-text);
    font: 14px/1.4 var(--hp-font);
    text-align: left;
}

#controls *,
#controls *::before,
#controls *::after {
    box-sizing: border-box;
}

#controls label,
#controls input,
#controls select,
#controls button {
    font-family: var(--hp-font);
}

/*---------- header bar ----------*/
#controls #hpHeader {
    padding: 14px 18px 12px;
    background: var(--hp-navy);
    border-bottom: 3px solid var(--hp-red);
    border-radius: 14px 14px 0 0;
    color: #fff;
}

#controls #hpTitle {
    margin: 0;
    padding: 0;
    color: #fff;
    font: 700 20px/1.2 var(--hp-font);
    letter-spacing: .02em;
    text-align: left;
    text-shadow: none;
}

#controls #hpSubtitle {
    margin: 4px 0 0;
    color: #c9d6e6;
    font-size: 14px;
}

/*---------- specs + results ----------*/
#controls #hpBody {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
    gap: 14px;
    align-items: start;
    padding: 14px 16px 0;
}

#controls .hpCard {
    display: block;
    width: auto;
    margin: 0;
    padding: 16px 18px 18px;
    background: #fff;
    border: 1px solid var(--hp-border);
    border-radius: 10px;
    color: var(--hp-text);
    text-align: left;
}

#controls .hpCardTitle {
    margin: 0 0 12px;
    padding: 0 0 10px;
    border-bottom: 1px solid #e3e9f0;
    color: var(--hp-navy);
    font: 700 17px/1.2 var(--hp-font);
    text-align: left;
    text-shadow: none;
    white-space: normal;
}

/*---------- gear specs ----------*/
#controls #hpFields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

#controls .pInputs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: auto;
    min-width: 0;
    margin: 0;
    text-align: left;
}

#controls .hpLabel {
    float: none;
    color: var(--hp-label);
    font: 600 13px var(--hp-font);
    text-align: left;
}

#controls .hpControl,
#controls input.specbox1,
#controls select {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: var(--hp-input-h);
    padding: 0 10px;
    border: 1px solid var(--hp-input-border) !important;
    border-radius: 8px;
    background-color: #fff;
    color: var(--hp-text);
    font: 600 14px var(--hp-font);
    text-transform: none;
    transition: border-color .15s, box-shadow .15s;
}

#controls input.specbox1 {
    font-variant-numeric: tabular-nums;
}

#controls .hpControl:focus {
    outline: none;
    border-color: var(--hp-focus) !important;
    box-shadow: 0 0 0 3px rgba(47, 128, 237, .2);
}

#controls #getHorsepowerButton {
    display: block;
    width: 100%;
    min-height: 46px;
    margin: 16px 0 0;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: var(--hp-red);
    color: #fff;
    font: 700 15px var(--hp-font);
    text-shadow: none;
    box-shadow: none;
    cursor: pointer;
    transition: background .15s;
}

#controls #getHorsepowerButton:hover {
    background: var(--hp-red-dark);
}

/* under Get Horsepower; same size, navy so the two read as different actions */
#controls #buildGearButton {
    display: block;
    width: 100%;
    min-height: 46px;
    margin: 10px 0 0;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: var(--hp-navy);
    color: #fff;
    font: 700 15px var(--hp-font);
    cursor: pointer;
    transition: background .15s;
}

#controls #buildGearButton:hover {
    background: var(--hp-navy-2);
}

/* shown by showErrors() in horsepower.js while a spec box is empty or not a number */
#controls #errors {
    position: static;
    width: auto;
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: var(--hp-red);
    box-shadow: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

#controls .hpNote {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f1f5fa;
    color: var(--hp-muted);
    font-size: 13px;
    line-height: 1.5;
}

#controls .hpNote a,
#controls #hpFieldset a {
    color: var(--hp-navy);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

#controls .hpNote a:hover,
#controls #hpFieldset a:hover {
    color: var(--hp-red);
}

#controls .newwinIcon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

/*---------- results ----------*/
#controls #resultsDiv {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: auto;
    margin: 0;
    min-width: 0;
}

#controls #resultsTable {
    display: block;
    width: auto;
    max-width: none;
    border: 0;
    border-radius: 0;
}

#controls .hpRow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(90px, auto);
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #edf1f5;
}

#controls .hpRow:last-child {
    border-bottom: 0;
}

#controls .hpRow label {
    color: var(--hp-label);
    font: 600 13px/1.35 var(--hp-font);
}

/* calculated values read as text: right-aligned numbers */
#controls #resultsTable input.hpResult {
    width: 100%;
    max-width: none;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--hp-text);
    font: 600 15px var(--hp-font);
    font-variant-numeric: tabular-nums;
    text-align: right;
    box-shadow: none;
    cursor: default;
}

#controls #resultsTable input.hpResult:focus {
    outline: none;
}

/* horsepower and torque: the main answers */
#controls .hpRow.hpKey {
    margin: 0 -18px;
    padding: 10px 18px;
    background: #f1f5fa;
    border-bottom-color: #e3e9f0;
}

#controls .hpRow.hpKey label {
    color: var(--hp-navy);
    font-size: 14px;
    font-weight: 700;
}

#controls #resultsTable .hpKey input.hpResult {
    color: var(--hp-navy);
    font-size: 18px;
    font-weight: 700;
}

#controls .considerations {
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px solid #f0c36d;
    border-left: 4px solid #e0a100;
    border-radius: 8px;
    background: #fff7e0;
    color: #4d3b00;
    font: 13px/1.5 var(--hp-font) !important;
    text-align: left;
    white-space: normal;
}

#controls #resources {
    margin: 0;
    font-size: 14px;
}

#controls #resourceLegend {
    border-width: 0 0 1px;
    border-color: #e3e9f0;
    border-style: solid;
}

#controls #hpFieldset {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
}

/* link + its new-window icon on one line */
#controls .hpResourceLink {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

#controls .hpResourceLink .newwinIcon {
    flex: 0 0 auto;
    margin-right: 0;
}

#controls #hpDisclaimer {
    position: static;
    display: block;
    margin: 0;
    padding: 0 2px;
    border: 0;
    background: none;
    color: var(--hp-muted);
    font: 12px/1.5 var(--hp-font);
}

/*---------- tablets and phones ----------*/
@media (max-width: 860px) {
    #controls #hpBody {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    #controls {
        --hp-input-h: 44px;
        max-width: calc(100% - 16px);
        margin-top: 8px;
    }

    #controls #hpHeader {
        padding: 12px 14px 10px;
    }

    #controls #hpTitle {
        font-size: 18px;
    }

    #controls #hpBody {
        gap: 12px;
        padding: 12px 10px 0;
    }

    #controls .hpCard {
        padding: 14px;
    }

    #controls .hpRow.hpKey {
        margin: 0 -14px;
        padding: 10px 14px;
    }

    /* 16px stops iOS from zooming on focus */
    #controls .hpControl,
    #controls input.specbox1,
    #controls select {
        font-size: 16px;
    }

    #controls .hpLabel,
    #controls .hpRow label {
        font-size: 14px;
    }
}

@media (max-width: 420px) {
    #controls #hpFields {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    #controls * {
        transition: none !important;
    }
}
