/* ─────────────────────────────────────────────────────────────
   Case-study overlay (work.js). Same family as the contact dialog:
   white card on a blurred blue scrim, custom scrollbar, blur-in.
   ───────────────────────────────────────────────────────────── */
.work {
  --w-blue: #0133cc;
  --w-tint: #ebeffb;    /* blue at 8% on white */
  --w-tone: rgba(1, 51, 204, 0.72);
  --w-line: rgba(1, 51, 204, 0.18);
  --w-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --w-spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--w-blue);
  font-family: var(--font);
  overflow: hidden;
}
.work::backdrop { background: transparent; }
.work[open] { display: grid; place-items: center; }
html.work-open { overflow: hidden; }

.work-scrim {
  position: absolute;
  inset: 0;
  background: rgba(1, 26, 102, 0.42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.35s var(--w-ease);
}
.work.is-open .work-scrim { opacity: 1; }

.work-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1100px, calc(100% - 48px));
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border-radius: 36px;
  background: #fff;
  box-shadow: 0 40px 90px -30px rgba(1, 26, 102, 0.55);
  opacity: 0;
  filter: blur(10px);
  transform: translateY(28px) scale(0.97);
  transition: opacity 0.3s var(--w-ease), filter 0.4s var(--w-ease), transform 0.55s var(--w-ease);
}
.work.is-open .work-card { opacity: 1; filter: none; transform: none; }

.work-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.work-scroll::-webkit-scrollbar { display: none; }
.work-content {
  padding: 56px 64px 48px;
  transition: opacity 0.22s var(--w-ease), filter 0.22s var(--w-ease), transform 0.22s var(--w-ease);
}
/* "Next project": the content blurs out, swaps, blurs back in */
.work-card.is-swapping .work-content { opacity: 0; filter: blur(8px); transform: translateY(10px); }

.work-close {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1.5px solid var(--w-blue);
  border-radius: 50%;
  background: #fff;
  color: var(--w-blue);
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, transform 0.5s var(--w-spring);
}
.work-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.work-close:hover { background: var(--w-blue); color: #fff; transform: rotate(90deg); }
.work-close:focus-visible { outline: 2px solid var(--w-blue); outline-offset: 3px; }

/* Custom scrollbar (scrollbar.js), inside the rounded corners */
.work-bar {
  position: absolute;
  top: 84px;
  bottom: 30px;
  right: 8px;
  width: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--w-ease);
}
.work-card.can-scroll .work-bar { opacity: 1; pointer-events: auto; }
.work-bar-thumb {
  position: absolute;
  top: 0;
  right: 2px;
  width: 4px;
  min-height: 40px;
  border-radius: 999px;
  background: var(--w-line);
  cursor: grab;
  touch-action: none;
  transition: width 0.25s var(--w-ease), right 0.25s var(--w-ease), background-color 0.25s;
}
.work-card.is-scrolling .work-bar-thumb { background: var(--w-tone); }
.work-bar:hover .work-bar-thumb,
.work-card.is-dragging .work-bar-thumb { right: 1px; width: 6px; background: var(--w-blue); }
.work-card.is-dragging { user-select: none; }

/* ── Header ──────────────────────────────────────────────────── */
.work-head { padding-right: 56px; }
.work-kicker {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.work-title {
  max-width: 17ch;
  margin-top: 14px;
  font-size: clamp(34px, 4.6vw, 56px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.028em;
  text-wrap: balance;
}
.work-intro {
  max-width: 760px;
  margin-top: 20px;
  font-size: 21px;
  line-height: 1.42;
  color: var(--w-tone);
  text-wrap: pretty;
}

.work-cover {
  margin-top: 36px;
  overflow: hidden;
  border-radius: 24px;
  background: var(--w-tint);
  box-shadow: inset 0 0 0 1.5px var(--w-line);
}
.work-cover img { display: block; width: 100%; height: auto; aspect-ratio: 2000 / 467; object-fit: cover; }
.work.is-open .work-cover img { animation: workCover 1.4s var(--w-ease) both; }
@keyframes workCover { from { transform: scale(1.06); } }

/* Role / team / platform */
.work-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin: 36px 0 0;
}
.work-fact { padding-top: 14px; border-top: 1.5px solid var(--w-line); }
.work-fact dt { font-size: 15px; color: var(--w-tone); }
.work-fact dd { margin: 6px 0 0; font-size: 20px; font-weight: 700; line-height: 1.2; }

/* Big numbers */
.work-results {
  margin-top: 44px;
  padding: 26px 32px 24px;
  border-radius: 27px;
  background: var(--w-blue);
  color: #fff;
}
.work-results-head { font-size: 15px; font-weight: 500; opacity: 0.8; }
.work-results-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 18px;
}
.work-result { display: flex; flex-direction: column; gap: 6px; }
.work-result + .work-result { padding-left: 20px; border-left: 1.5px solid rgba(255, 255, 255, 0.22); }
.work-result-value { font-size: 58px; font-weight: 900; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.work-result-label { font-size: 16px; font-weight: 500; line-height: 1.25; }
.work-result-detail { font-size: 14px; opacity: 0.7; font-variant-numeric: tabular-nums; }
.work-results-note { margin-top: 18px; font-size: 13px; opacity: 0.7; }
.work.is-open .work-result { animation: workRise 0.7s var(--w-ease) both; animation-delay: calc(0.25s + var(--i, 0) * 0.08s); }
@keyframes workRise { from { opacity: 0; filter: blur(6px); transform: translateY(14px); } }

/* ── Story sections ─────────────────────────────────────────── */
.work-section { margin-top: 64px; }
.work-section-text {
  display: grid;
  grid-template-columns: auto minmax(0, 300px) minmax(0, 1fr);
  gap: 16px 28px;
  align-items: start;
}
.work-step {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--w-blue);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}
.work-section-title { font-size: 28px; font-weight: 700; line-height: 1.12; letter-spacing: -0.015em; }
.work-section-body { font-size: 19px; line-height: 1.45; color: var(--w-tone); text-wrap: pretty; }

