/*
 * Case-study motion layer
 *
 * Hand-authored, opt-in styles for work/* pages. Runtime state is applied by
 * animations.js; without those classes, every project remains fully visible.
 */

:root {
  --case-motion-ink: #111;
  --case-motion-muted: rgb(17 17 17 / 32%);
  --case-motion-line: rgb(17 17 17 / 18%);
  --case-motion-focus: #5b45ff;
  --case-motion-ease: cubic-bezier(.16, 1, .3, 1);
  --case-motion-fast: 220ms;
  --case-motion-medium: 420ms;
}

/* Editorial chapter indices mark each heading without changing its content. */
.case-motion-heading {
  position: relative;
}

.case-motion-heading::before {
  content: attr(data-motion-index);
  position: absolute;
  top: .48em;
  right: calc(100% + 18px);
  color: currentColor;
  font-size: .625rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .12em;
  opacity: .42;
}

/* Existing rich-text figure children receive these classes at runtime. */
.case-motion-figure__mask {
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
}

.case-motion-figure__media {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 50%;
}

html.case-motion-ready .case-motion-figure.is-motion-pending .case-motion-figure__mask {
  clip-path: none;
}

html.case-motion-ready .case-motion-figure.is-motion-pending .case-motion-figure__media {
  transform: none;
}

.case-motion-figure.is-motion-complete .case-motion-figure__mask {
  clip-path: inset(0 round 0);
}

/* Other projects: the title link's ::after (responsive.css) makes the whole
   card the target; pointer hover and keyboard focus share the image frame.
   animations.js adds the image scale and the title line where motion runs. */
.related-work-card { cursor: pointer; }
.related-work-card .related-work-image-wrap {
  position: relative;
  isolation: isolate;
}

.related-work-card .related-work-image-wrap::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 1px solid rgb(255 255 255 / 88%);
  border-radius: inherit;
  opacity: 0;
  transform: scale(.96);
  transition: opacity var(--case-motion-fast) var(--case-motion-ease), transform var(--case-motion-medium) var(--case-motion-ease);
}

.related-work-card:is(:hover, :focus-within) .related-work-image-wrap::after {
  opacity: 1;
  transform: scale(1);
}

/* The static width lets the existing GSAP scaleX underline animate cheaply. */
.related-work-card .work-title-line {
  width: 100% !important;
  transform-origin: 0 50%;
}

.related-work-image-wrap:focus-visible,
.related-work-title:focus-visible,
.summary a:focus-visible,
.nav-menu-area > .nav-link:focus-visible,
.nav-logo-wrap:focus-visible,
.video-frame-toggle:focus-visible {
  outline: 2px solid var(--case-motion-focus);
  outline-offset: 4px;
}

/* Editorial links get the same clear signal for hover and keyboard focus. */
.summary a {
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}

.summary a:is(:hover, :focus-visible) {
  text-decoration-color: currentColor;
  text-underline-offset: .3em;
}

/* CTA layers are injected inside the existing button. */
.dark-button.projects.case-motion-button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transform: translateZ(0);
}

.dark-button.projects.case-motion-button .case-motion-button__label {
  position: relative;
  z-index: 2;
  display: inline-block;
  color: inherit;
}

