/* ============================================================
   WORK (2026)

   The portfolio, built to turn a visitor into a client. The order is the
   argument:
     1. a short title over a hand of the work itself, dealt out as the page
        opens and fanned wider as you begin to scroll, each card opening its
        project;
     2. a moving band of what we do;
     3. the projects, one card each, stacking as you scroll: the type, the
        name, one large picture with the rest a tap away, what we did, and a
        button that opens the enquiry with that service already picked;
     4. the numbers, counting up, beside who else trusts us;
     5. a close that says exactly what happens after you get in touch.

   The motion, all of it transform, opacity or a one-off clip, so a budget
   phone runs it without dropping frames, and all of it off for anyone who
   asks for less motion:
     - headings whose words rise into place (data-split, main.js);
     - pictures that open like a curtain as they arrive;
     - project cards that stick and stack, the one beneath settling back and
       dimming as the next arrives;
     - on a mouse: a "View" cursor over the work, and buttons that lean
       towards the pointer.

   Set in TwoFold's colours on the dark ground the homepage and About use:
   deep navy, brand navy, teal for every key word and action.

   Standing rules for the whole site, kept here:
     - No gradients anywhere. Every surface is one flat colour.
     - Mobile first. The base rules ARE the phone layout; every media query
       below is min-width and only adds room as the screen grows. The phone
       gets the same composition as the laptop, never a lesser one.
   ============================================================ */

body.theme-dark .pf {
  --pf-bg:      #06192B;   /* the page ground                                  */
  --pf-brand:   #104068;   /* brand navy: behind images while they load        */
  --pf-teal:    #73BEC6;
  --pf-teal-hi: #62BEC2;
  --pf-teal-lt: #8DD1D8;
  --pf-ink:     #071E33;   /* text on teal                                     */
  --pf-text:    #EAF2F6;
  --pf-text-2:  rgba(234, 242, 246, .74);
  --pf-r:       clamp(14px, 1rem + .6vw, 22px);
  --pf-bend:    clamp(2.2rem, 1.3rem + 4.4vw, 5.8rem);   /* the About ribbon's curve */

  --pf-corner:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Cdefs%3E%3Cfilter id='b' x='-30%25' y='-30%25' width='160%25' height='160%25'%3E%3CfeGaussianBlur stdDeviation='3'/%3E%3C/filter%3E%3C/defs%3E%3Cpath d='M20 0Q28 0 33.66 5.66L114.34 86.34Q120 92 120 100V0Z' fill='%2306192B'/%3E%3Cpath d='M28 7Q28 0 32.95 4.95Q78.2 41.8 115.05 87.05Q120 92 113 92H40Q28 92 28 80Z' fill='%23000' fill-opacity='.35' filter='url(%23b)' transform='translate(-3 3)'/%3E%3Cpath d='M28 7Q28 0 32.95 4.95Q78.2 41.8 115.05 87.05Q120 92 113 92H40Q28 92 28 80Z' fill='%2373BEC6'/%3E%3C/svg%3E");   /* the folded corner, drawn once (see the close) */

  --pf-t-body:  clamp(.96rem, .93rem + .18vw, 1.04rem);
  --pf-t-lead:  clamp(1.02rem, .96rem + .4vw, 1.24rem);

  display: block;
  background: var(--pf-bg);
  color: var(--pf-text);
}
.pf a:focus-visible, .pf button:focus-visible { outline: 2px solid var(--pf-teal); outline-offset: 3px; }

