/* Projects (templates/pages/projects.html, static/js/projects-menu.js), laid out the way a Persona
   menu would be, in violet:
   - the menu: a violet panel with a jagged edge; the projects step down it as a staircase of
     heavy black words; the chosen one tilts out on a white slab with a black slab behind it
   - the project: ONE fixed diagonal composition, the same for every project (so the facts are
     always in the same place): the art tilted over a violet band crossing the screen, a huge title
     crashing into its corner, a tilted black card (summary + link), stats cascading as white
     jagged callouts, the notes fanned out as tilted cards underneath
   - black, white and one violet, all flat (hard-edged bands, no soft gradients, no glass, no blur)
   - snappy motion: pieces slamming into place from their own sides with a little overshoot
   The page keeps the same look in light and dark mode: it's this page's own theme. */

/* the page runs to the screen's left edge: the violet menu panel reaches under the sidebar
   (which has no panel of its own), and only its contents are pushed past the sidebar */
body.projects-page-active .destination {
    display: block;
    width: auto;
    min-height: 100svh;
    margin: 0;
    padding: 0;
}

/* registered so it can animate: the panel grows and shrinks with the sidebar, in step with it */
@property --pj-gutter {
    syntax: "<length>";
    inherits: true;
    initial-value: 0px;
}

body.projects-page-active .pj {
    --pj-gutter: 3.75rem;
    transition: --pj-gutter .35s cubic-bezier(.3, .5, .25, 1);
}

body.projects-page-active.site-sidebar-expanded .pj {
    --pj-gutter: 16rem;
}

body.projects-page-active .sky {
    opacity: 0;
    transition: opacity .42s ease;
}

.pj {
    --pj-black: #08060b;
    --pj-ink: #0d0b10;
    --pj-card: #141019;
    --pj-violet: #b45dfd;
    --pj-white: #ffffff;
    --pj-text: #f3eefc;
    --pj-dim: rgba(243, 238, 252, .7);
    --pj-type: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
    --pj-body: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
    --pj-snap: cubic-bezier(.2, 1.3, .4, 1);
    --pj-ease: cubic-bezier(.2, .9, .2, 1);
    --pj-slant: polygon(.5rem 0, 100% 0, calc(100% - .5rem) 100%, 0 100%);
    --pj-jag: polygon(2% 4%, 100% 0, 97% 92%, 0 100%);

    position: relative;
    min-height: 100svh;
    background: var(--pj-black);
    color: var(--pj-text);
    font-family: var(--pj-body);
    -webkit-font-smoothing: antialiased;
}

body.is-light-mode .pj {
    color: var(--pj-text);
}

.pj :is(a, button, select, input) {
    font: inherit;
    color: inherit;
}

.pj :is(a, button, select) {
    cursor: pointer;
}

.pj-app {
    display: grid;
    grid-template-columns: calc(var(--pj-gutter, 0rem) + clamp(18rem, 21vw, 24rem)) minmax(0, 1fr);
    height: 100svh;
}

/* ================================================================== the menu (violet panel) */

.pj-index {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 2rem 0 0 var(--pj-gutter, 0rem);
    background: var(--pj-violet);
    /* the jagged right edge, measured on the part right of the sidebar so it keeps its shape */
    --pj-w: calc(100% - var(--pj-gutter, 0rem));
    clip-path: polygon(0 0, 100% 0, calc(100% - var(--pj-w) * .09) 34%, 100% 61%, calc(100% - var(--pj-w) * .07) 100%, 0 100%);
    color: var(--pj-ink);
}

.pj-index-head,
.pj-tools {
    padding: 0 2.6rem 0 1.2rem;
}

.pj .pj-heading {
    width: fit-content;
    margin: 0;
    color: var(--pj-ink);
    font-family: var(--pj-type);
    font-size: clamp(2.3rem, 2.8vw, 3.2rem);
    font-stretch: 125%;
    font-weight: 900;
    letter-spacing: -.03em;
    line-height: .9;
    transform: rotate(-5deg) skewX(-8deg);
    transform-origin: left bottom;
    text-shadow: .1em .08em 0 var(--pj-white);
}

