/* ALL TYPE · Portfólio — Sala de projeção (spec 3): one work at a time on the stage, every work a frame on the fita.
   Over home.css: the tokens, the header, .strip / .strip-nav / .fichas (home.js runs them), .credits, .desc, .ext, .caption, .cta. */

/* ---------- the stage: credits at left, the work's row of pieces at right ---------- */
.stage { min-height: 560px; }
.work { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 56px; min-height: 560px; }
.work[hidden] { display: none; } /* portfolio.js: the works off the stage */

/* till portfolio.js has run (.js-stage) the URL picks the work: the hash's work, a group's first, else the first.
   The works hide only where :has() works (inside a forgiving :where()); elsewhere they all show, stacked */
html:not(.js-stage) :where(.stage:has(.work)) .work { display: none; }
html:not(.js-stage) .work:target,
html:not(.js-stage) .work:has(:target),
html:not(.js-stage) .stage-group:target > .work:first-child,
html:not(.js-stage) .stage:not(:has(:target)) > .work:first-of-type { display: grid; }

/* the credits never cut nor scroll: a taller column makes the stage (and its row) taller */
.work-credits { display: flex; flex-direction: column; min-width: 0; }
.work h2 { grid-area: title; margin: -6px 0 24px; font: 600 clamp(40px, 4vw, 60px)/1 var(--serif); letter-spacing: -.01em; overflow-wrap: break-word; text-wrap: balance; } /* Headline */
.work .credits { grid-area: rows; }
.work-text { grid-area: text; }
.work-text .desc:last-child { margin-bottom: 0; }
.work-wa { grid-area: wa; margin-top: 24px; }
.work-nav { grid-area: nav; display: flex; align-items: flex-end; gap: 8px; margin-top: auto; padding-top: 56px; } /* never closer to the WhatsApp than this */
.count { margin-right: auto; font: 600 clamp(34px, 3.5vw, 50px)/.95 var(--serif); letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; } /* Display Band */
.count .of { color: var(--soft); } /* 34px and up here, 26px on phones: large text */
.work-prev, .work-next { display: grid; place-items: center; width: 44px; height: 44px; background: var(--ink); color: var(--lime); border: 1px solid var(--lime); transition: background-color .2s var(--ease), color .2s var(--ease); }
.work-prev:hover:not([aria-disabled="true"]), .work-next:hover:not([aria-disabled="true"]) { background: var(--lime); color: var(--black); }
.work-nav [aria-disabled="true"] { opacity: .35; cursor: default; } /* the ends */

/* the pieces run on the paper, group by group as on the home's panel: a group's heading, its own strip, its caption;
   every piece takes its width from the row's height (--row) and its own ratio (--r), capped at the row's width */
