/* Interactive sections: [me_vs_muut] and [hintalaskuri] (inc/InteractiveSections.php).
   They print the two columns of a `.mh-text-sec` (head left, body right, 100px apart,
   see content.css); this file styles what is inside them. Brand: black, white and the
   yellow accent, nothing centred, no frames around list rows, one 1.25rem rhythm. */

.mhi [hidden] {
    display: none !important;
}

.mhi fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.mhi :focus-visible {
    outline: 3px solid var(--color-black);
    outline-offset: 3px;
}

.mhi-vh {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.mhi-nw {
    white-space: nowrap;
}

.mhi-lead {
    max-width: 52ch;
}

/* The calculator's controls are tall: the head scrolls with the page instead of sticking */
.mh-text-sec__head.mhi-static {
    position: static;
}

/* ---------- Groups and choices ---------- */
.mhi-group {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-width: 0;
}

.mhi-group__title {
    display: block;
    margin: 0 0 0.5rem;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
}

/* The rows keep a comfortable tap area (padding), but the first and last row do not add to the gaps around the group */
.mhi-group > .mhi-choice:first-child,
.mhi-group > .mhi-group__title + .mhi-choice {
    margin-top: -0.5rem;
}

.mhi-group > .mhi-choice:last-child {
    margin-bottom: -0.5rem;
}

.mhi-choice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.75rem;
    align-items: start;
}

.mhi-choice label {
    padding: 0.5rem 0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.4;
}

.mhi-choice__name {
    display: block;
    font-weight: 600;
}

.mhi-choice__desc {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.875rem;
    opacity: 0.8;
}

.mhi-choice input[type="checkbox"],
.mhi-choice input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    flex: none;
    width: 1.375rem;
    height: 1.375rem;
    margin: 0.5rem 0 0;
    background: var(--color-white);
    border: 2px solid var(--color-black);
    cursor: pointer;
}

.mhi-choice input[type="checkbox"] {
    border-radius: 3px;
    box-shadow: none;
}

.mhi-choice input[type="radio"] {
    border-radius: 50%;
}

.mhi-choice input[type="checkbox"]:checked {
    background: var(--color-black);
    box-shadow: none;
}

.mhi-choice input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 0.36rem;
    top: 0.1rem;
    width: 0.38rem;
    height: 0.7rem;
    border: solid var(--color-white);
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.mhi-choice input[type="radio"]:checked {
    background: var(--color-black);
    box-shadow: inset 0 0 0 3px var(--color-white);
}

.mhi input[type="number"],
.mhi select {
    display: block;
    width: 100%;
    min-height: 3rem;
    margin: 0;
    padding: 0.55rem 0.8rem;
    background-color: var(--color-white);
    color: var(--color-black);
    border: 2px solid var(--color-black);
    border-radius: 4px;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: none;
}

.mhi select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 0.8rem;
}

.mhi-hint {
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* ---------- Price calculator ---------- */
.mhi-fields {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    padding-top: 0.75rem;   /* the head's 1.25rem gap plus this makes 2rem after the lead, like between the groups */
}

.mhi-size {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.mhi-size__num {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mhi-size__num input {
    width: 6.5rem;
}

.mhi-size__unit {
    font-weight: 600;
}

.mhi-size__slider {
    flex: 1 1 11rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.mhi-size__limits {
    display: flex;
    justify-content: space-between;
    font-size: 0.9375rem;
    opacity: 0.8;
}

.mhi input[type="range"] {
    --mhi-fill: 23%;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 2rem;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.mhi input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--color-black) var(--mhi-fill), rgba(0, 0, 0, 0.25) var(--mhi-fill));
}

.mhi input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    margin-top: -12px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 3px solid var(--color-black);
}

.mhi input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.25);
}

.mhi input[type="range"]::-moz-range-progress {
    height: 4px;
    border-radius: 2px;
    background: var(--color-black);
}

.mhi input[type="range"]::-moz-range-thumb {
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 3px solid var(--color-black);
}

/* The lines under the size slider: the range hint and, at the end of the slider, the quote line for homes bigger than
   the calculator takes. The theme's paragraph rule (.mh-landing p) would zero the top margin and add one below. */
.mhi-group > .mhi-size ~ .mhi-hint {
    margin: 0.5rem 0 0;
}

