/* === WORK / CASE STUDY DARK SYSTEM ===
   Self-contained dark theme for /work and /work/[slug].
   Does not touch the light homepage theme in styles.css. */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --w-bg: #000000;
  --w-surface: #0d0d0d;
  --w-surface-2: #131313;
  --w-fg: #f2f2f0;
  --w-muted: #9a9a97;
  --w-subtle: #5c5c59;
  --w-border: rgba(255, 255, 255, 0.08);
  --w-border-strong: rgba(255, 255, 255, 0.14);
  --w-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --w-mono: "SF Mono", "Fira Code", "Fira Mono", monospace;
  --w-radius: 20px;
  --w-radius-sm: 12px;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
  background: var(--w-bg);
}

body.work-page {
  font-family: var(--w-font);
  background: var(--w-bg);
  color: var(--w-fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* clip (not hidden) prevents horizontal scroll WITHOUT creating a scroll
     container; an overflow:hidden/auto ancestor silently breaks the
     position:sticky project stack below. */
  overflow-x: clip;
  line-height: 1.5;
}

.work-page a {
  color: inherit;
  text-decoration: none;
}

/* === NAV === */
.work-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: clamp(28px, 3vw, 48px) clamp(28px, 3vw, 48px) 12px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
}

.work-page:not(.case-page) .work-nav {
  position: fixed;
  left: 0;
  right: 0;
}

.work-nav-logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: clamp(70px, 5.8vw, 86px);
}

.work-nav-logo img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 10px rgba(0, 0, 0, 0.32));
}

.work-nav-links {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(24px, 3vw, 44px);
  min-width: 0;
  margin-left: clamp(18px, 3vw, 36px);
  list-style: none;
  isolation: isolate;
  --nav-liquid-x: 0px;
  --nav-liquid-width: 0px;
}

.work-nav-links a {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 16px;
  color: rgba(242, 242, 240, 0.96);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  transition: color 0.2s ease;
}

.work-nav-links a:hover {
  color: var(--w-fg);
}

.work-nav-links li:not(.nav-liquid-indicator) {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.work-nav-links .nav-liquid-indicator {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 0;
  display: block;
  width: var(--nav-liquid-width);
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 28px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(var(--nav-liquid-x), -50%, 0) scale(0.92);
  transition:
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.18s ease;
}

@supports ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .work-nav-links .nav-liquid-indicator {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

.work-nav-links.has-liquid-target .nav-liquid-indicator {
  opacity: 1;
  transform: translate3d(var(--nav-liquid-x), -50%, 0) scale(1);
}

/* === WORK INDEX HERO (Fuel-inspired) ===
   The hero pins at the top (position: sticky, z-index 0) and the stack
   section slides up OVER it with a slanted top edge, the same cover
   transition as the project deck itself. */
.work-hero-v3 {
  --hero-progress: 0;
  --hero-eased-progress: 0;
  --hero-scale-start: 1.36;
  --hero-scale-range: -0.81;
  position: sticky;
  top: 0;
  z-index: 0;
  isolation: isolate;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding-top: 68px;
  background-color: var(--w-bg);
  background-image: none;
}

.work-hero-v3::before,
.work-hero-v3::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Dedicated GIF layer: only this pseudo-element scales and fades. */
.work-hero-v3::before {
  inset: auto;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: 100%;
  height: 100%;
  background-image: url('/videos/mfbg.gif?v=3');
  background-position: 50% 50%;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: calc(1 - var(--hero-progress) * 0.72);
  transform: translate(-50%, -50%) scale(calc(var(--hero-scale-start) + var(--hero-eased-progress) * var(--hero-scale-range)));
  transform-origin: center center;
  will-change: transform, opacity;
}

/* Subtle cinematic darkening while Projects slides over the hero. */
.work-hero-v3::after {
  z-index: 1;
  background: #000;
  opacity: calc(var(--hero-progress) * 0.24);
  will-change: opacity;
}

.work-hero-v3.is-hero-past::before {
  opacity: 0;
}

.work-hero-ripple {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.work-hero-scroll {
  position: absolute;
  top: auto;
  left: 50%;
  bottom: clamp(28px, 4vh, 44px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.92);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  visibility: visible;
  opacity: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.8));
  transform: translateX(-50%);
  /* Now a <button>: strip UA chrome, keep it tappable/clickable. */
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 10px;
  cursor: pointer;
}

.work-hero-scroll:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 6px;
  border-radius: 10px;
}

