/* --- TEAM INK CAROUSEL: parallax flower art beside the artist's details, one artist at a time
   (script: /team-ink.js; art: pre-rendered tiles in /assets/team/ink/, regenerate with
   `npm run team-ink` and `npm run flowers`; colours: teamTint/teamWash in artists.json) --- */
.team-ink {
    position: relative;
    isolation: isolate;
    width: 100%;
    padding: 24px 0 8px;
    text-align: left;
}

/* The band tints to the current artist's flower colour, fading out at the top and bottom */
.team-ink::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-color: var(--team-tint, var(--paper));
    transition: background-color 1.2s ease;
    -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}

.team-anchor {
    display: block;
    scroll-margin-top: 110px;
}

.team-ink-body {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    align-items: center;
    max-width: 1440px;
    margin: 0 auto;
}

.team-ink-hero {
    position: relative;
    height: clamp(440px, 40vw, 600px);
    overflow: hidden;
    isolation: isolate;
    /* The art fades out into the text column instead of stopping on a hard edge */
    -webkit-mask-image: linear-gradient(to right, #000 78%, transparent 99%);
    mask-image: linear-gradient(to right, #000 78%, transparent 99%);
}

.team-ink-hero:focus {
    outline: none;
}

.team-ink-layers {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 100%;
}

.team-ink-layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    will-change: transform;
    transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 1.2s ease;
}

.team-ink.is-ready .team-ink-layer {
    opacity: 1;
}

.team-ink-layer[data-layer="far"] {
    filter: blur(1.2px);
}

.team-ink-seg {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    will-change: transform;
}

/* Framed portraits: the segment is a point at the portrait's centre; frames are sized in design units */
.team-ink-seg.is-pinned {
    width: 0;
    height: 0;
}

/* A soft blob of the flower's colour behind everything */
.team-ink-layer[data-layer="wash"] .team-ink-seg::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 420%;
    height: 92%;
    transform: translate(-50%, -50%);
    /* Fades to clear before the edges of the art, so the wash never shows a hard line */
    background: radial-gradient(closest-side, var(--team-wash), transparent);
}

/* Framed portraits: pinned at the portrait's centre and sized in design units
   (var(--team-u) is one unit of the 580-unit-tall art) */
