/*
 * ET Group Justice: Projects & Insights only (the listing template for case studies, articles and webinars).
 * Ported from John's Projects & Insights design: assets/css/projects-insights.css and the CSS half of reveal.css, scoped
 * under .etgj (the design's .etg-justice wrapper is .etgj here). Class prefix pi-, as in the design.
 * List items are glass cards (.pi-card, the featured card's recipe) holding the homepage's post content (.etgj-post:
 * type label, title, text link, the whole card as the target) plus a topic beside the type and a one-line summary.
 * Motion: the design's newer reveal system, ported into pages/projects-insights.js; its CSS half is at the end of this
 * file and switches off justice.css's reveals here.
 */

.etgj [id] { scroll-margin-top: 96px; }

/* ================= HERO: headline on 1 to 6, the featured case study on 7 to 12 ================= */
.etgj .pi-hero { padding-bottom: var(--sheet-y); }
.etgj .pi-hero .etgj-hero__title { margin: 0; max-width: 10em; }
/* Nov 19 design: the hero intro keeps the system's vertical rule (justice.css .etgj-hero__lede's 1px line and 24px indent) */
.etgj .pi-hero .etgj-hero__lede { margin: 24px 0 32px; max-width: 32em; }
.etgj .pi-hero .etgj-hero__text > .etgj-btn { align-self: flex-start; }

/* What's in here: one hairline row per type (name, a line on what it holds), each a jump to the list with that type
   chosen. The arrow is the homepage's old HybridCourts / VirtualCorrections route arrow (.etgj-route__arrow, V4 to
   Oct 26): 28px, red, top right level with the name, a 4px nudge and the name underlined on hover. On desktop the
   column stretches to the card's height and these rows sit at its foot, so the last rule ends level with the card. */
.etgj .pi-kinds { margin: 48px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.etgj .pi-kinds li { border-bottom: 1px solid var(--line); }
.etgj .pi-kinds a {
  display: grid; grid-template-columns: minmax(0, 1fr) 28px; align-items: start; column-gap: var(--gap);
  padding: 22px 0; color: var(--ink); text-decoration: none;
}
.etgj .pi-kinds a::after {
  content: ""; grid-column: 2; grid-row: 1; width: 28px; height: 28px; margin-top: calc((var(--fs-subtitle) * 1.15 - 28px) / 2);
  background: var(--red-bright); -webkit-mask: var(--icon-arrow) center / contain no-repeat; mask: var(--icon-arrow) center / contain no-repeat;
  transition: transform 250ms var(--ease);
}
.etgj .pi-kinds a:hover::after { transform: translate(4px, -4px); }
.etgj .pi-kinds a:hover .pi-kinds__name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.etgj .pi-kinds__text { display: flex; flex-direction: column; gap: 6px; }
.etgj .pi-kinds__name { font: 400 var(--fs-subtitle)/1.15 var(--ff-display); letter-spacing: -0.02em; }
.etgj .pi-kinds__line { font: 400 var(--fs-body)/1.45 var(--ff); color: var(--ink-2); }
.etgj .pi-kinds a:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 2px; }

/* The featured case study: the Contact form card's glass, photo on top, the whole card is the link */
.etgj .pi-feature {
  position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 1px var(--line), 0 24px 60px -24px rgba(0, 0, 0, .55);
}
.etgj .pi-feature__img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.etgj .pi-feature__body { padding: 28px 32px 32px; }
.etgj .pi-feature .etgj-post__type { margin: 0 0 12px; }
.etgj .pi-feature__title { margin: 0 0 12px; font: 400 var(--fs-subtitle)/1.15 var(--ff-display); letter-spacing: -0.02em; color: var(--ink); text-wrap: balance; }
.etgj .pi-feature__text { margin: 0 0 24px; font: 400 var(--fs-body)/1.5 var(--ff); color: var(--ink-2); text-wrap: pretty; }
.etgj .pi-feature .etgj-post__link::before { content: ""; position: absolute; inset: 0; }
.etgj .pi-feature { transition: transform 350ms var(--ease), box-shadow 350ms var(--ease); }
.etgj .pi-feature:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), inset 0 0 0 1px rgba(255, 255, 255, .22), 0 32px 68px -24px rgba(0, 0, 0, .65); }
.etgj .pi-feature:hover .etgj-post__link { text-decoration-color: currentColor; }
.etgj .pi-feature:hover .etgj-post__link::after { transform: translate(3px, -3px); }

