/* GOOGLE FONT: ORBITRON */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400..900&display=swap');

/* -------------------------- */
/* GLOBAL RESETS */
*,
*::before,
*::after {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

/* -------------------------- */
/* ROOT VARIABLES */
:root {
  --primary-color: #373a40;
  --font-color: #eeeeee;
  --controls-background-color: #eeeeee;
  --controls-font-color: #181818;
  --operator-background-color: #dc5f00;
  --operator-font-color: #eeeeee;
  --operand-background-color: #686d76;
  --operand-font-color: #eeeeee;
  --error-color: #ffaa80;
}

/* -------------------------- */
/* BASE STYLES */
body {
  height: 100vh;
  font-family: 'Orbitron', sans-serif;
  color: var(--font-color);
  background-color: var(--operand-background-color);

  display: flex;
  justify-content: center;
  align-items: center;
}

a {
  text-decoration: none;
  color: #a9a9a9;
  font-size: 12px;
  letter-spacing: 3px;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--font-color);
}

/* -------------------------- */
/* BUTTON */
.btn {
  flex: 1;
  height: 3.5rem;
  width: auto;

  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 500;
  text-align: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: border-radius 0.3s ease;
}

.btn:hover {
  filter: brightness(0.9);
}

.btn:active {
  border-radius: 25%;
}

/* -------------------------- */
/* CALCULATOR LAYOUT */
.calculator {
  height: 33rem;
  width: 20rem;
  padding: 1.4rem;
  border-radius: 1rem;
  background-color: var(--primary-color);
  box-shadow: 2rem 2rem 1.5rem rgba(0, 0, 0, 0.3);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* -------------------------- */
/* DISPLAY */
.display {
  width: 100%;
  border-radius: 1rem;
  padding: 1.1rem;
  padding-bottom: 1.4rem;
  overflow: hidden;
  color: var(--font-color);

  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: end;
}

.display > div {
  min-height: 2rem;
  width: 100%;
}

/* UPPER LINE - INPUT */
.display .display-input {
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
}

/* LOWER LINE - RESULT */
.display .display-result {
  font-size: 2.5rem;
}

/* ERROR SETUP */
.display .error-setup {
  font-size: 1.5rem;
  color: var(--error-color);
}

/* -------------------------- */
/* INPUT KEYS LAYOUT */
.keys {
  width: 100%;
  display: grid;
  grid-template-columns: 3fr 1fr;
  grid-template-areas:
    'controls operators'
    'operands operators';
  gap: 0.5rem;
}

/* -------------------------- */
/* CONTROL BUTTONS */
.controls {
  grid-area: controls;
  display: flex;
  gap: 0.5rem;
}

.controls .btn {
  background-color: var(--controls-background-color);
  color: var(--controls-font-color);
}

/* -------------------------- */
/* OPERATOR BUTTONS */
.operators {
  grid-area: operators;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.operators .btn {
  background-color: var(--operator-background-color);
  color: var(--operator-font-color);
}

/* -------------------------- */
/* OPERAND BUTTONS */

/* 
Reproduce the typical calculator layout 
by displaying the number buttons in descending order.
*/
.operands {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
}

.operands-row {
  display: flex;
  gap: 0.5rem;
}

.operands .btn {
  background-color: var(--operand-background-color);
  color: var(--operand-font-color);
}

/* -------------------------- */
/* MEDIA QUERIES */
@media (min-width: 300px) and (max-width: 468px) {
  body {
    overflow: hidden;
    position: relative;
  }

  .github-link {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
  }

  .calculator {
    height: 100vh;
    width: 100vw;
    border-radius: 0;
    overflow: hidden;

    display: block;
    text-align: center;
  }

  .keys,
  .controls,
  .operators,
  .operands,
  .operands-row {
    gap: 0.8rem;
  }

  .display {
    margin-top: 4.2rem;
  }

  .display > div {
    min-height: 4rem;
  }

  .display .display-input {
    font-size: 2.8rem;
  }

  .display .display-result {
    font-size: 4rem;
    margin-bottom: 2rem;
  }

  .display .error-setup {
    font-size: 2.8rem;
  }

  .btn {
    height: 4.5rem;
    font-size: 1.5rem;
  }
}