.work-hero-scroll-line {
  position: relative;
  display: block;
  width: 2px;
  height: 48px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.4);
}

.work-hero-scroll-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #ffffff;
  animation: work-scroll-line 2.4s ease-in-out infinite;
}

.work-hero-scroll-icon {
  display: block;
  width: 22px;
  height: 22px;
  margin-top: -5px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: work-scroll-icon 2.4s ease-in-out infinite;
}

@keyframes work-scroll-line {
  0% { transform: translateY(-100%); }
  55%, 100% { transform: translateY(100%); }
}

@keyframes work-scroll-icon {
  0%, 25% { opacity: 0.35; transform: translateY(-3px); }
  55% { opacity: 1; transform: translateY(3px); }
  100% { opacity: 0.35; transform: translateY(6px); }
}

@media (max-width: 767px) {
  .work-hero-v3 {
    --hero-scale-start: 1.25;
    --hero-scale-range: -0.87;
  }

  .work-hero-v3::before {
    background-image: url('/videos/mfmobilebg.gif?v=3');
  }

  .work-hero-scroll {
    bottom: 64px;
  }
}

.work-hero-head {
  position: relative;
  z-index: 3;
  padding: 0 clamp(20px, 5vw, 80px);
  max-width: 980px;
}

/* Section caption / marker type, used for eyebrow and stack captions.
   12px, heavy, paren-wrapped in markup e.g. (Work) / (01). */
.cap,
.work-hero-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.55);
  font-feature-settings: "tnum" 1;
}

.work-hero-label {
  margin-bottom: 22px;
}

.work-hero-head .work-hero-title {
  font-size: clamp(48px, 12vw, 148px);
  font-weight: 1000;
  letter-spacing: -0.03em;
  line-height: 0.95;
  margin-bottom: 24px;
  color: #ffffff;
}

.word-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.word {
  display: inline-block;
  animation: word-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i) * 0.08s);
}

@keyframes word-up {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-up {
  opacity: 0;
  transform: translateY(16px);
  animation: reveal-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i) * 0.08s);
}

@keyframes reveal-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === STACKING PROJECT ROWS (Fuel-style) ===
   Pure CSS deck effect. All rows are siblings of ONE container, each
   position:sticky, with shared progressive offsets supplied by home-dark.css
   so later rows slide over earlier ones while leaving stepped edges visible.
   Scroll distance comes from each row's own flow height; the container
   is 3× a card tall, so there is always room to scroll and the pin
   holds. Depth = box-shadow seam only, no JS transforms.

   IMPORTANT: no ancestor between .stack-row and <body> may set
   overflow:hidden/auto/scroll; that silently disables sticky. */
.stack-section {
  position: relative;
  /* Paint above the pinned hero so scrolling slides this section over it;
     the clipped top edge gives the cover a slanted, editorial cut. */
  z-index: 1;
  background: var(--w-bg);
  clip-path: polygon(0 clamp(28px, 5vw, 72px), 100% 0, 100% 100%, 0 100%);
  padding: clamp(64px, 8vw, 120px) clamp(20px, 5vw, 80px) clamp(40px, 6vw, 96px);
}

/* Each project is one sticky unit (.stack-card) = image box + caption row
   below it. Later units are later in DOM, so they paint over and cover
   earlier ones as they slide up. The caption is a flow row UNDER the image
   inside the same unit, so it never overlaps the image and always travels
   with it. z-index via --stack-index makes the cover order explicit. */
.stack-card {
  position: sticky;
  top: 0;
  z-index: calc(var(--stack-index, 0) + 1);
  display: block;
  /* Match the case-study media width so the work stack and project pages
     share the same curated desktop measure. */
  width: min(100%, 1200px);
  max-width: 100%;
  margin: 0 auto clamp(40px, 8vh, 96px);
}

