/* ---------- 03 Work: cover flip (js/work-flip.js) ----------
   First the section says what it is ("Selected work", centred). Then, one project at a time, its cover comes up from
   under the bottom edge much bigger than the screen, lands in the middle, and its details rise in underneath. The
   next cover comes up over them. Nothing fades: text slides behind masks or gets covered, covers are covered. */
.wf { position: relative; }
.wf-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }   /* svh: a phone's address bar doesn't push it */

/* the intro: centred where the covers land; it slides away behind its masks as the first cover arrives */
.wf-intro { position: absolute; left: 20px; right: 20px; top: 50%; translate: 0 -50%; z-index: 1; text-align: center; color: var(--ink); }
.wf-kick { font-size: max(calc(16 * var(--u)), 13px); line-height: 30px; letter-spacing: -.015em; }
.wf-intro h2 { margin-top: 14px; font-size: clamp(64px, 10vw, 168px); line-height: .92; font-weight: 600; letter-spacing: -.055em; }
.wf-intro h2 em { font-style: normal; color: var(--purple); }
.wf-intro h2 br { display: none; }
.wf-intro .sub { margin-top: 22px; font-size: clamp(15px, 1.25vw, 19px); color: var(--mute); }

/* covers */
.wf-cover { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; cursor: pointer; visibility: hidden; }
.wf-cover .face { position: absolute; inset: 0; overflow: hidden; border-radius: 10px; background: #1b1b1b;
  box-shadow: 0 40px 90px -30px rgb(20 10 60 / .45); }
.wf-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }

/* each project's details, under its cover and aligned to its edges */
.wf-info { position: absolute; left: 0; top: 0; z-index: 2; color: var(--ink); display: grid; grid-template-columns: auto 1fr minmax(0, 36ch);
  column-gap: clamp(18px, 2.4vw, 40px); align-items: start; }
.wf-info .num { font-size: clamp(40px, 4.4vw, 72px); line-height: .82; font-weight: 600; letter-spacing: -.06em; color: var(--purple); font-variant-numeric: tabular-nums; }
.wf-info .tags { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.wf-info .title { margin-top: 8px; font-size: clamp(22px, 2.1vw, 34px); line-height: 1.08; font-weight: 600; letter-spacing: -.025em; }
.wf-info .co { margin-top: 4px; font-size: clamp(15px, 1.25vw, 19px); color: var(--mute); }
.wf-info .desc { font-size: clamp(14px, 1.1vw, 17px); line-height: 1.45; }
.wf-info .side { justify-self: end; }
.wf-more { display: inline-flex; margin-top: 12px; font-size: 16px; font-weight: 500; color: var(--ink); }
.wf .wf-more .ln > span { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.wf-more svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: translate .35s var(--ease); }
.wf-more:hover svg { translate: 6px 0; }

/* a line of text sits in a mask and slides up into view */
.wf .ln { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.wf .ln > span { display: block; }
.wf.js-ln .ln > span { visibility: hidden; }   /* until the script has tucked them under their masks */

/* glass edges: covers come up through (and the last one leaves through) frosted glass that gets stronger toward the
   screen edge and melts into the page colour, instead of a hard cut. A few stacked layers, each blurring more and
   masked to a narrower band nearer the edge. */
.wf-glass { position: absolute; left: 0; right: 0; height: var(--gh, 12vh); z-index: 10; pointer-events: none; }
.wf-glass.bottom { bottom: 0; }
.wf-glass.top { top: 0; transform: scaleY(-1); --gh: 16vh; }
.wf-glass i { position: absolute; inset: 0; }
.wf-glass i:nth-child(1) { backdrop-filter: blur(2px);  -webkit-backdrop-filter: blur(2px);  mask-image: linear-gradient(transparent 0%, #000 30%, #000 100%); }
.wf-glass i:nth-child(2) { backdrop-filter: blur(6px);  -webkit-backdrop-filter: blur(6px);  mask-image: linear-gradient(transparent 25%, #000 55%, #000 100%); }
.wf-glass i:nth-child(3) { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); mask-image: linear-gradient(transparent 50%, #000 78%, #000 100%); }
.wf-glass i:nth-child(4) { backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); mask-image: linear-gradient(transparent 72%, #000 95%); }
.wf-glass i:nth-child(5) { background: linear-gradient(transparent 45%, color-mix(in srgb, var(--bg) 55%, transparent) 80%, var(--bg) 100%); }

/* phones: the cover nearly full width, the details stacked in one column, the heading on two lines */
@media (max-width: 760px) {
  .wf-intro h2 { font-size: clamp(52px, 17vw, 96px); }
  .wf-intro h2 br { display: inline; }
  .wf-info { grid-template-columns: auto 1fr; row-gap: 14px; }
  .wf-info .side { grid-column: 1 / -1; justify-self: start; }
  .wf-info .num { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .wf.js-ln .ln > span { visibility: visible; }
}