/* ---- shared: buttons and links ------------------------------------------ */
body.theme-dark .pf .pf-btn {
  display: inline-flex; align-items: center; gap: .6rem;
  min-height: 3.1rem; padding: .85rem 1.45rem;
  border: 0; border-radius: 999px;
  background: var(--pf-teal-hi); color: var(--pf-ink);
  font-family: var(--font-body); font-size: .95rem; font-weight: 700; line-height: 1.2;
  cursor: pointer;
  /* --mx/--my: the lean towards the pointer (data-magnetic, mouse only) */
  transform: translate3d(var(--mx, 0px), calc(var(--my, 0px) + var(--lift, 0px)), 0);
  transition: background-color .3s var(--ease), transform .35s var(--ease);
}
body.theme-dark .pf .pf-btn i { font-size: .8em; transition: transform .3s var(--ease); }
/* on the teal close, the button turns navy */
body.theme-dark .pf .pf-btn--ink { background: var(--pf-ink); color: #fff; }

body.theme-dark .pf .pf-link {
  display: inline-flex; align-items: center; gap: .5rem;
  /* underlined with text-decoration, not a border, so the link can take the
     padding a 44px tap target needs without the line drifting away */
  padding: .72rem 0;
  font-family: var(--font-body); font-size: .95rem; font-weight: 600;
  color: #fff;
  text-decoration: underline; text-decoration-color: var(--pf-teal);
  text-decoration-thickness: 2px; text-underline-offset: 6px;
}
body.theme-dark .pf .pf-link i { font-size: .78em; color: var(--pf-teal); }
body.theme-dark .pf .pf-link--ink { color: var(--pf-ink); text-decoration-color: currentColor; }
body.theme-dark .pf .pf-link--ink i { color: inherit; }

@media (hover: hover) {
  body.theme-dark .pf .pf-btn:hover { --lift: -1px; background: #fff; color: var(--pf-ink); }
  body.theme-dark .pf .pf-btn:hover i { transform: translateX(3px); }
  body.theme-dark .pf .pf-link:hover { color: var(--pf-teal-lt); }
  body.theme-dark .pf .pf-link--ink:hover { color: var(--pf-brand); }
}

/* ---- shared: words that rise into place ------------------------------------
   main.js wraps each word of a [data-split] heading in two spans: the outer
   one clips, the inner one rises out of it when the heading (or the reveal
   around it) comes in. The padding keeps descenders and the last letter's
   overhang from being clipped.
   --------------------------------------------------------------------- */
.pf [data-split].is-split .w {
  display: inline-block; overflow: hidden; vertical-align: top;
  padding: 0 .07em .14em 0; margin: 0 -.07em -.14em 0;
}
.pf [data-split].is-split .w__i { display: inline-block; }
html.js:not(.no-anim) .pf [data-split].is-split .w__i {
  transform: translate3d(0, 112%, 0);
  transition: transform 1s var(--ease-out) calc(var(--wi, 0) * 70ms + 60ms);
}
html.js:not(.no-anim) .pf .is-in [data-split].is-split .w__i,
html.js:not(.no-anim) .pf [data-split].is-split.is-in .w__i { transform: none; }

/* ---- 1. hero -------------------------------------------------------------
   Two words, one line under them, one way in, and then a hand of the work:
   seven pieces fanned like cards, each opening its project.
   --------------------------------------------------------------------- */
body.theme-dark .pf .pf-hero {
  /* clears the floating nav pill, whose underside sits at 73px on a phone */
  padding: 6.75rem 0 clamp(2.2rem, 6vw, 4rem);
  text-align: center;
  /* the outer cards reach past the edges of a phone: clip, never scroll */
  overflow: hidden; overflow: clip;
}
body.theme-dark .pf .pf-hero__title {
  margin: 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(3.5rem, 2.2rem + 6vw, 9.4rem);
  line-height: 1; letter-spacing: -.035em;
  color: #fff;
}
body.theme-dark .pf .pf-hero__title .pf-light { font-weight: 400; letter-spacing: -.03em; }
body.theme-dark .pf .pf-hero__title em { font-style: normal; color: var(--pf-teal); }
body.theme-dark .pf .pf-hero__lead {
  margin: 1rem auto 0; max-width: 30ch;
  font-size: var(--pf-t-lead); line-height: 1.55;
  color: var(--pf-text-2);
  text-wrap: balance;
}
.pf-hero__actions { display: flex; justify-content: center; margin-top: 1.5rem; }

/* The hand. Each card sits on the same spot and is sent to its place by
   --i (its seat, -3 to 3, left to right) and --d (how far from the middle,
   0 to 3): out along the row, down a little, and turned, pivoting on its
   bottom edge like a hand of cards. */
body.theme-dark .pf .pf-deck {
  --card-w: clamp(8.4rem, 36vw, 13.5rem);
  --step:   clamp(3.9rem, 16.4vw, 8.8rem);
  --rot:    5.5deg;
  --drop:   calc(var(--card-w) * .07);
  --spread: clamp(.7rem, 3.4vw, 2.6rem);   /* the extra fan as you scroll */
  position: relative;
  list-style: none;
  margin: clamp(2.2rem, 6vw, 3.4rem) 0 0; padding: 0;
  height: calc(var(--card-w) * 1.25 + var(--drop) * 3 + 1.2rem);
}
.pf-card {
  position: absolute; left: 50%; bottom: calc(var(--drop) * 3 + .6rem);
  width: var(--card-w); aspect-ratio: 4 / 5;
  z-index: calc(10 - var(--d));
  transform-origin: 50% 100%;
  transform: translateX(calc(-50% + var(--i) * var(--step))) translateY(calc(var(--d) * var(--drop))) rotate(calc(var(--i) * var(--rot)));
  /* dealt from the middle outwards */
  transition: transform 1.2s var(--ease) calc(var(--d) * 90ms + 140ms);
}
/* the two outermost cards only once there is room for seven */
.pf-card--far { display: none; }
/* before the deal: all seven stacked in the middle */
html.js:not(.no-anim) .pf-deck.reveal:not(.is-in) .pf-card {
  transform: translateX(-50%) translateY(14%) rotate(0deg) scale(.9);
}
body.theme-dark .pf .pf-card__link {
  display: block; width: 100%; height: 100%;
  border-radius: var(--pf-r);
  transition: transform .45s var(--ease);
}
.pf-card__in {
  display: block; width: 100%; height: 100%;
  border-radius: inherit; overflow: hidden;
  background: var(--pf-brand);
  box-shadow: 0 22px 40px -22px rgba(0, 0, 0, .75);
}
.pf-card__in img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (hover: hover) {
  .pf-card:hover, .pf-card:focus-within { z-index: 20; }
  body.theme-dark .pf .pf-card__link:hover { transform: translateY(-9%); }
}
body.theme-dark .pf .pf-card__link:focus-visible { transform: translateY(-9%); outline-offset: 5px; }

/* ---- 2. what we do, on the move -------------------------------------------
   Two copies of one row, the second picking up where the first ends, so the
   loop never shows a seam. Every word is set the same, solid white, with the
   TwoFold mark in teal between them. Paused while it is off screen (main.js)
   and still for anyone who asks for less motion.
   --------------------------------------------------------------------- */
body.theme-dark .pf .pf-band {
  display: flex; overflow: hidden;
  padding: clamp(1.6rem, 5vw, 3rem) 0;
  border-block: 1px solid rgba(115, 190, 198, .16);
}
.pf-band__track {
  display: flex; flex: none; align-items: baseline;
  animation: pf-band 38s linear infinite;
}
body.theme-dark .pf .pf-band__track span {
  display: inline-flex; align-items: center;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.2rem, 1.35rem + 4vw, 5.4rem);
  line-height: 1; letter-spacing: -.02em;
  white-space: nowrap;
  color: #fff;
}
/* the mark between words, sized to the type */
body.theme-dark .pf .pf-band__track span::after {
  content: "";
  flex: none;
  width: .56em; height: .5em;
  margin: 0 .55em;
  background: image-set(url("../img/mark-98.webp") 1x, url("../img/mark-196.webp") 2x) center / contain no-repeat;
}
.pf-band.is-off .pf-band__track { animation-play-state: paused; }
@keyframes pf-band { to { transform: translate3d(-100%, 0, 0); } }

/* ---- 3. the project cards ---------------------------------------------------
   One card per project, in a stack: each sticks as it reaches the top of
   the screen and the next slides up over it, while the one beneath settles
   back a little and dims (the homepage services deck, for whole projects).
   main.js decides where each card sticks: under the nav, a little lower
   each time so the edges of the cards beneath show, or by its bottom edge
   when it is taller than the screen, so all of it has been seen before the
   next one covers it. Anyone who asks for less motion gets a plain list.

   The card: a navy surface with its top right corner folded over in teal,
   the fold from the brand; the project's type, name and line; one large
   framed picture with the rest a tap away beneath it; then the story, what
   we did, and the way in. On a phone that reads top to bottom; on a laptop
   the pictures take the left and the words the right.
   --------------------------------------------------------------------- */
body.theme-dark .pf .pf-work { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(3.5rem, 8vw, 6rem); }
.pf-stack { position: relative; }
.pf-proj + .pf-proj { margin-top: clamp(1.25rem, 3.5vw, 2.25rem); }
html.js:not(.no-anim) .pf-stack:not(.is-flat) .pf-proj {
  position: sticky;
  top: calc(var(--nav-h) + 1rem);   /* the default; main.js fits each card */
}

.pf-proj__card {
  --fold:   clamp(2.3rem, 1.6rem + 2.6vw, 3.8rem);
  --card-r: clamp(18px, .9rem + 1vw, 30px);
  --frame-r: clamp(12px, .6rem + .6vw, 18px);
  position: relative;
  padding: clamp(1rem, .55rem + 2vw, 2.4rem);
  transform-origin: 50% 0;
}
/* the surface and the dimming layer share one shape: rounded, with the top
   right corner cut away along the fold */
.pf-proj__bg, .pf-proj__shade {
  position: absolute; inset: 0;
  border-radius: var(--card-r);
  clip-path: polygon(0 0, calc(100% - var(--fold)) 0, 100% var(--fold), 100% 100%, 0 100%);
  pointer-events: none;
}
.pf-proj__bg { background: var(--tone, #0E3152); box-shadow: inset 0 0 0 1px rgba(115, 190, 198, .12); }
.pf-proj__shade { background: #06192B; opacity: 0; }
/* the corner itself, folded down over the card */
.pf-proj__fold {
  position: absolute; top: 0; right: 0;
  width: var(--fold); height: var(--fold);
  background: var(--pf-teal);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  border-bottom-left-radius: 7px;
  pointer-events: none;
}

.pf-proj__grid {
  position: relative;
  display: grid; gap: 1.15rem;
  grid-template-areas: "head" "media" "body";
}
.pf-proj__head { grid-area: head; padding-right: calc(var(--fold) * .75); }   /* clear of the fold */
.pf-proj__media { grid-area: media; min-width: 0; }
.pf-proj__body { grid-area: body; }

body.theme-dark .pf .pf-proj__tag {
  margin: 0;
  font-size: .72rem; font-weight: 600; line-height: 1.3;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--pf-teal);
}
body.theme-dark .pf .pf-proj__title {
  margin: .65rem 0 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.95rem, 1.35rem + 2.4vw, 3.4rem);
  line-height: 1.08; letter-spacing: -.025em;
  color: #fff;
}
body.theme-dark .pf .pf-proj__line {
  margin: .7rem 0 0;
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.04rem, .96rem + .42vw, 1.32rem);
  line-height: 1.35; letter-spacing: -.005em;
  color: var(--pf-teal-lt);
  text-wrap: balance;
}
body.theme-dark .pf .pf-proj__story {
  margin: 0; max-width: 46ch;
  font-size: var(--pf-t-body); line-height: 1.68;
  color: var(--pf-text-2);
  text-wrap: pretty;
}
body.theme-dark .pf .pf-proj__did {
  list-style: none; margin: 1.15rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .45rem;
}
body.theme-dark .pf .pf-proj__did li {
  padding: .42rem .85rem;
  border-radius: 999px;
  background: rgba(115, 190, 198, .14);
  font-size: .78rem; font-weight: 600; line-height: 1.2;
  color: var(--pf-teal-lt);
}
/* what changed, set apart on a teal rule, with the number big where the
   project has one */
body.theme-dark .pf .pf-proj__result {
  margin: 1.15rem 0 0; padding: .15rem 0 .15rem 1rem;
  max-width: 44ch;
  border-left: 2px solid var(--pf-teal);
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(.98rem, .94rem + .2vw, 1.08rem);
  line-height: 1.5; letter-spacing: 0;
  color: #fff;
  text-wrap: pretty;
}
body.theme-dark .pf .pf-proj__result strong {
  display: block; margin-bottom: .3rem;
  font-weight: 700;
  font-size: clamp(2.1rem, 1.6rem + 2vw, 3rem);
  line-height: 1; letter-spacing: -.03em;
  color: var(--pf-teal-lt); font-variant-numeric: tabular-nums lining-nums; }
.pf-proj__body .pf-btn { margin-top: 1.4rem; }

/* the frame: one picture at a time, landscape pictures filling it and
   portrait ones set whole inside it, on a soft blur of themselves: a tiny
   picture blurred ahead of time (img/work/mat), set by the page or main.js,
   so a phone does no filter work */
body.theme-dark .pf .pf-view {
  position: relative; margin: 0;
  aspect-ratio: 16 / 10;
  border-radius: var(--frame-r); overflow: hidden;
  background: rgba(0, 0, 0, .26) 50% 50% / cover no-repeat;
}
.pf-view picture, .pf-view img { display: block; width: 100%; height: 100%; }
.pf-view img { object-fit: cover; transition: opacity .3s var(--ease), transform 1.6s var(--ease-out); }
.pf-view.is-fading img { opacity: 0; }
/* the curtain: hung on the picture, never on the figure the reveal watches
   (a figure clipped to nothing never counts as on screen) */
.pf-view picture { clip-path: inset(0 round var(--frame-r)); transition: clip-path 1.2s var(--ease-out); }
body.theme-dark .pf .pf-view.reveal { opacity: 1; transform: none; }
html.js:not(.no-anim) .pf .pf-view.reveal:not(.is-in) picture { clip-path: inset(100% 0 0 0 round var(--frame-r)); }
html.js:not(.no-anim) .pf .pf-view.reveal:not(.is-in) img { transform: scale(1.14); }

/* the rest of the project, a tap away. Every thumbnail is the same 4:3
   crop whatever the shape of its picture, so the row reads as one set.
   They share the row until they reach a comfortable size for a thumb;
   past that (six or seven pictures on a phone) the row slides sideways
   instead of squeezing them. The padding gives the ring of the one
   showing room inside the scroller, which would otherwise clip it. */
.pf-thumbs {
  display: flex; gap: .45rem;
  margin: calc(.6rem - 3px) -3px 0; padding: 3px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: 3px;
  scrollbar-width: none;
}
.pf-thumbs::-webkit-scrollbar { display: none; }
body.theme-dark .pf .pf-thumb {
  flex: 1 1 0; min-width: 3.25rem; max-width: 5.6rem;
  scroll-snap-align: start;
  aspect-ratio: 4 / 3;
  padding: 0; border: 0; border-radius: 10px; overflow: hidden;
  background: rgba(0, 0, 0, .26);
  cursor: pointer;
  opacity: .5;
  box-shadow: 0 0 0 2px transparent;
  transition: opacity .25s var(--ease), box-shadow .25s var(--ease);
}
.pf-thumb picture, .pf-thumb img { display: block; width: 100%; height: 100%; }
.pf-thumb img { object-fit: cover; }
body.theme-dark .pf .pf-thumb.is-on { opacity: 1; box-shadow: 0 0 0 2px var(--pf-teal); }
@media (hover: hover) {
  body.theme-dark .pf .pf-thumb:not(.is-on):hover { opacity: .85; }
}

/* ---- 4. the numbers, beside who trusts us -------------------------------- */
body.theme-dark .pf .pf-proof {
  list-style: none;
  margin: 0 0 clamp(2rem, 5vw, 3rem); padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem;
}
.pf-proof li { display: grid; gap: .4rem; align-content: start; }
body.theme-dark .pf .pf-proof strong {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.6rem);
  line-height: 1; letter-spacing: -.03em;
  color: #fff;
  font-variant-numeric: tabular-nums lining-nums;
}
body.theme-dark .pf .pf-proof strong span:not(.val) { color: var(--pf-teal); }
body.theme-dark .pf .pf-proof small {
  font-size: .72rem; font-weight: 600; line-height: 1.35;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--pf-text-2);
}

