/* Világos műszaki munkafelület;
a számítás és a rajz közös vizuális rendszert kap. */
.calculator-page {
    padding-bottom: 72px;
    animation: calculator-enter 420ms cubic-bezier(.22, 1, .36, 1);
}

@keyframes calculator-enter {
    from {
        opacity: 0;
        transform: translateY(7px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calc-intro {
    padding-top: 42px;
    padding-bottom: 34px;
}

.calc-back {
    display: inline-block;
    margin-bottom: 28px;
    color: var(--green-text);
}

.calc-intro h1 {
    max-width: 850px;
    font-size: clamp(32px, 4vw, 54px);
    margin: 12px 0 20px;
}

.calc-intro > p:last-child {
    max-width: 780px;
    font-size: 21px;
    color: var(--muted);
}

.calc-category {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.calc-category a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 10px;
    text-decoration: none;
    font-weight: 650;
}

.calc-category [aria-current] {
    color: var(--green-text);
    border-color: #77974d;
    background: #edf4e4;
    box-shadow: inset 0 -3px #78a632;
}

.calc-workspace {
    border: 1px solid #d5dfcd;
    border-radius: 20px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 14px 40px #263d1b08;
    margin-bottom: 28px;
}

.calc-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 28px 32px;
    background: linear-gradient(115deg, #f2f6eb, #fdfefb);
    border-bottom: 1px solid var(--line);
}

.calc-heading h2 {
    margin: 8px 0 0;
    font-size: clamp(25px, 2.5vw, 32px);
}

.calc-heading-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    color: var(--green);
}

.calc-modes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 20px 32px;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.calc-modes button {
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
    transition: background .35s ease, border-color .35s ease, box-shadow .35s ease;
}

.calc-modes .ui-icon {
    width: 23px;
    height: 23px;
    color: var(--green);
    margin-bottom: 7px;
}

.electric-modes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.electric-modes button {
    display: flex;
    gap: 12px;
    align-items: center;
}

.electric-modes .ui-icon {
    margin-bottom: 0;
    flex-shrink: 0;
}

.electric-circuit {
    margin: 0 0 20px;
}

.electric-circuit svg {
    width: 100%;
    display: block;
}

.electric-circuit text {
    fill: var(--green-text);
    font: 16px "Source Sans 3", sans-serif;
}

.electric-ok {
    color: #325e08;
}

.electric-warning {
    color: #a43128;
}

.calc-modes span {
    display: block;
    color: var(--green-text);
    font-size: 21px;
    font-weight: 700;
}

.calc-modes strong {
    font-size: 16px;
}

.calc-modes [aria-pressed="true"] {
    background: #edf4e4;
    border-color: #77974d;
    box-shadow: inset 3px 0 var(--green);
}

.calc-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.calc-form, .calc-result-panel {
    padding: 30px 32px;
    min-width: 0;
}

.calc-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.calc-result-panel {
    border-left: 1px solid var(--line);
    background: linear-gradient(145deg, #f8faf4, #fff 75%);
}

.calc-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.calc-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 16px;
    font-weight: 650;
    min-width: 0;
}

.calc-input {
    display: flex;
    border: 1px solid #9aa792;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.calc-input:focus-within {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

.calc-input input {
    width: 100%;
    min-width: 0;
    border: 0;
    padding: 11px 13px;
    background: transparent;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.calc-input input:focus-visible {
    outline: none;
}

.calc-input > span {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f0f4eb;
    color: var(--green-text);
    white-space: nowrap;
}

.calc-field select {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid #9aa792;
    border-radius: 8px;
    color: var(--ink);
    background: #fff;
}

.calc-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 16px;
    font-weight: 650;
}

.calc-option input {
    width: 19px;
    height: 19px;
    margin-top: 4px;
    accent-color: var(--green);
}

.calc-option small {
    display: block;
    color: var(--muted);
    font-weight: 400;
}

/* Az eredeti sebességértékelés színei; a szöveges minősítés is mindig látszik. */
.calc-flow {
    --flow-color: #71806a;
    --flow-duration: 4s;
    margin: 0 0 24px;
    padding: 16px;
    border: 1px solid #dce4d6;
    border-radius: 12px;
    background: #fff;
}

.calc-flow[data-band="low"] {
    --flow-color: #226b91;
}

.calc-flow[data-band="moderate"] {
    --flow-color: #437608;
}

.calc-flow[data-band="elevated"] {
    --flow-color: #976000;
}

.calc-flow[data-band="high"] {
    --flow-color: #b63429;
}

.flow-heading {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 15px;
    font-weight: 650;
}

.flow-heading button {
    border: 0;
    background: transparent;
    color: var(--green-text);
    font-size: 13px;
    text-decoration: underline;
    min-height: 32px;
}

.calc-flow svg {
    display: block;
    width: 100%;
    margin: 10px auto;
}

.flow-duct {
    fill: #f5f7f1;
    stroke: #718167;
    stroke-width: 2;
}

.flow-stream {
    stroke: var(--flow-color);
    fill: none;
    stroke-width: 2.5;
    animation: duct-flow var(--flow-duration) linear infinite;
}

.calc-flow:not([data-band]) .flow-stream,
.calc-flow.is-paused .flow-stream {
    animation-play-state: paused;
}

#air-band {
    color: var(--flow-color);
    font-weight: 650;
    font-size: 16px;
}

.calc-flow small {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

@keyframes duct-flow {
    to {
        transform: translateX(160px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .flow-stream {
        animation: none;
    }

    #air-pause {
        display: none;
    }
}

.calculator-page [hidden] {
    display: none !important;
}

.calc-field:has([aria-invalid="true"]) .calc-input {
    border-color: #ac352d;
    outline-color: #ac352d;
}

.calc-error {
    color: #9b3028;
    padding: 12px;
    background: #fff1ef;
    border-radius: 8px;
}

.calc-method {
    font-size: 16px;
    color: var(--muted);
}

.calc-method summary {
    cursor: pointer;
    color: var(--green-text);
    font-weight: 650;
    padding: 10px 0;
}

.calc-method .calc-fields, .calc-method p {
    margin-top: 16px;
}

.calc-method-wide {
    border-top: 1px solid var(--line);
    padding: 16px 32px 22px;
}

.calc-method-wide a {
    display: inline-block;
    margin-top: 16px;
    color: var(--green-text);
}

.calc-technical {
    margin: 0 0 24px;
    text-align: center;
}

.calc-technical svg {
    display: block;
    width: 100%;
    max-width: 380px;
    height: 220px;
    margin: auto;
    overflow: visible;
}

.calc-technical figcaption {
    color: var(--muted);
    font-size: 14px;
    margin-top: 12px;
}

.drawing-grid {
    stroke: #819d5d;
    stroke-width: .4;
    opacity: .3;
}

#drawing-grid path {
    fill: none;
    stroke: #819d5d;
    stroke-width: .5;
}

.duct-outline {
    stroke: #456b21;
    stroke-width: 3;
    fill: #e4eed6;
}

.dimension-line {
    stroke: #687a5a;
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 4 4;
}

.calc-technical text {
    fill: #34492d;
    font: 15px "Source Sans 3", sans-serif;
}

.air-particles {
    fill: #5c9219;
    animation: air-pulse 2.4s ease-in-out infinite;
}

@keyframes air-pulse {
    50% {
        opacity: .35;
        transform: translateX(8px);
    }

}

.calc-result-main {
    padding: 19px 22px;
    background: #edf4e4;
    border: 1px solid #d3e2bd;
    border-radius: 12px;
    margin-bottom: 16px;
}

.calc-result-main span {
    display: block;
    color: var(--green-text);
    font-size: 15px;
}

.calc-result-main strong {
    display: block;
    font-size: clamp(26px, 3vw, 38px);
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.calc-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 0;
}

.calc-result-grid > div {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.calc-result-grid dt {
    font-size: 14px;
    color: var(--muted);
}

.calc-result-grid dd {
    margin: 0;
    font-size: 21px;
    font-weight: 650;
}

.calc-form .button {
    align-self: flex-start;
}

.calc-muted, .calc-empty, .calc-note {
    color: var(--muted);
    font-size: 16px;
}

.calc-empty {
    padding: 18px 0;
}

.calc-note {
    margin-top: 16px;
}

.calc-layer {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.calc-layer > span {
    color: var(--green-text);
    font-weight: 700;
}

.calc-layer small {
    display: block;
    color: var(--muted);
}

#add-section {
    margin-top: 22px;
}

.material-project > .calc-muted, #project-sections, #project-materials {
    margin: 20px 32px;
}

.project-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
}

.project-section button {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 7px;
    min-height: 44px;
    padding: 8px 12px;
    color: #873b31;
}

.calc-table-scroll {
    overflow-x: auto;
}

.calc-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 16px;
}

.calc-table th, .calc-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.calc-table th {
    background: #f1f5eb;
    color: var(--green-text);
    font-size: 14px;
}

.calc-table td:not(:first-child) {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.electric-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #f6f8f1;
}

.electric-preview-content {
    padding: 32px;
}

.electric-preview-content > p:not(.eyebrow) {
    max-width: 72ch;
}

.electric-preview h2 {
    font-size: 28px;
    margin-top: 10px;
}

.electric-preview .calc-muted {
    margin: 12px 0 20px;
}

.electric-drawing {
    position: relative;
    background: #e8ece3;
    overflow: hidden;
}

/* A HTML magasság helyett a vízszintes képkivágás adja a megjelenési arányt. */
.electric-drawing img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 12 / 5;
    object-fit: cover;
    object-position: center 48%;
    transition: transform 700ms cubic-bezier(.22, 1, .36, 1);
}

