/* 1. CSS Variables - Our 4-Color Earthy Palette */
:root {
    --color-1-beige: #f5f5dc;      /* App Background & Screen Text */
    --color-2-gray: #e5e5e5;       /* Calculator Body & Number Buttons */
    --color-3-olive: #4b5320;      /* Screen Background & Operators */
    --color-4-brown: #5c4033;      /* Equals Button */
}

/* 2. Global Reset & Body Styling */
* {
    box-sizing: border-box;
    font-family: 'Inter', sans-serif; /* Clean, modern font */
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-1-beige);
    /* Flexbox to perfectly center the calculator on the screen */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* 3. The Calculator Container */
.calculator {
    background-color: var(--color-2-gray);
    padding: 20px;
    border-radius: 15px;
    /* Subtle drop shadow to give it depth */
    box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.2);
    width: 380px; 
}

/* 4. The Display Screen */
.display {
    background-color: var(--color-3-olive);
    color: var(--color-1-beige);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: right; /* Numbers align to the right */
    word-wrap: break-word;
    word-break: break-all;
    /* Minimal height to ensure it doesn't collapse */
    min-height: 100px; 
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    /* Optional: A monospaced font looks great for math screens */
    font-family: 'Courier New', Courier, monospace; 
}

.previous-operand {
    font-size: 1.2rem;
    opacity: 0.75; /* Slightly faded */
}

.current-operand {
    font-size: 2.5rem;
    font-weight: bold;
}

/* 5. The Buttons Grid Layout */
.buttons {
    display: grid;
    /* This creates exactly 5 equal-sized columns */
    grid-template-columns: repeat(5, 1fr);
    gap: 10px; /* Space between buttons */
}

/* 6. General Button Styling */
.btn {
    cursor: pointer;
    font-size: 1.1rem;
    border: none;
    outline: none;
    padding: 15px 10px;
    border-radius: 8px;
    background-color: white; /* Base color for unstyled buttons */
    color: #333;
    font-weight: bold;
    /* Smooth transitions for hover effects */
    transition: all 0.2s ease;
}

/* Micro-animation: push down when clicked */
.btn:active {
    transform: scale(0.95);
}

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

/* 7. Specific Button Type Styling */
.number {
    background-color: var(--color-2-gray);
    /* Make the buttons pop out slightly from the gray background */
    box-shadow: 0px 4px 6px rgba(0,0,0,0.1); 
}

.operator, .action {
    background-color: var(--color-3-olive);
    color: var(--color-1-beige);
}

.fn {
    /* Scientific functions get a slightly different shade */
    background-color: #d1d5db; 
}

/* The Equals Button is our hero action */
#equals {
    background-color: var(--color-4-brown);
    color: var(--color-1-beige);
    /* Makes the equals button stretch across all 5 columns */
    grid-column: 1 / -1; 
    font-size: 1.5rem;
}
