.calculator-main {
    position: relative;
    isolation: isolate;
    padding-block: clamp(2.25rem, 6vw, 4.25rem) 5rem;
    background-color: #f5faf6;
    background-image:
        linear-gradient(rgb(249 251 247 / 20%), rgb(242 249 244 / 32%)),
        url("/assets/images/calculators/shared/page-background.png");
    background-position: center top;
    background-size: cover;
}

.calculator-page {
    display: grid;
    gap: clamp(1.25rem, 3vw, 2rem);
}

.calculator-hero {
    max-width: 52rem;
    margin-inline: auto;
    text-align: center;
}

.calculator-main--water .calculator-hero,
.calculator-main--calories .calculator-hero {
    max-width: 70rem;
}

.calculator-hero__icon {
    display: grid;
    width: 3.8rem;
    height: 3.8rem;
    margin: 0 auto 0.8rem;
    border-radius: 1rem;
    color: #ffffff;
    font-size: 1.35rem;
    box-shadow: 0 0.7rem 1.8rem rgb(20 58 45 / 13%);
    place-items: center;
}

.calculator-hero__icon--calories {
    background: #f4511e;
}

.calculator-hero__icon--water {
    background: #1769e0;
}

.calculator-hero__kicker {
    display: block;
    color: #176b63;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.calculator-hero h1 {
    margin: 0.65rem 0 0.75rem;
    font-size: clamp(2.25rem, 7vw, 4rem);
    line-height: 0.98;
    letter-spacing: -0.055em;
    text-wrap: balance;
}

.calculator-main--water .calculator-hero h1,
.calculator-main--calories .calculator-hero h1 {
    color: #052f27;
}

.calculator-hero > p {
    max-width: 43rem;
    margin: 0 auto;
    color: var(--color-muted);
    font-size: clamp(1rem, 2vw, 1.15rem);
    text-wrap: balance;
}

.calculator-workspace {
    display: grid;
    width: min(100%, 58rem);
    margin-inline: auto;
    gap: 1.25rem;
}

.calculator-main--water .calculator-workspace,
.calculator-main--calories .calculator-workspace {
    display: block;
    width: min(100%, 78rem);
}

.calculator-panel,
.calculator-result {
    min-width: 0;
    padding: clamp(1.2rem, 3vw, 1.8rem);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.water-calculator-layout,
.calorie-calculator-layout {
    display: grid;
    gap: 1rem;
}

.calculator-panel--water-form,
.calculator-result--water,
.calculator-panel--calorie-form,
.calculator-result--calories {
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 1rem 2.5rem rgb(20 58 45 / 8%);
}

.calculator-panel__heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.8rem;
    margin-bottom: 1.4rem;
}

.calculator-panel__heading--result {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
}

.calculator-panel__heading h2,
.calculator-panel__heading p {
    margin: 0;
}

.calculator-panel__heading h2 {
    font-size: clamp(1.2rem, 2.2vw, 1.55rem);
    letter-spacing: -0.03em;
}

