/* ========================================
   WORK PAGE — Vanini Space Portfolio Grid (brown/pink)
   vanini.space
   ======================================== */

/* ============ DESIGN LANGUAGE OVERRIDE ============
   matrix.css is still loaded (for its shared structural chrome — .top-nav,
   .nav-tab, .ipod-*, .glitch-* — this page has never had its own copy of
   that layout CSS, only colour retints on top of it; dropping matrix.css
   entirely broke all of it, see the style-guide-audit follow-up note dated
   2026-08-14). tokens.css now loads alongside it — different variable
   names, no collision — so this :root block below can override matrix.css's
   own green :root values with ones DERIVED from tokens.css, instead of the
   hardcoded, off-palette duplicates that used to sit here (style-guide
   audit S1/S2). Names are kept as-is (--matrix-green legitimately holds
   pink now, not renamed to something like --accent) to avoid a blind
   rename across every call site in this file; that's a real but separate,
   higher-risk follow-up from fixing the values themselves.
   --mag itself is a FILL colour and fails text contrast on this ground
   (2.8:1) — --mag-tint is tokens.css's accessible reading of the same hue
   for text (9.2:1), see tokens.css for the reasoning.
   --font-display is the SINGLE swap point for the planned Anton -> Panchang
   change: once Panchang is self-hosted, edit only the line below. */
:root {
    --matrix-green: var(--mag-tint);
    --matrix-bright: var(--cad);
    --matrix-cyan: var(--bone);
    --matrix-dark-green: var(--bg-secondary);
    --bg-primary: var(--ground);
    --bg-secondary: color-mix(in srgb, var(--ground) 88%, var(--bone));
    --bg-card: color-mix(in srgb, var(--ground) 92%, transparent);
    --bg-input: color-mix(in srgb, var(--ground) 60%, transparent);
    --border-color: color-mix(in srgb, var(--mag) 25%, transparent);
    --border-active: color-mix(in srgb, var(--mag) 70%, transparent);
    --text-primary: var(--bone);
    --text-muted: color-mix(in srgb, var(--bone) 65%, var(--ground));
    --font-mono: var(--sans);
    --font-display: var(--display);
}

/* matrix.css's own `body {}` rule still applies (background: var(--bg-primary),
   now correctly ground-toned via the override above) — this just wins the
   font-family/color half of it, per style-guide audit S3: body text should
   read in --sans (Inter), not matrix.css's --font-mono. Same specificity as
   matrix.css's body rule, source order wins since this file loads after it. */
body {
    font-family: var(--sans);
    color: var(--text-primary);
}

/* Shared app chrome (nav / iPod player / glitch-click bursts) hardcodes
   rgba(var(--accent-rgb),…) and rgba(10,10,10,…) literals in matrix.css instead of
   the tokens above — retint those literals here, scoped to this page,
   rather than editing the shared file. Values match the source rule's blur
   radius / alpha exactly; only the RGB triplet changes. */
.top-nav { background: rgba(34, 25, 15, .97); }
.nav-logo { color: var(--matrix-green); }
.nav-tab:hover { background: rgba(240, 164, 230, .03); }
.ipod-toggle { box-shadow: 0 0 20px rgba(240, 164, 230, .05); }
.ipod-toggle:hover { box-shadow: 0 0 20px rgba(240, 164, 230, .15); }
.ipod-nano.open .ipod-toggle { box-shadow: 0 0 15px rgba(240, 164, 230, .2); }
.ipod-screen { box-shadow: 0 0 40px rgba(240, 164, 230, .05); }
.ipod-progress-bar { background: rgba(240, 164, 230, .15); }
.ipod-progress-knob { box-shadow: 0 0 6px rgba(240, 164, 230, .4); }
.ipod-btn:hover { box-shadow: 0 0 10px rgba(240, 164, 230, .1); }
.ipod-btn.ipod-play:hover { background: rgba(240, 164, 230, .1); box-shadow: 0 0 15px rgba(240, 164, 230, .2); }
.gv-tear .glitch-tear { border-top-color: rgba(240, 164, 230, .3); }
.gv-pixel .glitch-pixel { box-shadow: 0 0 8px rgba(240, 164, 230, .9), 0 0 16px rgba(240, 164, 230, .4); }
.glitch-pixel:nth-child(odd) { box-shadow: 0 0 8px rgba(242, 240, 233, .9), 0 0 16px rgba(242, 240, 233, .4); }
.gv-static .sn-mid { color: rgba(240, 164, 230, .7); }
.gv-static .sn-dim { color: rgba(240, 164, 230, .2); }
.glitch-corrupt:nth-child(3) { text-shadow: 0 0 6px rgba(240, 164, 230, .4); }