@media (min-width: 961px) {
  .etgj .pi-hero { row-gap: 0; }
  .etgj .pi-hero > .pi-hero-brand { grid-column: 1 / -1; grid-row: 1; margin: 0 0 16px; }
  .etgj .pi-hero > .etgj-hero__text { grid-column: 1 / 7; grid-row: 2; align-self: stretch; display: flex; flex-direction: column; }
  .etgj .pi-hero .pi-kinds { margin-top: auto; padding-top: 0; }
  .etgj .pi-hero .etgj-hero__text > .etgj-btn { margin-bottom: 48px; }
  /* the card's top meets the top of the headline's lowercase letters, as on Why, Courts and Contact */
  .etgj .pi-hero > .pi-feature { grid-column: 7 / -1; grid-row: 2; align-self: stretch; margin: calc(var(--fs-display) * 0.35) 0 0 var(--cell-pad); }
  /* Both columns end on one line: the photo's base crop is 2:1 (Nov 11: John asked for the rows to sit higher and the
     card to be shorter by the same amount), and when the text column runs taller (narrower desktops) the card
     stretches to it and the photo takes up the extra height */
  .etgj .pi-hero .pi-feature__img { flex: 1 0 auto; aspect-ratio: 2 / 1; min-height: 0; }
}
@media (max-width: 960px) {
  .etgj .pi-hero > * { grid-column: 1 / -1; }
  .etgj .pi-feature { margin-top: 40px; }
  .etgj .pi-feature__body { padding: 24px; }
}

/* Hero load: the card rises as one (its photo and text then come in as reveal units). The eyebrow is a reveal unit
   like the headline and lede, so it has no separate CSS rise here (the design ran both on it). */
@media (prefers-reduced-motion: no-preference) {
  .etgj.etgj-js .pi-feature { opacity: 0; translate: 0 20px; animation: etgj-rise 600ms var(--ease) 260ms forwards; }
}
body[data-a11y-toggle="active"] .etgj .pi-feature { opacity: 1 !important; translate: none !important; animation: none !important; }

/* ================= THE LIST: heading and filters, then the cards ================= */
.etgj .pi-list-head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 24px 40px; margin-bottom: 40px; }
.etgj .pi-list-head .etgj-h2 { margin: 0; }

/* Filters: two groups of pills (type, topic), the Contact form's chip look. Buttons with aria-pressed. */
.etgj .pi-filters { display: flex; flex-wrap: wrap; gap: 16px 32px; }
.etgj .pi-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.etgj .pi-filter__label { width: 100%; margin: 0 0 2px; padding: 0; font: 400 var(--fs-small)/1.35 var(--ff); color: var(--grey); }
.etgj .pi-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin: 0; padding: 8px 16px; box-sizing: border-box;
  font: 500 var(--fs-small)/1.2 var(--ff); color: var(--ink-2); background: transparent; border: 0; border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); cursor: pointer;
  transition: color 200ms var(--ease), background-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.etgj .pi-chip:hover { color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .34); }
.etgj .pi-chip[aria-pressed="true"] { color: #14171C; background: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.etgj .pi-chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.etgj .pi-chip__n { font-weight: 400; opacity: .6; }

/* Card additions: the topic beside the type, and a summary under the title */
.etgj .pi-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 10px; font-size: var(--fs-small); line-height: 1.4; color: var(--grey); }
.etgj .pi-meta .etgj-post__type { margin: 0; }
.etgj .pi-meta__topic { position: relative; padding-left: 13px; }
.etgj .pi-meta__topic::before { content: ""; position: absolute; left: 0; top: 50%; width: 5px; height: 5px; margin-top: -2px; background: var(--grey); opacity: .7; }
.etgj .pi-posts .etgj-post__title { flex: 0 0 auto; margin: 0 0 12px; }
.etgj .pi-summary { flex: 1; margin: 0 0 24px; font: 400 var(--fs-body)/1.5 var(--ff); color: var(--ink-2); text-wrap: pretty; }

/* The cards: the featured card's glass (lighter shadow), three to a row, two on tablets, one on phones. The photo runs
   flush across the top; the text sits in a 28px inset; the link stays at the foot so a row's links line up. */
.etgj .pi-cards { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); margin: 0; padding: 0; }
.etgj .pi-card {
  position: relative; overflow: hidden; padding: 0 0 28px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 0 0 1px var(--line), 0 18px 44px -24px rgba(0, 0, 0, .5);
  transition: transform 350ms var(--ease), box-shadow 350ms var(--ease);
}
.etgj .pi-card:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 0 0 1px rgba(255, 255, 255, .22), 0 26px 52px -24px rgba(0, 0, 0, .6); }
.etgj .pi-card > .etgj-media { height: auto; aspect-ratio: 16 / 10; margin: 0 0 24px; border-radius: 0; }
.etgj .pi-card > :not(.etgj-media) { margin-left: 28px; margin-right: 28px; }
.etgj .pi-card:focus-within { outline: 2px solid #fff; outline-offset: 3px; }
.etgj .pi-card .etgj-post__link:focus-visible { outline: none; }
/* Filtering: projects-insights.js hides cards (and moves them to the end, which the grid ignores) */
.etgj .pi-cards > [hidden] { display: none; }
@media (max-width: 960px) {
  .etgj .pi-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .etgj .pi-cards { grid-template-columns: minmax(0, 1fr); row-gap: 16px; }
  .etgj .pi-card > :not(.etgj-media) { margin-left: 24px; margin-right: 24px; }
}

/* Empty state, when a type and topic pair has nothing yet */
.etgj .pi-empty { grid-column: 1 / -1; margin: 0; padding: 28px; font: 400 var(--fs-body)/1.5 var(--ff); color: var(--ink-2); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); }
.etgj .pi-empty[hidden] { display: none; }
.etgj .pi-empty .etgj-link { margin-left: 4px; }

