/* shared.css is now loaded via its own <link> in <head>, before this file,
   instead of @import — see the note at the top of shared.css. */

/* Main Content Styling */
.main-content {
    max-width: var(--content-max);
    width: min(calc(100% - 2 * var(--content-gutter)), var(--content-max));
    padding: clamp(1.2rem, 3vw, 2rem) 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.main-content > .hidden {
    width: 100%;
}

.hero {
    /* Sized ~20% smaller across the board (gap, bottom margin, text, and
       the store card below) so "Featured Projects" peeks into view at the
       bottom of the initial viewport as a hint to scroll, instead of the
       hero filling the whole screen on its own. */
    /* Store card is currently commented out in index.html, so the hero is
       centered with the name front and center. When the card returns, swap
       justify-content back to space-between and .intro text-align to left. */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: clamp(1.2rem, 2.4vw, 2.4rem);
    width: 100%;
    max-width: 860px;
    margin: 0 auto clamp(2.56rem, 7.68vw, 6.4rem);
}

.intro {
    text-align: center;
    flex: 0 1 auto;
    margin-bottom: 0;
}

.intro h1 {
    color: var(--text-primary);
    font-size: clamp(2.4rem, 7vw, 5.6rem);
    margin-bottom: clamp(0.4rem, 1vw, 0.8rem);
    line-height: 1.05;
}

.intro h2 {
    color: var(--text-secondary);
    /* Kept on a single line; font scales with viewport so it fits on phones. */
    font-size: clamp(0.7rem, 2.2vw, 1.6rem);
    line-height: 1.3;
    white-space: nowrap;
    margin: 0 auto;
}

/* Software logo standing in for its name in the hero line; the name shows
   in a small label above it on hover / keyboard focus. */
.tool-icon {
    position: relative;
    display: inline-block;
    width: 0.95em;
    height: 0.95em;
    vertical-align: -0.12em;
    color: #e87d0d;
    outline: none;
}

.tool-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: currentColor;
    transition: transform .2s ease;
}

.tool-icon::after {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translate(-50%, 4px);
    padding: 0.25rem 0.55rem;
    border-radius: 5px;
    background-color: #e87d0d;
    color: #ffffff;
    font-size: clamp(0.65rem, 1.2vw, 0.8rem);
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

.tool-icon:hover svg,
.tool-icon:focus-visible svg {
    transform: scale(1.12);
}

.tool-icon:hover::after,
.tool-icon:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.store-card {
    position: relative;
    flex: 0 0 auto;
    width: min(100%, 240px);
    aspect-ratio: 8 / 11;
}

.store-card > a {
    display: block;
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
}

.box {
    border-radius: clamp(1.2rem, 3.2vw, 2.4rem);
    width: 100%;
    height: 100%;
    padding: clamp(1.2rem, 4vw, 2.4rem);
    text-align: center;
    transition: .3s ease-in-out;
    background-image: url("assets/HEAT.jpg");
    background-position: left 50% bottom 45%;
    background-size: cover;
}

.box h2 {
    /* Sits on top of a photo background, not the page background — stays
       white in both themes rather than following --text-primary. */
    color: #ffffff;
    font-size: clamp(1rem, 2.4vw, 1.6rem);
}

.box:hover {
    transform: translateY(-5%);
    transition: .3s ease-in-out;
    box-shadow: inset 0px 0px 5000px var(--shadow-color);
}

.box-shadow {
    position: absolute;
    inset: 0;
    border-radius: clamp(1.2rem, 3.2vw, 2.4rem);
    width: 100%;
    height: 100%;
    text-align: center;
    box-shadow: 0px 10px 50px var(--shadow-color);
    pointer-events: none;
    z-index: 0;
}

.box-shadow:hover {
    box-shadow: 0px 10px 50px var(--shadow-color);
}

.current-projects {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    margin-bottom: clamp(2rem, 5vw, 3rem);
    gap: 1rem;
}

.project-info {
    flex: 1 1 200px;
    margin: 0;
    text-align: center;
}

.project-info h3 {
    color: var(--text-heading-soft);
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    margin-bottom: 10px;
}

.project-info p a {
    color: #5a31f4;
    text-decoration: none;
}

.project-info p a:hover {
    text-decoration: underline;
}

/* Featured Projects Styling */
.featured-projects {
    width: 100%;
    text-align: center;
}

.featured-projects h1,
.featured-projects h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.25rem);
    color: var(--text-heading-soft);
    margin-bottom: clamp(1.15rem, 2.5vw, 1.75rem);
}