.pj-tally {
    margin: .9rem 0 0;
    font-family: var(--pj-type);
    font-size: .74rem;
    font-weight: 700;
}

.pj-tally b {
    font-weight: 900;
}

.pj-tools {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: 1rem;
}

.pj-search {
    display: flex;
    flex: 1 1 100%;
    align-items: center;
    gap: .4rem;
    padding: 0 .75rem;
    background: var(--pj-ink);
    clip-path: var(--pj-slant);
    color: var(--pj-white);
}

.pj-search:focus-within {
    background: #000;
}

.pj-search svg {
    flex: none;
    width: .95rem;
    height: .95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
}

.pj-search input {
    width: 100%;
    min-width: 0;
    padding: .45rem 0;
    border: 0;
    outline: 0;
    background: none;
    font-family: var(--pj-type);
    font-size: .84rem;
    font-weight: 700;
}

.pj-search input::placeholder {
    color: rgba(255, 255, 255, .55);
}

.pj-sort {
    display: flex;
    background: var(--pj-ink);
    clip-path: var(--pj-slant);
    color: var(--pj-white);
}

.pj-sort select {
    padding: .3rem .7rem;
    border: 0;
    outline: 0;
    background: none;
    font-family: var(--pj-type);
    font-size: .76rem;
    font-weight: 800;
}

.pj-sort option {
    background: var(--pj-ink);
}

.pj-filters {
    display: contents;
}

.pj-chip {
    padding: .2rem .75rem;
    border: 0;
    background: rgba(13, 11, 16, .16);
    clip-path: var(--pj-slant);
    font-family: var(--pj-type);
    font-size: .72rem;
    font-weight: 800;
    transition: background .12s ease, color .12s ease;
}

.pj-chip:hover {
    background: rgba(13, 11, 16, .32);
}

.pj-chip[aria-pressed="true"] {
    background: var(--pj-ink);
    color: var(--pj-white);
}

.pj-chip:focus-visible {
    outline: 2px solid var(--pj-white);
    outline-offset: -2px;
}

/* the staircase of projects */
.pj-list {
    flex: 1;
    min-height: 0;
    margin: 1.1rem 0 0;
    padding: .4rem 3rem 2.5rem .6rem;
    overflow: hidden auto;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(13, 11, 16, .4) transparent;
}

.pj-list li {
    animation: pj-step-in .45s var(--pj-snap) calc(var(--n) * 35ms + .05s) both;
}

.pj-list li:nth-child(4n + 2) { padding-left: .7rem; }
.pj-list li:nth-child(4n + 3) { padding-left: 1.4rem; }
.pj-list li:nth-child(4n + 4) { padding-left: .7rem; }

@keyframes pj-step-in {
    from { opacity: 0; translate: -2rem 0; }
}

.pj-row {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: .7rem;
    padding: .42rem .9rem .42rem .7rem;
    color: var(--pj-ink);
    text-decoration: none;
    transform-origin: left center;
    transition: translate .3s var(--pj-snap), rotate .3s var(--pj-snap), scale .3s var(--pj-snap), color .1s ease;
}

.pj-row::before,
.pj-row::after {
    content: "";
    position: absolute;
    inset: .1rem 0;
    clip-path: polygon(.7rem 0, 100% 0, calc(100% - .7rem) 100%, 0 100%);
    transition: background .12s ease, scale .3s var(--pj-snap);
}

.pj-row::before {
    z-index: -1;
}

.pj-row::after {
    z-index: -2;
    background: var(--pj-ink);
    translate: .4rem .35rem;
    scale: 0 1;
    transform-origin: left;
}

.pj-row:hover {
    translate: .4rem 0;
}

.pj-row:hover::before {
    background: rgba(13, 11, 16, .14);
}

.pj-row:focus-visible {
    outline: 0;
}

.pj-row:focus-visible::before {
    background: rgba(13, 11, 16, .22);
}

.pj-row[aria-current="page"] {
    translate: .5rem 0;
    rotate: -2.5deg;
    scale: 1.05;
}

