/* page-work.css. Work only. Everything here builds on css/site.css (tokens, .hl, .display.fit, .piece, .strip, .tags, .rv).
   Parts: first screen (headline window + index), case title moment (.chead), facts, lead, pieces, kit row, results, text. */

/* ---------- first screen: the headline is one line with a window, the six case titles are the index ---------- */
.intro {
  position: relative; z-index: 1; min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; gap: 14px;
  padding: calc(var(--nav) + 4px) var(--m) 22px;
  --f: min(8.6vw, 15svh);
}
.intro .kicker { margin: 0; animation: fade .9s ease .5s backwards; }
/* two lines set side by side: the first keeps the window and takes whatever room the letters leave */
.intro .hl { flex-direction: row; align-items: center; gap: .075em; }
.intro .ln { --rest: 66; --tight: 66; }
.intro .ln:first-child { flex: 1 1 0; min-width: 0; }
.intro .ln:last-child { --dir: 1; }
.intro .ln:last-child .w { --i: 1; }
.intro .win { z-index: 1; }
/* what the window shows for the line of the index that is under the pointer or has focus */
.pv {
  position: absolute; inset: 0; z-index: 2; overflow: hidden; border-radius: .09em; background: var(--panel);
  display: grid; place-items: center; opacity: 0; transition: opacity .25s;
  font-size: .62em; line-height: 1; color: var(--ink); font-variation-settings: "wght" 900, "wdth" 62;
}
/* the number is drawn by the style sheet, so the headline's own text stays "Work Case Studies" */
.pv--3::after { content: "03"; } .pv--4::after { content: "04"; } .pv--5::after { content: "05"; } .pv--6::after { content: "06"; }
.pv img { display: block; width: 100%; height: 100%; object-fit: cover; }

.idx { align-self: center; }
.idx ol { margin: 0; padding: 0; list-style: none; }
/* two sizes, so that every title can be set to the full measure with the width axis: the long ones smaller, the short ones larger */
.idx li { font-size: min(4.2vw, 7.6svh); line-height: .92; overflow: hidden; padding-top: .03em; text-wrap: wrap; }
.idx li:nth-child(3), .idx li:nth-child(4), .idx li:nth-child(6) { font-size: min(6.4vw, 11.6svh); }
.idx a { display: block; transition: color .2s; }
.idx i {
  display: inline-block; width: 2.1em; vertical-align: top; padding-top: .3em;
  font: 500 14px/1 "Archivo", sans-serif; font-stretch: 100%; font-variation-settings: normal; color: var(--dim); transition: color .2s;
}
/* focus, on every device. The outline is drawn inside the link: the lines are masks (overflow hidden) and would cut one drawn outside */
.idx a:focus-visible { outline-offset: -3px; }
.idx:has(a:focus-visible) a:not(:hover, :focus-visible) { color: var(--dim); }
.idx a:focus-visible i { color: var(--y); }
.intro:has(a[href="#case-2"]:focus-visible) .pv--2,
.intro:has(a[href="#case-3"]:focus-visible) .pv--3,
.intro:has(a[href="#case-4"]:focus-visible) .pv--4,
.intro:has(a[href="#case-5"]:focus-visible) .pv--5,
.intro:has(a[href="#case-6"]:focus-visible) .pv--6 { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .idx:has(a:hover) a:not(:hover, :focus-visible) { color: var(--dim); }
  .idx a:hover i { color: var(--y); }
  .intro:has(a[href="#case-2"]:hover) .pv--2,
  .intro:has(a[href="#case-3"]:hover) .pv--3,
  .intro:has(a[href="#case-4"]:hover) .pv--4,
  .intro:has(a[href="#case-5"]:hover) .pv--5,
  .intro:has(a[href="#case-6"]:hover) .pv--6 { opacity: 1; }
}
.wfoot { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4vw; animation: fade .9s ease .5s backwards; }
.wfoot .lede { max-width: 30em; margin: 0; }
.wfoot .go { align-items: center; }

