/* + VARIABLES DEL TEMA */
:root {
    --color-primary: #ffe000;
    --color-primary-soft: #fff8bf;
    --color-text: #191919;
    --color-text-muted: #5f5f5f;
    --color-surface: #ffffff;
    --color-border: #d8d8d8;
    --color-background: #f5f5f2;
    --shadow-card: 0 1.25rem 3.5rem rgb(31 31 20 / 14%);
    --radius-large: 1.5rem;
    --radius-medium: 0.9rem;
}

/* + AJUSTES GENERALES */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    color-scheme: light;
}

body {
    margin: 0;
}

button,
input,
output {
    font: inherit;
}

/* + BLOQUE BEM: PAGE */
.page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(1rem, 5vw, 3rem);
    background:
        radial-gradient(circle at 10% 10%, rgb(255 224 0 / 28%), transparent 34rem),
        linear-gradient(145deg, var(--color-background), #ecece7);
    color: var(--color-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

/* + BLOQUE BEM: APP */
.app {
    position: relative;
    width: min(100%, 48rem);
    overflow: hidden;
    border: 1px solid rgb(25 25 25 / 10%);
    border-radius: var(--radius-large);
    background-color: rgb(255 255 255 / 92%);
    box-shadow: var(--shadow-card);
    animation: app-entry 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.app::before {
    position: absolute;
    inset: 0 0 auto;
    height: 0.4rem;
    background-color: var(--color-primary);
    content: "";
}

.app__header {
    padding: clamp(2rem, 6vw, 3.25rem) clamp(1.25rem, 5vw, 3rem) 1rem;
    text-align: center;
}

.app__title {
    margin: 0;
    font-size: clamp(2rem, 8vw, 3.25rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
}

.app__title::after {
    display: block;
    width: 3.75rem;
    height: 0.35rem;
    margin: 1rem auto 0;
    border-radius: 999px;
    background-color: var(--color-primary);
    content: "";
}

.app__content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem clamp(1.25rem, 5vw, 3rem) clamp(1.5rem, 5vw, 3rem);
}

/* + BLOQUE BEM: CALCULATION-FORM */
.calculation-form {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background-color: var(--color-surface);
    animation: content-entry 500ms 120ms ease-out both;
}

.calculation-form__field {
    display: grid;
    gap: 0.6rem;
}

.calculation-form__label {
    font-size: 1.05rem;
    font-weight: 750;
}

.calculation-form__help {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.calculation-form__input {
    width: 100%;
    min-height: 3.25rem;
    padding: 0.75rem 0.9rem;
    border: 2px solid var(--color-border);
    border-radius: 0.7rem;
    background-color: var(--color-surface);
    color: var(--color-text);
    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.calculation-form__input:hover {
    border-color: #a7a7a7;
}

.calculation-form__input:focus-visible {
    border-color: var(--color-text);
    outline: none;
    box-shadow: 0 0 0 0.25rem rgb(255 224 0 / 55%);
}

.calculation-form__button {
    min-height: 3.25rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-text);
    border-radius: 0.7rem;
    background-color: var(--color-primary);
    color: var(--color-text);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 0.35rem 0 var(--color-text);
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.calculation-form__button:hover {
    background-color: #ffea3d;
    transform: translateY(-0.12rem);
    box-shadow: 0 0.47rem 0 var(--color-text);
}

.calculation-form__button:active {
    transform: translateY(0.18rem);
    box-shadow: 0 0.12rem 0 var(--color-text);
}

.calculation-form__button:focus-visible {
    outline: 0.2rem solid var(--color-text);
    outline-offset: 0.22rem;
}

/* + BLOQUE BEM: RESULT */
.result {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid rgb(210 184 0 / 45%);
    border-radius: var(--radius-medium);
    background: linear-gradient(145deg, var(--color-primary-soft), #fffdf0);
    animation: content-entry 500ms 200ms ease-out both;
}

.result__title {
    margin: 0;
    font-size: 1.15rem;
}

.result__output {
    display: block;
    min-height: 8rem;
    padding: 1rem;
    overflow-wrap: anywhere;
    border: 2px dashed rgb(25 25 25 / 32%);
    border-radius: 0.7rem;
    background-color: rgb(255 255 255 / 78%);
    color: var(--color-text);
    font-size: 1.1rem;
    white-space: pre-wrap;
}

/* + ANIMACIONES */
@keyframes app-entry {
    from {
        opacity: 0;
        transform: translateY(0.8rem) scale(0.985);
    }

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

@keyframes content-entry {
    from {
        opacity: 0;
        transform: translateY(0.45rem);
    }

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

/* + DISEÑO ADAPTABLE */
@media (max-width: 42rem) {
    .app__content {
        grid-template-columns: 1fr;
    }

    .result__output {
        min-height: 6rem;
    }
}

/* Respeta la preferencia de quienes necesitan reducir el movimiento. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