/* In preparation: the slot for the case studies ET is clearing (a dashed card: no photo, no link) */
.etgj .pi-slot {
  grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 56px; align-items: center;
  margin-top: var(--gap); padding: 28px; border: 1px dashed rgba(255, 255, 255, .22); border-radius: var(--radius);
}
.etgj .pi-slot__label { margin: 0 0 8px; font: 400 var(--fs-small)/1.4 var(--ff); color: var(--grey); }
.etgj .pi-slot__title { margin: 0; font: 400 var(--fs-heading)/1.25 var(--ff-display); letter-spacing: -0.01em; color: var(--ink); }
.etgj .pi-slot__text { margin: 0; font: 400 var(--fs-body)/1.5 var(--ff); color: var(--ink-2); text-wrap: pretty; }

@media (max-width: 960px) {
  .etgj .pi-list-head { flex-direction: column; align-items: stretch; margin-bottom: 24px; }
  .etgj .pi-slot { grid-template-columns: minmax(0, 1fr); padding: 24px; }
  .etgj .pi-slot > :last-child { margin-top: 12px; }
}

/* Hover: the cards (and the featured card) lift 4px and their shadow deepens. transform, not translate: the reveal and
   the hero's entrance animate translate, so the two never fight. No lift with reduced motion or Simplify Visuals. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .etgj .pi-card:hover, .etgj .pi-feature:hover { transform: translateY(-4px); }
}
body[data-a11y-toggle="active"] .etgj :is(.pi-card, .pi-feature) { transform: none !important; }

/* The filter's live count, read out by screen readers only */
.etgj .pi-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Post-hero hairlines ----------
   justice.css computes --rule-grad once on .etgj (line .13); the design re-declares it after the hero, where --line is .12 */
.etgj.etgj-page-projects-insights .etgj-sheet:not(.etgj-sheet--hero) { --rule-grad: linear-gradient(var(--line), var(--line)); }

/* ---------- Reveals (the design's reveal.css): pages/projects-insights.js owns every entrance on this page ----------
   justice.css's reveal states are switched off here, so nothing animates twice or on two clocks. The script marks
   units with data-pi-reveal and adds .pi-in (not .is-in, which justice.js also sets on its own schedule). */
.etgj { --reveal-ease: cubic-bezier(.25, .6, .3, 1); --reveal-dur: 850ms; }
.etgj.etgj-page-projects-insights.etgj-js :is(.etgj-sheet .etgj-h2, .etgj-head .etgj-link, .etgj-statement, .etgj-hero__media, .etgj-rail,
  .etgj-feature, .etgj-stat, .etgj-post, .etgj-closing, .etgj-case, .etgj-person, .etgj-flow__step, .etgj-strip,
  .etgj-hero__title, .etgj-hero__lede, .etgj-hero .etgj-btn) {
  opacity: 1; translate: none; animation: none; transition: transform .14s var(--ease-out);
}
/* the cards keep their slower lift (the line above gives every .etgj-post the quick .14s; this selector outranks it, as in the Nov 19 design) */
.etgj.etgj-page-projects-insights.etgj-js .pi-cards > .etgj-post.pi-card { transition: transform 350ms var(--ease), box-shadow 350ms var(--ease); }
/* Nov 25: scroll reveals switched off on every Justice page: hairlines, dividers and step connectors sit drawn from the start. */
/* cell dividers belong to their cell: they come in with it */
.etgj.etgj-page-projects-insights.etgj-js :is(.etgj-cells > * + *, .etgj-stat + .etgj-stat)::before { transform: none; transition: none; }
/* the hidden start: a unit is invisible until the script starts it (its animation then runs from this state) */
.etgj.etgj-page-projects-insights.etgj-js:not(.etgj-calm) [data-pi-reveal]:not(.pi-in) { opacity: 0; }
/* until the script has tagged the first screen, hold it (no flash of content that then fades in) */
.etgj.etgj-boot .etgj-sheet--hero > .etgj-wrap { opacity: 0; }
