/* ============================================
   CARDS.CSS — Project cards, shared by Home and Work
   Markup comes from js/render.js.
   ============================================ */

.work-card {
    --tint: var(--color-accent);
    --tint-dim: var(--color-accent-dim);

    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform 0.5s var(--ease), border-color var(--transition), box-shadow 0.5s var(--ease);
}

/* Each category carries its own tint, so a grid of mixed work still reads
   as groups at a glance. */
.work-card.cat-visual-studio {
    --tint: var(--color-accent-2);
    --tint-dim: color-mix(in srgb, var(--color-accent-2) 14%, transparent);
}

.work-card.cat-open-source {
    --tint: var(--color-text);
    --tint-dim: color-mix(in srgb, var(--color-text) 7%, transparent);
}

.work-card.spot::before {
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--tint-dim), transparent 45%);
}

.work-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--tint) 45%, transparent);
    box-shadow: var(--shadow-pop);
}

.work-card:focus-within {
    border-color: color-mix(in srgb, var(--tint) 45%, transparent);
}

.work-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 28px;
}

.work-card-media {
    position: relative;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    transition: transform 0.6s var(--ease);
}

.work-card-media img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.work-card-monogram {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 2rem;
    line-height: 1;
    color: var(--tint);
}

.work-card:hover .work-card-media {
    transform: rotate(-6deg) scale(1.06);
}

.work-card-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-muted);
    margin-bottom: 8px;
}

.work-card-kicker .icon {
    color: var(--tint);
}

.work-card-title {
    font-size: 1.35rem;
    margin-bottom: 8px;
}

.work-card-title a {
    color: var(--color-text);
}

.work-card-title a:hover {
    color: var(--color-text);
}

/* The title link stretches over the whole card, so the card is one big
   target without nesting the store links inside another <a>. */
.work-card-title .stretched::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.work-card-title .stretched:focus-visible {
    outline: none;
}

.work-card-title .stretched:focus-visible::after {
    outline: 2px solid var(--tint);
    outline-offset: -2px;
    border-radius: var(--radius);
}

.work-card-tagline {
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 20px;
}

.work-card-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-bottom: 20px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--color-muted);
}

.work-card-stack li {
    position: relative;
}

.work-card-stack li + li::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

.work-card-links {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-right: 48px;
}

.work-card-go {
    position: absolute;
    right: 20px;
    bottom: 20px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    transition: transform 0.5s var(--ease), background-color var(--transition), color var(--transition), border-color var(--transition);
}

.work-card:hover .work-card-go {
    transform: rotate(-45deg);
    color: var(--color-bg);
    background: var(--tint);
    border-color: var(--tint);
}

/* — Large variant: spotlight tiles on the home page — */
.work-card-lg {
    padding: 28px;
}

.work-card-lg .work-card-media {
    width: 72px;
    height: 72px;
    border-radius: 20px;
}

.work-card-lg .work-card-media img {
    width: 52px;
    height: 52px;
}

.work-card-lg .work-card-title {
    font-size: clamp(1.5rem, 2.4vw, 2rem);
}

.work-card-lg .work-card-tagline {
    font-size: 1rem;
    max-width: 48ch;
}

/* A soft wash of the category tint in the corner. */
.work-card-lg::after {
    content: '';
    position: absolute;
    right: -20%;
    top: -40%;
    width: 70%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, var(--tint-dim), transparent 65%);
    pointer-events: none;
    z-index: -1;
}

@media (min-width: 1024px) {
    .work-card-lg {
        padding: 36px;
    }
}

/* — Grids — */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* Home page bento: two wide spotlights, then three, then one wide plus the
   "see everything" tile. */
.bento {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .bento {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento > .span-wide {
        grid-column: span 2;
    }
}

@media (min-width: 1024px) {
    .bento {
        grid-template-columns: repeat(6, 1fr);
        gap: 20px;
    }

    .bento > * {
        grid-column: span 2;
    }

    .bento > .span-half {
        grid-column: span 3;
    }

    .bento > .span-wide {
        grid-column: span 4;
    }
}

/* The closing tile in the bento that links to the full list. */
.more-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    min-height: 220px;
    padding: 28px;
    border-radius: var(--radius);
    background: var(--color-accent);
    color: var(--color-accent-ink);
    overflow: hidden;
    transition: transform 0.5s var(--ease);
}

.more-tile:hover {
    color: var(--color-accent-ink);
    transform: translateY(-4px);
}

.more-tile-count {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(3.5rem, 7vw, 5.5rem);
    line-height: 0.9;
}

.more-tile-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.more-tile-label .icon {
    width: 22px;
    height: 22px;
    transition: transform 0.5s var(--ease);
}

.more-tile:hover .more-tile-label .icon {
    transform: rotate(-45deg);
}

.more-tile::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.06) 0 1px, transparent 1px 12px);
    pointer-events: none;
}

/* — Screenshot cover —
   Bleeds to the card edges; the icon tile then overlaps its bottom edge like
   a store listing. */
.work-card-cover {
    position: relative;
    margin: -24px -24px 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--color-surface-2);
    border-bottom: 1px solid var(--color-border);
}

.work-card-lg .work-card-cover {
    margin: -28px -28px 0;
}

@media (min-width: 1024px) {
    .work-card-lg .work-card-cover {
        margin: -36px -36px 0;
    }
}

.work-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.8s var(--ease);
}

.work-card:hover .work-card-cover img {
    transform: scale(1.04);
}

.has-cover .work-card-top {
    margin-top: -28px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.has-cover .work-card-media {
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.has-cover .work-card-lg .work-card-top,
.work-card-lg.has-cover .work-card-top {
    margin-top: -36px;
}