.stack-card-media {
  position: relative;
  aspect-ratio: 1600 / 1000;
  overflow: hidden;
  background: linear-gradient(145deg, var(--w-surface-2), var(--w-surface));
  box-shadow: 0 -24px 60px -12px rgba(0, 0, 0, 0.7);
}

.stack-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.stack-card:hover .stack-card-media img {
  transform: scale(1.03);
}

/* Caption row, in flow directly below the image box, same column width. */
.stack-cap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 16px;
  padding: clamp(16px, 1.8vw, 24px) 2px clamp(10px, 1.4vw, 18px);
  background: var(--w-bg);
  color: var(--w-fg);
}

.cap-left {
  justify-self: start;
}

.cap-right {
  justify-self: end;
  align-self: start;
}

.cap-center {
  justify-self: center;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cap-title {
  font-size: clamp(15px, 1.4vw, 18px);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--w-fg);
}

.cap-category {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--w-muted);
}

/* === WORK INDEX CTA === */
.work-cta {
  position: relative;
  z-index: 20;
  width: 100%;
  padding: clamp(64px, 9vw, 128px) clamp(20px, 5vw, 80px) clamp(72px, 10vw, 140px);
  border-top: 1px solid var(--w-border);
  background: var(--w-bg);
  box-shadow: 0 -4px 0 var(--w-bg);
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(20px, 3vw, 32px);
}

.work-cta-title {
  max-width: 760px;
  color: var(--w-fg);
  font-size: clamp(34px, 5.5vw, 72px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.work-cta-text {
  max-width: 680px;
  color: var(--w-muted);
  font-size: clamp(17px, 1.8vw, 22px);
  line-height: 1.55;
  letter-spacing: -0.015em;
}

.work-cta .case-cta-btn {
  margin-top: 4px;
  align-self: center;
}

/* === CONTACT COMPOSER === */
.contact-section {
  position: relative;
  z-index: 20;
  width: 100%;
  padding: clamp(88px, 11vw, 160px) clamp(20px, 5vw, 80px);
  scroll-margin-top: calc(var(--mobile-header-h, 68px) + 16px);
  border-top: 1px solid var(--w-border);
  background: #000;
  box-shadow: 0 -4px 0 #000;
  isolation: isolate;
}

.contact-shell {
  width: min(100%, 940px);
  margin: 0 auto;
}

.contact-kicker {
  margin-bottom: 14px;
  color: rgba(242, 242, 240, 0.58);
  font-family: var(--w-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.contact-title {
  max-width: 820px;
  color: var(--w-fg);
  font-size: clamp(40px, 6.2vw, 76px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.contact-intro {
  max-width: 640px;
  margin-top: clamp(18px, 2.5vw, 28px);
  color: var(--w-muted);
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.55;
}

.contact-chat {
  margin-top: clamp(40px, 6vw, 72px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.055), transparent 44%),
    #090909;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.contact-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.018);
}

.contact-chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: linear-gradient(145deg, #222, #0c0c0c);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: -0.05em;
}

.contact-chat-person {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  line-height: 1.25;
}

.contact-chat-person strong {
  font-size: 14px;
  font-weight: 600;
}

.contact-chat-person span,
.contact-chat-status {
  color: var(--w-muted);
  font-size: 11px;
}

.contact-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.contact-chat-status > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #75df92;
  box-shadow: 0 0 12px rgba(117, 223, 146, 0.6);
}

.contact-chat-prompt {
  padding: clamp(28px, 5vw, 52px) clamp(18px, 4vw, 40px) 20px;
}

.contact-chat-prompt p {
  width: fit-content;
  max-width: min(78%, 540px);
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px 16px 16px 5px;
  background: #141414;
  color: rgba(242, 242, 240, 0.9);
  font-size: clamp(14px, 1.6vw, 17px);
  line-height: 1.45;
}

.contact-composer {
  margin: 0 clamp(12px, 2.5vw, 24px) clamp(12px, 2.5vw, 24px);
}

.contact-message-field {
  position: relative;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: #111;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-message-field:focus-within {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.035);
}

.contact-composer textarea {
  display: block;
  width: 100%;
  min-height: 166px;
  max-height: 260px;
  padding: 15px 150px 86px 15px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--w-fg);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}

.contact-composer textarea::placeholder {
  color: rgba(242, 242, 240, 0.34);
}

.contact-composer-actions {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.contact-shortcut {
  color: rgba(242, 242, 240, 0.34);
  font-family: var(--w-mono);
  font-size: 10px;
  white-space: nowrap;
}

.contact-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--w-fg);
  color: #080808;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.contact-send:hover {
  transform: translateY(-1px) scale(1.03);
  background: #fff;
}

.contact-send:disabled {
  cursor: wait;
  opacity: 0.45;
}

.contact-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-form-status {
  min-height: 20px;
  padding: 0 14px 6px;
  color: var(--w-muted);
  font-size: 11px;
}

.contact-form-status[data-state="success"] {
  color: #8fe5a5;
}

.contact-form-status[data-state="error"] {
  color: #ff9a9a;
}

/* === IMAGE FALLBACK (broken/missing placeholder assets) === */
.img-fallback {
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.img-fallback::after {
  content: attr(data-fallback-label);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--w-subtle);
}

/* === CASE STUDY: HERO === */
.case-hero {
  padding: clamp(32px, 5vw, 56px) clamp(20px, 5vw, 80px) 0;
}

.case-back {
  display: inline-block;
  font-size: 13px;
  color: var(--w-subtle);
  margin-bottom: clamp(24px, 4vw, 40px);
  transition: color 0.2s ease;
}

.case-back:hover {
  color: var(--w-fg);
}

.case-hero-media {
  width: 100%;
  max-width: 1200px;
  aspect-ratio: 1600 / 1000;
  border-radius: var(--w-radius);
  overflow: hidden;
  background: linear-gradient(145deg, var(--w-surface-2), var(--w-surface));
  margin-bottom: clamp(28px, 4vw, 44px);
  margin-inline: auto;
}

.case-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-hero-info {
  max-width: 900px;
  margin-inline: auto;
  padding-bottom: clamp(40px, 6vw, 72px);
}

.case-hero-meta {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--w-subtle);
  margin-bottom: 18px;
}

.case-hero-title {
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 20px;
  color: var(--w-fg);
}

.case-hero-desc {
  font-size: clamp(16px, 1.5vw, 19px);
  color: var(--w-muted);
  line-height: 1.6;
  letter-spacing: -0.005em;
}

/* === CASE STUDY: META === */
.case-meta-section {
  width: calc(100% - (2 * clamp(20px, 5vw, 80px)));
  max-width: 1200px;
  margin-inline: auto;
  padding: clamp(32px, 5vw, 48px) 0;
  border-top: 1px solid var(--w-border);
  border-bottom: 1px solid var(--w-border);
}

.case-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 4vw, 48px);
}