/* ---------- case title moment: the number and the name very large, one picture or the facts beside the number ---------- */
.chead {
  min-height: 100svh; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto;
  gap: var(--s3) var(--s5); align-items: end;
  padding: calc(var(--nav) + var(--s2)) var(--m) var(--s3);
}
.chead__n {
  grid-area: 1 / 1; align-self: start; font-size: min(46svh, 32vw); line-height: .8; font-weight: 900;
  font-variation-settings: "wght" 900, "wdth" 62; margin-left: -.03em;
}
.chead h2 { grid-area: 2 / 1 / auto / -1; font-size: min(var(--fs, 9.2vw), 22svh); }
.chead__side { grid-area: 1 / 2; justify-self: end; align-self: end; }
.chead .piece { width: min(100%, calc(58svh * 16 / 9)); }
.chead .facts { width: 100%; padding: 0; grid-template-columns: 1fr 1fr; }
.chead .facts dd { max-width: 17em; font-size: clamp(19px, 2vw, 30px); line-height: 1.2; }
/* each name gets the size at which the width axis can set all of its lines to the full measure */
#case-2-title { --fs: 8.9vw; }

/* cases 03 to 06 open with one band: the number as tall as the two lines of the name beside it, the facts in a row under both */
.chead--band {
  min-height: 0; grid-template-rows: auto auto; gap: var(--s4); padding-top: var(--s3);
  --f2: min(calc((100vw - 2 * var(--m) - var(--s4)) / var(--kf, 10)), 17svh);
}
#case-3 { --kf: 9.9; } #case-4 { --kf: 9.5; } #case-5 { --kf: 12.3; } #case-6 { --kf: 8.1; }
.chead--band .chead__n { align-self: end; font-size: calc(var(--f2) * 2.1); }
.chead--band h2 { grid-area: 1 / 2; font-size: var(--f2); }
.chead--band .facts { grid-area: 2 / 1 / auto / -1; grid-template-columns: repeat(4, 1fr); }
.chead--band .facts dd { max-width: 20em; font-size: clamp(17px, 1.5vw, 22px); line-height: 1.3; }

/* case 01: the clip stands to the right at full height, the number and the name share the left */
.chead--1 { grid-template-columns: minmax(0, 1fr) auto; --lh: min(100svh - var(--nav) - var(--s2) - var(--s3), 62vw); }
.chead--1 h2 { grid-area: 2 / 1; font-size: min(calc((100vw - 2 * var(--m) - var(--lh) * .5625 - var(--s5)) / 8.3), 12.5svh); }
.chead--1 .chead__n { font-size: min(60svh, 40vw); }
.land {
  grid-column: 2; grid-row: 1 / -1; align-self: stretch; display: block;
  height: var(--lh); aspect-ratio: 9 / 16;
  border-radius: var(--r); overflow: hidden; background: var(--panel);
}
.land img { display: block; width: 100%; height: 100%; object-fit: cover; }
.land__toggle { display: none; }

/* ---------- the hold: reserved before the script runs; the script turns it off where the first screen does not fit ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .wrun { height: 260svh; }
}
.work-scrub .wstage { position: sticky; top: 0; height: 100svh; overflow: clip; }
.work-scrub .intro { height: 100svh; min-height: 0; }
.work-scrub .intro .kicker, .work-scrub .wfoot { opacity: calc(1 - var(--fo, 0)); }
.work-scrub .intro .m { transform: translateX(calc(var(--wx, 0) * var(--dir, -1) * 1vw)); will-change: transform; }
.work-scrub .intro .win { will-change: left, top, width, height; }
.work-scrub .idx li > span { --o: clamp(0, var(--out, 0) * 1.5 - var(--k, 0) * .1, 1); transform: translateY(calc(var(--o) * -112%)); opacity: calc(1 - var(--o) * var(--o)); will-change: transform, opacity; }
.idx li:nth-child(2) { --k: 1; } .idx li:nth-child(3) { --k: 2; } .idx li:nth-child(4) { --k: 3; }
.idx li:nth-child(5) { --k: 4; } .idx li:nth-child(6) { --k: 5; }
.work-scrub .is-away .intro { pointer-events: none; }
.work-scrub .wstage.is-away .intro .pv { opacity: 0; } /* long on purpose: it has to beat the focus and hover rules that show a preview */
.work-scrub .chead--1 { position: absolute; z-index: 2; inset: 0; min-height: 0; pointer-events: none; }
/* one Pause button at a time: the first screen's own until that screen lets go, then this one, on the corner where the clip lands */
.work-scrub .is-away .clips__toggle { visibility: hidden; }
.work-scrub .land__toggle {
  display: block; grid-column: 2; grid-row: 1 / -1; align-self: end; justify-self: end; margin: 0 10px 10px 0;
  padding: .35em .8em; color: #fff; background: rgba(0, 0, 0, .72); pointer-events: auto; visibility: hidden;
}
.work-scrub .is-away .land__toggle { visibility: visible; }
.work-scrub .land { visibility: hidden; }
.work-scrub .chead--1 .chead__n { transform: translateY(calc(var(--ny, 100) * 1%)); clip-path: inset(0 0 calc(var(--ny, 100) * 1%) 0); }
.work-scrub .chead--1 h2 > span { transform: translateY(calc(var(--ly, 100) * 1%)); clip-path: inset(0 0 calc(var(--ly, 100) * 1%) 0); }
/* a link to #case-1 lands on the title moment: the last screen of the hold */
.work-scrub #case-1 { scroll-margin-top: calc(100svh - var(--nav)); }

