* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, #ffe1ec, transparent 35%),
        radial-gradient(circle at top right, #d8f7ff, transparent 35%),
        radial-gradient(circle at bottom left, #fff1b8, transparent 35%),
        #fafafa;
    color: #333;
}

header {
    position: relative;
    overflow: hidden;
    color: white;
    text-align: center;
    padding: 85px 20px 60px;
    background: linear-gradient(
        270deg,
        #ff595e,
        #ffca3a,
        #8ac926,
        #1982c4,
        #6a4c93,
        #ff595e
    );
    background-size: 600% 600%;
    animation: rainbowShift 10s ease infinite;
}

@keyframes rainbowShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

header h1 {
    margin: 0;
    font-size: 3rem;
    position: relative;
    z-index: 2;
}

header p {
    font-size: 1.2rem;
    position: relative;
    z-index: 2;
}

.filament-line {
    position: absolute;
    top: 35px;
    left: -20%;
    width: 140%;
    height: 8px;
    background: linear-gradient(
        90deg,
        #ff595e,
        #ffca3a,
        #8ac926,
        #1982c4,
        #6a4c93
    );
    border-radius: 50px;
    animation: filamentMove 5s linear infinite;
}

@keyframes filamentMove {
    from {
        transform: translateX(-20%);
    }

    to {
        transform: translateX(20%);
    }
}

.printer {
    position: absolute;
    top: 14px;
    left: 50%;
    width: 70px;
    height: 55px;
    transform: translateX(-50%);
    animation: printerMove 4s ease-in-out infinite;
}

.printer-head {
    width: 70px;
    height: 35px;
    background: #222;
    border-radius: 8px;
    margin: auto;
}

.printer-nozzle {
    width: 0;
    height: 0;
    margin: auto;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 22px solid #222;
}

@keyframes printerMove {
    0% {
        transform: translateX(-120px);
    }

    50% {
        transform: translateX(55px);
    }

    100% {
        transform: translateX(-120px);
    }
}

nav {
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

nav a {
    text-decoration: none;
    color: #1982c4;
    font-weight: bold;
}

#themeButton {
    border: none;
    background: #6a4c93;
    color: white;
    padding: 10px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

section {
    max-width: 1000px;
    margin: auto;
    padding: 50px 20px;
    text-align: center;
}

section h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}

section p {
    font-size: 1.05rem;
    line-height: 1.6;
}

.button {
    display: inline-block;
    margin-top: 20px;
    background: #ff595e;
    color: white;
    padding: 14px 22px;
    border-radius: 12px;
    text-decoration: none;
    transition: .3s;
    font-weight: bold;
}

.button:hover {
    background: #1982c4;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 30px;
}

.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    font-size: 1.2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,.12);
    border-top: 8px solid #ff595e;
    transition: transform .3s;
}

.card:hover {
    transform: translateY(-8px);
}

.card:nth-child(2) {
    border-color: #ffca3a;
}

.card:nth-child(3) {
    border-color: #8ac926;
}

.card:nth-child(4) {
    border-color: #1982c4;
}

.card:nth-child(5) {
    border-color: #6a4c93;
}

.card:nth-child(6) {
    border-color: #ff595e;
}

footer {
    background: #222;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

body.dark-mode {
    background:
        radial-gradient(circle at top left, #3b1230, transparent 35%),
        radial-gradient(circle at top right, #12343b, transparent 35%),
        #181818;
    color: #f1f1f1;
}

body.dark-mode nav {
    background: #252525;
}

body.dark-mode .card {
    background: #252525;
    color: white;
}

body.dark-mode footer {
    background: #111;
}

body.dark-mode #themeButton {
    background: #ffca3a;
    color: #222;
}

/* Mobile-friendly changes */
@media (max-width: 600px) {
    header {
        padding: 75px 15px 45px;
    }

    header h1 {
        font-size: 2.1rem;
        line-height: 1.2;
    }

    header p {
        font-size: 1rem;
    }

    nav {
        gap: 12px;
        padding: 12px 8px;
    }

    nav a {
        font-size: .95rem;
    }

    #themeButton {
        padding: 9px 12px;
        font-size: .9rem;
    }

    section {
        padding: 35px 18px;
    }

    section h2 {
        font-size: 1.7rem;
    }

    section p {
        font-size: 1rem;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 22px;
        font-size: 1.1rem;
    }

    .printer {
        transform: scale(.75);
        animation: printerMoveMobile 4s ease-in-out infinite;
    }

    @keyframes printerMoveMobile {
        0% {
            transform: translateX(-90px) scale(.75);
        }

        50% {
            transform: translateX(35px) scale(.75);
        }

        100% {
            transform: translateX(-90px) scale(.75);
        }
    }
}
