/*
 * Canonical motion rules for the context and method sections.
 * Kept separate while the visual revision is validated; this file intentionally
 * overrides legacy experiments without changing unrelated sections.
 */

@media (min-width: 901px) {
  .context {
    --context-content-out: 0;
    --context-focus: 0;
    --context-lift: 0;
    --context-exit: 0;
    min-height: 128svh;
    padding: 0;
  }

  .context .context-stage {
    position: sticky;
    top: 0;
    height: 100svh;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto;
    column-gap: var(--grid-gutter);
    row-gap: clamp(42px, 6vh, 74px);
    align-content: center;
    overflow: hidden;
    padding-block: clamp(52px, 8vh, 90px);
  }

  .context .context-heading { display: contents; }

  .context .context-heading > div:first-child {
    position: relative;
    z-index: 4;
    grid-column: 1 / span 7;
    grid-row: 1;
    align-self: start;
  }

  .context .context-keywords {
    position: relative;
    z-index: 2;
    grid-column: 7 / -1;
    grid-row: 1;
    align-self: start;
    width: 100%;
    min-height: clamp(330px, 43vh, 410px);
    margin: -12px 0 0;
  }

  .context .context-keywords span:nth-child(1) { left: 1% !important; top: 5% !important; }
  .context .context-keywords span:nth-child(2) { left: 36% !important; right: auto !important; top: 0 !important; }
  .context .context-keywords span:nth-child(3) { right: 2% !important; top: 15% !important; }
  .context .context-keywords span:nth-child(4) { left: 13% !important; top: 36% !important; }
  .context .context-keywords span:nth-child(5) { left: 48% !important; right: auto !important; top: 40% !important; }
  .context .context-keywords span:nth-child(6) { right: 0 !important; top: 58% !important; bottom: auto !important; }
  .context .context-keywords span:nth-child(7) { left: 4% !important; top: 70% !important; bottom: auto !important; }
  .context .context-keywords span:nth-child(8) { left: 39% !important; top: 78% !important; bottom: auto !important; }
  .context .context-keywords span:nth-child(9) { right: 14% !important; top: 86% !important; bottom: auto !important; }

  .context .context-copy { display: contents; }

  .context .context-copy p {
    align-self: start;
    max-width: 31ch;
    margin: 0;
  }

  .motion-ready .context.is-visible .context-heading > div:first-child,
  .motion-ready .context.is-visible .context-keywords,
  .motion-ready .context.is-visible .context-copy p {
    opacity: calc(1 - var(--context-content-out));
    transform: translate3d(0, calc(var(--context-content-out) * -34px), 0);
    transition: none;
  }

  .context .context-copy p:first-child { grid-column: 5 / span 4; grid-row: 2; }
  .context .context-copy p:last-child { grid-column: 9 / -1; grid-row: 2; }

  .context .context-transition-frame {
    position: absolute;
    z-index: 5;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: var(--context-focus);
    transition: none;
  }

  .motion-ready .context .context-transition-frame .context-transition {
    position: absolute !important;
    left: 50% !important;
    right: auto !important;
    top: calc(53% - var(--context-lift) * 4%);
    bottom: auto !important;
    width: min(90vw, 1260px) !important;
    margin: 0 !important;
    text-align: center;
    opacity: 1 !important;
    transform: translate3d(-50%, -50%, 0)
      scale(calc(1 + var(--context-lift) * .035)) !important;
    transform-origin: 50% 50%;
  }

  .motion-ready .context .context-transition span {
    display: block;
    opacity: 1;
    white-space: nowrap;
    transition: none !important;
    will-change: transform;
  }

  .motion-ready .context .context-transition span:first-child {
    transform: translate3d(0, calc((1 - var(--context-focus)) * -105%), 0) !important;
  }

  .motion-ready .context .context-transition span:last-child {
    transform: translate3d(0, calc((1 - var(--context-focus)) * 105%), 0) !important;
    background-position: calc((1 - var(--context-focus)) * 100%) 0;
  }

  .method {
    height: 245svh;
  }

  .method .method-inner {
    padding-block: clamp(34px, 5.5vh, 68px);
  }

  .method .method-opening {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(240px, .65fr);
    gap: clamp(48px, 8vw, 118px);
    align-items: center;
  }

  .method .method-opening > div:first-child { min-width: 0; }

  .method .method-opening h2 { max-width: none; }
  .method .method-opening h2,
  .method .method-intro { overflow: hidden; }

  .method .method-opening h2 > span,
  .method .method-intro > span {
    display: block;
    opacity: 0;
    transform: translate3d(0, 105%, 0);
    transition: opacity .48s ease, transform .72s cubic-bezier(.2, .72, .25, 1);
    will-change: opacity, transform;
  }

  .method.is-engaged .method-opening h2 > span,
  .method.is-engaged .method-intro > span {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  .method .method-opening h2 > span:nth-child(2) { transition-delay: 55ms; }
  .method .method-opening h2 > span:nth-child(3) { transition-delay: 110ms; }
  .method .method-intro > span:nth-child(1) { transition-delay: 150ms; }
  .method .method-intro > span:nth-child(2) { transition-delay: 205ms; }
  .method .method-intro > span:nth-child(3) { transition-delay: 260ms; }

  .method .method-symbols {
    position: relative;
    width: clamp(190px, 20vw, 300px);
    aspect-ratio: 1;
    justify-self: end;
  }

  .method .method-symbol {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.35;
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(.94);
    transition: opacity .42s ease, transform .58s cubic-bezier(.2, .72, .25, 1);
  }

  .method .method-symbol.is-active {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }

  .method .method-line {
    flex-shrink: 0;
    margin-top: clamp(36px, 5vh, 58px);
  }

  .method .method-line span {
    transition: none;
    will-change: transform;
  }

  .method .method-grid {
    gap: clamp(22px, 3vw, 48px);
  }

  .method .method-grid article {
    position: relative;
    opacity: calc(.2 + var(--card-reveal, 0) * .8);
    transform: translate3d(0, calc((1 - var(--card-reveal, 0)) * 30px), 0);
    clip-path: inset(calc((1 - var(--card-reveal, 0)) * 20%) 0 0 0);
    will-change: opacity, transform, clip-path;
  }

}

@media (min-width: 901px) and (max-height: 820px) {
  .context .context-stage {
    row-gap: clamp(24px, 3.5vh, 36px);
    padding-block: 34px;
  }
  .context h2 { font-size: clamp(40px, 4.2vw, 62px); }
  .context .context-keywords { min-height: 300px; }
  .context .context-copy p { font-size: clamp(16px, 1.25vw, 19px); line-height: 1.48; }
  .motion-ready .context .context-transition-frame .context-transition {
    font-size: clamp(27px, 2.7vw, 40px);
  }
}

@media (max-width: 900px) {
  .hero-new { grid-template-columns: minmax(0, 1fr) !important; overflow: hidden; }
  .hero-new .hero-copy { min-width: 0; width: 100%; }
  .hero-new .hero-support,
  .hero-new .hero-complement { width: 100%; max-width: 100%; white-space: normal; overflow-wrap: break-word; }
  .context .context-transition-frame { display: contents; }
  .context .context-transition { margin-top: var(--space-7); }
  .context .context-transition span { white-space: normal; }
  .method .method-symbols { width: min(250px, 66vw); margin: 42px auto 10px; }
  .method .method-symbol { display: none; width: 100%; height: auto; fill: none; stroke: currentColor; stroke-width: 1.4; }
  .method .method-symbol.is-active { display: block; }
}

/* Mobile: the photo arrives first, then the copy opens a space above it. */
@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .hero-new { --hero-details-delay: .62s; }
  .hero-new.is-typing .hero-visual { opacity: 0; animation: none; }
  .hero-new.is-photo-entering .hero-visual,
  .hero-new.is-typed .hero-visual {
    animation: mobile-hero-photo-in .56s cubic-bezier(.2,.75,.3,1) both;
  }
  .hero-new .hero-visual img { animation: none; }

  .hero-new .hero-details {
    display: grid;
    grid-template-rows: 1fr;
  }
  .hero-new .hero-details-inner { min-height: 0; }
  .hero-new.is-typing .hero-details { grid-template-rows: 0fr; }
  .hero-new.is-typing .hero-details-inner { visibility: hidden; overflow: hidden; }
  .hero-new.is-typed .hero-details {
    animation: mobile-hero-details-open .66s cubic-bezier(.25,.75,.25,1) var(--hero-details-delay) both;
  }
  .hero-new.is-typed .hero-details-inner {
    animation: mobile-hero-details-clip .66s steps(1, end) var(--hero-details-delay) both;
  }
  .hero-new.is-typed .hero-support { animation-delay: var(--hero-details-delay); }
  .hero-new.is-typed .hero-complement { animation-delay: calc(var(--hero-details-delay) + .12s); }
  .hero-new.is-typed .hero-actions { animation-delay: calc(var(--hero-details-delay) + .25s); }
  .hero-new.is-typed .hero-actions .cta span { animation-delay: calc(var(--hero-details-delay) + .74s); }
}

