/* CSS HSL */
:root {
    --white: hsla(0, 0%, 100%, 1);
    --nyanza: hsla(90, 61%, 91%, 1);
    --vista-blue: hsla(221, 42%, 69%, 1);
    --glaucous: hsla(224, 38%, 55%, 1);
    --yinmn-blue: hsla(227, 21%, 36%, 1);
    --green: hsla(150, 30%, 40%, 1);
    --transparent-green: hsla(150, 30%, 40%, 0.2);
    --puce: hsla(350, 56%, 68%, 1);
    --gray: hsla(0, 0%, 70%, 1);
    --caroline-blue: hsla(200, 42%, 69%, 1);
    --african-violet: hsla(270, 42%, 69%, 1);
}

/* ---------------------------------------------------------------------- */
/*  CSS Reset
/* ---------------------------------------------------------------------- */

/* Box Model
----------------------------------------------- */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* Typography
----------------------------------------------- */
body {
    margin: 0;
    padding: 0 16px;
    width: 100vw;
    font-family: "Rokkitt", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: 16px;
    line-height: 1.5;
    color: var(--yinmn-blue);
    background-color: var(--nyanza);
}

/* Links
----------------------------------------------- */
a {
    color: var(--glaucous);
    text-decoration: underline;
    transition: 0.2s ease-in;
}

a:hover {
    color: var(--vista-blue);
}

/* Lists
----------------------------------------------- */
ul,
ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Images
----------------------------------------------- */
img {
    max-width: 100%;
    height: auto;
    border: 0;
}

/* Tables
----------------------------------------------- */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

th,
td {
    padding: 8px;
    text-align: left;
    border: 1px solid #ddd;
}

/* Misc
----------------------------------------------- */
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
nav,
section,
summary {
    display: block;
}

/* Input number */
input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]:focus {
    appearance: auto;
    -moz-appearance: auto;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

input[type="number"]:focus::-webkit-outer-spin-button,
input[type="number"]:focus::-webkit-inner-spin-button {
    -webkit-appearance: auto;
}

/* ---------------------------------------------------------------------- */
/*  Custom Styles
/* ---------------------------------------------------------------------- */

/* Header */

header {
    width: 100%;
    max-width: 1200px;
    margin: 16px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#logo {
    width: 222px;
    height: 30px;
    fill: var(--yinmn-blue);
}

header h1 {
    font-family: "Rokkitt", serif;
    font-optical-sizing: auto;
    font-weight: 800;
    font-style: normal;
    display: none;
}

header button {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

header button svg {
    width: 32px;
    height: 32px;
    fill: var(--vista-blue);
}

header button:hover {
    background-color: var(--transparent-green);
    transition: 0.3s ease-in;
}

header button:hover svg {
    fill: var(--glaucous);
    transition: 0.3s ease-in;
}

section {
    width: 100%;
    max-width: 1200px;
    margin: 16px auto;
}

/* About */
#overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 17;
}

#about {
    position: absolute;
    top: 16px;
    right: calc((100vw - 1200px)/2);
    max-height: calc(100vh - 32px);
    overflow: scroll;
    padding: 24px;
    text-align: left;
    font-size: 20px;
    line-height: 1;
    background-color: var(--white);
    border-radius: 16px;
    max-width: 400px;
}

#close_about {
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

#close_about svg {
    width: 32px;
    height: 32px;
    fill: var(--vista-blue);
}

#close_about:hover {
    background-color: var(--transparent-green);
    transition: 0.3s ease-in;
}

#close_about:hover svg {
    fill: var(--glaucous);
    transition: 0.3s ease-in;
}

#about h2 {
    font-family: "Rokkitt", serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-style: normal;
    font-size: 32px;
    line-height: 1;
    color: var(--green);
}

span.label {
    display: inline;
    color: var(--green);
    opacity: 0.5;
    font-family: "Rokkitt", serif;
    font-size: 16px;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
}

