/* =========================================================
   Case study detail page
   Shares tokens, header, tags, tabs and CTA with styles.css
   ========================================================= */

:root { --pink: #f7c1d4; }

.case-page {
  max-width: calc(1800px + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Hero ---------- */
.cs-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 48px;
  padding-top: calc(var(--header-h) + 72px);
}
.cs-hero-main { display: flex; flex: 1 1 auto; flex-direction: column; align-items: flex-start; min-width: 0; }

/* Breadcrumb back to the list */
.cs-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; color: var(--muted); }
.cs-crumbs a { color: var(--ink); text-decoration: none; background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat; padding-bottom: 3px; transition: background-size .3s var(--ease-out); }
.cs-crumbs a:hover, .cs-crumbs a:focus-visible { background-size: 0 1px; }

.cs-title {
  max-width: 900px;
  margin: 0 0 20px;
  font-weight: 900;
  font-size: clamp(52px, 6.2vw, 96px);
  line-height: .98;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}
.cs-title .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .04em; }
.cs-title .w-in { display: inline-block; }
.js .cs-title .w-in { transform: translateY(105%); transition: transform .9s var(--ease-out) var(--d, 0s); }
.is-loaded .cs-title .w-in { transform: none; }

.cs-summary { margin: 0; font-weight: 500; font-size: 15px; line-height: 22.4px; }

.cs-tags {
  --chip-bg: var(--chip);
  --chip-ink: var(--ink);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 28px;
}
.cs-live { margin-top: 28px; }

/* Sticky-note facts */
.cs-notes {
  display: grid;
  flex: none;
  grid-template-columns: repeat(2, 272px);
  gap: 4px 6px;
  margin-top: -8px;
}
.cs-note {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 84px;
  padding: 16px 18px;
  background: var(--bg);
  transform: rotate(var(--r));
  transition: transform .4s var(--ease-back);
}
.cs-note-label { font-size: 15px; letter-spacing: -0.3px; }
.cs-note-value { font-weight: 500; font-size: 16px; line-height: 20px; }
.cs-note:hover { transform: rotate(0deg) scale(1.04); }
.js .cs-note { opacity: 0; }
.is-loaded .cs-note { animation: slap .7s var(--ease-out) var(--d, .7s) both; }

/* ---------- Framed media ---------- */
/* Each image fits on one screen: width is capped so its height stays within ~68% of the
   viewport (screenshots are ~1.47:1), never wider than 1000px, centred on the page. */
.cs-media {
  position: relative;
  width: min(100%, 1000px, calc((68vh - 20px) * 1.473));
  margin: 0 auto;
}
@supports (height: 1svh) {
  .cs-media { width: min(100%, 1000px, calc((68svh - 20px) * 1.473)); }
}
.cs-cover { margin-top: 56px; }
.cs-media-clip { overflow: hidden; border: 2px solid var(--ink); background: var(--chip); }
/* Placeholder size while the image downloads (most screenshots are 2048 x 1390) */
.cs-media:not(.img-ready) .cs-media-clip { aspect-ratio: 2048 / 1390; }
/* Images keep their own proportions, so replacement artwork of any size is never cropped */
.cs-media img { display: block; width: 100%; height: auto; }
.js .cs-media img { transform: scale(1.04); transition: transform .9s var(--ease-out); }
.cs-media.is-in img { transform: none; }
.cs-handles { position: absolute; inset: -6px; pointer-events: none; }
.cs-handles i {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--white);
  border: 2px solid var(--ink);
  transition: transform .5s var(--ease-back);
}
.cs-handles i:nth-child(1) { left: 0; top: 0; }
.cs-handles i:nth-child(2) { right: 0; top: 0; }
.cs-handles i:nth-child(3) { right: 0; bottom: 0; }
.cs-handles i:nth-child(4) { left: 0; bottom: 0; }
.js .cs-media .cs-handles i { transform: scale(0); }
.cs-media.is-in .cs-handles i { transform: scale(1); transition-delay: .35s; }
.cs-media:hover .cs-handles i { background: var(--blue); }