.calculator-panel__heading p {
    margin-top: 0.2rem;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.calculator-step {
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 0.8rem;
    color: #ffffff;
    background: #176b52;
    font-size: 1.05rem;
    font-weight: 850;
    box-shadow: 0 0.5rem 1rem rgb(23 107 82 / 17%);
    place-items: center;
}

.calculator-step--water,
.calculator-result--water .calculator-step {
    color: #ffffff;
    background: #1769e0;
    box-shadow: 0 0.5rem 1rem rgb(23 105 224 / 17%);
}

.calculator-step--calories,
.calculator-result--calories .calculator-step {
    color: #ffffff;
    background: #f4511e;
    box-shadow: 0 0.5rem 1rem rgb(244 81 30 / 18%);
}

.calculator-form {
    display: grid;
    gap: 1rem;
}

.calculator-field-grid {
    display: grid;
    gap: 1rem;
}

.calculator-input {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
}

.calculator-input > i {
    position: absolute;
    z-index: 1;
    left: 1rem;
    color: #6c9e8b;
    pointer-events: none;
}

.calculator-input .field__control {
    min-width: 0;
    padding-left: 2.9rem;
    padding-right: 3.75rem;
}

.calculator-input > span:last-child {
    position: absolute;
    right: 1rem;
    color: var(--color-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.calculator-form--water .field__label,
.calculator-form--calories .field__label {
    margin-bottom: 0.45rem;
    color: #123a31;
    font-size: 0.95rem;
    font-weight: 800;
}

.calculator-form--water .field__control,
.calculator-form--calories .field__control {
    min-height: 4rem;
    border-color: #adc6bc;
    background: #ffffff;
    color: #10251f;
    font-size: 1.1rem;
}

.calculator-form--water .field__control::placeholder,
.calculator-form--calories .field__control::placeholder {
    color: #a7b7b1;
}

.calculator-field-help {
    display: block;
    margin-top: 0.4rem;
    color: #5f766f;
    font-size: 0.78rem;
}

.calculator-form__error {
    padding: 0.75rem;
    margin: 0;
    border: 1px solid var(--color-danger-border);
    border-radius: var(--radius-sm);
    color: var(--color-danger);
    background: var(--color-danger-soft);
    font-size: 0.85rem;
    font-weight: 700;
}

.calculator-submit {
    min-height: 3.25rem;
    justify-self: stretch;
}

.calculator-submit--water,
.calculator-submit--calories {
    width: 100%;
    min-height: 3.65rem;
    margin-top: 0.3rem;
    border-color: #176b52;
    color: #ffffff;
    background: #176b52;
    font-size: 1rem;
    box-shadow: 0 0.8rem 1.6rem rgb(23 107 82 / 18%);
}

.calculator-submit--water:hover,
.calculator-submit--calories:hover {
    border-color: #0c513d;
    color: #ffffff;
    background: #0c513d;
}

.calculator-privacy-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    margin: -0.15rem 0 0;
    color: #5f766f;
    font-size: 0.8rem;
    text-align: center;
}

.calculator-privacy-note i {
    color: #176b52;
    font-size: 1rem;
}

.calculator-noscript {
    padding: 0.85rem;
    margin: 1rem 0 0;
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-sm);
    color: var(--color-warning);
    background: var(--color-warning-soft);
    font-weight: 700;
}

.calculator-result:focus-visible {
    outline: 0.2rem solid var(--color-focus);
    outline-offset: 0.25rem;
}

.water-result__details {
    display: grid;
    gap: 0.75rem;
}

.water-result__details article {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-background);
}

.water-result__main small,
.water-result__details small {
    color: var(--color-muted);
}

.water-result__main strong {
    font-size: clamp(1.7rem, 6vw, 2.3rem);
    letter-spacing: -0.04em;
}

.result-icon {
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    flex: 0 0 auto;
    border-radius: 0.75rem;
    color: #ffffff;
    place-items: center;
}

.result-icon--basal {
    background: #c9165e;
}

.result-icon--lose {
    background: #1769e0;
}

.result-icon--maintain {
    background: #008f7a;
}

.result-icon--gain {
    background: #7c3aed;
}

.calorie-result__status {
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    color: #c23f14;
    background: #fff0e8;
    font-size: 0.76rem;
    font-weight: 750;
    white-space: nowrap;
}

.calorie-result-state--empty {
    position: relative;
    display: grid;
    min-height: clamp(22rem, 62vw, 28rem);
    overflow: hidden;
    align-items: end;
    border: 1px solid #f2cda9;
    border-radius: 1rem;
    background: #fff5ea;
}

.calorie-result-state__picture,
.calorie-result-state__picture img,
.calorie-result__picture,
.calorie-result__picture img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.calorie-result-state__picture img,
.calorie-result__picture img {
    object-fit: cover;
}