.work-pieces { min-width: 0; background: var(--paper); }
.work-pieces > .strip { overflow: visible; }
.work-pieces > .strip > .strip-track { display: block; padding: 0; }
.work-pieces > .strip-nav, .work-pieces > .strip-nav[hidden] { display: none; }
.group + .group { margin-top: 40px; }
.group-strip > .strip-track { --row: min(60vh, 520px, 100cqw / var(--rw, 1)); align-items: flex-start; container-type: inline-size; }
.work .strip li { --pad: 0px; --band: 0px; --dur: 0px; height: auto; }
.work .strip li.v { --dur: 21px; } /* the duration under a video */
.work .strip .piece { height: auto; }
.work .strip .piece img, .work .strip video { width: min(100cqw - 2 * var(--pad), (var(--row) - var(--band) - 2 * var(--pad) - var(--dur)) * var(--r)); height: auto; max-width: none; aspect-ratio: var(--r); }
/* a lone piece stands on the lime-soft plate, which fills the row (the plate's padding, band and duration around it) */
.work .strip li.plate { --pad: clamp(14px, 1.6vw, 22px); --band: 8px; flex: 1 0 auto; align-self: stretch; display: flex; align-items: center; justify-content: center; padding: var(--pad); border-top: 8px solid var(--lime); background: var(--lime-2); }
.work .single li.plate { --row: min(60vh, 520px, (100cqw - 2 * var(--pad)) / var(--r) + 2 * var(--pad) + var(--band) + var(--dur)); }
.work .strip li.plate .dur, .work .strip li.plate .caption-k { color: var(--ink); } /* on the lime-soft plate the labels are ink, never grey */
/* the OB piece and its prize under it: nothing over the piece */
.work .strip li.prize { display: flex; flex-direction: column; width: min(100cqw, var(--row) * var(--r)); }
.caption.prize { align-self: stretch; margin-top: 12px; } /* its rule as wide as the piece (the figure only: on the li it pushed the row 4px past the strip) */
.caption.prize p { margin: 0; }
.notes { margin: 0; padding: 0; list-style: none; }
.note.head { margin-bottom: 16px; }
.note.tail { margin-top: 20px; }
.note .caption p:last-child { margin-bottom: 0; }
.note .ext:first-child { margin-top: 0; }
.group-title { padding-top: 18px; border-top: 6px solid var(--lime); font: 600 28px/1.15 var(--serif); text-wrap: balance; } /* Title */
/* desktop: the groups melt into the stage's one row (the track is its size container, --row its height), heading and
   caption as text slides of their own group; .flat only where every text fits the row (the build measures them) */
@media (min-width: 1100px) {
  /* the credits a little denser and the fita closer: the tallest column (Cadeira na Calçada) keeps the fita whole in a
     1440 x 900 first view, the counter still 56px from the WhatsApp */
  .work h2 { margin-bottom: 12px; }
  .work .credits { margin-bottom: 16px; }
  .work-text .ext { margin-top: 8px; }
  .work-text .desc:has(+ .ext) { margin-bottom: 0; } /* its margin would collapse over the link's */
  .work-wa { margin-top: 18px; }
  .works .fita-nav { margin-top: 12px; }
  .work-pieces.flat { display: flex; flex-direction: column; }
  .flat > .strip { flex: 1 1 0; min-height: 0; overflow-x: auto; }
  .flat > .strip > .strip-track { --row: 100cqh; display: flex; height: 100%; padding: 0 0 8px; align-items: flex-start; container-type: size; }
  .flat .group, .flat .group-strip, .flat .group-strip > .strip-track, .flat .notes { --row: 100cqh; display: contents; container-type: normal; }
  /* every slide a start snap, only the row's last one an end snap (not each group's last, as home.css) */
  .flat .strip li { scroll-snap-align: start; }
  .flat .strip li.end { scroll-snap-align: end; }
  .flat > .strip-nav, .flat > .strip-nav[hidden] { display: flex; }
  .flat .group .strip-nav { display: none; }
  .work .flat.single li.plate { --row: 100cqh; flex-shrink: 1; min-width: calc((var(--row) - var(--band) - 2 * var(--pad) - var(--dur)) * var(--r) + var(--pad)); } /* half its padding gives way first: no overflow of a few px (and no arrows for it) */
  .flat li.prize { width: min(100cqw, (var(--row) - 88px) * var(--r)); height: var(--row); }
  .flat li.prize .piece { flex: 1 1 0; min-height: 0; }
  .flat li.prize .piece img { width: 100%; height: 100%; object-fit: contain; object-position: left top; }
  .flat .note { flex: none; width: min(100cqw, 340px); margin: 0; }
  .flat .note.long { width: min(100cqw, 520px); }
  .flat.single .note { flex-shrink: 1; min-width: min(100cqw, 440px); } /* it gives way to the plate */
  .flat .note .caption { max-width: none; }
  .flat .note .caption p { margin-bottom: 6px; }
  /* a work whose texts stack: credits in view, each caption beside its pieces (the home's panel) */
  .work:not(:has(.flat)) .work-credits { position: sticky; top: 24px; align-self: start; }
  .work-pieces:not(.flat) .group:has(.tail) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 40%); gap: 0 40px; align-items: start; }
  .work-pieces:not(.flat) .tail { grid-area: 1 / 2 / span 2; margin: 0; }
}

