@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Raleway:wght@700;800&display=swap');

/* ===========================================
   Design Tokens — matches MyStyle.css
   =========================================== */
:root {
    --bg-dark: #110a05;
    --bg-card: #1c120a;
    --bg-nav: rgba(17, 10, 5, 0.85);
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --white: #fefce8;
    --muted: #a1a1aa;
    --border: rgba(245, 158, 11, 0.15);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: 0.25s ease;

    /* Calculator–specific */
    --btn-default: #7a4a10;
    /* dark amber — default button face */
    --btn-hover-from: #f59e0b;
    --btn-hover-to: #fde68a;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    font-weight: normal;
}

html {
    font-size: 62.5%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.15) 0%, transparent 60%),
        linear-gradient(160deg, #110a05 0%, #1a0f08 100%);
    color: var(--white);

    /* Match portfolio page-reveal animation */
    opacity: 0;
    animation: revealPage 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes revealPage {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Back link */
.back-link {
    position: fixed;
    top: 2rem;
    left: 2.4rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--muted);
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    text-decoration: none;
}

.back-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.06);
}

/* ===========================================
   Calculator Shell
   =========================================== */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(4, 9rem);
    grid-template-rows: minmax(14rem, auto) repeat(5, 9rem);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(245, 158, 11, 0.08);
}

/* ===========================================
   Display / Output
   =========================================== */
.output {
    grid-column: 1 / -1;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 1.6rem 2rem;
    gap: 0.4rem;
    border-bottom: 1px solid var(--border);
    word-wrap: break-word;
    word-break: break-all;
}

.output .previous-operand {
    font-size: 1.6rem;
    color: var(--muted);
    min-height: 2.4rem;
}

.output .current-operand {
    font-size: 3.2rem;
    font-weight: 500;
    color: var(--white);
    min-height: 4rem;
}

/* ===========================================
   Buttons — base
   =========================================== */
.calculator-grid>button {
    cursor: pointer;
    font-size: 2rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    border: 1px solid rgba(245, 158, 11, 0.1);
    outline: none;
    background: var(--btn-default);
    color: var(--white);
    transition: background var(--transition), color var(--transition),
        transform 0.1s ease, box-shadow var(--transition);
}

/* Yellow gradient highlight on hover */
.calculator-grid>button:hover {
    background: linear-gradient(135deg, var(--btn-hover-from), var(--btn-hover-to));
    color: #110a05;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
    transform: scale(1.04);
    z-index: 1;
}

.calculator-grid>button:active {
    transform: scale(0.96);
    box-shadow: none;
}

/* ===========================================
   Special Buttons
   =========================================== */

/* AC / 0 — span two columns */
.span-two {
    grid-column: span 2;
}

/* AC — accent treatment */
button[data-all-clear] {
    background: rgba(245, 158, 11, 0.18);
    color: var(--accent);
    font-weight: 600;
    font-size: 1.8rem;
    letter-spacing: 0.05em;
    border-color: rgba(245, 158, 11, 0.25);
}

button[data-all-clear]:hover {
    background: linear-gradient(135deg, var(--btn-hover-from), var(--btn-hover-to));
    color: #110a05;
}

/* Operator buttons — slightly lighter shade */
button[data-operation] {
    background: #5c3508;
    color: var(--accent);
    font-weight: 600;
}

button[data-operation]:hover {
    background: linear-gradient(135deg, var(--btn-hover-from), var(--btn-hover-to));
    color: #110a05;
}

/* Equals button — full accent */
button[data-equals] {
    background: var(--accent);
    color: #110a05;
    font-weight: 700;
}

button[data-equals]:hover {
    background: linear-gradient(135deg, var(--accent-hover), #fde68a);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
    transform: scale(1.04);
}

/* Delete button */
button[data-delete] {
    background: #3d1a1a;
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.15);
}

button[data-delete]:hover {
    background: linear-gradient(135deg, #ef4444, #fca5a5);
    color: #fff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}