/* Case study pages (Work > project) and the linked project cards on Work.
   Builds on site.css. */

/* A project opens full screen, like a service: no site header or tab bar, just
   a bar with Previous and Next (looping through the projects) and a close
   button back to Work. The page grows out of its card on Work (see vt.js). */
@view-transition { navigation: auto; }
.has-subnav .top, .has-subnav .tabbar { display: none; }
/* Growing out of the card, and back: only the clip moves (vt.js), so no fades */
.vt-grow::view-transition-old(root), .vt-grow::view-transition-new(root),
.vt-shrink::view-transition-old(root), .vt-shrink::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.vt-shrink::view-transition-old(root) { z-index: 1; }
.subnav { position: sticky; top: 0; z-index: 2; padding-top: env(safe-area-inset-top); }
/* Edge to edge on a solid background; the underline shows once the page has
   scrolled (class set by case.js), like the site header's */
.subnav::before {
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--gutter));
  z-index: -1;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
  pointer-events: none;
}
.subnav.stuck::before { border-bottom-color: rgba(255, 255, 255, 0.08); }
.subnav .wrap { display: flex; align-items: center; height: 80px; padding-right: 64px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  white-space: nowrap;
  color: var(--link-hover);
  font-size: 1.0625rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}
.back svg { width: 16px; height: 16px; transition: transform 0.2s ease; }
.back:hover, .back:focus-visible { color: var(--text); }
.back.prev:hover svg, .back.prev:focus-visible svg { transform: translateX(-4px); }
.back.next { margin-left: auto; padding-left: 16px; }
.back.next:hover svg, .back.next:focus-visible svg { transform: translateX(4px); }
.case-close { position: fixed; top: max(20px, env(safe-area-inset-top)); right: max(20px, var(--gutter)); z-index: 3; }
@media (max-width: 480px) { .subnav .wrap { padding-right: 52px; } }
.case.page { padding-top: clamp(32px, 6vh, 64px); }
.case .overline { margin: 0 0 16px; font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* Client, Role, Team, Timeline */
.case-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px clamp(24px, 3vw, 48px);
  margin-top: clamp(40px, 6vw, 64px);
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.case-meta dt { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.case-meta dd { margin-top: 8px; color: #dfe5ee; font-weight: 300; line-height: 1.45; }
@media (max-width: 860px) { .case-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Image placeholders. To add a real image later, put an <img> inside .ph-box
   and it fills the frame. */
.ph { margin: 0; }
.ph-box {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 160px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(135deg, rgba(79, 143, 255, 0.18), rgba(255, 255, 255, 0.03));
  color: rgba(242, 245, 249, 0.35);
}
.ph-box svg { width: 32px; height: 32px; }
.ph-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph figcaption { margin-top: 12px; color: var(--muted); font-size: 0.875rem; font-weight: 300; line-height: 1.45; }
.ph.hero .ph-box { aspect-ratio: 16 / 9; }
.case-hero { margin-top: clamp(40px, 6vw, 72px); }

/* Body sections */
.case-section { margin-top: clamp(80px, 11vw, 144px); }
.case-section .section-title { margin-bottom: clamp(24px, 3vw, 40px); }
.case-text { display: grid; gap: 20px; max-width: 40em; color: #dfe5ee; font-size: 1.125rem; font-weight: 300; line-height: 1.6; }
.case-text strong { color: var(--text); font-weight: 500; }
.case-text .pull { color: var(--text); font-family: Urbanist, Figtree, sans-serif; font-size: clamp(1.375rem, 2.4vw, 1.875rem); font-weight: 300; line-height: 1.3; }

/* Text beside an image */
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px var(--gap); align-items: start; }
.split .ph-box { aspect-ratio: 4 / 5; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } .split .ph-box { aspect-ratio: 4 / 3; } }
.split + .split { margin-top: clamp(48px, 6vw, 72px); }

/* Ticked lists */
.case .gets li { font-size: 1.0625rem; }

/* Decisions: two columns of short headed points */
.decisions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px clamp(32px, 4vw, 64px); }
.decision h3 { font-family: Urbanist, Figtree, sans-serif; font-size: 1.375rem; font-weight: 600; line-height: 1.2; }
.decision p { margin-top: 12px; color: #dfe5ee; font-size: 1.0625rem; font-weight: 300; line-height: 1.6; }
@media (max-width: 860px) { .decisions { grid-template-columns: minmax(0, 1fr); } }
.ph-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: clamp(48px, 6vw, 72px); }
.ph-row .ph-box { aspect-ratio: 9 / 16; max-height: 560px; }
@media (max-width: 720px) { .ph-row { grid-template-columns: minmax(0, 1fr); } .ph-row .ph-box { aspect-ratio: 4 / 3; } }
/* Social posts (4:5): three across on desktop, stacked on phones, never cropped */
.ph-row.posts .ph-box { width: 100%; height: auto; aspect-ratio: 4 / 5; max-height: none; min-height: 0; }
@media (max-width: 720px) { .ph-row.posts { gap: 32px; } .ph-row.posts .ph-box { aspect-ratio: 4 / 5; } }

/* Process: numbered steps */
.steps-list { display: grid; max-width: 44em; list-style: none; counter-reset: step; }
.steps-list li { counter-increment: step; display: grid; grid-template-columns: 56px minmax(0, 1fr); padding: 12px 0; color: #dfe5ee; font-size: 1.0625rem; font-weight: 300; line-height: 1.5; }
.steps-list li::before { content: counter(step, decimal-leading-zero); color: var(--muted); font-size: 0.8125rem; letter-spacing: 0.1em; padding-top: 0.2em; }
.steps-list .soon { color: #8fe3c6; }

/* Gallery: bento grid. Square cells, and the gap scales with the width
   (16px at a 276px cell), so every tile keeps its exact shape and images
   are never cropped. Tiles are exported at those shapes. */
.bento-wrap { container-type: inline-size; }
.bento {
  --c: calc(100cqw / (4 + 3 * 16 / 276));
  display: grid;
  grid-template-columns: repeat(4, var(--c));
  grid-auto-rows: var(--c);
  grid-auto-flow: dense;
  gap: calc(var(--c) * 16 / 276);
}
.bento .ph-box { min-height: 0; border-radius: calc(var(--c) * 20 / 276); background: none; }
/* Captions show only in the lightbox, so the tiles keep their shapes */
.bento figcaption { display: none; }
.bento .big { grid-column: span 2; grid-row: span 2; }
.bento .wide { grid-column: span 2; }
.bento .tall { grid-row: span 2; }
@media (max-width: 860px) {
  .bento { --c: calc(100cqw / (2 + 16 / 276)); grid-template-columns: repeat(2, var(--c)); }
}

/* Results */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.stat { padding: 24px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.08); }
.stat .label { color: var(--muted); font-size: 0.875rem; font-weight: 300; }
.stat .value { margin-top: 12px; font-family: Urbanist, Figtree, sans-serif; font-size: 2rem; font-weight: 600; color: #8fe3c6; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Closing call to action */
.case-end { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.case-end .note-small { margin-top: 8px; }
.case-foot { margin-top: clamp(80px, 10vw, 128px); padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, 0.1); }

/* Work page: the whole project card links to its case study, with a hover
   on the card (lift, glow on the image) and on its text (title turns blue,
   arrow slides) */
.card.linked { position: relative; border-radius: 24px; transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1); }
.card.linked h2 a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
.card.linked h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card.linked h2 a:focus-visible { outline: none; }
.card.linked:has(a:focus-visible) { outline: 2px solid var(--text); outline-offset: 8px; }
/* The image follows the mouse: a soft blue glow inside, and a gradient
   stroke that lights the border nearest the pointer. --mx and --my are set
   by /work/case.js. */
.card.linked .thumb { position: relative; transition: box-shadow 0.3s ease; }
.card.linked .thumb::before,
.card.linked .thumb::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.card.linked .thumb::before {
  inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(79, 143, 255, 0.16), transparent 65%);
}
.card.linked .thumb::after {
  inset: -1px;
  padding: 1px;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(196, 223, 255, 0.95), rgba(79, 143, 255, 0.55) 35%, rgba(79, 143, 255, 0) 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
.card.linked:hover .thumb::before, .card.linked:hover .thumb::after,
.card.linked:focus-within .thumb::before, .card.linked:focus-within .thumb::after { opacity: 1; }
.card.linked p { transition: color 0.2s ease; }
.card.linked .pkg-link { margin-top: 8px; color: var(--text); }
.card.linked:hover .thumb, .card.linked:focus-within .thumb {
  box-shadow: 0 24px 60px -28px rgba(79, 143, 255, 0.35);
}
.card.linked:hover h2 a, .card.linked:focus-within h2 a { color: var(--text); }
.card.linked:hover p:not(.company), .card.linked:focus-within p:not(.company) { color: #dfe5ee; }
.card.linked:hover .pkg-link svg, .card.linked:focus-within .pkg-link svg { transform: translateX(4px); }

/* Card image: fills the rounded thumb, under the hover glow and stroke */
.card .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 19px; }
.card.linked .thumb::before, .card.linked .thumb::after { z-index: 1; }

/* Gallery (Hope Tour): images at their own proportions, never cropped.
   One full-width image, then a portrait beside two stacked landscapes, then
   another full-width one. Each figure sets its ratio with --ar. Stacks on phones. */
.gallery { display: grid; gap: 24px 16px; }
.gallery .ph-box { width: 100%; height: auto; min-height: 0; aspect-ratio: var(--ar, 16 / 9); }
.gallery .ph figcaption { margin-top: 8px; }
.gallery-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 24px 16px; }
.gallery-stack { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
/* The last image in the stack takes up the height left beside the portrait */
.gallery-stack .ph.fill { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.gallery-stack .ph.fill .ph-box { flex: 1; aspect-ratio: auto; }
@media (max-width: 720px) {
  .gallery-split { grid-template-columns: minmax(0, 1fr); }
  .gallery-stack { gap: 24px; }
  .gallery-stack .ph.fill { display: block; }
  .gallery-stack .ph.fill .ph-box { aspect-ratio: var(--ar); }
}
/* Links out under the examples: an icon and the address, one per line */
.ext-links { list-style: none; margin: clamp(48px, 6vw, 72px) 0 0; padding: 0; display: grid; gap: 12px; justify-items: start; }
.ext-links a { display: inline-flex; align-items: center; gap: 10px; color: var(--link-hover); font-size: 0.9375rem; text-decoration: none; transition: color 0.2s ease; }
.ext-links a:hover, .ext-links a:focus-visible { color: #c2ddfa; }
.ext-links svg { flex: none; width: 20px; height: 20px; }
/* Phone screenshots: five across on desktop. On phones the row becomes a
   carousel to swipe through, with the next one peeking in from the right. */
.phones { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px 16px; min-width: 0; }
.phones:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
@media (max-width: 720px) {
  .phones {
    display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .phones::-webkit-scrollbar { display: none; }
  /* Each screenshot is about half the screen height, so the whole image and
     the start of the next one are in view together */
  .phones .ph { flex: none; width: min(64%, calc(50vh * 642 / 1389)); scroll-snap-align: start; }
  @supports (height: 1svh) { .phones .ph { width: min(64%, calc(50svh * 642 / 1389)); } }
}
/* Four key screens (MyPerkPay), under the decisions */
.phones.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(48px, 6vw, 72px); }
.phones.four .ph-box { width: 100%; height: auto; min-height: 0; aspect-ratio: var(--ar); }
.phones.four .ph figcaption { margin-top: 8px; }

/* Lightbox: every project image opens larger in an overlay, with previous
   and next to step through all the images on the page (built by case.js) */
.ph-box.zoomable { cursor: zoom-in; }
.ph-box.zoomable img { transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.ph-box.zoomable:hover img { transform: scale(1.015); }
.ph-box.zoomable:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
.lb-open, .lb-open body { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: max(72px, calc(env(safe-area-inset-top) + 64px)) clamp(12px, 3vw, 40px) max(24px, env(safe-area-inset-bottom));
  background: rgba(5, 6, 8, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.on { opacity: 1; }
.lb-stage { margin: 0; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.lb-stage img { display: block; max-width: 100%; max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px); width: auto; height: auto; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.lb-stage figcaption { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; max-width: 46em; color: var(--muted); font-size: 0.9375rem; font-weight: 300; line-height: 1.45; text-align: center; }
.lb-count { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lightbox button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(18, 21, 28, 0.8);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.lightbox button:hover, .lightbox button:focus-visible { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); }
.lightbox button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.lightbox button svg { width: 20px; height: 20px; }
.lightbox button[hidden] { display: none; }
.lb-close { position: absolute; top: max(16px, env(safe-area-inset-top)); right: clamp(12px, 3vw, 40px); }
@media (max-width: 720px) {
  /* Phones: the image takes the full width, with the arrows below it */
  .lightbox { grid-template-columns: minmax(0, 1fr); padding-bottom: calc(max(24px, env(safe-area-inset-bottom)) + 64px); }
  .lb-prev, .lb-next { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); }
  .lb-prev { left: calc(50% - 60px); }
  .lb-next { right: calc(50% - 60px); }
  .lb-stage img { max-height: calc(100vh - 260px); max-height: calc(100dvh - 260px); }
}
/* Strip mode (design evolution): every image in one row that scrolls
   sideways and snaps, each scaled to the screen height, numbered below */
.lb-strip { min-width: 0; height: 100%; display: flex; align-items: center; gap: clamp(16px, 2.5vw, 32px); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; }
.lb-strip::-webkit-scrollbar { display: none; }
.lb-strip[hidden], .lightbox.strip .lb-stage { display: none; }
.lb-strip figure { flex: none; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; scroll-snap-align: start; }
.lb-strip img { display: block; width: auto; height: calc(100vh - 170px); height: calc(100dvh - 170px); max-height: 1624px; aspect-ratio: 750 / 1624; border-radius: 12px; background: rgba(255, 255, 255, 0.04); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.lb-strip figcaption { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  /* Phones: one image fills most of the width and the next one peeks in */
  .lightbox.strip { padding-left: 0; padding-right: 0; }
  .lb-strip { --w: min(76vw, calc((100vh - 240px) * 750 / 1624)); --w: min(76vw, calc((100dvh - 240px) * 750 / 1624)); padding-inline: calc((100vw - var(--w)) / 2); gap: 12px; }
  .lb-strip figure { scroll-snap-align: center; }
  .lb-strip img { width: var(--w); height: auto; }
}
@media (prefers-reduced-motion: reduce) { .lightbox, .ph-box.zoomable img { transition: none; } .ph-box.zoomable:hover img { transform: none; } }

/* A real image shown whole: the frame takes the image's own shape */
.ph.fit .ph-box { display: block; height: auto; min-height: 0; aspect-ratio: auto; background: #fff; }
.ph.fit .ph-box img { position: static; display: block; width: 100%; height: auto; }
.gallery + .bento-wrap { margin-top: 24px; }
/* View project: white, light blue when the card is hovered */
.card.linked .pkg-link { margin-top: auto; padding-top: 12px; color: var(--text); transition: color 0.2s ease; }
.card.linked:hover .pkg-link, .card.linked:focus-within .pkg-link { color: var(--link); }

/* Platform links (web and social), under the UI examples */
.platforms { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(40px, 5vw, 56px); padding: 0; }
.platforms a { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.12); color: var(--text); font-size: 0.9375rem; text-decoration: none; transition: border-color 0.2s ease, background-color 0.2s ease; }
.platforms a:hover, .platforms a:focus-visible { border-color: rgba(255, 255, 255, 0.32); background: rgba(255, 255, 255, 0.04); }
.platforms svg { width: 18px; height: 18px; flex: none; }

/* App Store and Google Play buttons, under the Results cards */
.stores { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(32px, 4vw, 48px); padding: 0; }
.stores a { display: inline-flex; align-items: center; gap: 12px; min-width: 196px; padding: 10px 22px 10px 18px; border-radius: 14px; background: #f2f5f9; color: #0a0b0d; text-decoration: none; transition: background-color 0.2s ease, transform 0.2s ease; }
.stores a:hover, .stores a:focus-visible { background: #fff; transform: translateY(-1px); }
.stores svg { width: 26px; height: 26px; flex: none; }
.stores span { display: flex; flex-direction: column; font-size: 1.1875rem; font-weight: 500; line-height: 1.15; }
.stores small { font-size: 0.6875rem; font-weight: 400; letter-spacing: 0.02em; }
@media (prefers-reduced-motion: reduce) { .stores a { transition: none; } .stores a:hover { transform: none; } }

/* "See design and logo evolution": opens its own numbered lightbox set */
.evo-link { color: var(--link); text-decoration: none; transition: color 0.2s ease; }
.evo-link:hover, .evo-link:focus-visible { color: var(--link-hover); text-decoration: underline; text-underline-offset: 0.2em; }
.lb-cap[hidden] { display: none; }

/* Links, same rule as site.css: blue turns white, white turns blue, one size */
.back, .ext-links a { font-size: 1.0625rem; color: var(--link-hover); }
.back:hover, .back:focus-visible, .ext-links a:hover, .ext-links a:focus-visible, .evo-link:hover, .evo-link:focus-visible { color: var(--text); }
.evo-link { color: var(--link-hover); }
.card.linked:hover .pkg-link, .card.linked:focus-within .pkg-link { color: var(--link-hover); }

/* Type scale (see site.css): case study sections sit a level under the page
   title; body text, captions and labels match the rest of the site */
.case .section-title { font-size: var(--t-feature); line-height: 1.1; letter-spacing: -0.01em; }
.case-text, .decision p, .steps-list li, .case .gets li, .case-meta dd { font-size: var(--t-body); }
.case-text .pull { font-size: var(--t-quote); line-height: 1.2; }
.decision h3 { font-size: var(--t-heading); }
.ph figcaption, .stat .label, .lb-stage figcaption, .platforms a { font-size: var(--t-meta); }
.case .overline, .case-meta dt { font-size: var(--t-eyebrow); }