/* ---------- the YouTube plate: 16:9, the title in Display at its foot over the seal; a link until portfolio.js ---------- */
.work .strip li.yt-slide { width: min(100cqw, var(--row) * 16 / 9); }
/* each placa takes the whole view: the next one comes whole with the arrows, never as a sliver of letters */
.work .strip li.yt-slide:not(:only-child) { margin-right: calc(100cqw - min(100cqw, var(--row) * 16 / 9)); }
.yt { --yp: clamp(18px, 2vw, 28px); position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 20px; aspect-ratio: 16 / 9; min-height: 0; padding: var(--yp); border-top: 8px solid var(--lime); background: var(--lime-2); color: var(--ink); text-decoration: none; container-type: inline-size; }
.yt-title { max-width: 15em; font: 600 clamp(40px, 4.4vw, 64px)/1 var(--serif); font-size: min(clamp(40px, 4.4vw, 64px), 8.4cqi); letter-spacing: -.01em; overflow-wrap: break-word; text-wrap: balance; } /* Display, held to the placa's width: the longest title fits its 16:9 */
.yt-badge { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px; background: var(--ink); color: var(--lime); font: var(--caps); letter-spacing: .14em; } /* the seal: the play target */
.yt-badge .i { width: 12px; height: 12px; }
.yt.has-still { background: var(--ink); } /* a plate with the video's still: the picture fills it (the 4:3 old commercials keep their bars), the title and the seal sit on it */
.yt-still { position: absolute; inset: 0; display: block; background: var(--ink); }
.yt-still img { display: block; width: 100%; height: 100%; object-fit: contain; }
.yt.has-still { justify-content: space-between; } /* the title chip at the top, the seal at the foot: the middle stays for the picture */
.yt.has-still .yt-title, .yt.has-still .yt-badge { position: relative; }
.yt.has-still .yt-badge { background: var(--lime); color: var(--ink); } /* the seal flips to lime: ink would sink into the picture */
.yt.has-still .yt-title { padding: .2em .5em .26em; background: var(--paper); font-size: clamp(18px, 3.4cqi, 30px); line-height: 1.1; letter-spacing: 0; }
.yt:focus-visible { outline-offset: -3px; box-shadow: inset 0 0 0 6px var(--ink); } /* inward: the row clips */

/* ---------- the fita: 26 frames of one sheet, a label per group, off the right edge ---------- */
.fita-nav { --nav: 144px; position: relative; margin: 32px calc(-1 * var(--gut)) 64px 0; } /* --nav: the arrows (96) and 48px clear of the last group's rule: they read as the fita's */
.fita { --k: .78; gap: 8px; margin: 0; padding: 56px var(--gut) 0 0; } /* 75 x 100: 13 and DPZ at 1440, the DPZ rule clear of the arrows */
/* the labels' line keeps the arrows' room: nothing runs under them */
.js .fita { clip-path: polygon(0 0, calc(100% - var(--gut) - var(--nav)) 0, calc(100% - var(--gut) - var(--nav)) 56px, 100% 56px, 100% 100%, 0 100%); }
html:not(.js) .fita { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; } /* no arrows: one row still */
.fita > li:not(.fita-label) { position: relative; }
.fita > li:not(.fita-label)::before { content: ""; position: absolute; top: -56px; left: 0; right: -8px; border-top: 1px solid var(--ink); } /* the group's rule */
.fita > li:not(.fita-label):is(:last-child, :has(+ .fita-label))::before { right: 0; }
.fita-label { position: relative; top: -42px; width: 0; margin: 0 -8px 0 24px; white-space: nowrap; font: 700 11px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--label); } /* Label Small */
.fita-label:first-child { margin-left: 0; }
.frame { position: relative; display: block; width: calc(var(--fw) * var(--k) * 1px); height: calc(var(--fh) * var(--k) * 1px + 8px); padding-top: 8px; color: var(--ink); text-decoration: none;
  background-image: url(../img/portfolio/fita.webp);
  background-image: image-set(url(../img/portfolio/fita.avif) type("image/avif"), url(../img/portfolio/fita.webp) type("image/webp"));
  background-repeat: no-repeat; background-origin: content-box; background-clip: content-box;
  background-size: calc(var(--sw) * var(--k) * 1px) calc(var(--sh) * var(--k) * 1px);
  background-position: calc(var(--x) * var(--k) * -1px) calc(var(--y) * var(--k) * -1px); }
