/* Case studies: bento cards + project popup. Uses the page tokens from index.html. */
.cs-open { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.cs-open:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: 18px; }
.cs-open h3 { font-weight: 500; letter-spacing: -.01em; }
#cases { margin-top: 24px; }

.cs-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.cs-top img { width: 18px; height: 18px; border-radius: 5px; object-fit: contain; }
.cs-link { font-size: 13px; font-weight: 500; }
.cs-outs-mini { display: flex; gap: 22px; }
.cs-outs-mini b { display: block; font-size: 20px; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; }
.cs-outs-mini span { display: block; font-size: 11px; line-height: 1.35; color: var(--muted); }

/* bento */
.cs-bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cs-b { background: #fff; border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s; }
.cs-b:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgba(0,0,0,.35); }
.cs-b-img { aspect-ratio: 16/10; overflow: hidden; background: #dedfe2; }
.cs-b-img img { width: 100%; height: 100%; object-fit: cover; object-position: left top; display: block; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.cs-b:hover .cs-b-img img { transform: scale(1.04); }
/* device mockups: the whole device on a soft brand-colour glow */
.cs-mock { background: radial-gradient(120% 90% at 50% 40%, color-mix(in srgb, var(--mock) 80%, #fff), var(--mock) 55%, color-mix(in srgb, var(--mock) 70%, #000)) !important; }
.cs-b-img.cs-centre img { object-position: center; }
.cs-b-img.cs-mock img { object-fit: contain; object-position: center; padding: 16px 14px; }
.cs-browser.cs-mock { border: 0; }
.cs-browser.cs-mock [data-main] { background: none; padding: 28px 32px; }
.cs-b-body { min-width: 0; flex: 1; display: flex; flex-direction: column; padding: 14px 16px 18px; }
.cs-b-body .cs-tags { margin-top: auto; padding-top: 12px; } /* tags sit on the bottom edge however long the text is */
.cs-tags { display: flex; gap: 5px; margin-top: 12px; }
.cs-tags .cs-chip { background: #f3f4f6; font-size: 11.5px; }
.cs-b h3 { font-size: 15px; margin-top: 8px; }
.cs-b p { font-size: 13px; color: var(--text); margin-top: 2px; }
.cs-b-lg { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } /* minmax(0,…): the one-line tag row must not widen the text column */
.cs-b-lg .cs-b-text { min-width: 0; padding: 26px; display: flex; flex-direction: column; gap: 8px; }
.cs-b-lg h3 { font-size: 24px; letter-spacing: -.02em; margin-top: 6px; }
.cs-b-lg p { font-size: 14px; }
.cs-b-lg .cs-outs-mini { margin-top: auto; padding-top: 18px; }
.cs-b-lg .cs-tags { margin-top: 8px; }
.cs-b-lg .cs-link { margin-top: 6px; }
.cs-b-lg .cs-b-img { aspect-ratio: auto; min-height: 320px; }

/* "See all": extra projects unfold below the bento */
.cs-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .6s cubic-bezier(.2,.8,.2,1); }
.cs-more.open { grid-template-rows: 1fr; }
.cs-more-in { min-height: 0; overflow: hidden; }
.cs-lab { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding-top: 8px; }
.cs-lb { display: flex; flex-direction: column; gap: 8px; padding: 20px; background: #fff; border-radius: 18px; color: inherit;
  opacity: 0; transform: translateY(14px); transition: opacity .4s, transform .5s cubic-bezier(.2,.8,.2,1), box-shadow .35s; }
.cs-more.open .cs-lb { opacity: 1; transform: none; }
.cs-more.open .cs-lb:nth-child(1) { transition-delay: .12s; }
.cs-more.open .cs-lb:nth-child(2) { transition-delay: .19s; }
.cs-more.open .cs-lb:nth-child(3) { transition-delay: .26s; }
.cs-more.open a.cs-lb:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgba(0,0,0,.35); transition-delay: 0s; }
.cs-lb-top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.cs-tag { font: 500 11px "Geist Mono", monospace; color: var(--fg); background: #f3f4f6; padding: 3px 8px; border-radius: 6px; }
.cs-lb h3 { font-size: 15px; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; }
.cs-lb-meta { font: 500 12px "Geist Mono", monospace; color: var(--muted); }
.cs-lb p { font-size: 13px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.cs-lb-stack { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 6px; }
.cs-lb-stack span { font-size: 11px; color: var(--text); background: #f3f4f6; padding: 2px 8px; border-radius: 999px; }

/* ---------- popup shell ---------- */
html.cs-lock { overflow: hidden; }
.cs-dlg { border: 0; padding: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: transparent; overflow: hidden; color: var(--fg); }
.cs-dlg::backdrop { background: rgba(10,10,12,.55); backdrop-filter: blur(6px); animation: cs-fade .3s; }
.cs-dlg.is-closing::backdrop { animation: cs-fade .26s reverse forwards; }
@keyframes cs-fade { from { opacity: 0; } }
.cs-sheet { position: absolute; inset: 28px 24px; margin: auto; max-width: 1000px; height: min(880px, calc(100% - 56px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 24px; background: #fff; box-shadow: 0 40px 100px -30px rgba(0,0,0,.55);
  transform-origin: var(--ox, 50%) var(--oy, 50%); animation: cs-pop .5s cubic-bezier(.2,.8,.2,1); }
.cs-dlg.is-closing .cs-sheet { animation: cs-pop .26s ease-in reverse forwards; }
@keyframes cs-pop { from { opacity: 0; transform: scale(.55); } }
.cs-sheet.swap > * { animation: cs-in .38s cubic-bezier(.2,.8,.2,1); }
@keyframes cs-in { from { opacity: 0; transform: translateY(8px); } }
.cs-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* two columns: the left one is fixed and never scrolls, the right one scrolls */
.sp { display: grid; grid-template-columns: 300px 1fr; flex: 1; min-height: 0; }

/* ---------- left column ---------- */
.sd { display: flex; flex-direction: column; gap: 20px; min-height: 0; overflow: hidden; padding: 28px 26px; background: #f7f7f8; }
.sd > * { flex-shrink: 0; }
.sd-id { display: flex; align-items: center; gap: 12px; }
.sd-ic { width: 48px; height: 48px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: #fff; object-fit: contain; flex-shrink: 0; }
.sd h2 { font-size: 20px; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; }
.sd-cat { font-size: 12px; color: var(--muted); }
.cs-status { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--ok); background: var(--ok-bg); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.cs-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.sd-text { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.sd-text.clamp { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; } /* line count set in cases.js */
/* facts stacked: small label above each value */
.sd-facts { display: flex; flex-direction: column; gap: 14px; }
.sd-facts dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.sd-facts dd { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 13px; font-weight: 500; line-height: 1.35; }
.sd-facts dd img { width: 16px; height: 16px; border-radius: 4px; object-fit: contain; }
.sd-facts dd a { display: inline-flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.sd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* one-line tag rows: scroll sideways, fade at the edge that has more behind it (classes set in cases.js) */
.cs-fade { --l: 0px; --r: 0px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--l), #000 calc(100% - var(--r)), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 var(--l), #000 calc(100% - var(--r)), transparent); }
.cs-fade::-webkit-scrollbar { display: none; }
.cs-fade.fl { --l: 28px; }
.cs-fade.fr { --r: 36px; }
.cs-fade .cs-chip { flex-shrink: 0; white-space: nowrap; }
.cs-chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 3px 10px 3px 6px; color: var(--fg); font-size: 12px; font-weight: 500; }
.cs-chip img, .cs-chip svg { width: 14px; height: 14px; object-fit: contain; }
.sd-links { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.sd-links .btn { justify-content: center; height: 42px; font-size: 13px; white-space: nowrap; }
/* short laptop screens: tighten the fixed column so it still never needs to scroll */
@media (min-width: 701px) and (max-height: 740px) {
  .sd { gap: 12px; padding: 20px 22px; }
}

/* ---------- right column ---------- */
.mx-main { background: #fff; padding-bottom: 40px; }
.mx-main > * { flex-shrink: 0; }
.mx-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 32px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(10px); font: 500 12px "Geist Mono", monospace; color: var(--muted); }
.cs-nav { display: flex; gap: 6px; flex-shrink: 0; }
.cs-nav button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--fg); display: grid; place-items: center; cursor: pointer; transition: background .2s, transform .15s; }
.cs-nav button:hover { background: #f1f2f4; }
.cs-nav button:active { transform: scale(.94); }
.cs-nav svg { width: 17px; height: 17px; }
.mx-body { padding: 10px 32px 0; }
.mx-body > h2 { font-size: 34px; font-weight: 500; letter-spacing: -.03em; line-height: 1.1; }

.cs-browser { margin-top: 24px; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); box-shadow: 0 18px 40px -24px rgba(0,0,0,.3); }
.cs-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: #f7f7f8; border-bottom: 1px solid var(--line); }
.cs-bar i { width: 10px; height: 10px; border-radius: 50%; background: #dcdde0; }
.cs-bar span { margin: 0 auto; font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 1px 48px; }
.cs-plainshot [data-main] { object-fit: contain; background: #fff; }
[data-main] { display: block; width: 100%; height: auto; max-height: min(52vh, 480px); object-fit: cover; object-position: top; }

.ed-outs { display: flex; gap: 32px; margin-top: 40px; }
.ed-outs > div { flex: 1; }
.ed-outs b { display: block; font-size: 36px; font-weight: 500; letter-spacing: -.04em; line-height: 1.1; }
.ed-outs span { display: block; margin-top: 4px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.ed-sec { display: grid; grid-template-columns: 120px 1fr; gap: 20px; margin-top: 52px; }
.ed-lab { font-size: 15px; font-weight: 500; }
.ed-lab span { display: block; margin-bottom: 4px; font: 500 12px "Geist Mono", monospace; color: var(--muted); }
.ed-p { font-size: 15px; line-height: 1.65; color: var(--text); }

/* architecture timeline: a packet travels down while each step lights up in turn */
.tl { list-style: none; position: relative; }
.tl::before { content: ""; position: absolute; left: 21px; top: 30px; bottom: 30px; width: 2px; background: repeating-linear-gradient(180deg, #d4d6da 0 4px, transparent 4px 8px); }
.tl::after { content: ""; position: absolute; left: 18px; top: 30px; width: 8px; height: 8px; border-radius: 50%; background: var(--fg); animation: tl-dot calc(var(--n) * 1s) linear infinite; }
@keyframes tl-dot { to { top: calc(100% - 38px); } }
.tl li { position: relative; display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 8px 0; }
.tl-ic { position: relative; z-index: 1; width: 44px; height: 44px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: #0a0a0a; animation: tl-on calc(var(--n) * 1s) infinite; animation-delay: calc(var(--i) * 1s); }
.tl-ic img { width: 22px; height: 22px; object-fit: contain; }
.tl-ic svg { width: 20px; height: 20px; }
.tl b { display: block; font-size: 15px; font-weight: 500; line-height: 1.3; }
.tl small { font-size: 13px; color: var(--muted); }
.tl em { font-style: normal; font-size: 12px; color: var(--text); background: #f3f4f6; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
@keyframes tl-on { 0% { border-color: var(--fg); box-shadow: 0 0 0 4px rgba(10,10,10,.07); } 20%, 100% { border-color: var(--line); box-shadow: none; } }
.cs-observe { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; border: 1px dashed #d4d6da; border-radius: 12px; font-size: 12px; color: var(--muted); }
.cs-observe > svg { width: 16px; height: 16px; }
.cs-observe .cs-chip { background: #f3f4f6; }

.cs-mediagrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.cs-video { position: relative; display: block; aspect-ratio: 16/10; border-radius: 12px; overflow: hidden; background: #111; color: #fff; }
.cs-video img { width: 100%; height: 100%; object-fit: cover; filter: blur(2px) brightness(.45); transform: scale(1.06); }
.cs-video video, .cs-video iframe { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; }
.cs-demo { grid-column: 1 / -1; aspect-ratio: 16/9; padding: 0; border: 0; cursor: pointer; font: inherit; }
.cs-demo img { filter: brightness(.6); }
.cs-demo .btn-play { width: 64px; height: 64px; }
.cs-video .play { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px; text-align: center; }
.cs-video .btn-play { width: 50px; height: 50px; margin-bottom: 8px; border-radius: 50%; background: rgba(255,255,255,.95); color: #0a0a0a; display: grid; place-items: center; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.cs-video:hover .btn-play { transform: scale(1.08); }
.cs-video b { font-size: 13px; font-weight: 500; }
.cs-video small { font-size: 11px; opacity: .7; }
.cs-thumb { appearance: none; display: block; width: 100%; padding: 0; aspect-ratio: 16/10; border-radius: 12px; overflow: hidden; border: 2px solid transparent; background: #dedfe2; cursor: pointer; transition: border-color .2s; }
.cs-thumb.on { border-color: var(--fg); }
.cs-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; } /* whole image: banners and mockups aren't page screenshots */
.cs-thumb { background: #f3f4f6; }

@media (max-width: 700px) {
  .cs-bento, .cs-b-lg, .cs-lab { grid-template-columns: 1fr; }
  .cs-b-lg .cs-b-img { min-height: 0; aspect-ratio: 1200/630; order: -1; }
  .cs-b-lg .cs-b-img img { object-fit: contain; object-position: center; } /* the whole cover, centred, instead of a top-left crop */

  .cs-sheet { inset: 10px 8px; height: auto; border-radius: 20px; }
  .sp { display: block; overflow-y: auto; } /* the whole popup scrolls as one column */
  .sd { overflow: visible; }
  .sd-id { padding-right: 118px; }
  .sd-links { margin-top: 6px; }
  .sp .cs-nav { position: absolute; top: 12px; right: 12px; z-index: 5; } /* pinned to the sheet while the column scrolls */
  .sp .cs-nav { padding: 4px; border-radius: 999px; background: rgba(255,255,255,.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 4px 16px rgba(0,0,0,.12); } /* one frosted pill, readable over the scrolling text */
  .sp .cs-nav button { width: 32px; height: 32px; border-color: transparent; background: transparent; }
  .mx-main { overflow: visible; }
  .mx-top { position: static; padding: 14px 18px 4px; -webkit-backdrop-filter: none; backdrop-filter: none; } /* a backdrop-filter would trap the pinned nav */
  .mx-body { padding: 8px 18px 0; }
  .mx-body > h2 { font-size: 26px; }
  .ed-outs { gap: 14px; margin-top: 26px; } /* the three numbers stay side by side */
  .ed-outs b { font-size: 24px; }
  .ed-outs span { font-size: 12px; }
  .sd-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; } /* role on its own line, partner and site side by side */
  .sd-facts > div:first-child { grid-column: 1 / -1; }
  .ed-sec { grid-template-columns: 1fr; gap: 10px; margin-top: 36px; }
  .tl em { display: none; }
  .tl li { grid-template-columns: 44px 1fr; }
  .cs-mediagrid { grid-template-columns: 1fr 1fr; }
  .cs-video { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-sheet, .cs-sheet.swap > *, .cs-dlg::backdrop, .tl::after, .tl-ic { animation: none !important; }
  .cs-more, .cs-lb { transition: none; }
}