.team-ink-frame {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.team-ink-photo {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.team-ink-photo img {
    width: 100%;
    height: 100%;
    max-width: none;
    display: block;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.team-ink-photo img.is-loaded {
    opacity: 1;
}

/* Polaroid: a photo card with a little doodle on its border and tape in her flower's colour.
   The whole stack (back card, front card, tape) turns together as it slides in, so the photo
   always sits square in its card, then settles at the artist's own slight angle (--tilt). */
.team-ink-polaroid {
    width: calc(380 * var(--team-u));
    height: calc(470 * var(--team-u));
    transform: translate(-50%, -50%) rotate(calc(var(--tilt, -3deg) + var(--team-rel, 0) * 14deg));
}

.team-ink-polaroid-card,
.team-ink-polaroid-back {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    background: #fffdf9;
}

/* A second card peeking out behind */
.team-ink-polaroid-back {
    transform: rotate(6deg) translate(calc(12 * var(--team-u)), calc(4 * var(--team-u)));
    box-shadow: 0 calc(12 * var(--team-u)) calc(30 * var(--team-u)) rgba(31, 26, 28, 0.12);
}

.team-ink-polaroid-card {
    padding: calc(18 * var(--team-u)) calc(18 * var(--team-u)) calc(78 * var(--team-u));
    box-shadow: 0 calc(2 * var(--team-u)) calc(4 * var(--team-u)) rgba(31, 26, 28, 0.08), 0 calc(24 * var(--team-u)) calc(48 * var(--team-u)) rgba(31, 26, 28, 0.2);
}

.team-ink-polaroid .team-ink-photo {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
    background: #eee;
    /* A faint inner edge, like the print sitting in the card */
    box-shadow: inset 0 0 0 1px rgba(31, 26, 28, 0.08);
}

/* A small tattoo-flash doodle inked in the corner of the bottom border (one per artist: teamDoodle) */
.team-ink-polaroid-doodle {
    position: absolute;
    right: calc(26 * var(--team-u));
    bottom: calc(14 * var(--team-u));
    width: calc(50 * var(--team-u));
    height: calc(50 * var(--team-u));
    color: var(--rose);
    transform: rotate(-8deg);
    opacity: 0.9;
}

.team-ink-polaroid-doodle svg {
    display: block;
    width: 100%;
    height: 100%;
}

.team-ink-polaroid-tape {
    position: absolute;
    left: 50%;
    top: calc(-18 * var(--team-u));
    width: calc(130 * var(--team-u));
    height: calc(36 * var(--team-u));
    transform: translateX(-50%) rotate(4deg);
    background: var(--team-wash);
    opacity: 0.75;
    -webkit-mask-image: linear-gradient(90deg, transparent 0 2%, #000 4% 96%, transparent 98%);
    mask-image: linear-gradient(90deg, transparent 0 2%, #000 4% 96%, transparent 98%);
}

.team-ink-tile {
    position: absolute;
    top: 0;
    height: 100%;
    max-width: none;
    display: block;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.team-ink-tile.is-loaded {
    opacity: 1;
}

/* The flower's centre on its tile (see tools/team-ink/build-flowers.mjs) */
.team-ink-layer[data-layer="mid"] .team-ink-tile {
    transform-origin: 46.8% 50%;
}

/* Arrows and counter: under the bio on desktop, under the art on phones */
.team-ink-controls {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 36px;
    padding: 0 clamp(16px, 4vw, 48px) 0 clamp(8px, 2vw, 32px);
}

.team-ink-arrow {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    flex: none;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(31, 26, 28, 0.25);
    background: rgba(251, 247, 243, 0.6);
    color: var(--ink);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.team-ink-arrow:hover,
.team-ink-arrow:focus-visible {
    background: var(--ink);
    border-color: var(--ink);
    color: #ffffff;
}

.team-ink-arrow[data-dir="-1"]:hover {
    transform: translateX(-3px);
}

.team-ink-arrow[data-dir="1"]:hover {
    transform: translateX(3px);
}

.team-ink-arrow:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--blush);
}

.team-ink-count {
    margin: 0;
    font-family: 'lequire', sans-serif;
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--taupe);
    font-variant-numeric: tabular-nums;
}

.team-ink-count b {
    font-family: 'lequire', sans-serif;
    font-weight: 400;
    font-size: 15px;
    color: var(--ink);
}

/* Without JavaScript every card is listed, so the arrows have nothing to do */
.team-ink:not(.has-js) .team-ink-controls {
    display: none;
}

/* Artist cards: a plain list without JavaScript, one crossfading card with it */
.team-ink-cards {
    display: grid;
    gap: 48px;
    padding: 0 clamp(16px, 4vw, 48px) 0 clamp(8px, 2vw, 32px);
}

.team-ink.has-js .team-ink-cards {
    gap: 0;
}

.team-ink.has-js .team-ink-card {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s;
}

.team-ink.has-js .team-ink-card.is-active {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.6s ease 0.4s, transform 0.6s ease 0.4s, visibility 0s;
}

.team-ink-card {
    display: grid;
    gap: 18px;
    align-content: center;
}

.team-ink-card-head h3 {
    margin: 0;
    padding-left: 0.06em;
    font-family: 'Great Vibes', cursive;
    font-weight: 400;
    font-size: clamp(48px, 5vw, 76px);
    line-height: 1.1;
    white-space: nowrap;
    color: var(--ink);
}

.team-ink-card-role {
    margin: 4px 0 10px;
    font-size: 10px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--taupe);
}

.team-ink-card-bio {
    margin: 0;
    max-width: 54ch;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--ink-soft);
}

.team-ink-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.team-ink-card-tags li {
    padding: 5px 14px;
    border: 1px solid rgba(31, 26, 28, 0.35);
    border-radius: 99px;
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--ink);
}

/* "View Portfolio": spaced capitals over a hairline that sweeps away and redraws on hover */
.team-ink-more {
    display: inline-block;
    justify-self: start;
    margin-top: 10px;
    padding: 6px 0 8px;
    font-family: 'lequire', sans-serif;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}

.team-ink-more span {
    position: relative;
    display: inline-block;
    padding-bottom: 7px;
    font-family: 'lequire', sans-serif;
    color: var(--ink);
    transition: color 0.3s ease;
}

.team-ink-more span::after {
    content: "";
    position: absolute;
    left: 0;
    right: 3px;
    bottom: 0;
    height: 1px;
    background: currentColor;
    transform-origin: right;
}

.team-ink-more:hover span::after,
.team-ink-more:focus-visible span::after {
    animation: teamInkUnderline 0.7s cubic-bezier(0.7, 0, 0.2, 1);
}

@keyframes teamInkUnderline {
    0% { transform: scaleX(1); transform-origin: right; }
    45% { transform: scaleX(0); transform-origin: right; }
    46% { transform: scaleX(0); transform-origin: left; }
    100% { transform: scaleX(1); transform-origin: left; }
}

.team-ink-more:hover span,
.team-ink-more:focus-visible span {
    color: var(--taupe);
}

.team-ink-more:focus-visible {
    outline: 2px solid var(--blush);
    outline-offset: 4px;
}

/* Flower row: jump straight to any artist */
.team-ink-rail {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(6px, 1.5vw, 18px);
    max-width: 1280px;
    margin: 28px auto 0;
    padding: 0 clamp(16px, 4vw, 48px);
}

.team-ink-rail button {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 6px 8px 8px;
    border: 0;
    border-radius: 14px;
    background: none;
    color: var(--ink);
    cursor: pointer;
    box-shadow: none !important;
}

.team-ink-rail img {
    width: clamp(64px, 9vw, 110px);
    height: auto;
    aspect-ratio: 1376 / 768;
    object-fit: cover;
    filter: grayscale(1) opacity(0.55);
    transform: scale(0.9);
    transition: filter 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.team-ink-rail span {
    font-family: 'Great Vibes', cursive;
    font-size: 22px;
    line-height: 1.1;
    color: var(--taupe);
    transition: color 0.3s ease;
}

.team-ink-rail button:hover img,
.team-ink-rail button:focus-visible img {
    filter: grayscale(0.4) opacity(0.85);
    transform: scale(0.96);
}

.team-ink-rail button[aria-current="true"] img {
    filter: none;
    transform: scale(1.06);
}

.team-ink-rail button[aria-current="true"] span {
    color: var(--ink);
}

.team-ink-rail button:focus-visible {
    outline: 2px solid var(--blush);
    outline-offset: 2px;
}

@media (max-width: 899px) {
    .team-ink-body {
        grid-template-columns: 1fr;
    }

    /* Stacked: art, then the arrows, then the card */
    .team-ink-side {
        display: contents;
    }

    .team-ink-controls {
        order: 1;
        justify-content: center;
        margin-top: 8px;
        padding: 0 clamp(16px, 4vw, 48px);
    }

    .team-ink-cards {
        order: 2;
    }

    .team-ink-hero {
        -webkit-mask-image: none;
        mask-image: none;
    }

    .team-ink-cards {
        padding: 28px clamp(16px, 4vw, 48px) 0;
    }
}

@media (max-width: 699px) {
    .team-ink-hero {
        height: 460px;
    }

    /* Phones: a smaller Polaroid on the left, so the flower shows beside it on the right */
    .team-ink-polaroid {
        scale: 0.82;
        /* Keep the card's left edge ~26px in from the screen edge at any phone width
           (its centre starts 34 units right of the middle; half the scaled card is ~156 units) */
        translate: calc(26px + 122 * var(--team-u) - 50vw) calc(-16 * var(--team-u));
    }

    .team-ink-layer[data-layer="mid"] {
        translate: -14vw 0;
    }
}

@media (prefers-reduced-motion: reduce) {

    .team-ink::before,
    .team-ink-layer,
    .team-ink.has-js .team-ink-card {
        transition: none !important;
        animation: none !important;
    }
}