.frame.text { background: var(--lime-2) content-box; } /* YouTube only: the name on a plate */
.frame-name { display: flex; align-items: center; justify-content: center; height: 100%; padding: 4px 4px 20px; text-align: center; font: 600 15px/1.05 var(--serif); }
.frame-name.long { font-size: calc(var(--k) * 18px); } /* the build marks the long names: they break between words only, in 2 lines at every scale */
.frame-play { position: absolute; left: 0; bottom: 0; display: grid; place-items: center; width: 22px; height: 22px; background: var(--ink); color: var(--lime); }
.frame-play .i { width: 12px; height: 12px; }
.frame::before { content: ""; position: absolute; inset: 0 0 auto; height: 8px; background: var(--lime); transform: scaleY(0); transform-origin: top; transition: transform .2s var(--ease); }
.frame:hover::before { transform: scaleY(.5); }
.fita .frame:focus-visible { outline-offset: -3px; box-shadow: inset 0 0 0 6px var(--ink); } /* inward: the fita clips */
/* the frame of the work on the stage wears the lime band: portfolio.js marks it, without JavaScript the URL does */
.frame[aria-current]::before,
html:not(.js):not(:has(.stage :target)) .frame[href="#graco"]::before,
html:not(.js):has(#graco:target) .frame[href="#graco"]::before,
html:not(.js):has(#lacoste:target) .frame[href="#lacoste"]::before,
html:not(.js):has(#huawei:target) .frame[href="#huawei"]::before,
html:not(.js):has(#panasonic:target) .frame[href="#panasonic"]::before,
html:not(.js):has(#octopulse:target) .frame[href="#octopulse"]::before,
html:not(.js):has(#grupo-iguatemi:target) .frame[href="#grupo-iguatemi"]::before,
html:not(.js):has(#inhouse:target) .frame[href="#inhouse"]::before,
html:not(.js):has(#cadeira-na-calcada:target) .frame[href="#cadeira-na-calcada"]::before,
html:not(.js):has(#palmeiras-pay:target) .frame[href="#palmeiras-pay"]::before,
html:not(.js):has(#etna:target) .frame[href="#etna"]::before,
html:not(.js):has(#festival-paradiso:target) .frame[href="#festival-paradiso"]::before,
html:not(.js):has(#jhsf:target) .frame[href="#jhsf"]::before,
html:not(.js):has(#zahil:target) .frame[href="#zahil"]::before,
html:not(.js):has(#avon:target) .frame[href="#avon"]::before,
html:not(.js):has(#ob:target) .frame[href="#ob"]::before,
html:not(.js):has(#riachuelo:target) .frame[href="#riachuelo"]::before,
html:not(.js):has(#banho-a-banho:target) .frame[href="#banho-a-banho"]::before,
html:not(.js):has(#artex:target) .frame[href="#artex"]::before,
html:not(.js):has(#nabisco:target) .frame[href="#nabisco"]::before,
html:not(.js):has(#dove:target) .frame[href="#dove"]::before,
html:not(.js):has(#vinho-almaden:target) .frame[href="#vinho-almaden"]::before,
html:not(.js):has(#sazon:target) .frame[href="#sazon"]::before,
html:not(.js):has(#sony:target) .frame[href="#sony"]::before,
html:not(.js):has(#taiff:target) .frame[href="#taiff"]::before,
html:not(.js):has(#hcor:target) .frame[href="#hcor"]::before,
html:not(.js):has(#leite-jucara:target) .frame[href="#leite-jucara"]::before,
html:not(.js):has(#dpz:target) .frame[href="#avon"]::before,
html:not(.js):has(#mccann:target) .frame[href="#nabisco"]::before,
html:not(.js):has(#ogilvy:target) .frame[href="#dove"]::before,
html:not(.js):has(#dentsu:target) .frame[href="#sazon"]::before,
html:not(.js):has(#debrito:target) .frame[href="#taiff"]::before,
html:not(.js):has(#feq:target) .frame[href="#leite-jucara"]::before { transform: none; }
/* its arrows on the labels' line, at right; their room is kept (home.css) */
.fita-nav .strip-nav { position: absolute; top: 6px; right: var(--gut); margin: 0; }
/* smaller frames where 13 of them would put the DPZ label in the arrows' room */
@media (max-width: 1439px) { .fita { --k: .75; } }
@media (min-width: 1100px) and (max-width: 1365px) { .fita { --k: .6875; } }
/* short desktop screens (1280 x 800; the header's 84px there is home.css's, on every page): the stage closer to it and to
   the fita, the frames smaller: the whole fita row in the first view. The row keeps the height the build measures the
   texts against (496) */
@media (min-width: 1100px) and (max-height: 860px) {
  .works { padding-top: 8px; }
  .stage, .work { min-height: 548px; }
  .work .strip-nav { margin-top: 8px; }
  .works .fita-nav { margin-top: 12px; }
  .fita { --k: .6; }
}

/* ---------- tablet: the credits above the row, the row as tall as the home's carousels ---------- */
@media (max-width: 1099px) {
  .work { grid-template-columns: minmax(0, 1fr); gap: 32px; min-height: 0; }
  .work-credits { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "title title" "rows text" "wa text" "nav text"; gap: 0 40px; align-content: start; }
  .work-credits:not(:has(.work-text)) { grid-template-areas: "title title" "rows rows" "wa nav"; }
  .work-nav { margin-top: 0; padding-top: 24px; }
  .note.tail.cont { margin-top: 12px; } /* stacked, a script's next slide reads on as one text */
  .note.cont .caption { margin-top: 0; padding-top: 0; border-top: 0; }
}

/* ---------- phone: compact credits over the pieces, the text after; no stage arrows ---------- */
@media (max-width: 640px) {
  .work { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title nav" "rows rows" "wa wa" "pieces pieces" "text text"; gap: 0 16px; }
  .work-credits { display: contents; }
  .work-pieces { grid-area: pieces; }
  .work h2 { align-self: baseline; margin: 0 0 20px; }
  .work-nav { align-self: baseline; padding: 0; }
  .work-prev, .work-next { display: none; }
  .count { font-size: 26px; }
  .work-wa { margin: 0 0 24px; }
  .work-text { margin-top: 20px; }
  .group-strip > .strip-track { --row: min(56vh, 440px, 100cqw / var(--rw, 1)); }
  .work .single li.plate { --row: min(56vh, 440px, (100cqw - 2 * var(--pad)) / var(--r) + 2 * var(--pad) + var(--band) + var(--dur)); }
  .fita { --k: .75; }
  /* the title fits the 16:9 plate in Value, the seal smaller and closer to the edge */
  .yt { --yp: 14px; gap: 12px; }
  .yt-title { font: 600 clamp(19px, 7.6cqi, 24px)/1.1 var(--serif); letter-spacing: 0; }
  .yt-badge { height: 36px; padding: 0 14px; gap: 8px; letter-spacing: .1em; }
}
@media (max-width: 400px) {
  .yt { --yp: 12px; gap: 10px; }
  .yt-title { font-size: clamp(16px, 6.8cqi, 22px); }
  .yt-badge { height: 32px; }
}
@media (max-width: 359px) {
  .work-wa .cta { padding: 0 16px; letter-spacing: .12em; } /* keeps "Conversar no WhatsApp" on one line */
}