/* ---- 5. the close --------------------------------------------------------
   Quiet and compact, on the page's own ground: a navy card with a teal
   folded corner, and the one bright thing on it is the button. What
   happens after you get in touch sits underneath, in three short lines
   rather than three boxes. (It used to be a full width slab of teal, which
   shouted over the work above it.)
   --------------------------------------------------------------------- */
body.theme-dark .pf .pf-cta { padding: clamp(2.4rem, 6vw, 4.2rem) 0 clamp(3.4rem, 8vw, 6rem); }
body.theme-dark .pf .pf-cta__card {
  --f: 1.6rem;
  position: relative;
  max-width: 62rem; margin-inline: auto;
  padding: clamp(1.7rem, 1.1rem + 2.2vw, 2.9rem) clamp(1.3rem, .9rem + 2vw, 2.6rem) clamp(1.8rem, 1.2rem + 2.4vw, 3rem);
  border-radius: 26px 0 26px 26px;          /* the fold takes the fourth corner */
  background: #0E3152;
  box-shadow: 0 26px 42px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 0 0 1px rgba(115, 190, 198, .14);
  text-align: center;
}
.pf-cta__card::after {
  content: "";
  position: absolute; top: 0; right: 0;
  width: calc(var(--f) * 1.2); height: calc(var(--f) * 1.2);
  background: var(--pf-corner) 0 0 / 100% 100% no-repeat;
  pointer-events: none;
}
body.theme-dark .pf .pf-cta__kicker {
  margin: 0 0 .75rem;
  font-family: var(--font-body); font-size: .72rem; font-weight: 600; line-height: 1.3;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--pf-teal);
}
body.theme-dark .pf .pf-cta__title {
  margin: 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3.1rem);
  line-height: 1.08; letter-spacing: -.025em;
  color: #fff;
}
body.theme-dark .pf .pf-cta__title > span:not(.w) { color: var(--pf-teal); font-weight: 400; }
body.theme-dark .pf .pf-cta__lead {
  margin: .8rem auto 0; max-width: 44ch;
  font-size: var(--pf-t-body); line-height: 1.6;
  color: var(--pf-text-2);
  text-wrap: balance;
}
.pf-cta__actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .2rem 1.4rem; margin-top: 1.1rem; }