.calorie-result-state--empty::after {
    position: absolute;
    inset: 48% 0 0;
    content: "";
    background: linear-gradient(to bottom, transparent, rgb(255 247 238 / 92%) 38%, #fff7ee 72%);
    pointer-events: none;
}

.calorie-result-state__copy {
    position: relative;
    z-index: 1;
    padding: 2rem 1rem 2.15rem;
    text-align: center;
}

.calorie-result-state__copy h3 {
    margin: 0;
    color: #10251f;
    font-size: clamp(1.55rem, 5vw, 2.15rem);
    letter-spacing: -0.045em;
}

.calorie-result-state__copy p {
    margin: 0.55rem 0 0;
    color: #526b64;
    font-size: 0.95rem;
    line-height: 1.45;
}

.calorie-result__primary {
    position: relative;
    display: grid;
    min-height: clamp(13rem, 35vw, 15.5rem);
    overflow: hidden;
    align-items: center;
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid #f1c69e;
    border-radius: 1rem;
    background: #fff3e5;
}

.calorie-result__primary::after {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(90deg, rgb(255 246 236 / 100%) 0%, rgb(255 246 236 / 94%) 43%, transparent 73%);
    pointer-events: none;
}

.calorie-result__summary {
    position: relative;
    z-index: 1;
    display: grid;
    width: min(72%, 30rem);
}

.calorie-result__summary small,
.calorie-result__summary > span,
.calorie-result__basal small,
.calorie-goals small {
    color: #60766f;
}

.calorie-result__summary small {
    font-size: 0.95rem;
}

.calorie-result__summary strong {
    color: #0b2d25;
    font-size: clamp(2.65rem, 7vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.055em;
    white-space: nowrap;
}

.calorie-result__summary > span {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.calorie-result__basal {
    display: flex;
    min-width: 0;
    min-height: 5rem;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    margin-top: 0.75rem;
    border: 1px solid #d9e6e1;
    border-radius: 0.8rem;
    background: rgb(249 251 249 / 92%);
}

.calorie-result__basal > span:last-child {
    display: grid;
}

.calorie-result__basal strong {
    color: #102d26;
    font-size: clamp(1.35rem, 4vw, 1.8rem);
    line-height: 1.1;
}

.calorie-result__basal small:last-child {
    font-size: 0.76rem;
}

.calorie-goal-section {
    margin-top: 0.75rem;
}

.calorie-goal-section h3 {
    margin: 0 0 0.45rem;
    color: #54746b;
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.calorie-goals {
    display: grid;
    gap: 0.65rem;
}

.calorie-goals > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem;
    border: 1px solid #d9e6e1;
    border-radius: 0.8rem;
    background: rgb(249 251 249 / 92%);
}

.calorie-goals > div > span:last-child {
    display: grid;
    min-width: 0;
}

.calorie-goals strong {
    color: #102d26;
    font-size: clamp(1.25rem, 3vw, 1.65rem);
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.calorie-goals__limit {
    margin: 0.65rem 0 0;
    color: #5f766f;
    font-size: 0.78rem;
    line-height: 1.45;
}

.water-result__status {
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    color: #0b58a8;
    background: #e1efff;
    font-size: 0.76rem;
    font-weight: 750;
    white-space: nowrap;
}

.water-result-state--empty {
    position: relative;
    display: grid;
    min-height: clamp(19rem, 58vw, 24rem);
    overflow: hidden;
    align-items: end;
    border-radius: 1rem;
    background: #eaf5ff;
}

.water-result-state__picture,
.water-result-state__picture img,
.water-result__picture,
.water-result__picture img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.water-result-state__picture img,
.water-result__picture img {
    object-fit: cover;
}

.water-result-state--empty::after {
    position: absolute;
    inset: 35% 0 0;
    content: "";
    background: linear-gradient(to bottom, transparent, rgb(238 248 255 / 90%) 40%, #eef8ff 76%);
    pointer-events: none;
}

.water-result-state__copy {
    position: relative;
    z-index: 1;
    padding: 2rem 1rem 1.8rem;
    text-align: center;
}

.water-result-state__copy h3 {
    margin: 0;
    color: #063e34;
    font-size: clamp(1.5rem, 5vw, 2rem);
    letter-spacing: -0.045em;
}

.water-result-state__copy p {
    margin: 0.55rem 0 0;
    color: #54746f;
    font-size: 0.95rem;
    line-height: 1.45;
}

.water-result-state--values {
    min-width: 0;
}

.water-result__main {
    position: relative;
    display: grid;
    min-height: clamp(14rem, 38vw, 16.5rem);
    overflow: hidden;
    align-items: center;
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid #a7cdf7;
    border-radius: 1rem;
    background: #e8f5ff;
}

.water-result__main::after {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(90deg, rgb(236 247 255 / 100%) 0%, rgb(236 247 255 / 94%) 42%, transparent 72%);
    pointer-events: none;
}

.water-result__picture img {
    object-position: center;
}

.water-result__summary {
    position: relative;
    z-index: 1;
    display: grid;
    width: min(70%, 26rem);
}

.water-result__summary small {
    font-size: 0.95rem;
}

.water-result__summary strong {
    color: #053e34;
    font-size: clamp(2.7rem, 7vw, 4.5rem);
    line-height: 1;
    white-space: nowrap;
}

.water-result__summary > span {
    margin-top: 0.4rem;
    color: #54746f;
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: 700;
}

.water-result__details {
    margin-top: 0.8rem;
}

.water-result__details article {
    display: flex;
    min-height: 5rem;
    align-items: center;
    gap: 0.8rem;
    border-color: #d9e6e1;
    background: rgb(249 251 249 / 92%);
}

.water-result__detail-icon {
    display: grid;
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
    border-radius: 0.75rem;
    color: #ffffff;
    background: #1769e0;
    place-items: center;
}

.water-result__details article > span:last-child {
    display: grid;
}

.water-result__details strong {
    color: #112d27;
    font-size: 0.98rem;
}

.water-result__details small {
    margin-top: 0.15rem;
    font-size: 0.8rem;
}

.water-result__rounding {
    margin: 0.9rem 0 0.15rem;
    color: #5f766f;
    font-size: 0.78rem;
}

.calculator-disclaimer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.9rem;
    margin: 1rem 0 0;
    border-radius: var(--radius-sm);
    color: var(--color-muted);
    background: var(--color-neutral-soft);
    font-size: 0.8rem;
}

.calculator-disclaimer--water,
.calculator-disclaimer--calories {
    align-items: center;
    border: 1px solid #f0d7a6;
    background: rgb(255 249 237 / 94%);
    color: #5d716b;
}

.calculator-disclaimer__icon {
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.7rem;
    color: #ffffff;
    background: #ad7200;
    place-items: center;
}

.calculator-switcher {
    display: grid;
    width: min(100%, 58rem);
    align-items: center;
    gap: 0.85rem;
    padding: 1.15rem;
    margin-inline: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.calculator-main--water .calculator-switcher,
.calculator-main--calories .calculator-switcher {
    width: min(100%, 78rem);
    background: rgb(255 255 255 / 94%);
}

.calculator-switcher__icon {
    display: grid;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.85rem;
    color: #ffffff;
    font-size: 1.25rem;
    place-items: center;
}

.calculator-switcher__icon--water {
    background: #1769e0;
}

.calculator-switcher__icon--calories {
    background: #f4511e;
}

.calculator-switcher__copy .landing-kicker {
    color: #176b63;
    font-size: 0.72rem;
}

.calculator-switcher h2 {
    margin: 0.25rem 0 0;
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    letter-spacing: -0.025em;
}

.calculator-switcher__link {
    display: inline-flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem 1.15rem;
    border: 1px solid #176b52;
    border-radius: 0.75rem;
    color: #176b52;
    background: transparent;
    font-weight: 800;
    text-decoration: none;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.calculator-switcher__link:hover {
    border-color: #0c513d;
    color: #ffffff;
    background: #0c513d;
}

.calculator-switcher__link:focus-visible {
    outline: 0.2rem solid var(--color-focus);
    outline-offset: 0.2rem;
}

@media (min-width: 38rem) {
    .calculator-field-grid,
    .water-result__details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .calculator-field-grid--water {
        grid-template-columns: 1fr;
    }

    .calculator-submit:not(.calculator-submit--water):not(.calculator-submit--calories) {
        min-width: 18rem;
        justify-self: center;
    }

    .calorie-goals {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

}

@media (min-width: 48rem) {
    .calculator-switcher {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .calculator-switcher__link {
        min-width: 15rem;
    }
}

@media (min-width: 62rem) {
    .water-calculator-layout,
    .calorie-calculator-layout {
        grid-template-columns: minmax(19rem, 0.86fr) minmax(31rem, 1.34fr);
        align-items: stretch;
    }

    .calculator-panel--water-form,
    .calculator-result--water {
        min-height: 31rem;
    }

    .calculator-form--water {
        align-content: start;
    }

    .water-result-state--empty {
        min-height: 23rem;
    }

    .calculator-panel--calorie-form,
    .calculator-result--calories {
        min-height: 36rem;
    }

    .calculator-form--calories {
        align-content: start;
    }

    .calorie-result-state--empty {
        min-height: 28rem;
    }
}

@media (max-width: 37.99rem) {
    .calculator-panel__heading--result {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .water-result__status,
    .calorie-result__status {
        grid-column: 2;
        width: fit-content;
        margin-top: 0.15rem;
        white-space: normal;
    }

    .water-result__summary {
        width: 75%;
    }

    .calorie-result__summary {
        width: 76%;
    }

    .water-result__summary strong {
        font-size: clamp(2.15rem, 11vw, 3.2rem);
    }

    .calculator-switcher__link {
        width: 100%;
    }
}

@media (max-width: 25rem) {
    .calculator-main {
        padding-top: 2rem;
    }

    .calculator-panel,
    .calculator-result {
        padding: 1rem;
    }

    .water-result__summary strong {
        white-space: normal;
    }

    .calorie-result__summary strong {
        font-size: clamp(2.1rem, 11vw, 3.1rem);
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .calculator-switcher__link,
    .calculator-submit {
        transition: none;
    }
}

:root[data-theme="dark"] .calculator-main {
    background-color: #071710;
    background-image:
        linear-gradient(rgb(5 12 24 / 91%), rgb(5 12 24 / 94%)),
        url("/assets/images/calculators/shared/page-background.png");
}

:root[data-theme="dark"] .calculator-main--water .calculator-hero h1,
:root[data-theme="dark"] .calculator-main--calories .calculator-hero h1,
:root[data-theme="dark"] .calculator-form--water .field__label,
:root[data-theme="dark"] .calculator-form--calories .field__label,
:root[data-theme="dark"] .water-result__details strong,
:root[data-theme="dark"] .calorie-result__basal strong,
:root[data-theme="dark"] .calorie-goals strong,
:root[data-theme="dark"] .calorie-result-state__copy h3 {
    color: var(--color-text);
}

:root[data-theme="dark"] .calculator-hero__kicker,
:root[data-theme="dark"] .calculator-switcher__copy .landing-kicker {
    color: #70d0b1;
}

:root[data-theme="dark"] .calculator-panel--water-form,
:root[data-theme="dark"] .calculator-result--water,
:root[data-theme="dark"] .calculator-panel--calorie-form,
:root[data-theme="dark"] .calculator-result--calories,
:root[data-theme="dark"] .calculator-main--water .calculator-switcher,
:root[data-theme="dark"] .calculator-main--calories .calculator-switcher {
    background: rgb(52 59 73 / 95%);
}

:root[data-theme="dark"] .calculator-form--water .field__control,
:root[data-theme="dark"] .calculator-form--calories .field__control {
    border-color: var(--color-control-border);
    color: var(--color-text);
    background: var(--color-background);
}

:root[data-theme="dark"] .calculator-privacy-note,
:root[data-theme="dark"] .water-result__rounding,
:root[data-theme="dark"] .calorie-goals__limit,
:root[data-theme="dark"] .calculator-field-help {
    color: var(--color-muted);
}

:root[data-theme="dark"] .calculator-disclaimer--water,
:root[data-theme="dark"] .calculator-disclaimer--calories {
    border-color: #6d571f;
    color: #ddd3b8;
    background: rgb(64 53 31 / 95%);
}

:root[data-theme="dark"] .calorie-result__basal,
:root[data-theme="dark"] .water-result__details article,
:root[data-theme="dark"] .calorie-goals > div {
    border-color: var(--color-border);
    background: rgb(29 39 52 / 94%);
}

:root[data-theme="dark"] .calorie-result-state--empty::after {
    background: linear-gradient(to bottom, transparent, rgb(30 36 47 / 92%) 38%, #1e242f 72%);
}

:root[data-theme="dark"] .calorie-result__primary::after {
    background: linear-gradient(90deg, rgb(30 36 47 / 100%) 0%, rgb(30 36 47 / 94%) 43%, rgb(30 36 47 / 15%) 78%);
}

:root[data-theme="dark"] .calorie-result__summary strong {
    color: #ffffff;
}

:root[data-theme="dark"] .calorie-result__summary small,
:root[data-theme="dark"] .calorie-result__summary > span,
:root[data-theme="dark"] .calorie-result__basal small,
:root[data-theme="dark"] .calorie-goals small,
:root[data-theme="dark"] .calorie-result-state__copy p {
    color: var(--color-muted);
}

:root[data-theme="dark"] .calculator-switcher__link {
    color: #70d0b1;
    border-color: #70d0b1;
}

:root[data-theme="dark"] .calculator-switcher__link:hover {
    color: #ffffff;
    border-color: #0c513d;
}
