/* ================================================= */
/* ==================== GENERAL ==================== */
/* ================================================= */

:root {
    --pixel: 4px;
    --brown: #6b4528;
    --dark-green: #3f7d3a;
    --hill-green: #6fa58a;
    --ground-green: #72a854;
    --house: #eee2c6;
    --roof: #a65345;
    --sun: #ffd966;
}

body {
    margin: 0;
    font-family: "Courier New", monospace;
}

.window {
    position: relative;

    width: 100vw;
    height: 100vh;

    background-color: #5b7199;

    transition: background-color 1.5s steps(6);

    overflow: hidden;
}


/* ================================================= */
/* ===================== TITLE ===================== */
/* ================================================= */

h1,
h3 {
    width: fit-content;

    color: #6b4528;

    background-color: #fff8dc;

    border: 4px solid #6b4528;

    box-shadow: 4px 4px 0 #6b4528;

    padding: 6px 12px;

    box-sizing: border-box;

    font-family: "Courier New", monospace;
}


/* ---------- TITLE ---------- */

h1 {
    margin: 20px 0 5px 30px;

    font-size: 28px;
}


/* ---------- SUBTITLE ---------- */

h3 {
    margin: 0 0 0 30px;

    font-size: 16px;
}


/* ================================================= */
/* ================== OUTER FRAME ================== */
/* ================================================= */

.outer-frame {
    position: absolute;

    top: 1px;
    left: 1px;
    right: 1px;
    bottom: 1px;

    border: 20px solid white;

    box-sizing: border-box;

    z-index: 7;

    pointer-events: none;
}


/* ================================================= */
/* ====================== SUN ====================== */
/* ================================================= */


.sun {
    position: absolute;

    left: 50%;
    bottom: 20%;

    width: 85px;
    height: 85px;

    transform: translateX(-50%);

    background-color: var(--sun);

    z-index: 0;

    /*
       Small pixel corners.
       Each step is only a few pixels.
    */

    clip-path: polygon(
        25% 0,
        75% 0,
        75% 6%,
        94% 6%,
        94% 25%,
        100% 25%,
        100% 75%,
        94% 75%,
        94% 94%,
        75% 94%,
        75% 100%,
        25% 100%,
        25% 94%,
        6% 94%,
        6% 75%,
        0 75%,
        0 25%,
        6% 25%,
        6% 6%,
        25% 6%
    );

    transition: bottom 1.5s steps(12);
}


/* ================================================= */
/* =================== LANDSCAPE =================== */
/* ================================================= */

.landscape {
    position: absolute;

    bottom: 0;
    left: 0;

    width: 100%;
    height: 45%;

    z-index: 1;
}


/* ================================================= */
/* ===================== HILLS ===================== */
/* ================================================= */

.hills {
    position: absolute;

    bottom: 25%;
    left: -10%;

    width: 120%;
    height: 60%;

    background-color: var(--hill-green);

    /*
       MUCH smaller staircase.
       The previous version used huge 10% jumps.
    */

    clip-path: polygon(
        0 100%,
        0 72%,

        4% 72%,
        4% 68%,
        8% 68%,
        8% 64%,
        12% 64%,
        12% 60%,
        16% 60%,
        16% 56%,
        20% 56%,
        20% 52%,
        24% 52%,
        24% 48%,
        28% 48%,
        28% 44%,
        32% 44%,
        32% 40%,
        36% 40%,
        36% 36%,
        40% 36%,
        40% 32%,
        44% 32%,
        44% 28%,
        48% 28%,
        48% 24%,
        52% 24%,
        52% 28%,
        56% 28%,
        56% 32%,
        60% 32%,
        60% 36%,
        64% 36%,
        64% 40%,
        68% 40%,
        68% 44%,
        72% 44%,
        72% 48%,
        76% 48%,
        76% 52%,
        80% 52%,
        80% 56%,
        84% 56%,
        84% 60%,
        88% 60%,
        88% 64%,
        92% 64%,
        92% 68%,
        96% 68%,
        96% 72%,
        100% 72%,

        100% 100%
    );
}


/* ================================================= */
/* ===================== GROUND ==================== */
/* ================================================= */

.ground {
    position: absolute;

    bottom: 0;
    left: 0;

    width: 100%;
    height: 45%;

    background-color: var(--ground-green);
}


/* ================================================= */
/* ===================== HOUSES ==================== */
/* ================================================= */

.house {
    position: absolute;

    bottom: 18%;

    width: 100px;
}


/* ---------- HOUSE BODY ---------- */

.house-body {
    width: 100px;
    height: 80px;

    background-color: var(--house);

    border: 4px solid var(--brown);

    box-sizing: border-box;

    /*
       Tiny block highlights
    */

    background-image:
        linear-gradient(
            90deg,
            transparent 0,
            transparent 8px,
            rgba(107, 69, 40, 0.04) 8px,
            rgba(107, 69, 40, 0.04) 12px,
            transparent 12px
        );

    background-size: 16px 16px;
}


/* ---------- ROOF ---------- */

.roof {
    width: 0;
    height: 0;

    border-left: 50px solid transparent;
    border-right: 50px solid transparent;

    border-bottom: 45px solid var(--roof);

    margin-left: 0;
}


/* ---------- HOUSE POSITIONS ---------- */

.house1 {
    left: 20%;
}

.house2 {
    left: 45%;

    transform: scale(0.8);
    transform-origin: bottom center;
}

.house3 {
    left: 68%;
    z-index: 2;
    transform: scale(0.70);
    transform-origin: bottom center;
}


/* ================================================= */
/* ====================== TREES ==================== */
/* ================================================= */

