html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overscroll-behavior: none;
}

.hero {
    position: relative;

    width: 100%;
    min-height: 100vh;

    background-image: url("../images/bg.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    overflow: hidden;
}

.yinyang {
    position: absolute;

    top: 50%;
    left: 50%;

    width: 500px;

    transform: translate3d(-50%, -50%, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform, filter;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);

    /* Helps prevent edge shimmer artifacts on transparent PNG hover scaling. */
    outline: 1px solid transparent;

    transition:
        transform 0.3s ease,
        filter 0.3s ease,
        box-shadow 0.3s ease;
}

.yinyang:hover {
    transform: translate3d(-50%, -50%, 0) scale(1.06);
    filter: brightness(1.04) contrast(1.03);
    box-shadow:
        0 0 22px rgba(255, 255, 255, 0.30),
        0 0 42px rgba(255, 255, 255, 0.14);
}

.content {
    position: absolute;

    top: 50%;
    left: 10%;

    transform: translateY(-50%);

    color: white;

    z-index: 10;
}

.content h1 {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.content p {
    font-size: 1.5rem;
}

.about-content {
    left: 50%;

    max-width: 760px;
    width: min(82vw, 760px);

    padding: 28px 32px;

    transform: translate(-50%, -50%);

    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);

    border-radius: 18px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.35);
}

.about-content ul {
    font-size: 1.35rem;
    line-height: 1.1;

    padding-left: 1.4rem;
}

.about-content li+li {
    margin-top: 0.35rem;
}

.projects-container {
    max-width: 1000px;

    margin: auto;
    padding-top: 100px;

    color: white;
    text-align: center;
}

.project-card {
    margin: 30px auto;
    padding: 30px;

    max-width: 800px;

    background: rgba(0, 0, 0, 0.4);

    border-radius: 15px;

    backdrop-filter: blur(5px);
}

.project-card h2 {
    margin-top: 0;
}

.project-card a {
    display: inline-block;

    margin-top: 15px;
    padding: 10px 20px;

    text-decoration: none;

    color: white;

    border: 1px solid white;
    border-radius: 8px;

    transition: 0.3s;
}

.project-card a:hover {
    background: white;
    color: black;
}

.project-page p {
    display: inline-block;

    padding: 12px 24px;

    background: rgba(0, 0, 0, 0.25);

    backdrop-filter: blur(6px);

    border-radius: 10px;
}

.digit-container {
    display: flex;

    justify-content: center;
    gap: 48px;

    margin-top: 20px;

    flex-wrap: wrap;
}

.digit-box {
    background: rgba(0, 0, 0, 0.45);

    padding: 30px;

    border-radius: 15px;

    backdrop-filter: blur(8px);

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.4);

    width: 380px;
}

.digit-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.result-box {
    position: relative;
    overflow: hidden;
}

canvas {
    background: black;

    touch-action: none;
    overscroll-behavior: contain;

    -webkit-touch-callout: none;
    user-select: none;

    border-radius: 15px;
}

#nn-gif {
    width: 220px;
    height: 220px;
}

.prediction-display {
    position: absolute;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    font-size: 96px;
    font-weight: bold;

    color: white;

    text-shadow:
        2px 2px 8px black;
}

button {
    margin: 10px 5px;

    padding: 10px 20px;

    border: none;
    border-radius: 8px;

    font-weight: bold;

    cursor: pointer;

    background-color: #2b2c2c;

    color: white;

    transition: 0.3s;
}

button:hover {
    background-color: #005f73;
}

.project-page {
    display: flex;
    flex-direction: column;
    align-items: center;

    position: relative;
    z-index: 10;

    width: 90%;
    max-width: 1400px;

    margin: auto;

    padding-top: 50px;

    color: white;
    text-align: center;
}

.app-frame {
    display: block;

    width: 100%;
    max-width: 1200px;

    height: 850px;

    margin: 30px auto 0;

    border: none;

    box-shadow:
        0 0 20px rgba(255, 255, 255, 0.1);
}

.description {
    font-size: 1.5rem;

    max-width: 600px;

    margin: auto auto 40px auto;

    text-align: center;

    color: #e0e0e0;

    text-shadow:
        0 2px 8px rgba(0, 0, 0, 0.8);

    background: rgba(0, 0, 0, 0.25);

    backdrop-filter: blur(6px);

    border-radius: 10px;

    padding: 12px 24px;

    display: block;
}

/* Tablets */
@media (max-width: 1024px) {
    .app-frame {
        width: 90%;
        height: 900px;
    }

    .description {
        width: 90%;
        font-size: 1.3rem;
    }
}

/* Phones */
@media (max-width: 768px) {

    .about-content {
        left: 50%;

        width: min(84vw, 560px);
        max-width: none;

        padding: 18px 20px;

        transform: translate(-50%, -50%);
    }

    .about-content h1 {
        font-size: 2.4rem;
    }

    .about-content p,
    .about-content ul {
        font-size: 1.05rem;
    }

    .project-page {
        padding-top: 18px;
    }

    .digit-container {
        flex-direction: column;
        align-items: center;
        gap: 16px;

        width: 100%;

        margin-top: 12px;
    }

    .digit-box {
        display: flex;
        flex-direction: column;
        align-items: center;

        width: 84vw;
        max-width: 290px;
        min-height: 208px;

        padding: 10px;
        box-sizing: border-box;
    }

    .digit-box h3 {
        margin-top: 0;
        margin-bottom: 8px;
        font-size: 0.95rem;
    }

    canvas,
    #nn-gif {
        display: block;

        width: min(42vw, 144px);
        height: auto;

        margin: 0 auto;
    }

    .prediction-display {
        font-size: clamp(38px, 10vw, 56px);
    }

    .digit-actions {
        gap: 10px;
    }

    .digit-actions button {
        margin: 6px 0 0;
        padding: 8px 12px;

        font-size: 0.86rem;
        border: 1px solid rgba(255, 255, 255, 0.45);
    }

    .project-page h1 {
        font-size: 2.2rem;
    }

    .description {
        width: min(84vw, 320px);
        font-size: 0.95rem;

        margin: 0 auto 10px auto;
        padding: 8px 10px;
    }

    .links {
        margin-top: 10px;
    }
}

/* Small phones */
@media (max-width: 480px) {

    .about-content {
        width: min(88vw, 360px);

        padding: 16px 16px;
    }

    .about-content h1 {
        font-size: 2rem;
    }

    .about-content p,
    .about-content ul {
        font-size: 0.95rem;
    }

    .project-page {
        padding-top: 12px;
    }

    .digit-container {
        gap: 12px;
    }

    .digit-box {
        width: 84vw;
        max-width: 272px;
        min-height: 196px;
        padding: 8px;
    }

    .digit-box h3 {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }

    .digit-actions {
        gap: 8px;
    }

    .digit-actions button {
        padding: 7px 10px;
        font-size: 0.8rem;
    }

    canvas,
    #nn-gif {
        width: min(38vw, 128px);
    }

    .prediction-display {
        font-size: clamp(32px, 9vw, 44px);
    }

    .project-page h1 {
        font-size: 1.8rem;
    }

    .description {
        width: min(82vw, 260px);
        font-size: 0.85rem;
        margin-bottom: 8px;
        padding: 6px 8px;
    }
}

/* Phones in landscape */
@media (max-width: 768px) and (orientation: landscape) {

    .app-frame {
        height: 450px;
    }
}

/* Phones in portrait */
@media (max-width: 480px) and (orientation: portrait) {

    .app-frame {
        height: 700px;
    }
}