/* ---------- Story sections ---------- */
.cs-section {
  max-width: 800px;
  margin: 88px auto;
  font-weight: 500;
  font-size: 15.5px;
  line-height: 23.5px;
}
.cs-h2 {
  margin: 0 0 28px;
  font-weight: 500;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -1.6px;
}
.cs-section p { margin: 0 0 18px; }
.cs-list-title { margin-bottom: 6px !important; }
.cs-list { margin: 0 0 18px; padding-left: 20px; }
.cs-list li { margin: 0 0 6px; padding-left: 4px; }
.cs-list li::marker { color: var(--card, var(--ink)); }

.cs-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 8px; }
.cs-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  background: var(--card, var(--yellow));
  color: var(--on, var(--ink));
  transition: transform .4s var(--ease-back);
}
.cs-stat:nth-child(odd) { transform: rotate(-1deg); }
.cs-stat:nth-child(even) { transform: rotate(1.2deg); }
.cs-stat:hover { transform: rotate(0) scale(1.03); }
.cs-stat-v { font-weight: 900; font-size: 64px; line-height: 1; letter-spacing: -2px; }
.cs-stat-l { font-family: "DM Mono", ui-monospace, monospace; font-size: 14px; letter-spacing: -0.42px; text-transform: uppercase; }

/* ---------- Next project ---------- */
.cs-next { margin-top: 140px; }
.cs-next-link { display: block; color: var(--on); text-decoration: none; }
.cs-next-link .project-tabs { height: 42px; }
.cs-next-tab { justify-content: flex-start; gap: 14px; width: 220px; height: 42px; padding-left: 28px; }
.cs-next-dot { display: block; width: 12px; height: 12px; border-radius: 12px; background: var(--on); }
.cs-next-link .tab-shape { height: 42px; -webkit-mask-size: 47px 42px; mask-size: 47px 42px; width: 47px; }

.cs-next-card {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 640px;
  padding: 16px;
  overflow: hidden;
  background: var(--card);
}
.cs-next-img { position: relative; flex: 1 1 0; min-width: 0; overflow: hidden; }
.cs-next-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s var(--ease-out);
}
.cs-next-link:hover .cs-next-img img { transform: scale(1.05); }
.cs-next-text {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  padding: 32px;
  text-align: center;
}
.cs-next-title { margin: 0; font-weight: 500; font-size: 44px; line-height: 1.1; letter-spacing: -1.6px; }
.cs-next-summary { margin: 0; font-weight: 500; font-size: 15px; line-height: 22.4px; }
.cs-next-tags { flex: none; justify-content: center; margin-top: 12px; }

.see-bubble {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border-radius: 80px;
  background: var(--chip);
  color: var(--ink);
  font-weight: 500;
  font-size: 22px;
  pointer-events: none;
  opacity: 0;
  scale: .3;
  transition: opacity .25s ease, scale .35s var(--ease-back);
}
.cs-next-card.is-hover { cursor: none; }
.cs-next-card.is-hover .see-bubble { opacity: 1; scale: 1; }

/* Touch: keep the bubble visible, parked bottom-right */
@media (pointer: coarse), (hover: none) {
  .see-bubble { left: auto; top: auto; right: 24px; bottom: 24px; opacity: 1; scale: 1; transform: none !important; }
}

.case-page + .cta,
.cta.cs-cta { margin-top: 180px; }

.cs-after { margin-top: 18px; }

/* =========================================================
   Case studies listing page
   ========================================================= */
.cl-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: calc(var(--header-h) + 72px);
  text-align: center;
}
.cl-head .work-title { padding-top: 0; }
.cl-intro { max-width: 460px; margin: 0; font-weight: 500; font-size: 15px; line-height: 22.4px; }

.cl-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.cl-filter {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  overflow: hidden;
  border: 0;
  background: var(--chip);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.cl-filter::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--blue);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .35s var(--ease-out);
}
.cl-filter:hover::before,
.cl-filter.is-active::before { transform: scaleY(1); }
.cl-count { opacity: .5; }

.cl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 72px 56px;
  margin-top: 72px;
}

.cl-card { --tab-bg: var(--chip); display: block; color: var(--ink); text-decoration: none; }
.cl-card.is-hidden { display: none; }
.cl-card.is-pop { animation: card-pop .6s var(--ease-out) both; }
@keyframes card-pop { from { opacity: 0; transform: translateY(24px) scale(.98); } }