/* ---------- case body ---------- */
.case { padding-bottom: var(--s6); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3) calc(var(--m) * 2); margin: 0; padding: var(--s5) var(--m) 0; }
.facts dt { margin-bottom: .3em; font-size: 14px; line-height: 1.4; color: var(--dim); }
.facts dd { margin: 0; max-width: 20em; font-size: clamp(17px, 1.5vw, 22px); line-height: 1.3; font-weight: 600; font-stretch: 88%; }
/* the facts in the left third, the text in the right two thirds: the same columns as the text blocks further down */
.brief { display: grid; grid-template-columns: 1fr 2fr; gap: var(--s4) calc(var(--m) * 2); padding: var(--s5) var(--m) 0; }
.brief .facts { grid-template-columns: 1fr; align-content: start; padding: 0; }
.lead__p { max-width: 30em; margin-bottom: var(--s3); font-size: clamp(21px, 2.3vw, 35px); line-height: 1.24; font-weight: 600; font-stretch: 88%; }
.piece--wide, .shots { padding: var(--s5) var(--m) 0; }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--m) * 2); }
.case figcaption { font-size: 15px; line-height: 1.3; }

/* covers and kit slides: large, in one row */
.kit { margin-top: var(--s5); }
.kit .strip { margin: 0; }
.kit .strip:focus-visible { outline-offset: -4px; } /* full bleed: an outline outside it would be off the screen */
.kit .strip ul { gap: clamp(16px, 3vw, 48px); align-items: flex-start; padding-bottom: 8px; }
.kit .strip li { width: auto; border-radius: 0; overflow: visible; background: none; }
.kit .strip img { width: auto; height: min(74svh, 118vw); border-radius: var(--r); background: var(--panel); }
.kit figcaption { margin-top: 12px; }

/* results: one number to a row; from 1100px they share one row (three or four across) */
.stats { padding: var(--s4) var(--m) 0; }
.stats li { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding-top: .12em; }
.stats b {
  white-space: nowrap; font-size: min(18vw, 31svh); line-height: .84; font-weight: 900;
  font-variation-settings: "wght" 900, "wdth" 62; margin-left: -.03em;
}
.stats span { max-width: 9em; text-align: right; font-size: clamp(18px, 2.3vw, 36px); line-height: 1.1; font-weight: 600; font-stretch: 88%; }
@media (min-width: 1100px) {
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4) calc(var(--m) * 2); }
  .stats:has(> li:nth-child(4)) { grid-template-columns: repeat(4, 1fr); }
  .stats li { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 0; padding-top: 0; }
  .stats b { font-size: min(10.4vw, 24svh); }
  .stats:has(> li:nth-child(4)) b { font-size: min(7.6vw, 24svh); }
  .stats span { max-width: none; margin-top: .45em; text-align: left; font-size: clamp(17px, 1.6vw, 24px); }
}