.tree {
    position: absolute;

    bottom: 10%;

    width: 100px;
    height: 170px;
}


/* ---------- TREE TRUNK ---------- */

.trunk {
    position: absolute;

    bottom: 0;
    left: 40px;

    width: 20px;
    height: 70px;

    background-color: var(--brown);

    /*
       Pixelated trunk
    */
    clip-path: polygon(
        4px 0,
        16px 0,
        16px 4px,
        20px 4px,
        20px 70px,
        0 70px,
        0 4px,
        4px 4px
    );
}


/* ---------- TREE LEAVES ---------- */

.leaves {
    position: absolute;

    bottom: 55px;
    left: 0;

    width: 100px;
    height: 80px;

    background-color: var(--dark-green);

    border-radius: 0;

    /*
       4px pixel staircase silhouette
    */
    clip-path: polygon(
        28px 0,
        72px 0,

        72px 4px,
        84px 4px,

        84px 8px,
        92px 8px,

        92px 16px,
        100px 16px,

        100px 60px,
        96px 60px,

        96px 68px,
        88px 68px,

        88px 76px,
        76px 76px,

        76px 80px,
        24px 80px,

        24px 76px,
        12px 76px,

        12px 68px,
        4px 68px,

        4px 60px,
        0 60px,

        0 16px,
        8px 16px,

        8px 8px,
        16px 8px,

        16px 4px,
        28px 4px
    );
}


/* ---------- TREE POSITIONS ---------- */

.tree1 {
    left: 5%;

    transform: scale(1.2);
    transform-origin: bottom center;
}

.tree2 {
    right: 5%;

    transform: scale(1.5);
    transform-origin: bottom center;
}


/* ================================================= */
/* ===================== NOTEPAD =================== */
/* ================================================= */

#notepadButton {
    position: absolute;

    top: 40px;
    right: 40px;

    z-index: 10;

    padding: 8px 16px;

    font-family: "Courier New", monospace;
    font-size: 16px;
    font-weight: bold;

    color: var(--brown);

    background-color: #fff8dc;

    border: 4px solid var(--brown);

    box-shadow: 4px 4px 0 var(--brown);

    cursor: pointer;
}

#notepadButton:hover {
    transform: translate(2px, 2px);

    box-shadow: 2px 2px 0 var(--brown);
}

#notepadButton:active {
    transform: translate(4px, 4px);

    box-shadow: none;
}


/* ---------- NOTEPAD ---------- */

#notepad {
    display: none;

    position: absolute;

    top: 85px;
    right: 40px;

    width: 280px;
    height: 350px;

    background-color: #fff8dc;

    border: 5px solid var(--brown);

    box-shadow: 6px 6px 0 rgba(107, 69, 40, 0.35);

    box-sizing: border-box;

    z-index: 10;
}


/* ---------- NOTEPAD HEADER ---------- */

.notepad-header {
    height: 45px;

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

    padding: 0 12px;

    box-sizing: border-box;

    background-color: var(--house);

    border-bottom: 4px solid var(--brown);

    font-family: "Courier New", monospace;
    font-weight: bold;
}


/* ---------- CLOSE BUTTON ---------- */

#closeNotepad {
    border: none;

    background: none;

    font-family: "Courier New", monospace;
    font-size: 24px;

    cursor: pointer;
}


/* ---------- TASKS ---------- */

.task {
    display: flex;
    align-items: center;

    gap: 10px;

    padding: 15px;

    box-sizing: border-box;
}


/* ---------- CHECKBOX ---------- */

.task-check {
    width: 18px;
    height: 18px;

    cursor: pointer;
}


/* ---------- TASK TEXT ---------- */

.task-text {
    flex: 1;

    border: none;
    border-bottom: 2px solid var(--brown);

    outline: none;

    background: transparent;

    font-family: "Courier New", monospace;
    font-size: 15px;
}


/* ---------- COMPLETED TASK ---------- */

.task-text.completed {
    text-decoration: line-through;

    opacity: 0.5;
}

/* ---------- DUCKS ---------- */

.duck-container {
    position: absolute;
    left: 20px;
    bottom: 0;
    width: 60px;
    z-index: 5;
}

.duck {
    display: block;
    width: 60px;
    height: auto;

    opacity: 0;
    transform: translateY(20px);

    transition:
        opacity 0.4s steps(4),
        transform 0.5s steps(5);
}

/* Task 1: ducks emerge */

.ducks-out .duck {
    opacity: 1;
    transform: translateY(0);
}


/* ---------- $2 MESSAGE ---------- */

.money-message {
    position: absolute;
    left: 50%;
    bottom: 100%;

    font-family: "Courier New", monospace;
    font-size: 20px;
    font-weight: bold;
    color: #6b4528;

    opacity: 0;
    transform: translateX(-50%) translateY(5px);

    pointer-events: none;
}

.money-message.show {
    animation: moneyPop 1.5s steps(4) forwards;
}

@keyframes moneyPop {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }

    20% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    75% {
        opacity: 1;
        transform: translateX(-50%) translateY(-5px);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-15px);
    }
}

/* ---------- SUCCESS MESSAGE ---------- */

#successMessage {
    display: none;
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    text-align: center;
    z-index: 20;

    font-family: "Courier New", monospace;
    font-size: 22px;
    font-weight: bold;
    color: #6b4528;
}

#successMessage.show {
    display: block;
}

/*----------HAPPY DUCKS----------*/

.ducks-happy .duck {
    animation: duckHappy 1s steps(4) infinite;

}
@keyframes duckHappy {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
    100% {
        transform: translateY(0);
    }
}