/* Case studies carousel, shared by case-studies.html and the homepage. Written by tools/build_case_studies.py: edit it there.
   Behaviour is in assets/case-gallery.js. Uses --mid, --px, --amber and --spring from the page. */
/* the index: a carousel of large black cards (header with arrows, scrolling track, dots). Behaviour in assets/case-gallery.js.
   --gx is the page's left content margin: the header and the first card both start there */
.g4{ --gx:max(clamp(1.25rem, 4vw, 2rem), calc(50vw - 700px + 2rem)); padding-block:8rem; }
.g4-wrap{ width:100%; padding-inline:var(--gx); }
.g4-head{ display:flex; align-items:flex-end; justify-content:space-between; margin-bottom:2rem; }
.g4-head > div:first-child{ display:flex; flex-direction:column; gap:1rem; }
.g4-h{ font-weight:500; font-size:1.875rem; line-height:2.25rem; letter-spacing:-.02em; }
.g4-p{ max-width:32rem; color:var(--mid); }
.g4-nav{ display:none; flex-shrink:0; gap:.5rem; }
@media (min-width:768px){ .g4-head{ margin-bottom:3.5rem; } .g4-h{ font-size:2.25rem; line-height:2.5rem; } .g4-nav{ display:flex; } }
@media (min-width:1024px){ .g4-head{ margin-bottom:4rem; } .g4-h{ font-size:3rem; line-height:1; letter-spacing:-.03em; } }
.g4-btn{ display:grid; place-items:center; width:2.25rem; height:2.25rem; border-radius:.375rem; color:#000; }
.g4-btn:hover{ background:#f0f0f0; }
.g4-btn:active{ background:#e2e2e2; }
.g4-btn:focus-visible{ outline:2px solid #000; outline-offset:2px; }
.g4-btn:disabled{ opacity:.35; }
.g4-btn:disabled:hover{ background:none; }
.g4-track{ display:flex; gap:1rem; overflow-x:auto; padding:6px 0 6px var(--gx); scroll-padding-left:var(--gx); scrollbar-width:none; overscroll-behavior-x:contain; }
.g4-track::-webkit-scrollbar{ display:none; }
.g4-track.is-drag{ cursor:grabbing; user-select:none; }
.g4-track.no-snap{ scroll-snap-type:none; }
@media (min-width:769px){ .g4-track{ scroll-snap-type:x mandatory; } .g4-item{ scroll-snap-align:start; } }
.g4-item{ --cw:min(77vw, 62rem); flex:0 0 auto; width:var(--cw); }
.g4-item:last-child{ box-sizing:content-box; padding-right:var(--gx); }
/* the card: black panel, text on the left, a portrait photograph set into the right side */
.g4-card{ display:grid; grid-template-columns:minmax(0,1fr) 32%; gap:clamp(1.5rem, 4vw, 3rem); width:100%; height:100%; min-height:max(26rem, calc(var(--cw) * 415 / 770)); padding:clamp(1.5rem, 3.8vw, 2.375rem); border-radius:.75rem; background:#000; color:#fff; transition:opacity .2s ease; }
.g4-card:active{ opacity:.88; }
.g4-card:focus-visible{ outline:3px solid var(--amber); outline-offset:3px; }
.g4-body{ display:flex; flex-direction:column; align-items:flex-start; min-width:0; }
.g4-tag{ padding:.25rem .5rem; border-radius:3px; background:#2b2b2b; color:#e6e6e6; font-size:.8125rem; line-height:1.3; }
.g4-t{ margin-top:1.125rem; font-weight:400; font-size:clamp(2rem, 4.6vw, 3.75rem); line-height:1.04; letter-spacing:-.035em; text-wrap:balance; }
.g4-d{ margin-top:auto; padding-top:1.5rem; max-width:max(15rem, 48%); font-size:1rem; line-height:1.45; }
.g4-d::before{ content:""; display:inline-block; width:7px; height:7px; margin-right:.5rem; background:#fff; vertical-align:.1em; }
.g4-more{ display:flex; align-items:center; margin-top:1.25rem; font-size:.9375rem; line-height:1.25rem; }
.g4-more svg{ margin-left:.5rem; transition:transform .25s var(--spring); }
.g4-card:hover .g4-more svg, .g4-card:focus-visible .g4-more svg{ transform:translateX(.3rem); }
.g4-ph{ position:relative; overflow:hidden; border-radius:.375rem; background:#1a1a1a; }
.g4-ph img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:center; filter:grayscale(1); }
/* phones: the photograph becomes a short band across the top of the card */
@media (max-width:639px){
  .g4-item{ --cw:86vw; }
  .g4-card{ grid-template-columns:minmax(0,1fr); grid-template-rows:8.5rem minmax(0,1fr); gap:1.25rem; min-height:31rem; }
  .g4-ph{ order:-1; }
  .g4-d{ max-width:none; }
}
.g4-dots{ display:flex; justify-content:center; gap:.5rem; margin-top:2rem; }
.g4-dot{ position:relative; width:.5rem; height:.5rem; border-radius:999px; background:#000; opacity:.2; transition:opacity .2s ease; }
.g4-dot::after{ content:""; position:absolute; inset:-6px; }
.g4-dot.is-on{ opacity:1; }
.g4-dot:hover{ opacity:.6; } .g4-dot.is-on:hover{ opacity:1; }
.g4-dot:active{ opacity:.8; }
.g4-dot:focus-visible{ outline:2px solid #000; outline-offset:3px; }
/* on the homepage the carousel sits in that page's column: same left margin as its other sections, less space above */
.g4-home{ --gx:var(--px); padding-block:clamp(2.5rem, 5vw, 4.5rem) clamp(4rem, 8vw, 7rem); }
@media (min-width:768px){ .g4-home{ --gx:calc(max(1.5rem, (100vw - 84rem) / 2) + var(--px)); } }
.g4-home .g4-head > div:first-child{ gap:clamp(1.25rem, 2.4vw, 1.75rem); }
.g4-all{ margin-top:2rem; padding-inline:var(--gx); }