.project {
    background-color: var(--bg-elevated);
    padding: clamp(1.15rem, 3.5vw, 1.75rem);
    border-radius: clamp(0.9rem, 2vw, 1.15rem);
    box-shadow: 0px 10px 50px var(--shadow-color);
    margin-bottom: clamp(1.15rem, 2.5vw, 1.75rem);
    text-align: left;
    transition: background-color .35s ease;
}

.project-tags {
    margin-bottom: 9px;
}

.tag {
    background-color: rgb(38, 113, 253);
    color: #ffffff;
    padding: 0.32rem 0.68rem;
    border-radius: 5px;
    font-size: clamp(0.7rem, 1.6vw, 0.8rem);
    margin-right: 9px;
}

.project h3 {
    font-size: clamp(1.15rem, 3vw, 1.75rem);
    margin-bottom: 9px;
}

.project p {
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    color: var(--text-secondary);
    margin-bottom: 18px;
    line-height: 1.5;
}

/* Links out to the Reddit post; underlined so they read as links without
   changing the card's colors. */
.project a.project-link,
.artwork-caption a.project-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--text-faint);
    text-underline-offset: 3px;
    transition: text-decoration-color .2s ease, color .2s ease;
}

.project p a.project-link,
.artwork-caption p a.project-link {
    font-weight: 600;
}

.project a.project-link:hover,
.artwork-caption a.project-link:hover {
    color: var(--text-primary);
    text-decoration-color: currentColor;
}

