/* Kalkulačka přebírá paletu webu. Barva a typ čáry odlišují oba proudy. */
.heat-exchanger {
    padding: var(--layout-gap);
    font-size: 1rem;
}

.heat-exchanger .hx-intro {
    margin: 0 0 var(--layout-gap);
    color: var(--text-secondary);
}

.hx-layout,
.hx-stack {
    display: grid;
    align-items: start;
    gap: var(--layout-gap);
}

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

.hx-panel,
.hx-results,
.hx-graph,
.hx-method {
    min-width: 0;
    margin: 0;
    padding: var(--layout-gap);
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--bg);
}

.hx-panel legend,
.hx-results h3,
.hx-graph figcaption,
.hx-method summary {
    color: var(--heading);
    font-weight: 700;
    font-size: 1rem;
}

.hx-panel legend {
    padding-inline: 5px;
}

.hx-field-grid,
.hx-temperatures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px var(--layout-gap);
}

.hx-panel > * + * {
    margin-top: 10px;
}

.hx-temperatures:first-of-type {
    margin-top: 0;
}

.hx-field {
    display: grid;
    align-content: end;
    gap: 4px;
    min-width: 0;
    font-size: .875rem;
}

.hx-wide,
.hx-side {
    grid-column: 1 / -1;
}

.hx-side {
    margin: 0;
    font-size: .875rem;
    font-weight: 700;
}

.hx-side:not(:first-child) {
    margin-top: 4px;
}

.hx-hot { color: var(--accent); }
.hx-cold { color: var(--link); }

.hx-field input,
.hx-field select,
.hx-reset {
    min-width: 0;
    min-height: 42px;
    padding: 6px 10px;
    border: 1px solid var(--field-border);
    border-radius: 5px;
    background: var(--surface);
    color: var(--text);
}

.hx-field input,
.hx-field select {
    width: 100%;
    font-size: 1rem;
}

.hx-field select {
    appearance: none;
    padding-right: 32px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}

.hx-field [aria-invalid="true"] { border-color: var(--danger); }
.hx-field input:focus-visible,
.hx-field select:focus-visible,
.hx-method summary:focus-visible,
.hx-reset:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
}

.hx-note,
.hx-error {
    margin-bottom: 0;
    font-size: .875rem;
}

.hx-note { color: var(--text-secondary); }
.hx-error { color: var(--danger); }

.hx-results h3 { margin: 0 0 10px; }

.hx-key-results,
.hx-deltas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--layout-gap);
    margin: 0;
}

.hx-key-results > div {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    padding: var(--layout-gap);
    border: 1px solid var(--line);
    border-top: 2px solid var(--heading);
    border-radius: 5px;
    background: var(--surface-raised);
}

.hx-key-results dt {
    color: var(--text-secondary);
    font-size: .875rem;
    font-weight: 700;
}

.hx-key-results dd {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0 6px;
    margin: 2px 0 0;
    color: var(--heading);
    font-size: .875rem;
}

.hx-key-results output {
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.hx-key-results dd,
.hx-result-list dd,
.hx-deltas dd {
    font-variant-numeric: tabular-nums;
}

.hx-result-list {
    margin: 10px 0 0;
    font-size: .875rem;
}

.hx-result-list > div {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    column-gap: var(--layout-gap);
    padding: 6px 0;
}

.hx-result-list > div + div {
    border-top: 1px solid var(--line);
}

.hx-result-list dd,
.hx-deltas dd {
    margin: 0;
    font-weight: 700;
}

.hx-graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px var(--layout-gap);
    margin-block: 4px;
    font-size: .875rem;
}

.hx-graph canvas {
    display: block;
    width: 100%;
    height: 190px;
}

.hx-deltas {
    padding-top: 8px;
    border-top: 1px solid var(--line);
    font-size: .875rem;
}

.hx-deltas > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 6px;
}

.hx-deltas dt { color: var(--text-secondary); }

.hx-actions { margin-top: var(--layout-gap); }
.hx-reset { cursor: pointer; }
.hx-reset:hover { background: var(--surface-hover); }

.hx-method { margin-top: var(--layout-gap); }
.hx-method summary { cursor: pointer; }
.hx-method-content p { margin: 10px 0 0; }
.hx-method-content dl { margin: 10px 0 0; }
.hx-method-content dl > div {
    padding-block: 8px;
    border-bottom: 1px solid var(--line);
}
.hx-method-content dt { font-weight: 700; }
.hx-method-content dd { margin: 0; }
.hx-method-content code {
    color: var(--link);
    overflow-wrap: anywhere;
}

/* Na užším displeji zůstávají vedle sebe jen dvojice souvisejících polí. */
@media (max-width: 720px) {
    .hx-layout { grid-template-columns: minmax(0, 1fr); }
}
