/* casestudies.css
   Per-client product overlay for the case-studies page.

   The page keeps its four client logos (from the live site). This makes each
   logo a clear button and adds a full-screen overlay that shows just that
   client's products, then a single-image view with prev/next. Scoped values,
   matched to the live look (white, Open Sans, quiet). */

/* ---------- logo affordance ---------- */

.cs-logo-btn {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  display: block;
  width: 100%;
  transition: transform 200ms ease, filter 200ms ease;
}

/* Normalize every client logo to one uniform height so the four read as the
   same size regardless of aspect ratio (Unitron is portrait, the rest
   landscape). Each logo renders at a fixed height with its natural width and
   is centered; max-width guards against overflow in a narrow column. */
.cs-logo-btn img {
  display: block;
  width: auto;
  height: clamp(88px, 11vw, 150px);
  max-width: 100%;
  margin: 0 auto;
  object-fit: contain;
}

/* Unitron stacks its mark over the wordmark, so at the shared height its mark
   reads larger than the others'. Trim it to ~76.5% to balance the row. */
.cs-logo-btn img[src*="unitron"] {
  height: calc(clamp(88px, 11vw, 150px) * 0.765);
}

/* Subtle lift on hover/focus — no color effect. */
.cs-logo-btn:hover,
.cs-logo-btn:focus-visible {
  transform: translateY(-3px);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.12));
}

.cs-logo-btn:focus-visible { outline: 2px solid #111; outline-offset: 6px; }

/* A quiet "View work" cue under each logo, revealed on hover/focus. */
.cs-logo-cue {
  display: block;
  margin-top: 12px;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 200ms ease;
}

.cs-logo-btn:hover .cs-logo-cue,
.cs-logo-btn:focus-visible .cs-logo-cue { opacity: 1; }

/* ---------- mono -> color logo reveal ---------- */

/* Converted logos carry one transparent, full-color mark. At rest it is fully
   desaturated — blacks stay black, colored areas drop to grey — and on
   hover/focus/tap the color returns with saturation pushed past 1 so the
   arrival is unmistakable. The button click (work overlay) is untouched. */
.cs-logo-btn--swap img {
  filter: grayscale(1) contrast(1.04) opacity(0.92);
  transition: filter 320ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

.cs-logo-btn--swap:hover img,
.cs-logo-btn--swap:focus-visible img,
.cs-logo-btn--swap:active img {
  filter: grayscale(0) contrast(1.04) saturate(1.3) opacity(1);
}

/* ---------- "see more in the gallery" link under the logos ---------- */

.cs-see-more {
  text-align: center;
  margin: 28px 0 4px;
  font-family: "Open Sans", Arial, sans-serif;
}

.cs-see-more a {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.6);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 180ms ease, border-color 180ms ease;
}


.cs-see-more a:hover,
.cs-see-more a:focus-visible {
  color: rgb(65, 105, 225);
  border-bottom-color: rgb(65, 105, 225);
}

/* ---------- overlay: dimmed backdrop + floating panel ---------- */

.cs-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(20, 20, 20, 0.55);
  font-family: "Open Sans", Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 48px);
}

.cs-overlay[hidden] { display: none; }

/* The pop-out card. The page stays visible, dimmed, behind it. */
.cs-ov-panel {
  background: #ffffff;
  width: min(1000px, 100%);
  max-height: 88vh;
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  padding: 20px clamp(16px, 3vw, 32px) 28px;
}

/* The product list scrolls inside the panel, not the whole page. */
.cs-ov-body { min-height: 0; overflow-y: auto; }

.cs-ov-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.cs-ov-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #111;
}

.cs-ov-btn {
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  padding: 12px 4px;
  min-height: 44px;
}

.cs-ov-btn:hover { color: #111; }

/* ---------- grid view ---------- */

.cs-ov-grid {
  list-style: none;
  margin: 32px auto 0;
  padding: 0;
  max-width: 1100px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px 30px;
}

@media (max-width: 820px) { .cs-ov-grid { grid-template-columns: repeat(2, 1fr); gap: 28px 20px; } }
@media (max-width: 480px) { .cs-ov-grid { grid-template-columns: 1fr; } }

.cs-ov-grid li { margin: 0; }

.cs-tile {
  border: 0;
  background: none;
  padding: 0;
  width: 100%;
  cursor: pointer;
}

.cs-tile .frame {
  display: block;
  aspect-ratio: 1 / 1;
  background: #fafafa;
  overflow: hidden;
}

.cs-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 300ms ease;
}

.cs-tile:hover img { transform: scale(1.03); }

/* ---------- single-image (zoom) view ---------- */

.cs-ov-zoom {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  height: 100%;
}

.cs-ov-zoom[hidden] { display: none; }
.cs-ov-grid-wrap[hidden] { display: none; }

.cs-zoom-figure {
  margin: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
  justify-items: center;
}

.cs-zoom-figure img {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
}

.cs-zoom-figure figcaption {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.6);
  text-align: center;
  max-width: 60ch;
}

.cs-zoom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.cs-zoom-pos { font-size: 12px; color: rgba(0, 0, 0, 0.6); }

@media (prefers-reduced-motion: reduce) {
  .cs-logo-btn, .cs-logo-cue, .cs-logo-btn--swap img, .cs-tile img { transition: none; }
  .cs-logo-btn:hover { transform: none; }
  .cs-tile:hover img { transform: none; }
}