@keyframes mobile-hero-photo-in {
  from { opacity: 0; clip-path: inset(100% 0 0); transform: translateY(22px); }
  to { opacity: 1; clip-path: inset(0); transform: translateY(0); }
}

@keyframes mobile-hero-details-open {
  from { grid-template-rows: 0fr; }
  to { grid-template-rows: 1fr; }
}

@keyframes mobile-hero-details-clip {
  from { overflow: hidden; }
  to { overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-new .eyebrow, .hero-new .hero-visual, .hero-new .hero-visual img,
  .hero-new.is-typed .hero-support, .hero-new.is-typed .hero-complement,
  .hero-new.is-typed .hero-actions, .hero-new.is-typed .hero-actions .cta span { animation: none; }
  .context .context-stage { position: relative; height: auto; }
  .context .context-heading > div:first-child,
  .context .context-keywords,
  .context .context-copy p,
  .context .context-transition-frame { opacity: 1; transform: none !important; }
  .method .method-grid article { opacity: 1; transform: none; clip-path: none; }
}

.context .context-transition span {
  font-family: roc-grotesk-wide, roc-grotesk, Arial, sans-serif;
  font-weight: 400;
}

@media (max-width: 900px) {
  .context .context-transition {
    max-width: min(100%, 28ch);
    font-size: clamp(23px, 3.6vw, 32px);
    text-wrap: balance;
  }
}

/* Keep the project panels below the actual height of the progress header. */
@media (min-width: 901px) {
  .projects { height: 320svh; }
  .projects.is-condensed .projects-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: clamp(12px, 2vh, 24px);
  }
  .projects.is-condensed .projects-heading { position: relative !important; inset: auto; }
  .projects.is-condensed .projects-heading h2 { width: 100%; white-space: normal; }
  .projects.is-condensed .project-panels { position: relative; inset: auto; }
}