.pj-row[aria-current="page"]::before {
    background: var(--pj-white);
}

.pj-row[aria-current="page"]::after {
    scale: 1 1;
}

.pj-cover {
    display: grid;
    grid-row: 1 / 3;
    overflow: hidden;
    aspect-ratio: 1;
    place-items: center;
    background: var(--pj-ink);
    color: var(--pj-white);
    outline: 2px solid var(--pj-ink);
}

.pj-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pj-row-name {
    display: inline-block;
    overflow: hidden;
    align-self: end;
    max-width: 100%;
    font-family: var(--pj-type);
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    font-weight: 900;
    letter-spacing: -.015em;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
    transform: skewX(-8deg);
}

.pj-row-meta {
    display: flex;
    align-self: start;
    gap: .55rem;
    opacity: .72;
    font-family: var(--pj-type);
    font-size: .68rem;
    font-weight: 800;
}

.pj-row-visits:empty {
    display: none;
}

.pj-empty {
    margin: 1rem 2.6rem 1rem 1.2rem;
    font-size: .88rem;
    font-weight: 700;
}

/* ================================================================== the project */

/* behind it: a violet band slicing across the screen, a thin white one beside it, fine hatching */
.pj-detail {
    position: relative;
    min-height: 0;
    margin-left: -2.2rem;
    overflow: auto;
    background:
        linear-gradient(-13deg, transparent 0 36%, var(--pj-violet) 36% 55%, transparent 55%),
        linear-gradient(-13deg, transparent 0 57%, rgba(255, 255, 255, .9) 57% 57.8%, transparent 57.8%),
        repeating-linear-gradient(-62deg, rgba(255, 255, 255, .03) 0 2px, transparent 2px 15px),
        var(--pj-black);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .25) transparent;
}

.pj-back {
    display: none;
}

.pj-project:not([hidden]) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
}

.pj-project {
    position: relative;
    max-width: 112rem;
    margin: 0 auto;
    padding: clamp(2rem, 5vh, 4rem) clamp(2rem, 4vw, 5rem) clamp(2rem, 5vh, 4rem) clamp(3.6rem, 5vw, 6rem);
    overflow: hidden;
}

/* the composition: the same grid for every project, with pieces overlapping on purpose */
.pj-stage {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto auto;
    align-items: start;
}

.pj-art {
    position: relative;
    z-index: 1;
    grid-column: 1 / 8;
    grid-row: 1 / 3;
    rotate: -5deg;
}

.pj-cut {
    position: relative;
    display: grid;
    aspect-ratio: 16 / 10;
    place-items: center;
    filter:
        drop-shadow(3px 0 0 var(--pj-ink)) drop-shadow(-3px 0 0 var(--pj-ink))
        drop-shadow(0 3px 0 var(--pj-ink)) drop-shadow(0 -3px 0 var(--pj-ink))
        drop-shadow(clamp(.8rem, 1.1vw, 1.3rem) clamp(.8rem, 1.1vw, 1.3rem) 0 var(--pj-white));
}

.pj-cut img,
.pj-cut::before {
    clip-path: polygon(3% 0, 100% 4%, 96% 100%, 0 95%);
}

.pj-cut img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pj-cut.is-empty::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--pj-white);
}

/* the title crashes into the art's lower right corner */
.pj-heading-group {
    position: relative;
    z-index: 3;
    grid-column: 7 / 13;
    grid-row: 2 / 4;
    align-self: end;
    margin: 0 0 1rem -1rem;
    transform: rotate(-6deg);
    transform-origin: left center;
}

.pj-eyebrow {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin: 0 0 .5rem .4rem;
    color: var(--pj-ink);
    font-family: var(--pj-type);
    font-size: .78rem;
    font-weight: 800;
}

.pj-eyebrow span {
    padding: .1rem .75rem;
    background: var(--pj-white);
    clip-path: var(--pj-slant);
}

.pj-eyebrow .pj-badge {
    background: var(--pj-violet);
}