.cl-tabs { display: flex; align-items: flex-end; height: 50px; }
.cl-tab {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 50px;
  padding: 0 24px 0 28px;
  background: var(--tab-bg);
  color: var(--ink);
  transition: background .4s ease, color .4s ease;
}
.cl-dot { display: block; width: 12px; height: 12px; border-radius: 12px; background: currentColor; }
.cl-tab-shape {
  width: 56px;
  height: 50px;
  background: var(--tab-bg);
  -webkit-mask: url("../assets/svg/tab-right.svg") 0 0 / 56px 50px no-repeat;
          mask: url("../assets/svg/tab-right.svg") 0 0 / 56px 50px no-repeat;
  transition: background .4s ease;
}
.cl-panel {
  position: relative;
  padding: 16px;
  overflow: hidden;
  background: var(--tab-bg);
  transition: background .4s ease;
}
.cl-img { position: relative; overflow: hidden; aspect-ratio: 793 / 370; }
.cl-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .9s var(--ease-out);
}
.cl-title {
  margin: 28px 0 0;
  font-weight: 500;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -1.5px;
  text-align: center;
}
.cl-desc { margin: 10px 0 0; font-weight: 500; font-size: 16px; line-height: 23px; text-align: center; }

/* Hover: every folder turns ink black (#111212) */
.cl-card:hover,
.cl-card:focus-visible { --tab-bg: var(--ink); }
.cl-card:hover .cl-tab,
.cl-card:focus-visible .cl-tab { color: var(--white); }
.cl-card:hover .cl-img img { transform: scale(1.05); }
.cl-panel.is-hover { cursor: none; }
.cl-panel.is-hover .see-bubble { opacity: 1; scale: 1; }

@media (max-width: 900px) {
  .cl-grid { grid-template-columns: 1fr; gap: 56px; margin-top: 48px; }
}
@media (max-width: 760px) {
  .cl-head { padding-top: calc(var(--header-h) + 40px); }
  .cl-title { margin-top: 20px; font-size: 30px; letter-spacing: -1px; }
  .cl-desc { font-size: 15px; line-height: 22px; }
  .cl-tabs, .cl-tab, .cl-tab-shape { height: 42px; }
  .cl-tab-shape { -webkit-mask-size: 47px 42px; mask-size: 47px 42px; width: 47px; }
  .cl-tab { padding: 0 16px 0 20px; gap: 10px; }
  .cl-panel { padding: 10px; }
  .cl-filter { padding: 10px 12px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cs-hero { flex-direction: column; gap: 40px; }
  .cs-notes { grid-template-columns: repeat(2, minmax(0, 272px)); margin-top: 0; }
  .cs-section { margin: 80px auto; }
}

@media (max-width: 760px) {
  .cs-hero { padding-top: calc(var(--header-h) + 40px); }
  .cs-title { font-size: clamp(40px, 12vw, 56px); }
  .cs-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px 6px; }
  .cs-note { min-height: 0; padding: 12px 14px; }
  .cs-note-label { font-size: 13px; }
  .cs-note-value { font-size: 14px; line-height: 18px; }
  .cs-cover { margin-top: 40px; }
  .cs-section { margin: 72px auto; font-size: 15px; line-height: 22.5px; }
  .cs-h2 { font-size: 32px; letter-spacing: -1px; margin-bottom: 20px; }
  .cs-stat-v { font-size: 44px; }
  .cs-stats { gap: 12px; }
  .cs-next { margin-top: 96px; }
  .cs-next-card { flex-direction: column; min-height: 0; }
  .cs-next-img { flex: none; height: 240px; }
  .cs-next-text { padding: 28px 12px 96px; }
  .cs-next-title { font-size: 34px; }
  .case-page + .cta,
  .cta.cs-cta { margin-top: 120px; }
}

@media (max-width: 400px) {
  .cs-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .js .cs-title .w-in,
  .js .cs-media img,
  .js .cs-media .cs-handles i { transform: none !important; }
  .js .cs-note { opacity: 1 !important; transform: rotate(var(--r)) !important; }
}