body.theme-dark .pf .pf-steps {
  list-style: none;
  margin: clamp(1.6rem, 4vw, 2.2rem) 0 0; padding: 0;
  display: grid; gap: .85rem;
  text-align: left;
}
body.theme-dark .pf .pf-steps li { display: grid; gap: .22rem; }
body.theme-dark .pf .pf-steps strong {
  font-family: var(--font-display); font-weight: 700;
  font-size: .98rem; line-height: 1.3; letter-spacing: -.01em;
  color: #fff;
}
body.theme-dark .pf .pf-steps span { font-size: .88rem; line-height: 1.5; color: var(--pf-text-2); }
@media (min-width: 700px) {
  body.theme-dark .pf .pf-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.6rem; }
}

/* ---- the "View" cursor ------------------------------------------------------
   The site's cursor ring (home-dark.css, mouse only) grows into a teal disc
   with a word in it over anything marked data-cursor.
   --------------------------------------------------------------------- */

/* ---- scroll-linked motion, where the browser can drive it ------------------
   All of it runs from the scroll itself, off the main thread. Elsewhere the
   page simply holds still: the hand stays as dealt, and covered cards stay
   as they are.
   --------------------------------------------------------------------- */
@supports (animation-timeline: scroll()) {
  /* the hand fans wider over the first stretch of scroll */
  .pf-card__in {
    animation: pf-spread linear both;
    animation-timeline: scroll(root block);
    animation-range: 0px 70svh;
  }
}
@keyframes pf-spread { to { transform: translate3d(calc(var(--i) * var(--spread)), 0, 0) rotate(calc(var(--i) * 2.5deg)); } }

