/* ==========================================================
   1. BASE — works without JS
   Projects stacked vertically, each track swipeable.
   ========================================================== */

.showcase {
    background: var(--ink);
    color: var(--paper);
}

.project {
    position: relative;
    height: 100vh;
    overflow: hidden;
}

.project__track {
    display: flex;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
}

.project__slide {
    position: relative;
    flex: 0 0 100%;
    height: 100%;
    margin: 0;
    scroll-snap-align: start;
}

.project__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* ---------- Text on the first two slides ---------- */

.project__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: var(--gutter);
    padding-left: calc(var(--gutter) + 80px); /* clear the fixed index */
    padding-bottom: 140px;                    /* clear caption and counter */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 60%);
    color: #fff;
    pointer-events: none;
}

.project__intro-number {
    margin: 0 0 16px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--accent);
}

.project__intro-title {
    margin: 0;
    font-size: clamp(40px, 7vw, 120px);
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.04em;
}

.project__intro-meta {
    margin: 16px 0 0;
    font-size: 16px;
    opacity: 0.75;
}

.project__text {
    max-width: 38ch;
    margin: 0;
    font-size: clamp(20px, 2.2vw, 32px);
    line-height: 1.45;
}
/* The fixed UI only makes sense in the layered version. */
.showcase__ui { display: none; }


/* ==========================================================
   2. ENHANCED — when JS is running
   ========================================================== */

/* JS will set the real height (one screen per scroll step). */
.js .showcase {
    position: relative;
    height: 100vh;
}

/* The stage sticks to the screen while the page scrolls. */
.js .showcase__stage {
    position: sticky;
    top: var(--admin-bar);
    height: calc(100vh - var(--admin-bar));
    overflow: hidden;
}

/* Every project fills the stage; later ones paint on top. */
.js .project {
    position: absolute;
    inset: 0;
    height: auto;
    transform: translate3d(0, var(--y, 0%), 0) scale(var(--scale, 1));
    transform-origin: 50% 50%;
    will-change: transform;
}

/* Every project except the first starts hidden below the stage. */
.js .project + .project { --y: 100%; }

/* Darkening layer, controlled by --shade. */
.js .project::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #000;
    opacity: var(--shade, 0);
    pointer-events: none;
}

/* The track no longer scrolls by itself — JS moves it with --x. */
.js .project__track {
    overflow: visible;
    scroll-snap-type: none;
    transform: translate3d(calc(var(--x, 0) * -100%), 0, 0);
    will-change: transform;
}


/* ==========================================================
   3. FIXED UI — index, caption, counter, progress
   ========================================================== */

.js .showcase__ui {
    display: block;
    position: fixed;
    inset: var(--admin-bar) 0 0 0;
    z-index: 50;
    pointer-events: none;
    color: #fff;
}

.showcase__ui a { pointer-events: auto; }

.showcase__index,
.showcase__caption,
.showcase__counter {
    position: absolute;
    mix-blend-mode: difference;
}

/* Index: vertical list of project numbers */
.showcase__index {
    left: var(--gutter);
    top: 50%;
    transform: translateY(-50%);
}

.showcase__index ol {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Caption: bottom left */
.showcase__caption {
    left: var(--gutter);
    bottom: 48px;
    max-width: 60vw;
}

.showcase__number,
.showcase__meta {
    margin: 0;
    font-size: 14px;
    opacity: 0.75;
}

.showcase__number {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}
.showcase__index-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-family: var(--font-mono);
    font-size: 12px;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.showcase__index-item::before {
    content: "";
    width: 12px;
    height: 1px;
    background: currentColor;
    transition: width 0.3s;
}

.showcase__index-item[aria-current="true"] { opacity: 1; }
.showcase__index-item[aria-current="true"]::before { width: 32px; }
.showcase__title {
    margin: 0 0 8px;
    font-size: clamp(32px, 5vw, 72px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

/* Counter: bottom right */
.showcase__counter {
    right: var(--gutter);
    bottom: 48px;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* Progress: thin accent bar at the very bottom (no blend!) */
.showcase__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
}

.showcase__progress span {
    display: block;
    height: 100%;
    background: var(--accent);
    transform: scaleX(var(--progress, 0));
    transform-origin: left center;
}