/* Minimal Reset CSS */
html {
  box-sizing: border-box;
  font-size: 16px;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ol,
ul {
  margin: 0;
  padding: 0;
  font-weight: normal;
}

ol,
ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* My Custom CSS */

:root {
  --bg-color: black;
  --calc-bg-color: #0a0a0a;
  --btn-bg-color: #161616;
  --btn-bg-color-light: #383838;
  --color: white;
  --color-alert: #d42a2a;
  --color-accent: #35a02c;
  --color-accent-light: #38eb27;
}

body {
  color: var(--color);
  background-color: var(--bg-color);
  font-family: "Roboto", sans-serif;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
}

.calculator {
  grid-template-rows: 1fr 4fr;
  border: 1px solid var(--btn-bg-color-light);
  background-color: var(--calc-bg-color);
  border-radius: 5%;
  max-width: 300px;
  height: max(530px, 50vh);
  margin: 0 auto;
  padding: 1rem;
}

.display {
  height: 7rem;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  justify-items: center;
  text-align: right;
  margin: 1rem;
}

#user-input {
  font-size: 2rem;
}

@keyframes moveUp {
  100% {
    transform: translateY(-300%);
    font-size: 1rem;
  }
}

.moveUp {
  animation-name: moveUp;
  animation-duration: 0.5s;
}

@keyframes cursor-blink {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 100;
  }
  100% {
    opacity: 0;
  }
}

#user-input::after {
  content: "";
  background-color: rgb(109, 226, 226);
  display: inline-block;
  width: 2px;
  height: 2.1rem;
  margin-bottom: -8px;
  animation: cursor-blink steps(1) 1.2s infinite;
}

.button {
  --size: 25px;
  --animation-duration: 0.5s;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 100%;
  width: var(--size);
  height: var(--size);
  transition: background-color var(--animation-duration);
}

.button:disabled {
  cursor: auto;
  filter: brightness(0.5) !important;
}

.btn-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  justify-items: center;
  align-items: center;
  gap: 3px;
  position: relative;
}

.history {
  display: none;
  position: absolute;
  background-color: var(--calc-bg-color);
  border-right: 2px solid var(--btn-bg-color);
  padding-inline: 1.5rem;
  top: 0;
  left: 0;
  width: 75%;
  height: 100%;
}

.history.open {
  display: flex;
  flex-direction: column-reverse;
  gap: 1rem;
}

.history > button {
  background-color: #383838;
  border: none;
  border-radius: 100vh;
  color: white;
  font-weight: 700;
  padding-block: 0.5em;
  cursor: pointer;
}

.entries {
  overflow: auto;
  padding: 0.5rem;
}

.entry {
  margin-top: 1em;
  text-align: right;
}

.entry > *:hover {
  background-position: right;
}

.entry-result {
  color: var(--color-accent-light);
  cursor: pointer;
  background: linear-gradient(to left, #383838 50%, var(--calc-bg-color) 50%)
    left;
  background-size: 210%;
  transition: 0.3s ease-out;
}

.btn-func > .button {
  filter: brightness(0.8);
  background-color: var(--calc-bg-color);
}

.btn-special {
  display: flex;
  justify-content: space-between;
  padding: 0 1.3rem;
  border-bottom: 2px solid var(--btn-bg-color);
  padding-bottom: 1rem;
}

.btn-special > .button {
  display: flex;
  justify-content: center;
  background-color: var(--calc-bg-color);
}

.material-icons-outlined {
  font-size: 1rem;
}

.button-accent {
  color: var(--color-accent);
}

.btn-grid .button {
  --fs: 1.5rem;
  --size: 55px;
  background-color: var(--btn-bg-color);
  font-size: var(--fs);
}

.button[value="clear"] {
  color: var(--color-alert);
}

.button[value="="] {
  background-color: var(--color-accent);
}

.button:enabled:hover {
  background-color: var(--btn-bg-color-light);
}

.button[value="="]:hover {
  background-color: var(--color-accent-light);
}

@keyframes changeSize {
  0% {
    font-size: var(--fs);
  }
  50% {
    font-size: calc(0.6 * var(--fs));
  }
  100% {
    font-size: var(--fs);
  }
}

.button.changeSize {
  animation-name: changeSize;
  animation-duration: var(--animation-duration);
}

/* Use the button's onClick event */
button span {
  pointer-events: none;
}