.project-image {
    background-color: var(--bg-surface);
    border-radius: 14px;
    overflow: hidden;
    max-width: 100%;
    /* A fixed pixel max-height doesn't scale down for narrow screens, which
       is exactly what forced an extreme, zoomed-in crop on mobile. An
       aspect-ratio on the frame instead scales proportionally at every
       width, and matches this image's own ~16:9 ratio, so nothing needs to
       be cropped or object-fit: contain'd differently per breakpoint. */
    aspect-ratio: 16 / 9;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

section {
    display: grid;
    text-align: center;
}

/* body > .hidden is a horizontal flex row (shared.css); gallery rows with a
   caption need to stack it above the images instead of beside them. */
body > .hidden:has(> .artwork-caption) {
    flex-direction: column;
    align-items: center;
}

/* "Client Commissions" / "Passion Projects" section titles — same look as
   the "Featured Projects" heading. */
.gallery-heading {
    font-size: clamp(1.75rem, 3.5vw, 2.25rem);
    color: var(--text-heading-soft);
    text-align: center;
    margin: clamp(2.5rem, 6vw, 4rem) 0 0;
}

/* Small header + description above each gallery row. Shares the row's width
   so the text lines up with the left edge of the first image. */
.artwork-caption {
    width: min(calc(100% - 2 * var(--content-gutter)), var(--content-max));
    margin: clamp(0.5rem, 1.5vw, 1rem) auto clamp(0.75rem, 1.6vw, 1rem);
    text-align: left;
}

.artwork-caption h3 {
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

/* Heading with Featured Projects-style tags beside it; wraps under on
   narrow screens. */
.caption-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 10px;
    /* Takes over the h3's default top margin (1em of its font size) so the
       caption starts at the same height as the others. */
    margin: clamp(1rem, 2.2vw, 1.2rem) 0 0.3rem;
}

/* Default margins on the h3 pushed it below the tags' centre line. */
.caption-title h3 {
    margin: 0;
}

/* Inline spans' padding doesn't count toward line height, which left the
   pills sitting above the heading's centre; as flex items they center on
   their full box. */
.caption-title .project-tags {
    display: flex;
    gap: 7px;
    margin-bottom: 0;
}

.caption-title .tag {
    margin-right: 0;
    padding: 0.25rem 0.64rem;
    font-size: clamp(0.715rem, 1.51vw, 0.81rem);
    line-height: 1.2;
}

.artwork-caption p {
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Role / date lines under the heading, before the description. */
.artwork-caption .caption-role {
    color: var(--text-primary);
    font-size: clamp(0.85rem, 1.9vw, 0.95rem);
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
}

.artwork-caption .caption-date {
    line-height: 1.4;
    margin: 0;
}

.artwork-caption .caption-date + p {
    margin-top: 0.5rem;
}

.artwork-display {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    width: min(calc(100% - 2 * var(--content-gutter)), var(--content-max));
    padding: 0;
    margin: 0 auto 24px;
    text-align: center;
}

.artwork-item {
    display: block;
    min-width: 0;
}

.artwork-display img,
.artwork-display video {
    border-radius: clamp(0.8rem, 2.4vw, 1.2rem);
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0px 10px 75px var(--shadow-color);
    transition: transform .3s ease, box-shadow .3s ease;
}

.artwork-item:hover {
    position: relative;
    z-index: 2;
}

.artwork-item:hover img,
.artwork-item:hover video {
    transform: scale(1.15);
    box-shadow: 0px 0px 20px var(--glow-color);
}

/* Added by app.js after 1s of hovering: another 40% on top of the 1.15. */
.artwork-item.zoomed img,
.artwork-item.zoomed video {
    transform: scale(1.61);
}

/* Gallery row with four images instead of three; 2x2 on phones. */
.artwork-display.artwork-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 768px) {
    .artwork-display.artwork-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tiles here start ~3/4 the width of a 3-column tile, so both hover steps
   are scaled by 4/3 to land at the same on-screen size as the rest of the
   gallery (1.15 -> 1.53, 1.61 -> 2.15). Desktop only: on phones the 2x2
   tiles are already larger than 3-column ones. */
@media (min-width: 769px) {
    .artwork-cols-4 .artwork-item:hover img,
    .artwork-cols-4 .artwork-item:hover video {
        transform: scale(1.53);
    }

    .artwork-cols-4 .artwork-item.zoomed img,
    .artwork-cols-4 .artwork-item.zoomed video {
        transform: scale(2.15);
    }
}

/* Compact strip of square thumbnails (Client Commissions). */
.artwork-display.artwork-thumbs {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 16px;
}

/* Each tile is a square frame; the image is absolutely positioned inside it
   so on hover it can grow past the frame to its natural aspect ratio (--ar,
   set inline per item), uncropping into the full picture. Width/height
   transition instead of transform so the crop itself morphs. */
.artwork-thumbs .artwork-item {
    position: relative;
    aspect-ratio: 1 / 1;
}

.artwork-thumbs img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    max-width: none;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    transform: translate(-50%, -50%);
    transition: width .35s ease, height .35s ease, box-shadow .35s ease;
}

.artwork-thumbs .artwork-item:hover img {
    width: 280%;
    height: calc(280% / (var(--ar)));
    transform: translate(-50%, -50%);
}

/* Edge tiles grow inward so the preview doesn't run off the content edge.
   Per row (7n) rather than first/last-child so strips that wrap onto a
   second row are covered too. */
.artwork-thumbs .artwork-item:nth-child(7n + 1) img {
    left: 0;
    transform: translate(0, -50%);
}

.artwork-thumbs .artwork-item:nth-child(7n) img {
    left: auto;
    right: 0;
    transform: translate(0, -50%);
}

/* Second step after 1s of hovering (app.js adds .zoomed): another 40% on
   the 280% preview. Grows width/height like the first step; the scale()
   in .artwork-item.zoomed is outranked here, so tiles keep their
   translate positioning. */
.artwork-thumbs .artwork-item.zoomed img {
    width: 392%;
    height: calc(392% / (var(--ar)));
}

@media (max-width: 768px) {
    .artwork-display.artwork-thumbs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
    }

    .artwork-thumbs .artwork-item:nth-child(4n + 1) img {
        left: 0;
        transform: translate(0, -50%);
    }

    .artwork-thumbs .artwork-item:nth-child(4n) img {
        left: auto;
        right: 0;
        transform: translate(0, -50%);
    }
}