.mhi-hint--limit {
    font-size: 1rem;
    font-weight: 600;
}

/* The one line under "Vuokraan laatikot erikseen": what the calculator assumes */
.mhi-hint--rent {
    padding-left: 2.125rem;
    margin-top: 0.25rem;
}

/* The result: flat yellow, left aligned. One text size (17px), bold for what matters, a hairline above each group,
   prices under the names on a phone and in a right hand column on wider screens, lines at most 40rem. */
.mhi-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    background: var(--color-accent);
    color: var(--color-black);
    font-size: 1.0625rem;
    font-weight: 500;
    line-height: 1.6;
}

.mhi-panel > * {
    margin: 0;
}

/* The theme sets its own paragraph size (smaller on phones): the panel keeps one size */
.mhi-panel p {
    font-size: inherit;
    line-height: inherit;
}

.mhi-result__head {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1.75rem;
}

.mhi-result__head > * {
    margin: 0;
}

.mhi-result__top {
    font-weight: 700;
}

.mhi-panel .mhi-result__price {
    margin-top: 0.25rem;
    font-size: clamp(2.25rem, 7vw, 3.25rem);
    font-weight: 800;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}

.mhi-result__group {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem 0 1.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.35);
}

.mhi-result__group:last-child {
    padding-bottom: 0;
}

.mhi-panel .mhi-label,
.mhi-label {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1.4;
}

.mhi-lines {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 0;
}

/* phone: name, then the price big under it, then the explanation */
.mhi-lines__row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mhi-lines dt {
    font-weight: 700;
}

.mhi-lines dd {
    margin: 0;
}

.mhi-lines__kicker {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
}

.mhi-lines__sum {
    font-size: 1.25rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.mhi-lines__text {
    font-weight: 500;
}

.mhi-lines__note {
    max-width: 40rem;
    font-size: 1rem;
    line-height: 1.55;
}

.mhi-lines__row > .mhi-lines__note {
    margin-top: 0.25rem;
}

.mhi-remarks {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 40rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 1rem;
    line-height: 1.55;
}

.mhi-remarks li {
    position: relative;
    margin: 0;
    padding-left: 1.25em;
}

.mhi-remarks li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 0.4em;
    height: 0.4em;
    background: var(--color-black);
    border-radius: 50%;
}

/* wider screens: name on the left, price in a right hand column */
@media (min-width: 641px) {
    .mhi-lines__row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 1.5rem;
        row-gap: 0.25rem;
        align-items: baseline;
    }

    .mhi-lines__sum {
        font-size: 1.0625rem;
        font-weight: 700;
        text-align: right;
    }

    .mhi-lines__text,
    .mhi-lines__note {
        grid-column: 1 / -1;
    }
}

.mhi-below {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    width: 100%;
}

.mhi-below > * {
    margin: 0;
}

.mhi-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .mhi-buttons {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .mhi-buttons .mh-painike {
        width: 100%;
    }
}

/* Links in the result and in the size notice keep the text colour and are underlined */
.mhi-panel a,
.mhi-hint--limit a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.mhi-panel a:hover,
.mhi-panel a:focus-visible,
.mhi-hint--limit a:hover,
.mhi-hint--limit a:focus-visible {
    text-decoration-thickness: 2px;
}

.mhi-small {
    font-size: 0.8125rem;
    opacity: 0.8;
}

/* ---------- Floating price (phones and tablets) ---------- */
.mhi-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem max(16px, env(safe-area-inset-right, 0px)) calc(0.75rem + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    background: var(--color-accent);
    color: var(--color-black);
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.2);
}

.mhi-bar__sum {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mhi-bar__label {
    overflow: hidden;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mhi-bar__price {
    font-size: 1.375rem;
    font-weight: 800;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mhi-bar .mhi-bar__btn {
    flex: none;
    width: auto;
    max-width: none;
    padding: 14px 18px;
    font-size: 0.8125rem;
    white-space: nowrap;
}

/* The site's own floating buttons would sit under the bar: hide them while it shows */
body.mhi-bar-on .kansleri-floating-cta-banner {
    display: none;
}

@media (min-width: 1025px) {
    .mhi-bar {
        display: none !important;
    }
}