.pj .pj-title {
    margin: 0;
    color: var(--pj-white);
    font-family: var(--pj-type);
    font-size: clamp(3rem, 5.4vw, 7.4rem);
    font-stretch: 112%;
    font-weight: 900;
    letter-spacing: -.045em;
    line-height: .86;
    transform: skewX(-8deg);
    -webkit-text-stroke: .06em var(--pj-ink);
    paint-order: stroke fill;
    text-shadow: .09em .08em 0 var(--pj-violet);
}

.pj .pj-title::first-letter {
    padding: 0 .05em;
    margin-right: .03em;
    background: var(--pj-violet);
    color: var(--pj-ink);
    -webkit-text-stroke: 0;
    text-shadow: none;
}

/* the card: summary and link, tilted the other way, top right */
.pj-card {
    position: relative;
    z-index: 2;
    isolation: isolate;
    grid-column: 8 / 13;
    grid-row: 1;
    margin: 1rem 0 0 1.5rem;
    padding: clamp(1.2rem, 1.6vw, 1.8rem) clamp(1.3rem, 1.8vw, 2rem);
    rotate: 2.5deg;
    filter:
        drop-shadow(3px 0 0 var(--pj-white)) drop-shadow(-3px 0 0 var(--pj-white))
        drop-shadow(0 3px 0 var(--pj-white)) drop-shadow(0 -3px 0 var(--pj-white))
        drop-shadow(.6rem .6rem 0 var(--pj-violet));
}

.pj-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--pj-card);
    clip-path: var(--pj-jag);
}

.pj .pj-summary {
    margin: 0;
    color: var(--pj-white);
    font-family: var(--pj-type);
    font-size: clamp(1.05rem, 1.25vw, 1.45rem);
    font-weight: 800;
    line-height: 1.3;
}

.pj .pj-button {
    position: relative;
    isolation: isolate;
    display: inline-block;
    margin-top: 1.1rem;
    padding: .65rem 1.6rem;
    color: var(--pj-ink);
    font-family: var(--pj-type);
    font-size: .95rem;
    font-weight: 900;
    text-decoration: none;
    filter: drop-shadow(.35rem .3rem 0 var(--pj-violet));
    transition: translate .2s var(--pj-snap), filter .2s var(--pj-snap);
}

.pj .pj-button::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--pj-white);
    clip-path: polygon(.8rem 0, 100% 0, calc(100% - .8rem) 100%, 0 100%);
    transition: background .12s ease;
}

.pj .pj-button:hover {
    translate: .3rem -.15rem;
    filter: drop-shadow(.55rem .45rem 0 var(--pj-white));
}

.pj .pj-button:hover::before {
    background: var(--pj-violet);
}

.pj .pj-button:focus-visible {
    outline: 3px solid var(--pj-violet);
    outline-offset: 4px;
}

.pj .pj-button.is-here {
    padding: 0;
    color: var(--pj-dim);
    filter: none;
    font-weight: 800;
    cursor: default;
}

.pj .pj-button.is-here::before {
    display: none;
}

/* stats: white jagged callouts cascading down from under the art */
.pj-stats {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: .4rem 1.1rem;
    grid-column: 1 / 7;
    grid-row: 3;
    margin: 2.2rem 0 0 1rem;
}

.pj-stat {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column-reverse;
    padding: .7rem 1.2rem .8rem 1rem;
    color: var(--pj-ink);
    rotate: -4deg;
    filter: drop-shadow(.35rem .35rem 0 var(--pj-ink));
}

.pj-stat::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--pj-white);
    clip-path: polygon(4% 0, 100% 8%, 95% 100%, 0 90%);
}

.pj-stat:nth-child(2) { margin-top: 1.4rem; rotate: 3deg; }
.pj-stat:nth-child(3) { margin-top: .5rem; rotate: -2deg; }

.pj-stat dt {
    width: fit-content;
    margin-top: .3rem;
    padding: 0 .55rem;
    background: var(--pj-violet);
    clip-path: var(--pj-slant);
    font-family: var(--pj-type);
    font-size: .68rem;
    font-weight: 900;
}

.pj-stat dd {
    margin: 0;
    font-family: var(--pj-type);
    font-size: clamp(1.6rem, 2.1vw, 2.7rem);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    line-height: 1;
    transform: skewX(-8deg);
}