/* Collapsible "Build log" under a gallery row (native <details>). Same
   width as the caption/row so it lines up with their left edge. */
.build-log {
    width: min(calc(100% - 2 * var(--content-gutter)), var(--content-max));
    margin: 0 auto 24px;
}

.build-log summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--text-faint);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

.build-log summary::-webkit-details-marker {
    display: none;
}

.build-log summary:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface);
}

.build-log summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.build-log-chevron {
    transition: transform .2s ease;
}

.build-log[open] .build-log-chevron {
    transform: rotate(180deg);
}

.build-log-note {
    margin: 0.75rem 0;
    color: var(--text-primary);
    font-weight: 600;
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
}

/* Desktop: a 4-column grid read left to right, row by row. Images keep
   their own aspect ratio, centred in their row. Each is an .artwork-item so
   the gallery hover-enlarge applies. */
.build-log-images {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
    gap: 12px;
}

/* One fixed 16:9 frame for every tile so rows line up; cover crops the
   overflow rather than letterboxing. */
.build-log-images img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 6px 30px var(--shadow-color-soft);
    transition: transform .3s ease, box-shadow .3s ease;
}

/* Stage label chip on the first tile of each build stage. Sits on the
   image, so it reads the same in light and dark mode; fades out while the
   image is enlarged so it doesn't float over it. */
.build-log-images .artwork-item {
    position: relative;
}

.build-log-stage {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: clamp(0.65rem, 1.4vw, 0.75rem);
    font-weight: 600;
    line-height: 1.3;
    pointer-events: none;
    transition: opacity .2s ease;
}

.build-log-images .artwork-item:hover .build-log-stage {
    opacity: 0;
}

/* Build-log hover-enlarge is 25% stronger than the gallery's: 1.15 -> 1.44,
   then 1.61 -> 2.01 after 1s (app.js adds .zoomed). */
@media (min-width: 769px) {
    .build-log-images .artwork-item:hover img {
        transform: scale(1.44);
    }

    .build-log-images .artwork-item.zoomed img {
        transform: scale(2.01);
    }
}

/* Phones: one row that scrolls sideways inside the dropdown. The scroller
   clips anything that grows, so the hover-enlarge is turned off here. */
@media (max-width: 768px) {
    .build-log-images {
        display: flex;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        gap: 10px;
        padding-bottom: 8px;
    }

    .build-log-images .artwork-item {
        flex: 0 0 auto;
    }

    .build-log-images img {
        width: auto;
        height: 156px;
        box-shadow: none;
    }

    /* No enlarge on phones, so the label can stay put. */
    .build-log-images .artwork-item:hover .build-log-stage {
        opacity: 1;
    }

    .build-log-images .artwork-item:hover img,
    .build-log-images .artwork-item.zoomed img {
        transform: none;
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    .hero {
        flex-direction: column;
        align-items: center;
    }

    .intro {
        text-align: center;
    }

    .store-card {
        align-self: center;
        width: 100%;
        /* 60% of the desktop cap (300px) */
        max-width: 180px;
    }

    .artwork-display {
        gap: clamp(14px, 2vw, 24px);
        margin-bottom: clamp(14px, 2vw, 24px);
    }

    .hero {
        max-width: 100%;
    }
}
