@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css");
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap');

/* ------ NORMALIZE ------ */
:root {
   font-family: 'Roboto', sans-serif;
   line-height: 1.5;
   font-weight: 400;
   font-synthesis: none;
   text-rendering: optimizeLegibility;
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
   font-size: 16px;
}
* {
   margin: 0;
   padding: 0;
   box-sizing: border-box;
}
header,
section,
main,
nav,
footer,
article,
figure,
hgroup {
   display: block;
   width: 100%;
}
a {
   text-decoration: none;
   cursor: pointer;
}
h1, h2 {
   text-wrap: balance;
}
p {
   text-wrap: pretty;
}

/* ------ MAIN STYLE ------ */
body {
   background-color: #1a1b1f;
   color: #e9e9e9;
   display: grid;
   place-content: center;
   height: 100svh;
   gap: 1.5rem;
}

main {
   margin-top: 1rem;
   display: flex;
   flex-direction: column;
   align-items: center;
}

h1 {
   text-align: center;
   font-size: 1.625rem;
}

.subtitle {
   text-align: center;
   font-size: 0.875rem;
   color: #6e6e6e;
   margin-bottom: 0.5rem;
}

/* ---- Calculadora ---- */
#calculator {
   position: relative;
   display: flex;
   flex-direction: column;
   width: 420px;
   height: auto;
   padding: 1rem;
   margin-top: 1.2rem;
   border-radius: 0.5rem;
   background-color: #18191b;
}

a {
   position: absolute;
   background: #18191b;
   color: #292b33;
   font-size: 1.3rem;
   transition: color .3s ease-in-out;
}
a:hover {
   color: #a45bf7b6;
}

.calculator__output {
   text-align: end;
   display: flex;
   flex-direction: column;
   justify-content: center;
   height: 6rem;
}

.calculator__output--result {
   font-weight: 300;
   font-size: 2rem;
}

.calculator__navbar {
   display: flex;
   justify-content: end;
   border-top: 1px solid #24252b;
   padding: 0.5rem;
   color: #6e6e6e;
}

i.bi-backspace {
   font-size: 1.1rem;
   transition: color .2s ease;
}
i.bi-backspace:hover {
   cursor: pointer;
   color: #a45bf7b6;
}

.calculator__keyboard {
   display: grid;
   grid-template-columns: repeat(4, 1fr);
   font-size: 1.5rem;
   gap: 0.8rem;
   padding: 0.5rem 0;
}

.key {
   background-color: #1a1b1f;
   height: 4rem;
   display: flex;
   align-items: center;
   justify-content: center;
   border-radius: 0.7rem;
   transition: background .3s ease;
}
.key:hover {
   background: #292b33;
   cursor: pointer;
}

.key.clear {
   grid-column: 1/3;
   color: #e43838;
}
.key.clear:hover {
   background-color: #f754540a;
}

.operator {
   color: #a45bf7;
}

.resultado {
   color: #ba7ffd;
}

.key.equal {
   background-color: #6f32b6;
   color: #fff;
}
.key.equal:hover {
   background: #a45bf7;
}

/* ------ MEDIA QUERY ------ */
@media (width <= 440px){
   #calculator {
      width: 100vw;
   }
}