/* =========================================================
   EPINOZIA | PHYSICS — CALCULATOR OVERRIDES
   Load AFTER /css/calculators.css.
   Shared layout and visual styles live in the global file.
   Physics-only components and intentional differences stay here.
========================================================= */

.calculator-layout {
    width: calc(100% - 32px);
    max-width: 1600px;
    grid-template-columns: var(--ad-sidebar-width)
        minmax(0, var(--site-max-width))
        var(--ad-sidebar-width);
    gap: 24px;
}

.calculator-ad {
    min-height: var(--ad-sidebar-height);
}

.calculator-inputs {
    min-width: 0;
}

.input-group label {
    font-size: 14px;
}

.input-note {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

.physics-input {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.physics-input:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.physics-input input {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #0f172a;
    font-size: 16px;
    font-weight: 600;
}

.physics-input input::placeholder {
    color: #94a3b8;
    opacity: 1;
    font-weight: 400;
}

.physics-input .input-unit {
    padding: 0 14px;
    flex-shrink: 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.physics-input.is-unknown {
    background-color: #eff6ff;
    border-color: #93c5fd;
}

.physics-input.is-unknown input {
    color: #2563eb;
}

.physics-input input:disabled {
    cursor: not-allowed;
    opacity: 1;
}

.physics-input.is-unknown:focus-within {
    box-shadow: none;
}

.unknown-label {
    color: #2563eb;
    font-size: 11px;
    font-weight: 600;
}

.variable-selector {
    margin-bottom: 28px;
}

.variable-selector label {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
}

.variable-selector select {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #0f172a;
    font-size: 14px;
    cursor: pointer;
}

.variable-selector select:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.18);
    outline-offset: 2px;
    border-color: #2563eb;
}

.calculator-actions {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.calculate-button,
.reset-button {
    min-height: 44px;
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease,
        border-color 0.2s ease;
}

.calculate-button {
    background-color: #2563eb;
    border: 1px solid #2563eb;
    color: #ffffff;
}

.calculate-button:hover {
    background-color: #1d4ed8;
}

.reset-button {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.reset-button:hover {
    background-color: #f8fafc;
}

.calculate-button:focus-visible,
.reset-button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 3px;
}

.calculator-message {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.6;
}

.calculator-message[hidden] {
    display: none;
}

.calculator-message.error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.calculator-message.info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.calculator-results h2 {
    margin: 0 0 28px;
    color: #0f172a;
    font-size: clamp(23px, 3vw, 30px);
    line-height: 1.25;
}

.result-main strong {
    display: block;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.result-summary {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.result-summary > div {
    min-width: 0;
    border-radius: 8px;
}

.result-summary strong {
    display: block;
    overflow-wrap: anywhere;
}

.calculator-chart {
    min-height: 240px;
}

.physics-visualization {
    width: 100%;
    min-height: 240px;
    display: block;
}

.physics-visualization svg {
    width: 100%;
    height: auto;
    display: block;
}

.solution-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.solution-section h3 {
    margin-bottom: 14px;
    color: #0f172a;
    font-size: 16px;
}

.solution-toggle {
    min-height: 42px;
    padding: 10px 16px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #2563eb;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.solution-toggle:hover {
    background-color: #eff6ff;
    border-color: #93c5fd;
}

.solution-toggle:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.solution-content {
    margin-top: 18px;
    padding: 20px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.solution-content[hidden] {
    display: none;
}

.solution-step {
    margin-bottom: 20px;
}

.solution-step:last-child {
    margin-bottom: 0;
}

.solution-step h4 {
    margin-bottom: 8px;
    color: #0f172a;
    font-size: 13px;
}

.solution-step p {
    margin-bottom: 8px;
    color: #475569;
    font-size: 13px;
    line-height: 1.7;
}

.solution-formula {
    margin: 12px 0;
    padding: 12px 14px;
    background-color: #ffffff;
    border-left: 3px solid #2563eb;
    border-radius: 6px;
    color: #123a63;
    font-size: 15px;
    line-height: 1.7;
    overflow-x: auto;
}

.calculator-explanation {
    margin-top: 28px;
    padding: 20px;
    background-color: #eff6ff;
    border-radius: 10px;
}

.calculator-explanation h3 {
    margin-bottom: 10px;
    color: #0f172a;
    font-size: 15px;
}

.calculator-explanation p {
    color: #475569;
    font-size: 13px;
    line-height: 1.7;
}

.calculator-learn-more p {
    margin-bottom: 12px;
}

.calculator-learn-button {
    border-radius: 8px;
    font-size: 13px;
    transition: background-color 0.2s ease;
}

.calculator-learn-button:hover {
    background-color: #0d2f52;
}

.calculator-learn-button:focus-visible {
    outline: 3px solid rgba(18, 58, 99, 0.22);
    outline-offset: 2px;
}

@media (max-width: 1599px) {
    .calculator-layout {
        width: min(92%, var(--site-max-width));
    }

    .calculator-mobile-ad {
        width: min(100%, 728px);
        min-height: 90px;
        margin: 24px auto 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

}

@media (max-width: 1023px) {
    .calculator-tool {
        grid-template-columns: 1fr;
    }

    .calculator-header {
        width: min(92%, 720px);
    }

    .calculator-intro,
    .calculator-instruction {
        text-align: left;
    }

    .calculator-mobile-ad {
        width: 100%;
        max-width: 728px;
    }

}

@media (max-width: 599px) {
    .calculator-header,
    .calculator-layout {
        margin-inline: auto;
    }

    .calculator-layout {
        gap: 18px;
    }

    .calculator-mobile-ad {
        width: 100%;
        max-width: var(--ad-mobile-width);
        min-height: var(--ad-mobile-height);
    }

    .calculator-actions {
        flex-direction: column;
    }

    .calculate-button,
    .reset-button {
        width: 100%;
    }

    .result-summary {
        grid-template-columns: 1fr;
    }

    .solution-content {
        padding: 15px;
    }

}

/* Kinematics Solver: compact method selector */

.method-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.method-buttons label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 10px 12px;
    text-align: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
}

.method-buttons label:has(input:checked) {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
}

.method-buttons input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.method-buttons label:has(input:focus-visible) {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 3px;
}

/* Kinematics Solver: method label */

#solving-method-label {
    display: block;
    margin: 0 0 8px;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.physics-visualization[hidden] {
    display: none !important;
}


/* =========================================
   KINEMATICS - CONFLICTING RESULTS
   ========================================= */

/* Keep normal results large */
#result-value {
    display: block;
    font-size: clamp(1.8rem, 2.5vw, 2.5rem);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

/* Smaller text for conflicting results */
#result-value:has(.conflict-results) {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
}

/* Conflict container */
.conflict-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

/* Conflict heading */
.conflict-results h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #b45309;
}

/* Explanation */
.conflict-results p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #64748b;
}

/* Individual equation results */
.conflict-results .conflict-item {
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

/* Calculated value */
.conflict-results .conflict-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: #123a63;
    margin-bottom: 4px;
}

/* Equation description */
.conflict-results .conflict-description {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.5;
    color: #64748b;
}

/* Mobile adjustments */
@media (max-width: 599px) {
    .conflict-results .conflict-item {
        padding: 10px 12px;
    }

    .conflict-results .conflict-value {
        font-size: 1rem;
    }
}


/* =========================================================
   PHYSICS — READABILITY AND SPACING REFINEMENTS
   Match Finance typography without changing shared styles.
   ========================================================= */

/* Guidance text and field labels */
.calculator-inputs .input-note {
    font-size: 15px;
    line-height: 1.65;
    margin: 8px 0 18px;
}

.calculator-inputs .input-group label,
.calculator-inputs .variable-selector label {
    font-size: 14px;
    line-height: 1.5;
}

/* Space after the instructions before the first input */
.calculator-inputs .input-note + .input-group {
    margin-top: 14px;
}

/* Solution instructions and button */
.solution-section > p,
.solution-section > .input-note,
.solution-section > small {
    display: block;
    font-size: 15px;
    line-height: 1.65;
    color: #475569;
    margin: 0 0 16px;
}

.solution-section .solution-toggle {
    font-size: 14px;
    margin-top: 10px;
}

.solution-step h4 {
    font-size: 16px;
    line-height: 1.4;
}

.solution-step p,
.calculator-explanation p {
    font-size: 15px;
    line-height: 1.7;
}

.calculator-message,
.conflict-results p {
    font-size: 14px;
    line-height: 1.65;
}

.conflict-results .conflict-description {
    font-size: 13px;
    line-height: 1.6;
}

.calculator-explanation h3 {
    font-size: 16px;
}

.calculate-button,
.reset-button {
    font-size: 14px;
}

/* Initial results placeholder */
.calculator-results .result-main span {
    font-size: 15px;
    line-height: 1.6;
}

/* =========================================================
   PHYSICS — RESPONSIVE LAYOUT FIX
   Override the desktop three-track grid below 1600px.
   Keep shared and Finance CSS unchanged.
   ========================================================= */
@media (max-width: 1599px) {
    .calculator-layout {
        grid-template-columns: minmax(0, 1fr);
        width: min(92%, var(--site-max-width, 1200px));
        max-width: 1200px;
        gap: 20px;
    }

    .calculator-layout > .calculator-tool {
        min-width: 0;
    }

    .calculator-ad-left,
    .calculator-ad-right {
        display: none;
    }
}

@media (max-width: 1023px) {
    .calculator-tool {
        grid-template-columns: minmax(0, 1fr);
    }

    .calculator-inputs {
        border-right: 0;
        border-bottom: 1px solid #e2e8f0;
    }
}

@media (max-width: 599px) {
    .calculator-layout {
        width: calc(100% - 32px);
        grid-template-columns: minmax(0, 1fr);
    }

    .calculator-tool,
    .calculator-inputs,
    .calculator-results {
        min-width: 0;
    }

    .calculator-inputs,
    .calculator-results {
        padding: 19px;
    }
}