.pj-stats.is-loading dd {
    opacity: .4;
}

/* the notes: tilted cards fanned out in a row */
/* each note is only as big as what's in it (a one-word "built with" gets a small card), and long
   text wraps at a readable width instead of stretching every card to match the biggest */
.pj-notes {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.6rem 1.4rem;
    margin-top: clamp(2.4rem, 5vh, 3.6rem);
}

.pj-note {
    position: relative;
    isolation: isolate;
    flex: 0 1 auto;
    min-width: 9rem;
    max-width: min(30rem, 100%);
    padding: 1.1rem 1.3rem 1.3rem;
}

.pj-note::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--pj-card);
    clip-path: polygon(2% 3%, 100% 0, 98% 97%, 0 100%);
}

.pj-note:nth-child(4n + 1) { rotate: -1.5deg; }
.pj-note:nth-child(4n + 2) { rotate: 1deg; translate: 0 .6rem; }
.pj-note:nth-child(4n + 3) { rotate: -.8deg; }
.pj-note:nth-child(4n + 4) { rotate: 1.5deg; translate: 0 .5rem; }

.pj-note h3 {
    width: fit-content;
    margin: 0 0 .6rem;
    padding: .16rem .9rem .16rem .8rem;
    background: var(--pj-violet);
    clip-path: var(--pj-slant);
    color: var(--pj-ink);
    font-family: var(--pj-type);
    font-size: .84rem;
    font-weight: 900;
}

.pj-note p {
    margin: 0;
    color: var(--pj-dim);
    line-height: 1.55;
}

.pj-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pj-tags li {
    padding: .14rem .75rem;
    background: rgba(255, 255, 255, .14);
    clip-path: var(--pj-slant);
    font-family: var(--pj-type);
    font-size: .74rem;
    font-weight: 800;
}

/* arriving: everything slams into place from its own side */
.pj-project:not([hidden]) .pj-art { animation: pj-from-left .5s var(--pj-snap) .12s both; }
.pj-project:not([hidden]) .pj-card { animation: pj-from-right .5s var(--pj-snap) .2s both; }
.pj-project:not([hidden]) .pj-heading-group { animation: pj-from-below .5s var(--pj-snap) .26s both; }
.pj-project:not([hidden]) .pj-stat { animation: pj-pop .4s var(--pj-snap) both; }
.pj-project:not([hidden]) .pj-stat:nth-child(1) { animation-delay: .34s; }
.pj-project:not([hidden]) .pj-stat:nth-child(2) { animation-delay: .4s; }
.pj-project:not([hidden]) .pj-stat:nth-child(3) { animation-delay: .46s; }
.pj-project:not([hidden]) .pj-notes { animation: pj-from-below .5s var(--pj-snap) .4s both; }

@keyframes pj-from-left {
    from { opacity: 0; translate: -4rem 0; }
}

@keyframes pj-from-right {
    from { opacity: 0; translate: 4rem 0; }
}

@keyframes pj-from-below {
    from { opacity: 0; translate: 0 3rem; }
}

@keyframes pj-pop {
    from { opacity: 0; scale: .4; }
}

/* ================================================================== narrower screens */
/* the composition stacks but keeps its tilts and overlaps */

@media (max-width: 1180px) {
    .pj-stage {
        grid-template-columns: minmax(0, 1fr);
    }

    .pj-art,
    .pj-heading-group,
    .pj-card,
    .pj-stats {
        grid-column: 1;
        grid-row: auto;
    }

    .pj-art {
        max-width: 42rem;
    }

    .pj-heading-group {
        margin: -2.2rem 0 0 1.5rem;
    }

    .pj-card {
        max-width: 34rem;
        margin: 2rem 0 0 .5rem;
    }
}

/* ================================================================== phones */