/* A card settles back and dims while the NEXT card rises over it, and its
   words fade as they go under, so the edge left peeking above the next card
   is a clean sheet. The settling runs on the page's own scroll, between two
   positions main.js measures for each card: the next card's top meeting
   this card's bottom edge (--sink-a) and that card pinning (--sink-b). So
   the card being read stays fully lit however much of the next one already
   shows. (Not a view timeline on the next card: Chrome misplaces a sticky
   element on its own view timeline once cards start pinning.) Where scroll
   timelines are not supported, or before main.js has measured, the cards
   still stack, just without the settling. */
@supports (animation-timeline: scroll()) {
  html.js:not(.no-anim) .pf-stack.is-fit:not(.is-flat) > .pf-proj:not(:last-child) .pf-proj__card  { animation: pf-sink linear both; }
  html.js:not(.no-anim) .pf-stack.is-fit:not(.is-flat) > .pf-proj:not(:last-child) .pf-proj__shade { animation: pf-dim linear both; }
  html.js:not(.no-anim) .pf-stack.is-fit:not(.is-flat) > .pf-proj:not(:last-child) .pf-proj__grid  { animation: pf-fade ease-in both; }
  html.js:not(.no-anim) .pf-stack.is-fit:not(.is-flat) > .pf-proj:not(:last-child) :is(.pf-proj__card, .pf-proj__shade, .pf-proj__grid) {
    animation-timeline: scroll(root block);
    animation-range: var(--sink-a) var(--sink-b);
  }
}
@keyframes pf-sink { to { transform: scale(.94); } }
@keyframes pf-dim  { to { opacity: .5; } }
@keyframes pf-fade { to { opacity: 0; } }