.work figure { margin: 0; }
.work figcaption { margin-top: 10px; font-size: 14px; color: var(--w-tone); text-align: center; }

/* Phones in a row */
.work-phones {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  margin-top: 32px;
  padding: 28px;
  border-radius: 27px;
  background: var(--w-tint);
}
.work-phones--three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 18px; padding: 28px 12%; }
.work-phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 22px;
  box-shadow: 0 0 0 1.5px var(--w-line), 0 18px 36px -18px rgba(1, 26, 102, 0.45);
  transition: transform 0.5s var(--w-spring);
}
.work-phone:hover img { transform: translateY(-6px); }

/* Desktop / tablet shots */
.work-wide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 32px;
}
.work-wide.is-single { grid-template-columns: minmax(0, 1fr); }
.work-shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 0 0 1.5px var(--w-line), 0 18px 40px -22px rgba(1, 26, 102, 0.45);
}

/* Platform + theme switcher */
.work-themes { margin-top: 32px; }
.work-switches { display: flex; flex-wrap: wrap; gap: 12px; }
.work-switch { display: flex; gap: 6px; padding: 5px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--w-line); }
.work-switch-btn {
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--w-blue);
  font: 700 15px/1 var(--font);
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}
.work-switch-btn[aria-pressed='true'] { background: var(--w-blue); color: #fff; }
.work-switch-btn:focus-visible { outline: 2px solid var(--w-blue); outline-offset: 2px; }
.work-themes .work-phones { transition: background-color 0.5s var(--w-ease); }
.work-themes[data-theme='dark'] .work-phones { background: #0b1433; }
.work-themes[data-theme='dark'] .work-phone figcaption { color: rgba(255, 255, 255, 0.7); }
.work-note { margin-top: 12px; font-size: 14px; color: var(--w-tone); }

/* ── Footer ─────────────────────────────────────────────────── */
.work-foot { margin-top: 64px; padding-top: 32px; border-top: 1.5px solid var(--w-line); }
.work-outcome { max-width: 780px; font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
.work-foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  margin-top: 28px;
}
.work-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--w-blue);
  font-size: 22px;
  font-weight: 900;
  text-decoration: none;
}
.work-cta-text { position: relative; }
.work-cta-text::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--w-ease);
}
.work-cta:hover .work-cta-text::after, .work-cta:focus-visible .work-cta-text::after { transform: scaleX(1); transform-origin: left; }
.work-cta-arrow {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  transition: background-color 0.35s, color 0.35s, transform 0.55s var(--w-spring);
}
.work-cta-arrow svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.work-cta:hover .work-cta-arrow { background: var(--w-blue); color: #fff; transform: rotate(45deg) scale(1.06); }
.work-cta:focus-visible { outline: 2px solid var(--w-blue); outline-offset: 4px; border-radius: 8px; }

.work-next {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 14px 22px;
  border: 1.5px solid var(--w-blue);
  border-radius: 22px;
  background: #fff;
  color: var(--w-blue);
  font-family: var(--font);
  text-align: right;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, transform 0.5s var(--w-spring);
}
.work-next-label { font-size: 13px; font-weight: 500; opacity: 0.75; }
.work-next-title { font-size: 17px; font-weight: 900; }
.work-next-title::after { content: ' →'; }
.work-next:hover { background: var(--w-blue); color: #fff; transform: translateX(4px); }
.work-next:focus-visible { outline: 2px solid var(--w-blue); outline-offset: 3px; }

/* ── Small screens: a sheet from the bottom ─────────────────── */
@media (max-width: 760px) {
  .work-content { padding: 32px 20px 28px; }
  .work-facts, .work-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-result:nth-child(3) { padding-left: 0; border-left: 0; }
  .work-result-value { font-size: 44px; }
  .work-section-text { grid-template-columns: auto minmax(0, 1fr); }
  .work-section-body { grid-column: 1 / -1; }
  .work-intro { font-size: 18px; }
  /* phones scroll sideways instead of shrinking to nothing */
  .work-phones {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 20px;
  }
  .work-phones::-webkit-scrollbar { display: none; }
  .work-phone { flex: 0 0 62%; scroll-snap-align: center; }
  .work-wide { grid-template-columns: minmax(0, 1fr); }
  .work-outcome { font-size: 22px; }
  .work-cta { font-size: 19px; }
}
@media (max-width: 640px) {
  .work[open] { place-items: end center; }
  .work-card { width: 100%; max-height: 94dvh; border-radius: 28px 28px 0 0; transform: translateY(60px); }
  .work-close { top: 16px; right: 16px; width: 42px; height: 42px; }
  .work-bar { top: 70px; bottom: 16px; right: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .work-card, .work-scrim, .work-content { transition: opacity 0.2s; filter: none; transform: none; }
  .work.is-open .work-cover img, .work.is-open .work-result { animation: none; }
}