/* ============ BACKGROUND ART ============ */
/* Disabled: the background is now the site-wide video (see site-shell.css).
   This layer was tuned as `screen` at 6% over an opaque #0a0a0a body. With
   the body transparent it blends against the footage instead, and the
   reference image reads as a second, competing picture rather than a
   texture — verified in the browser, not assumed.

   The デザイン No. 155 reference now drives the enter screen's structure and
   palette, which is a better use of it than a wash on this page.

   Re-enable only by re-tuning against the video; restoring these values as
   they were will reproduce the same clash. */
.work-bg-art {
    display: none;
}

/* ============ HERO ============ */
.work-hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 160px 40px 64px;
}

.work-title {
    font-family: var(--font-display);
    font-size: 16vw;
    font-weight: 700;
    line-height: 0.85;
    letter-spacing: 6px;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    gap: 0.02em;
    overflow: hidden;
    background: linear-gradient(
        180deg,
        rgba(240, 164, 230, 1) 0%,
        rgba(240, 164, 230, 0.7) 40%,
        rgba(240, 164, 230, 0.35) 70%,
        rgba(240, 164, 230, 0.15) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.work-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
    animation: charReveal 0.8s ease-out forwards;
}

.work-title .char:nth-child(1) { animation-delay: 0.05s; }
.work-title .char:nth-child(2) { animation-delay: 0.10s; }
.work-title .char:nth-child(3) { animation-delay: 0.15s; }
.work-title .char:nth-child(4) { animation-delay: 0.20s; }

.work-sub {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 20px;
    opacity: 0;
    animation: fadeUp 0.8s ease-out 0.35s forwards;
}

/* ============ FILTER BAR ============ */
.filter-bar {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0 40px 48px;
    opacity: 0;
    animation: fadeUp 0.8s ease-out 0.45s forwards;
}

.filter-pill {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    /* min-height, unconditional: `height: 30px` under a coarse-pointer-only
       44px override left desktop pills at 30px. */
    min-height: 44px;
    padding: 0 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.filter-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--matrix-green);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.45s ease-out;
    z-index: 0;
}

.filter-pill span {
    position: relative;
    z-index: 1;
}

.filter-pill:hover::before,
.filter-pill:active::before,
.filter-pill.active::before {
    transform: scaleX(1);
}

.filter-pill:hover,
.filter-pill:active,
.filter-pill.active {
    color: var(--bg-primary);
    border-color: var(--matrix-green);
    box-shadow: 0 0 15px rgba(240, 164, 230, 0.15);
}