/* ============================================================
   Larger screens: only additions from here on.
   ============================================================ */

@media (min-width: 620px) {
  .pf-card--far { display: block; }
  .pf-thumbs { gap: .55rem; }
}

@media (min-width: 900px) {
  body.theme-dark .pf .pf-hero { padding-top: 8.5rem; }
  body.theme-dark .pf .pf-deck { --rot: 5deg; }

  /* pictures on the left, words on the right: the name and line at the
     top, the story and the way in settled at the bottom */
  /* every card the tallest one's height (main.js sets --pf-h), with its
     contents centred, so the stack's edges line up */
  .pf-proj__card { box-sizing: border-box; min-height: var(--pf-h, 0px); display: grid; align-content: center; }
  .pf-proj__grid {
    grid-template-columns: minmax(0, 13fr) minmax(0, 11fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "media head" "media body";
    column-gap: clamp(2rem, 4vw, 3.6rem); row-gap: 1.3rem;
  }
  .pf-proj__media { align-self: center; }
  .pf-proj__body { align-self: end; }
  .pf-thumbs { margin-top: calc(.8rem - 3px); gap: .7rem; }
  /* a long set (eight or more) would only slide on a laptop, where a mouse
     cannot easily scroll sideways, so it lays out as two even rows of five */
  .pf-thumbs:has(> :nth-child(8)) { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; }
  body.theme-dark .pf .pf-thumbs:has(> :nth-child(8)) .pf-thumb { min-width: 0; max-width: none; }
  /* the number beside its sentence, so the card stays inside the screen */
  body.theme-dark .pf .pf-proj__result:has(strong) {
    display: grid; grid-template-columns: auto minmax(0, 1fr);
    align-items: center; column-gap: 1rem;
  }
  body.theme-dark .pf .pf-proj__result strong { margin-bottom: 0; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums lining-nums; }
  body.theme-dark .pf :is(.pf-proj__story, .pf-proj__result) { max-width: 54ch; }

  body.theme-dark .pf .pf-proof { max-width: 50rem; }
}

/* ============================================================
   Less motion: everything lands where it would end up, and stays. The
   project cards lie in a plain list instead of stacking.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .pf-card, .pf-card__link, .pf-view picture, .pf-view img { transition: none !important; }
  .pf-card__in, .pf-band__track, .pf-proj__card, .pf-proj__shade, .pf-proj__grid { animation: none !important; }
  .pf [data-split] .w__i { transform: none !important; }
  .pf-stack .pf-proj { position: static !important; }
}