.case-meta-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--w-subtle);
  margin-bottom: 12px;
}

.case-meta-value {
  font-size: 15px;
  color: var(--w-fg);
  line-height: 1.5;
}

.stack-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack-pill {
  font-size: 12px;
  font-family: var(--w-mono);
  padding: 5px 12px;
  border-radius: 980px;
  background: var(--w-surface-2);
  border: 1px solid var(--w-border);
  color: var(--w-muted);
}

.project-meta-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-meta-link {
  font-size: 14px;
  color: var(--w-fg);
  text-underline-offset: 3px;
  text-decoration: underline;
  text-decoration-color: var(--w-border-strong);
  transition: text-decoration-color 0.2s ease;
  width: fit-content;
}

.project-meta-link:hover {
  text-decoration-color: var(--w-fg);
}

.project-meta-link--empty {
  color: var(--w-subtle);
  text-decoration: none;
  cursor: default;
}

/* === CASE STUDY: OVERVIEW === */
.case-overview {
  padding: clamp(56px, 8vw, 100px) clamp(20px, 5vw, 80px);
  max-width: 900px;
  margin-inline: auto;
}

.section-label-dark {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--w-subtle);
  margin-bottom: 20px;
}

.case-overview-text {
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 500;
  color: var(--w-fg);
  line-height: 1.45;
  letter-spacing: -0.015em;
}

/* === CASE STUDY: SCREENSHOT SECTIONS === */
.case-sections {
  display: flex;
  flex-direction: column;
  gap: clamp(64px, 9vw, 120px);
  padding: 0 clamp(20px, 5vw, 80px) clamp(64px, 9vw, 120px);
  max-width: 1280px;
  margin-inline: auto;
}