@media (max-width: 860px) {
    body.projects-page-active .pj,
    body.projects-page-active.site-sidebar-expanded .pj {
        --pj-gutter: 0rem;
    }

    .pj-app {
        display: block;
        height: auto;
        min-height: 100svh;
    }

    .pj-index {
        min-height: 100svh;
        padding-top: 3.6rem;
        clip-path: none;
    }

    .pj-index-head,
    .pj-tools {
        padding-right: 1.2rem;
    }

    .pj-list {
        overflow: visible;
        padding-right: 1.6rem;
    }

    /* a project opens as a full-screen sheet over the list */
    .pj-detail {
        position: fixed;
        inset: 0;
        z-index: 30;
        margin-left: 0;
        translate: 100% 0;
        visibility: hidden;
        transition: translate .4s var(--pj-ease), visibility 0s linear .4s;
    }

    .pj.is-sheet-open .pj-detail {
        translate: 0 0;
        visibility: visible;
        transition: translate .4s var(--pj-ease);
    }

    .pj-project:not([hidden]) {
        justify-content: flex-start;
    }

    .pj-project {
        padding: 1rem 1.2rem 3rem;
    }

    .pj-back {
        display: inline-flex;
        align-self: flex-start;
        align-items: center;
        gap: .2rem;
        margin: 0 0 1rem 1.8rem;
        padding: .2rem .8rem .2rem .5rem;
        background: var(--pj-white);
        clip-path: var(--pj-slant);
        color: var(--pj-ink);
        font-family: var(--pj-type);
        font-size: .86rem;
        font-weight: 900;
        text-decoration: none;
    }

    .pj-back svg {
        width: 1.1rem;
        height: 1.1rem;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.6;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .pj-art {
        rotate: -3deg;
    }

    .pj-heading-group {
        margin: -1.4rem 0 0 .6rem;
        transform: rotate(-4deg);
    }

    .pj .pj-title {
        font-size: 2.8rem;
    }

    .pj-card {
        margin: 1.6rem .4rem 0;
        rotate: 1.5deg;
    }

    .pj-stats {
        margin: 1.8rem 0 0;
    }

    .pj-notes {
        flex-direction: column;
        align-items: stretch;
    }

    .pj-note {
        max-width: none;
    }
}

/* ================================================================== calmer */

@media (prefers-reduced-motion: reduce) {
    .pj *,
    .pj *::before,
    .pj *::after {
        animation: none !important;
    }

    .pj-row,
    .pj-detail,
    .pj.is-sheet-open .pj-detail {
        transition: none;
    }
}

body.animations-disabled .pj *,
body.animations-disabled .pj *::before,
body.animations-disabled .pj *::after {
    animation: none !important;
}

/* the band behind the title is violet, so its violet bits turn black to stay visible */
.pj-eyebrow .pj-badge {
    background: var(--pj-ink);
    color: var(--pj-white);
}

/* the first letter in a darker purple than the violet (a friend's suggestion), on its black box */
.pj .pj-title::first-letter {
    background: var(--pj-ink);
    color: #7a2fd6;
}

/* the heading moved clear of the site sidebar's collapse tab */
@media (min-width: 861px) {
    .pj-index-head {
        padding-left: 2.4rem;
    }
}

/* room between the type/date tags and the title, so the title's boxed first letter (which sticks
   up past the tight line height) doesn't run into them */
.pj-eyebrow {
    margin-bottom: 1.1rem;
}

/* ================================================================== filling big screens
   Taken from the real menus: Persona 5's Confidant screen sweeps several diagonal bands of
   different widths across the whole screen, with rays fanning out from a corner; Persona 3
   Reload runs huge type down a screen edge, cut off by it. */

@media (min-width: 861px) {
    .pj-detail {
        background:
            /* thin white stripe above the main band */
            linear-gradient(-13deg, transparent 0 32.6%, rgba(255, 255, 255, .85) 32.6% 33.1%, transparent 33.1%),
            /* the main violet band */
            linear-gradient(-13deg, transparent 0 36%, var(--pj-violet) 36% 55%, transparent 55%),
            /* white stripe, then a deep violet band trailing under it */
            linear-gradient(-13deg, transparent 0 57%, rgba(255, 255, 255, .9) 57% 57.8%, transparent 57.8%),
            linear-gradient(-13deg, transparent 0 60%, #2c1546 60% 68%, transparent 68%),
            linear-gradient(-13deg, transparent 0 69.2%, rgba(180, 93, 253, .55) 69.2% 69.8%, transparent 69.8%),
            /* rays fanning from the bottom-left corner */
            repeating-conic-gradient(from 0deg at -6% 112%, rgba(180, 93, 253, .075) 0 2.2deg, transparent 2.2deg 5.5deg),
            var(--pj-black);
    }

    /* the article spans the whole panel (so edge type reaches the screen edge); the composition
       inside stays capped and centred */
    .pj-project {
        max-width: none;
        min-height: 100%;
    }

    .pj-stage,
    .pj-notes {
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: 112rem;
        margin-inline: auto;
    }

    .pj-notes {
        margin-top: clamp(2.4rem, 5vh, 3.6rem);
    }
}

.pj-ghost {
    position: absolute;
    top: -.04em;
    right: -.16em;
    z-index: 0;
    writing-mode: vertical-rl;
    font-family: var(--pj-type);
    font-size: clamp(8rem, 19vh, 17rem);
    font-weight: 900;
    font-stretch: 125%;
    font-style: italic;
    line-height: .82;
    white-space: nowrap;
    color: transparent;
    -webkit-text-stroke: 2px rgba(180, 93, 253, .42);
    pointer-events: none;
    user-select: none;
}

@media (max-width: 1180px) {
    .pj-ghost { display: none; }
}

/* ================================================================== search, sort, filters
   Search and sort share a row; the filters are one row of tabs: black words on the violet, the
   active one on a tilted black slab, like Persona's category tabs. (Prefixed with .pj so they beat
   the .pj :is(a, button, select, input) font reset, which was leaving the chips in the system font.) */

.pj .pj-search {
    flex: 1 1 7rem;
}

.pj .pj-sort {
    position: relative;
    flex: none;
    align-items: center;
}

.pj .pj-sort select {
    appearance: none;
    padding: .45rem 1.7rem .45rem .85rem;
    color: var(--pj-white);
    font-family: var(--pj-type);
    font-size: .78rem;
    font-weight: 800;
    cursor: pointer;
}

.pj-sort::after {
    content: "";
    position: absolute;
    top: 50%;
    right: .85rem;
    width: .36rem;
    height: .36rem;
    border-right: 2px solid var(--pj-violet);
    border-bottom: 2px solid var(--pj-violet);
    translate: 0 -70%;
    rotate: 45deg;
    pointer-events: none;
}

.pj .pj-sort:focus-within {
    background: #000;
}

.pj .pj-filters {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: nowrap;
    gap: 0;
    margin: .35rem -.5rem 0 -.3rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.pj .pj-chip {
    flex: none;
    padding: .22rem .5rem;
    background: none;
    color: var(--pj-ink);
    font-family: var(--pj-type);
    font-size: .76rem;
    letter-spacing: -.01em;
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
    transition: background .12s ease, color .12s ease, rotate .25s var(--pj-snap);
}

.pj .pj-chip:hover {
    background: rgba(13, 11, 16, .16);
}

.pj .pj-chip[aria-pressed="true"] {
    background: var(--pj-ink);
    color: var(--pj-white);
    rotate: -4deg;
}

/* ================================================================== no picture yet
   A project without a picture says so: hazard-style hatching, a big "?" and a "no image yet"
   tag (only the "?" on the small list thumbnails). Roblox games wait with just the hatching
   (is-pending) until their picture loads or turns out to be missing. */

.pj-cut.is-empty::before,
.pj-cover.is-empty {
    background: repeating-linear-gradient(-45deg, #2a1546 0 .9rem, var(--pj-ink) .9rem 1.8rem);
}

.pj-cover.is-empty {
    background-size: auto;
    background-image: repeating-linear-gradient(-45deg, #2a1546 0 .3rem, var(--pj-ink) .3rem .6rem);
}

.pj-missing {
    position: relative;
    display: grid;
    justify-items: center;
    font-family: var(--pj-type);
    font-weight: 900;
}

.pj-missing-mark {
    color: var(--pj-violet);
    font-size: clamp(6rem, 11vw, 12rem);
    font-stretch: 125%;
    font-style: italic;
    line-height: .8;
    text-shadow: .06em .05em 0 var(--pj-white);
    transform: rotate(-6deg) skewX(-8deg);
}

.pj-missing-label {
    margin-top: 1.4rem;
    padding: .3rem 1.1rem;
    background: var(--pj-white);
    clip-path: var(--pj-slant);
    color: var(--pj-ink);
    font-size: clamp(.8rem, .9vw, 1rem);
    rotate: -4deg;
}

.pj-cover .pj-missing-mark {
    font-size: 1.5rem;
    text-shadow: .07em .06em 0 var(--pj-white);
}

.pj-cover .pj-missing-label {
    display: none;
}

.is-pending .pj-missing {
    visibility: hidden;
}

/* ================================================================== ambient motion
   Like Persona 5's pause menu: the information stays still, the background keeps living. The
   ray fan turns slowly, the giant project name creeps up the right edge, and the selected
   project's black slab breathes (its text doesn't move). Off with the animations switch or
   reduced motion (the rules in "calmer" above stop every animation in .pj). */

@property --pj-ray-turn {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

@media (min-width: 861px) {
    .pj .pj-detail {
        background:
            linear-gradient(-13deg, transparent 0 32.6%, rgba(255, 255, 255, .85) 32.6% 33.1%, transparent 33.1%),
            linear-gradient(-13deg, transparent 0 36%, var(--pj-violet) 36% 55%, transparent 55%),
            linear-gradient(-13deg, transparent 0 57%, rgba(255, 255, 255, .9) 57% 57.8%, transparent 57.8%),
            linear-gradient(-13deg, transparent 0 60%, #2c1546 60% 68%, transparent 68%),
            linear-gradient(-13deg, transparent 0 69.2%, rgba(180, 93, 253, .55) 69.2% 69.8%, transparent 69.8%),
            repeating-conic-gradient(from var(--pj-ray-turn) at -6% 112%, rgba(180, 93, 253, .075) 0 2.2deg, transparent 2.2deg 5.5deg),
            var(--pj-black);
        /* one ray period (5.5deg) per loop, so it turns forever without a jump */
        animation: pj-rays 9s linear infinite;
    }
}

@keyframes pj-rays {
    to { --pj-ray-turn: 5.5deg; }
}

.pj-ghost {
    overflow: hidden;
    height: 100%;
    /* the box is only a line tall (line-height .82), so letters with tails (q, y, p, g),
       which hang off the left side in this sideways text, were clipped: leave them room */
    padding-left: .3em;
}

.pj-ghost-track {
    display: block;
    /* the text runs vertically, so its length is the track's height; let it be the full text,
       not the panel's height, so -50% is exactly two copies */
    inline-size: max-content;
    animation: pj-ghost-creep 150s linear infinite;
}

/* the text runs top to bottom; four copies, so sliding up by half loops seamlessly */
@keyframes pj-ghost-creep {
    to { translate: 0 -50%; }
}

.pj-row[aria-current="page"]::after {
    animation: pj-breathe 2.6s ease-in-out infinite alternate;
}

@keyframes pj-breathe {
    from { translate: .4rem .35rem; }
    to { translate: .65rem .55rem; }
}

/* ================================================================== with the music
   projects-menu.js sets --pj-bass / --pj-mid / --pj-loud (0-1) from the site's music. The
   rays keep their own slow turn whatever plays; the edge name's outline brightens with the
   mids and fills in a little with the overall loudness, and the selected project's black slab
   punches out on the bass. All 0 (the resting look) without music. */

.pj .pj-ghost {
    color: rgba(180, 93, 253, calc(var(--pj-loud, 0) * .2));
    -webkit-text-stroke-color: rgba(180, 93, 253, calc(.42 + var(--pj-mid, 0) * .58));
}

.pj .pj-row[aria-current="page"]::after {
    scale: calc(1 + var(--pj-bass, 0) * .06) calc(1 + var(--pj-bass, 0) * .4);
    transition: background .12s ease, scale .08s linear;
}