/* challenge, approach, achievements */
.case .cols { padding: var(--s5) var(--m) 0; }
.textblock h3, .tech h3 { margin-bottom: .7em; }
.textblock > p { font-size: clamp(16px, 1.3vw, 19px); }
.list li { position: relative; margin-top: .6em; padding-left: 1.15em; max-width: 34em; }
.list li::before { content: ""; position: absolute; left: 0; top: .6em; width: .32em; height: .32em; background: var(--dim); }
.process p { margin-top: .8em; }
.process strong { font-weight: 650; }
.tech { display: grid; grid-template-columns: 1fr 2fr; gap: var(--s3) calc(var(--m) * 2); padding: var(--s4) var(--m) 0; }
.list--big li { margin-top: .55em; font-size: clamp(20px, 2.15vw, 34px); line-height: 1.2; font-weight: 600; font-stretch: 88%; }
.list--big li:first-child { margin-top: 0; }
.list--big li::before { top: .46em; }
.more { margin-top: var(--s2); }

/* ---------- motion without script, where the browser can: the row travels while its screen holds, the big pieces are presented ---------- */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .kit { height: 250svh; view-timeline: --kit block; }
    .kit .strip { position: sticky; top: 0; height: 100svh; display: flex; align-items: center; padding-top: var(--nav); }
    .kit .strip ul { flex: none; animation-timeline: --kit; animation-range: contain 0% contain 100%; }
    .case .piece--wide .piece__media, .shots .piece__media { animation: present linear both; animation-timeline: view(); animation-range: entry 0% cover 40%; }
  }
}

/* ---------- phone and tablet ---------- */
@media (max-width: 820px) {
  /* each line is set to the measure with the width axis (site.js), the window runs edge to edge between them */
  .intro { --f: 16vw; --r0: 0px; gap: 12px; padding-bottom: 18px; }
  .intro .hl { flex-direction: column; align-items: stretch; gap: 8px; }
  .intro .ln { flex-wrap: wrap; gap: 8px .2em; }
  .intro .ln:first-child { flex: none; font-size: 1.62em; }
  .intro .slot { flex: 0 0 calc(100% + 2 * var(--m)); margin-inline: calc(-1 * var(--m)); height: clamp(64px, 10svh, 130px); min-width: 0; font-size: calc(1em / 1.62); }
  .intro .win { animation: open .95s var(--ease) .25s backwards; }
  .idx li { font-size: 7.2vw; line-height: 1; padding: .3em 0; overflow: visible; }
  .idx i { width: 2.2em; padding-top: .2em; }
  .wfoot { grid-template-columns: 1fr; gap: 8px; }

  .chead { grid-template-columns: 1fr 1fr; gap: var(--s3) var(--s2); }
  .chead__n { font-size: 56vw; }
  .chead--1 .chead__n { font-size: 44vw; }
  .chead { grid-template-rows: 1fr auto auto; }
  .chead h2 { grid-area: 3 / 1 / auto / -1; font-size: 12.6vw; }
  .chead__side { grid-area: 2 / 1 / auto / -1; justify-self: stretch; }
  .chead--1 h2 { grid-area: 2 / 1 / auto / -1; font-size: 12.6vw; }
  .chead .piece, .chead .facts { width: 100%; }
  .chead--band { grid-template-columns: 1fr; grid-template-rows: none; gap: var(--s3); --f2: 12.6vw; }
  .chead--band .chead__n { grid-area: auto; font-size: 34vw; }
  .chead--band h2 { grid-area: auto; }
  .chead--band .facts { grid-area: auto; grid-template-columns: 1fr 1fr; }
  .chead--1 { grid-template-rows: auto auto; align-content: end; }
  .land { grid-column: 2; grid-row: 1; justify-self: end; height: auto; width: min(100%, 38svh); }
  .work-scrub .land__toggle { grid-row: 1; }
  .brief, .piece--wide, .shots, .stats, .tech { padding-top: var(--s4); }
  .brief, .shots, .tech { grid-template-columns: 1fr; }
  .brief .facts { grid-template-columns: 1fr 1fr; }
  .stats li { flex-direction: column; align-items: flex-start; gap: 0; padding-top: var(--s3); }
  .stats b { order: 2; margin-top: .08em; font-size: 31vw; }
  .stats span { max-width: none; text-align: left; font-size: 18px; }
  .case .cols { padding-top: var(--s5); }
}