.box_tip {
    text-align: center;
    /* color: var(--gray); */
    background-color: var(--nyanza);
    border: solid 1px var(--transparent-green);
    border-radius: 8px;
    padding: 8px 16px;
}

.box_tip:nth-of-type(1) {
    margin: 0 0 8px 0;
}

.box_tip img {
    background-color: var(--white);
    padding: 16px;
    margin: 8px 0 0 0;
    max-height: 30vh;
}

/* CSS for the form section */

#my-form {
    padding: 16px 0;
    text-align: center;
    font-size: 32px;
    line-height: 1;
}

#my-form p {
    margin: 8px 0;
}

#my-form p input {
    height: 100%;
    padding: 0;
    margin: 0;
    border: none;
    border-bottom: 2px dashed var(--transparent-green);
    background: none;
    text-align: center;
    font-family: "JetBrains Mono", monospace;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: 32px;
    line-height: 1;
    color: var(--green);
}

#my-form p input:focus {
    outline: none;
    background-color: var(--white);
    border-bottom: 2px solid var(--white);
    border-radius: 8px;
}

#my-form p input::placeholder {
    color: var(--transparent-green);
}

#f-amount {
    width: 280px;
}

#f-tenor,
#f-promo-duration {
    width: 100px;
}

#f-interest,
#f-promo-interest {
    width: 120px;
}

input:disabled {
    opacity: 1;
}

.input-error {
    color: var(--puce) !important;
    border-bottom: 2px dashed var(--puce) !important;
}

.input-error::placeholder {
    color: var(--puce) !important;
}

.button {
    background-color: var(--glaucous);
    border: none;
    border-radius: 16px;
    color: var(--white);
    padding: 16px 24px;
    font-family: "Rokkitt", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    margin: 16px;
    cursor: pointer;
}

.button:hover {
    background-color: var(--vista-blue);
    transition: 0.3s ease-in;
}

/* CSS for the result section */

.container {
    display: flex;
    gap: 16px;
}

#my-result {
    text-align: left;
    font-size: 32px;
    line-height: 1;
}

.box {
    background-color: var(--white);
    flex: 1;
    padding: 24px;
    border-radius: 16px;
}

.box h4 {
    display: inline;
    color: var(--green);
    opacity: 0.5;
    font-family: "Rokkitt", serif;
    font-size: 20px;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
}

.row-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.row-group label {
    white-space: nowrap;
}

.row-group input {
    flex: 1;
    height: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    border-bottom: 2px dashed var(--transparent-green);
    background: none;
    text-align: right;
    font-family: "JetBrains Mono", monospace;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: 32px;
    line-height: 1;
}

.row-group input::placeholder {
    color: var(--transparent-green);
}

.box:nth-of-type(1) .row-group input {
    color: var(--caroline-blue);
}

.box:nth-of-type(2) .row-group input {
    color: var(--african-violet);
}

#chart_container {
    max-height: 320px;
}

#chart_placeholder {
    display: block;
    margin: auto;
}

#myChart {
    display: none;
    height: 320px;
}

br.responsive {
    display: none;
}

#disclaimer {
    display: none;
    text-align: center;
    font-size: 14px;
    color: var(--gray);
}

/* CSS for responsive */

@media (max-width: 1300px) {

    #my-form,
    #my-form p input,
    #my-result,
    .row-group input {
        font-size: 24px;
    }
}

@media (max-width: 1200px) {
    #about {
        right: 16px;
        margin-left: 16px;
    }
}

@media (max-width: 800px) {
    .container {
        flex-direction: column;
    }

    br.responsive {
        display: block;
        height: 8px;
        content: '';
    }
}

@media (max-width: 500px) {
    #about {
        font-size: 18px;
    }

    #my-form p input,
    .row-group input {
        font-size: 18px;
    }

    #my-form,
    #my-result {
        font-size: 18px;
    }

    .box h4 {
        font-size: 18px;
    }

    #f-amount {
        width: 160px;
    }

    #f-tenor,
    #f-promo-duration {
        width: 60px;
    }

    #f-interest,
    #f-promo-interest {
        width: 60px;
    }

}