.dark-button.projects.case-motion-button .case-motion-button__accent {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #fff;
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.dark-button.projects.case-motion-button:is(:hover, :focus-visible, .is-active) {
  color: var(--case-motion-ink);
}

.dark-button.projects.case-motion-button:is(:hover, :focus-visible, .is-active) .case-motion-button__accent {
  transform: scaleX(1);
}

.dark-button.projects:focus-visible,
.back-to-top-wrap:focus-visible {
  outline: 2px solid var(--case-motion-focus);
  outline-offset: 4px;
}

.nav-menu-area > .nav-link:is(:hover, :focus-visible),
.nav-logo-wrap:is(:hover, :focus-visible) {
  translate: 0 0;
}

@media (max-width: 991px), (hover: none), (pointer: coarse) {
  .case-motion-heading::before {
    display: none;
  }

  html.case-motion-ready .case-motion-figure.is-motion-pending .case-motion-figure__mask {
    clip-path: none;
  }

  html.case-motion-ready .case-motion-figure.is-motion-pending .case-motion-figure__media {
    transform: none;
  }

  .related-work-card:is(:hover, :focus-within),
  .related-work-card:is(:hover, :focus-within) .related-work-title,
  .related-work-card:is(:hover, :focus-within) .work-category-text {
    transform: none;
  }

  .dark-button.projects.case-motion-button:is(:hover, :focus-visible, .is-active),
  .back-to-top-wrap:is(:hover, :focus-visible, .is-active) {
    scale: 1;
    transform: none;
  }

}

@media (prefers-reduced-motion: reduce) {
  .case-motion-figure__mask,
  .case-motion-figure__media,
  .related-work-card,
  .dark-button.projects,
  .back-to-top-wrap,
  .back-to-top-arrow-wrap,
  .nav-menu-area > .nav-link,
  .nav-logo-wrap,
  .video-frame-toggle {
    animation: none !important;
    transition: none !important;
  }

  html.case-motion-ready .case-motion-figure.is-motion-pending .case-motion-figure__mask {
    clip-path: none;
  }

  html.case-motion-ready .case-motion-figure.is-motion-pending .case-motion-figure__media,
  .case-motion-figure:hover .case-motion-figure__media,
  .related-work-card,
  .dark-button.projects,
  .back-to-top-wrap,
  .back-to-top-arrow-wrap,
  .nav-menu-area > .nav-link,
  .nav-logo-wrap,
  .video-frame-toggle {
    opacity: 1;
    filter: none;
    scale: 1;
    translate: 0;
    transform: none;
  }

  .related-work-card:is(:hover, :focus-within),
  .related-work-card:is(:hover, :focus-within) .related-work-title,
  .related-work-card:is(:hover, :focus-within) .work-category-text,
  .related-work-card:is(:hover, :focus-within) .work-image {
    opacity: 1;
    filter: none;
    transform: none;
  }

  /* The frame is a resting state, not motion: it still answers hover and focus. */
  .related-work-card .related-work-image-wrap::after {
    transition: none;
    transform: none;
  }

  .dark-button.projects.case-motion-button .case-motion-button__accent {
    display: none;
  }
}

/* Related service (SEO task T2, 2026-10-21): after the article, before the
   other projects, one reading-width lilac card names the service this case
   proves and links its page. No motion owner. */
.case-related-service { padding: 0 var(--site-gutter, 24px) clamp(32px, 4vw, 56px); }
.case-related-service > .container-large { width: 100%; max-width: var(--site-content, 1200px); margin: 0 auto; padding: 0 !important; }
.case-related-service-card {
  max-width: var(--site-readable, 720px);
  padding: clamp(24px, 3vw, 40px);
  border-radius: var(--site-radius-md, 24px);
  color: #0A1628;
  background: #D6D4ED;
  font-family: Inter, "Inter Fallback", sans-serif;
}
.case-related-service-label { margin: 0 0 10px; color: rgb(10 22 40 / 70%); font: 600 .8125rem/1.3 Inter, "Inter Fallback", sans-serif; letter-spacing: .02em; text-transform: uppercase; }
.case-related-service-title { margin: 0 0 12px; color: #0A1628; font-family: "Funnel Display", "Funnel Display Fallback", Inter, "Inter Fallback", sans-serif; font-size: clamp(1.625rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; text-transform: none; }
.case-related-service-text { margin: 0 0 18px; color: #0A1628; font: 400 1.0625rem/1.5 Inter, "Inter Fallback", sans-serif; letter-spacing: -.012em; }
.case-related-service-link {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 13px 24px;
  border: 1px solid #0A1628; border-radius: 999px; color: #D6D4ED; background: #0A1628;
  font: 400 .875rem/1.4 Inter, "Inter Fallback", sans-serif; text-decoration: none; text-align: center;
}
.case-related-service-link:is(:hover, :focus-visible) { text-decoration: underline; text-underline-offset: 4px; }
.case-related-service-link:focus-visible { outline: 3px solid #0A1628; outline-offset: 4px; }
@media (max-width: 479px) { .case-related-service-card { padding: 22px 18px; border-radius: var(--site-radius-sm, 14px); } }
/* The measurement note reads at body size in a readable measure (2026-10-22);
   it had been the smallest text on the page at 14px over 107 characters. */
body .summary > .case-evidence-note { max-width: 62ch; font-size: 1.0625rem; line-height: 1.6; }