.case-section-media {
  width: 100%;
  max-width: 1200px;
  aspect-ratio: 16/10;
  border-radius: var(--w-radius);
  overflow: hidden;
  background: linear-gradient(145deg, var(--w-surface-2), var(--w-surface));
  border: 1px solid var(--w-border);
  margin-bottom: 28px;
  margin-inline: auto;
}

.case-section-media img,
.case-section-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.case-section-title {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--w-fg);
  max-width: 700px;
}

.case-section-text {
  font-size: 16px;
  color: var(--w-muted);
  line-height: 1.65;
  max-width: 640px;
  letter-spacing: -0.005em;
}

/* === MOBILE SCREENSHOTS === */
.mobile-section {
  padding: 0 clamp(20px, 5vw, 80px) clamp(64px, 9vw, 120px);
  max-width: 1280px;
  margin-inline: auto;
}

.mobile-section-text {
  font-size: 16px;
  color: var(--w-muted);
  line-height: 1.65;
  max-width: 640px;
  letter-spacing: -0.005em;
  margin-bottom: 28px;
}

.mobile-strip {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.mobile-strip::-webkit-scrollbar {
  display: none;
}

.mobile-shot {
  flex-shrink: 0;
  width: clamp(180px, 22vw, 260px);
  aspect-ratio: 9/19.5;
  border-radius: var(--w-radius-sm);
  overflow: hidden;
  background: linear-gradient(145deg, var(--w-surface-2), var(--w-surface));
  border: 1px solid var(--w-border);
}

.mobile-shot img,
.mobile-shot video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* === CASE STUDY: CTA === */
.case-cta {
  padding: clamp(80px, 12vw, 160px) clamp(20px, 5vw, 80px);
  border-top: 1px solid var(--w-border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(32px, 5vw, 48px);
}

.case-cta-title {
  max-width: 760px;
  text-align: center;
  font-size: clamp(32px, 5.5vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--w-fg);
}

.case-page .case-cta .case-cta-btn {
  align-self: center;
  justify-content: center;
}

.work-page .case-cta-btn {
  display: inline-flex;
  align-items: center;
  padding: 16px 32px;
  border-radius: 980px;
  background: var(--w-fg);
  color: #000000;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.work-page .case-cta-btn:hover {
  transform: translateY(-2px);
  background: #ffffff;
  color: #000000;
}

/* CSS adaptation of Shatlyk1011's Hover Border Gradient component. The site
   is server-rendered, so the existing mail link keeps its semantics while the
   rotating edge and hover highlight are handled without React dependencies. */
@keyframes hover-border-gradient-spin {
  to { transform: rotate(1turn); }
}

.work-page .hover-border-gradient {
  position: relative;
  isolation: isolate;
  min-height: 50px;
  overflow: hidden;
  padding: 1px;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: var(--w-fg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease, box-shadow 0.45s ease;
}

.work-page .hover-border-gradient::before {
  content: '';
  position: absolute;
  inset: -190%;
  z-index: 0;
  background: conic-gradient(
    from 0deg,
    transparent 0 42%,
    rgba(255, 255, 255, 0.08) 46%,
    rgba(255, 255, 255, 0.95) 50%,
    rgba(255, 255, 255, 0.08) 54%,
    transparent 58% 100%
  );
  filter: blur(2px);
  animation: hover-border-gradient-spin 4s linear infinite;
  pointer-events: none;
}

.work-page .hover-border-gradient::after {
  content: '';
  position: absolute;
  inset: 1px;
  z-index: 1;
  border-radius: inherit;
  background: rgba(3, 3, 3, 0.96);
  pointer-events: none;
}

.work-page .hover-border-gradient > span {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 31px;
  border-radius: inherit;
  white-space: nowrap;
}

.work-page .hover-border-gradient:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(92, 142, 255, 0.28),
    0 0 26px rgba(50, 117, 248, 0.22);
}

.work-page .hover-border-gradient:hover::before {
  background: conic-gradient(
    from 0deg,
    transparent 0 38%,
    rgba(50, 117, 248, 0.12) 43%,
    #3275f8 48%,
    #dce8ff 50%,
    #3275f8 52%,
    rgba(50, 117, 248, 0.12) 57%,
    transparent 62% 100%
  );
  animation-duration: 1.2s;
}

.work-page .hover-border-gradient:focus-visible {
  outline: 2px solid #8bb1ff;
  outline-offset: 4px;
}

/* === FOOTER === */
.work-footer {
  background: var(--w-bg);
  border-top: 1px solid var(--w-border);
  padding: clamp(32px, 5vw, 56px) clamp(20px, 5vw, 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.work-footer-copy {
  font-size: 12px;
  color: var(--w-subtle);
}

.work-footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  list-style: none;
}

.work-footer-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(242, 242, 240, 0.58);
  transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.work-footer-links a:hover {
  color: var(--w-fg);
  transform: translateY(-2px);
}

.work-footer-links svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.back-to-top {
  position: fixed;
  right: clamp(18px, 3vw, 36px);
  bottom: clamp(18px, 3vw, 36px);
  z-index: 120;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: none;
  background: none;
  color: var(--w-fg);
  cursor: pointer;
  /* Soft dark halo keeps the white arrow legible over lighter project
     imagery without any container or heavy shadow. */
  filter: drop-shadow(0 1px 8px rgba(0, 0, 0, 0.4));
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 0.75;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

/* === STACK: MOBILE / REDUCED-MOTION FALLBACK ===
   Applied via JS (small viewport or prefers-reduced-motion): drops the
   sticky pin/cover effect for a plain vertical scroll-in stack. */
.no-stack {
  padding: clamp(20px, 5vw, 80px);
  padding-top: 0;
}

/* Flat mode: drop the pin and fade each unit (image + its caption) in.
   Cards fill the container width here (the 56vw column would be too narrow
   on phones); the 16:9 ratio and caption-below layout are unchanged. */
.no-stack .stack-card {
  position: relative;
  top: auto;
  z-index: auto;
  width: 100%;
  max-width: none;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  margin: 0 0 clamp(28px, 5vw, 44px);
}

.no-stack .stack-card:last-child {
  margin-bottom: 0;
}

.no-stack .stack-card.in-view {
  opacity: 1;
  transform: translateY(0);
}

.no-stack .stack-card-media {
  box-shadow: none;
  border-radius: var(--w-radius-sm);
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .case-meta-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .work-nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(10px, 2.5vw, 16px);
    width: 100%;
    min-height: 0;
    padding: 10px clamp(8px, 2.5vw, 14px);
    background: #000;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .case-meta-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .work-nav-logo {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    width: clamp(54px, 15vw, 72px);
  }
  .work-nav-links {
    z-index: 1;
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: clamp(0px, 0.35vw, 3px);
    width: auto;
    max-width: none;
    min-width: 0;
    margin-left: 0;
    padding: 0;
    overflow: visible;
  }
  .work-nav-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 7px clamp(1px, 0.4vw, 3px);
    font-size: clamp(9.5px, 2.75vw, 13px);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
  }
  .work-nav-links li:not(.nav-liquid-indicator) {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 0;
  }
  .work-nav-links .nav-liquid-indicator {
    min-width: 0;
    height: 30px;
    border-color: rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.11);
  }
  .work-cta {
    align-items: center;
  }
  .contact-section {
    padding-top: 76px;
    padding-bottom: 88px;
  }
  .contact-chat {
    border-radius: 18px;
  }
}

@media (max-width: 480px) {
  .work-footer {
    gap: 12px;
  }
  .work-footer-links {
    gap: 22px;
    flex-wrap: wrap;
  }
  .back-to-top {
    right: 16px;
    bottom: 16px;
  }
  .back-to-top svg {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 340px) {
  .contact-shortcut {
    display: none;
  }

  .contact-composer textarea {
    padding-right: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * , *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .work-hero-v3::before {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
    will-change: auto;
  }
  .work-hero-v3::after {
    opacity: 0 !important;
    will-change: auto;
  }
  .no-stack .stack-card {
    transition: opacity 0.2s ease !important;
    transform: none !important;
  }
  .work-page .hover-border-gradient::before {
    animation: none !important;
    transform: rotate(45deg);
  }
}