/* ============ PROJECT GRID (CSS columns masonry) ============ */
.work-grid {
    position: relative;
    z-index: 1;
    column-count: 3;
    column-gap: 16px;
    padding: 0 40px 80px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============ EMPTY STATE ============ */
.work-empty {
    text-align: center;
    padding: 80px 20px;
    font-family: var(--font-mono);
    font-size: 1rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0;
    animation: fadeUp 0.8s ease-out 0.5s forwards;
}

.work-empty::before {
    content: '[ ]';
    display: block;
    font-size: 3rem;
    color: var(--matrix-green);
    opacity: 0.3;
    margin-bottom: 20px;
}

/* ============ PROJECT CARD ============ */
.work-card {
    break-inside: avoid;
    margin-bottom: 16px;
    display: block;
    color: inherit;
    text-decoration: none;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.6s ease-out forwards;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.4s ease;
}

.work-card:nth-child(1) { animation-delay: 0.1s; }
.work-card:nth-child(2) { animation-delay: 0.15s; }
.work-card:nth-child(3) { animation-delay: 0.2s; }
.work-card:nth-child(4) { animation-delay: 0.25s; }
.work-card:nth-child(5) { animation-delay: 0.3s; }
.work-card:nth-child(6) { animation-delay: 0.35s; }
.work-card:nth-child(7) { animation-delay: 0.4s; }
.work-card:nth-child(8) { animation-delay: 0.45s; }

.work-card:hover,
.work-card:active {
    box-shadow: 0 0 25px rgba(240, 164, 230, 0.12), 0 0 50px rgba(240, 164, 230, 0.05);
}

/* ---- Card image area ---- */
.work-card-img {
    overflow: hidden;
    position: relative;
    border-radius: 4px;
    aspect-ratio: 4 / 3;
}

.work-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

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

/* Placeholder for cards without images */
.work-card-placeholder {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 8px,
        rgba(240, 164, 230, 0.04) 8px,
        rgba(240, 164, 230, 0.04) 16px
    );
}

/* Hover tag label slides up from bottom */
.work-card-tag-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--matrix-green);
    background: linear-gradient(to top, rgba(34, 25, 15, 0.85) 0%, transparent 100%);
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.5s ease-out, opacity 0.4s ease;
    pointer-events: none;
}

.work-card:hover .work-card-tag-overlay,
.work-card:active .work-card-tag-overlay {
    transform: translateY(0);
    opacity: 1;
}

/* ---- Card info ---- */
.work-card-info {
    padding: 12px 2px 4px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.work-card-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 400;
    color: var(--matrix-green);
    letter-spacing: 1px;
    transition: opacity 0.4s ease;
}

.work-card-desc {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}

.work-card-tags {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============ CARD HIDDEN (filter) ============ */
.work-card.card-hidden {
    display: none;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 1024px) {
    .work-hero {
        padding: 140px 32px 56px;
    }

    .work-grid {
        padding: 0 32px 64px;
    }

    .filter-bar {
        padding: 0 32px 40px;
    }
}

@media (max-width: 768px) {
    .work-hero {
        padding: 120px 24px 48px;
    }

    .work-title {
        font-size: 20vw;
    }

    .work-grid {
        column-count: 2;
        column-gap: 12px;
        padding: 0 24px 56px;
    }

    .work-card {
        margin-bottom: 12px;
    }

    .filter-bar {
        padding: 0 24px 36px;
        gap: 6px;
    }

    .filter-pill {
        padding: 0 12px;
        /* Was 8px — unreadable at the iPhone viewport (confirmed via
           headless Chrome measurement). The pill itself already gets
           min-height: 44px under (pointer: coarse) below; this is the
           text-legibility fix, separate from the hit-area fix. */
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .work-hero {
        padding: 100px 16px 36px;
    }

    .work-title {
        font-size: 24vw;
    }

    .work-sub {
        font-size: 12px;
        letter-spacing: 0.08em;
        margin-top: 14px;
    }

    .work-grid {
        column-count: 1;
        column-gap: 0;
        padding: 0 16px 48px;
    }

    .work-card {
        margin-bottom: 20px;
    }

    .filter-bar {
        padding: 0 16px 28px;
    }

    .work-card-name {
        font-size: 15px;
    }

    .work-card-tags {
        /* Was 9px — bumped for legibility, same reasoning as the filter
           pill above. */
        font-size: 10.5px;
    }
}

@media (pointer: coarse) {
    .filter-pill {
        min-height: 44px;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes charReveal {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .work-title .char,
    .work-sub,
    .filter-bar,
    .work-card {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
