@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

/* --- CUSTOM PROPERTIES --- */
:root {
  /* colors */
  --clr-black: hsl(0, 0%, 0%);
  --clr-white: hsl(208, 100%, 97%);

  --primary-bg-color: hsl(240, 36%, 18%);
  --bg-color: hsl(240, 19%, 22.7%);

  --primary-accent: hsl(35, 100%, 50%);
  --grey-accent: hsl(0, 0%, 69%);

  --linear-gradient: linear-gradient(135deg, #667eea, #764ba2);
}

/* --- RESET --- */

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

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* margins */
body,
figure,
blockquote,
picture {
  margin: 0;
}

/* link */
a:link,
a:visited {
  text-decoration: none;
}

/* --- LAYOUTS --- */
body {
  color: var(--clr-white);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  background: var(--linear-gradient);
  height: 100vh;
  padding: 1rem;

  display: grid;
  place-items: center;
  overflow-x: hidden;
}

/* --- CALCULATOR --- */
.calculator {
  width: 100%;
  max-width: 14.5rem;
  border-radius: 16px;
  overflow: hidden;

  background: var(--primary-bg-color);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  padding: 10px;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.display {
  max-width: 92%;
  margin: 0 auto;
  padding: 10px 0px 10px 0px;
}

.previous-operand,
.current-operand {
  font-weight: 300;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;

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

.previous-operand {
  font-size: 1.2rem;
  color: #e4ebf2;
  min-height: 2.25rem;
}

.current-operand {
  font-size: 2.8rem;
  min-height: 4rem;
}

/* numbers */
.btn {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  font-size: 1.2rem;
  color: var(--clr-white);
  background: var(--bg-color);
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;

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

  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* triggers when the button clicked */
.btn:active {
  transform: scale(0.95);
}

/* operators / equals */
.btn[data-operator],
.btn[data-action='equals'] {
  background: var(--primary-accent);
}

/* clear */
.btn[data-action='clear'] {
  font-size: 1rem;
}

.btn[data-action='clear'],
.btn[data-action='toggle-sign'],
.btn[data-action='percent'] {
  background: var(--grey-accent);
  color: var(--clr-black);
  font-weight: 500;
}

/* svg */
.btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

.toggle-sign-icon,
.divide-icon {
  width: 1rem;
  height: 1rem;
}

.toggle-sign-icon {
  stroke: currentColor;
  stroke-width: 0.4;
}

/* 0 */
.zero {
  grid-column: span 2;
  aspect-ratio: auto;
  border-radius: 40px;
  justify-content: flex-start;
  padding-left: 1.125rem;
}

/* highlight */
.btn[data-operator] {
  transition: all 0.15s ease;
}

.btn[data-operator].active {
  background: var(--clr-white);
  color: var(--primary-accent);
}
