/* Portfolio: one outlined card per project, screenshots on a striped panel in the project's colour on the left,
   title and description on the right. The blog page reuses the card, the pixel arrows and the screen frame. */

main {
    width: calc(100% - 2 * var(--gutter));
    padding-bottom: 64px;
}

/* ---------- Project card ---------- */
.project {
    --accent: var(--yellow);
    margin-top: clamp(28px, 4vw, 44px);
    border: var(--line) solid var(--ink);
    border-radius: var(--radius);
    background-color: var(--card);
    box-shadow: var(--shadow) var(--shadow) 0 var(--ink);
}

.project:nth-of-type(2) { --accent: var(--pink); }
.project:nth-of-type(3) { --accent: var(--mint); }
.project:nth-of-type(4) { --accent: var(--blue); }
.project:nth-of-type(5) { --accent: var(--orange); }

.project_body {
    display: flex;
    align-items: center;
    gap: clamp(20px, 3.5vw, 40px);
    padding: clamp(16px, 3vw, 28px);
}

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

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

.slide,
.screenshots {
    position: relative;
    aspect-ratio: 4 / 3;
    border: var(--line) solid var(--ink);
    border-radius: var(--radius);
    background-color: var(--accent);
    background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.07) 0 10px, transparent 10px 20px);
    box-shadow: 4px 4px 0 var(--ink);
    overflow: hidden;
}

.slide {
    display: none;
}

.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%;
    padding: 14px;
    box-sizing: border-box;
    object-fit: contain;
}

/* Square dots under the screen: more labels of the radio buttons */
.dots_nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.dots_nav label {
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border: var(--line) solid var(--ink);
    background-color: var(--card);
    cursor: pointer;
}

.carousel input:nth-of-type(1):checked ~ .dots_nav label:nth-child(1),
.carousel input:nth-of-type(2):checked ~ .dots_nav label:nth-child(2),
.carousel input:nth-of-type(3):checked ~ .dots_nav label:nth-child(3),
.carousel input:nth-of-type(4):checked ~ .dots_nav label:nth-child(4) {
    background-color: var(--ink);
}

/* Arrows: the bare pixel arrows (white with a black outline) with a hard pixel shadow */
.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));
    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;
    image-rendering: pixelated;
}

.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));
}

.carousel input:focus-visible ~ .slides .arrow {
    outline: 3px dashed var(--ink);
    outline-offset: 3px;
}

/* Several portrait screenshots side by side, slightly tilted */
.screenshots_row {
    position: absolute;
    inset: 16px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.screenshots img {
    height: 100%;
    width: auto;
    min-width: 0;
    box-sizing: border-box;
    object-fit: contain;
    border: var(--line) solid #111111;
    border-radius: 10px;
    background-color: #111111;
}

.screenshots_row img:first-child { rotate: -3deg; }
.screenshots_row img:last-child { rotate: 3deg; }

/* ---------- Text ---------- */
.project_text {
    flex: 1;
    min-width: 0;
}

.project_text h2 {
    margin: 0 0 14px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(34px, 3.6vw, 46px);
    font-weight: normal;
    line-height: 1;
    overflow-wrap: anywhere;
}

/* Marker highlight on part of the title */
.project_text h2 mark {
    padding: 0 6px;
    background-color: var(--accent);
    color: var(--on-fill);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.project_text p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 18px;
    line-height: 1.55;
}

.project_text p + p,
.project_text p + .features {
    margin-top: 10px;
}

.project_text .label {
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Feature list with square bullets in the project's colour */
.features {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--ink-soft);
    font-size: 17px;
    line-height: 1.45;
}

.features li {
    position: relative;
    padding-left: 26px;
}

.features li::before {
    content: "";
    position: absolute;
    top: 0.42em;
    left: 0;
    width: 11px;
    height: 11px;
    border: 2px solid var(--ink);
    background-color: var(--accent);
}

/* Tech chips */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
}

.tags li {
    padding: 3px 10px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background-color: var(--card);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    box-shadow: 2px 2px 0 var(--ink);
}

/* Try it: the big press-down button in the project's colour */
.try_it {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 26px;
    padding: 8px 26px 10px;
    border: var(--line) solid var(--ink);
    border-radius: var(--radius);
    background-color: var(--accent);
    color: var(--on-fill);
    font-family: var(--font-display);
    font-size: 30px;
    line-height: 1;
    text-decoration: none;
    box-shadow: 5px 5px 0 var(--ink);
    transition: translate 0.08s, box-shadow 0.08s;
}

@media (hover: hover) {
    .try_it:hover {
        translate: -2px -2px;
        box-shadow: 7px 7px 0 var(--ink);
    }
}

.try_it:active {
    translate: 5px 5px;
    box-shadow: 0 0 0 var(--ink);
}

/* ---------- Tablets: screen above the text ---------- */
@media screen and (max-width: 860px) {
    .project_body {
        flex-direction: column;
        align-items: stretch;
    }

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

@media screen and (max-width: 760px) {
    main {
        padding-bottom: 32px;
    }
}

/* 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;
    }
}