.electric-preview:hover .electric-drawing img {
    transform: scale(1.025);
}

.preview-lock .ui-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
}

.preview-lock {
    position: absolute;
    left: 24px;
    bottom: 20px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: #fff;
    background: #344331;
    border-radius: 30px;
    font-size: 15px;
}

.calculator-page button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

@media (max-width: 800px) {
    .calc-columns, .electric-preview {
        grid-template-columns: 1fr;
    }

    .calc-result-panel {
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .calc-modes {
        grid-template-columns: 1fr 1fr;
    }

    .calc-heading {
        flex-wrap: wrap;
    }

}

@media (max-width: 480px) {
    .calc-heading, .calc-form, .calc-result-panel, .calc-method-wide, .electric-preview-content {
        padding: 22px 18px;
    }

    .electric-drawing img {
        aspect-ratio: 16 / 9;
    }

    .preview-lock {
        left: 16px;
        bottom: 16px;
        font-size: 13px;
    }

    .calc-modes {
        padding: 18px;
        gap: 8px;
    }

    .calc-modes button {
        padding: 10px;
    }

    .calc-fields {
        grid-template-columns: 1fr;
    }

    .material-project > .calc-muted, #project-sections, #project-materials {
        margin: 18px;
    }

    .calc-category a {
        flex: 1;
        justify-content: center;
        padding: 12px;
        font-size: 16px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .calculator-page {
        animation: none;
    }

    .electric-drawing img {
        transition: none;
        transform: none !important;
    }
    .air-particles {
        animation: none;
    }

    .calc-modes button {
        transition: none;
    }

}