@media (max-width: 900px) {
  .projects { padding-bottom: clamp(48px, 8vw, 64px); }
  .projects .project-panel:last-child { margin-bottom: 0; }
}

/* Fit the full desktop stack, including the extra width of a hovered card. */
@media (min-width: 1250px) {
  .testimonial-track { --card-overlap: 64px; padding-inline: 14px; }
  .testimonial-track .testimonial-card:not(.is-expanded):nth-child(n) {
    flex-basis: calc((100% + 5 * var(--card-overlap)) / 6 + 14px);
    margin-left: calc(-1 * var(--card-overlap));
    height: auto;
    min-height: 425px;
  }
}

@media (min-width: 768px) and (max-width: 1249px) {
  .testimonial-track {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 14px;
    padding-inline: 6px;
  }
  .testimonial-track .testimonial-card:not(.is-expanded):nth-child(n) {
    width: auto;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
    margin-left: 0;
    transform: none;
  }
}

@media (max-width: 767px) {
  .testimonial-track {
    padding-inline: 8vw;
    scroll-padding-inline: 8vw;
    scroll-snap-type: x mandatory;
    align-items: stretch;
  }
  .testimonial-track .testimonial-card:not(.is-expanded) {
    scroll-snap-align: center;
    scroll-snap-stop: always;
    overflow-wrap: anywhere;
  }
}

.ui-arrow {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -.12em;
}

.video-showcase::after {
  width: 80px;
  height: 36px;
  box-sizing: border-box;
  pointer-events: none;
}
.video-showcase .video-nav {
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  padding: 0;
}
.video-showcase .video-prev { left: calc(50% - 40px); }
.video-showcase .video-next { right: calc(50% - 40px); }
.video-showcase .video-nav .ui-arrow { width: 17px; height: 17px; }

@media (max-width: 900px) {
  .results-metrics {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    row-gap: clamp(40px, 10vw, 60px);
  }
  .results-metrics article { width: min(100%, 340px); margin-inline: auto; }
  .results-metrics article > span { margin-top: 16px; }
  .results-metrics article > p { margin-top: 10px; }
  .motion-ready .results-metrics:not(.has-entered) article:nth-child(n) {
    transform: translateY(16px);
  }
  .motion-ready .results-metrics.is-visible article:nth-child(n) { transform: none; }

  .context .context-keywords {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    min-height: 0;
    height: auto;
    margin-inline: auto;
  }
  .context .context-keywords span:nth-child(n) {
    position: static;
    min-width: 0;
    min-height: 40px;
    height: auto;
    padding: 8px 12px;
    animation: none;
    transform: none;
  }

  .projects .project-panel[data-project-panel="0"] {
    margin-bottom: clamp(70px, 18vw, 94px);
  }
  .project-panel[data-project-panel="1"] .posts-media {
    height: clamp(236px, 70vw, 344px);
    min-height: 0;
    aspect-ratio: auto;
    margin-top: 12px;
    padding-block: 12px;
  }
  .project-panel[data-project-panel="1"] .post-item {
    width: clamp(168px, 48vw, 238px);
    transform-origin: center;
  }
  .project-panel[data-project-panel="1"] .post-item.is-square {
    width: clamp(190px, 54vw, 265px);
  }
  .project-panel[data-project-panel="1"] .post-rail:not(.post-rail-reverse) .post-item {
    transform-origin: center;
  }

  .method .method-opening { gap: 12px; }
  .method .method-intro { margin-bottom: 0; }
  .method .method-symbols { width: min(150px, 43vw); margin: 0 auto 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .motion-ready .results-metrics:not(.has-entered) article:nth-child(n) {
    opacity: 1;
    transform: none;
    clip-path: none;
    transition: none;
  }
}
