/* Projects are dark panels with the screenshots in a black "screen" frame on the left and the title and
   description on the right. Same panel style as the command list on the OSaft console page. */

main {
    padding-bottom: clamp(24px, 4vw, 40px);
}

/* ---------- Window ---------- */
.project {
    width: calc(100% - 2 * var(--gutter));
    max-width: 1200px;
    margin: clamp(24px, 3vw, 32px) auto 0;
    border: 2px solid var(--color-line);
    border-radius: 12px;
    background-color: var(--color-card);
    box-shadow: 6px 6px 0 var(--color-shadow);  /* hard pixel shadow, like the arrows */
    color: var(--color-text-soft);
}

/* Body */
.project_body {
    display: flex;
    align-items: center;  /* a short description sits level with the screen, not at its top */
    gap: clamp(20px, 3vw, 32px);
    padding: clamp(16px, 2.5vw, 24px);
}

/* ---------- Screen: image slider ----------
   Hidden radio buttons pick the visible slide, the arrows are their labels */
.carousel {
    position: relative;  /* the hidden radio buttons stay inside the window, so clicking an arrow never scrolls the page away */
    flex: 0 0 42%;
    min-width: 0;
}

.carousel input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.slide {
    display: none;
    position: relative;
    aspect-ratio: 4 / 3;
    background-color: var(--color-screen);
    border: 2px solid var(--color-line);
    border-radius: 8px;
    overflow: hidden;
}

.carousel input:nth-of-type(1):checked ~ .slides .slide:nth-child(1),
.carousel input:nth-of-type(2):checked ~ .slides .slide:nth-child(2),
.carousel input:nth-of-type(3):checked ~ .slides .slide:nth-child(3),
.carousel input:nth-of-type(4):checked ~ .slides .slide:nth-child(4) {
    display: block;
}

.slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Several screenshots side by side, for portrait images like phone screenshots */
.screenshots {
    position: relative;
    aspect-ratio: 4 / 3;
    background-color: var(--color-screen);
    border: 2px solid var(--color-line);
    border-radius: 8px;
}

.screenshots_row {
    position: absolute;
    inset: 16px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.screenshots img {
    height: 100%;
    width: auto;
    min-width: 0;
    object-fit: contain;
    border-radius: 6px;
}

.arrow {
    position: absolute;
    top: 50%;
    translate: 0 -50%;
    display: grid;
    place-items: center;
    min-width: 44px;   /* tap target bigger than the drawn arrow */
    min-height: 60px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.5)); /* hard pixel shadow */
    transition: transform 0.12s steps(2); /* stepped, not smooth */
}

/* 9 x 13 px pixel art SVG, drawn at 4px per pixel */
.arrow img {
    display: block;
    width: 36px;
    height: 52px;
}

.arrow.prev {
    left: 12px;
}

.arrow.next {
    right: 12px;
}

@media (hover: hover) {
    .arrow.prev:hover {
        transform: translateX(-4px);
    }

    .arrow.next:hover {
        transform: translateX(4px);
    }
}

.arrow:active {
    transform: translateY(2px);
    filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.5));
}

/* Keyboard: the focused radio button lights up its slide's arrows */
.carousel input:focus-visible ~ .slides .arrow {
    outline: 2px solid var(--color-border);
    outline-offset: 2px;
}

/* ---------- Text ---------- */
.project_text {
    flex: 1;
    min-width: 0;  /* long words wrap instead of pushing the window wider */
}

.project_text h2 {
    margin: 0 0 10px;
    color: var(--color-primary);
    font-size: clamp(24px, 2.4vw, 28px);
    font-weight: normal;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.project_text p {
    margin: 0;
    font-size: 22px;
    line-height: 1.4;
}

.project_text p + p {
    margin-top: 12px;
}

.features {
    margin: 0;
    padding-left: 28px;
    font-size: 22px;
    line-height: 1.4;
}

/* Same outlined chips as the stack on the résumé */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.tags li {
    padding: 2px 10px;
    border: 2px solid var(--color-line);
    border-radius: 6px;
    color: var(--color-text-soft);
    font-size: 18px;
}

/* Try it: the one blue element in the window. Presses down like the arrows. */
.try_it {
    display: inline-block;
    margin-top: 24px;
    padding: 8px 28px;
    border-radius: 8px;
    background-color: var(--color-border);
    color: #FFFFFF;  /* white on blue in both themes */
    font-size: 26px;
    text-decoration: none;
    box-shadow: 3px 3px 0 var(--color-shadow);
    transition: translate 0.12s steps(2), box-shadow 0.12s steps(2);
}

.try_it:active {
    translate: 2px 2px;
    box-shadow: 1px 1px 0 var(--color-shadow);
}

.try_it:focus-visible {
    outline: 2px solid var(--color-border);
    outline-offset: 2px;
}

@media (hover: hover) {
    .try_it:hover {
        filter: brightness(1.1);
    }
}

/* ---------- Narrow screens and portrait tablets: screen above the text, both full width ---------- */
@media screen and (max-width: 860px) {
    .project_body {
        flex-direction: column;
        align-items: stretch;
    }

    .carousel {
        flex: none;
        width: 100%;
    }
}

/* Phones */
@media screen and (max-width: 600px) {
    .project {
        box-shadow: 4px 4px 0 var(--color-shadow);
    }
}

/* Small phones: a squarer frame gives the phone screenshots more room */
@media screen and (max-width: 480px) {
    .screenshots {
        aspect-ratio: 1 / 1;
    }

    .screenshots_row {
        inset: 12px;
        gap: 12px;
    }
}
