/* Lightweight motion shared by the portfolio pages. Content stays visible without JS. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes site-arrive {
    from { opacity: .72; translate: 0 10px; }
    to { opacity: 1; translate: 0 0; }
  }
  @keyframes site-result {
    from { opacity: .5; transform: translate3d(0, 10px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
  }
  @keyframes site-menu {
    from { opacity: .4; transform: translate3d(0, -7px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
  }
  .site-motion-enter {
    animation: site-arrive .56s cubic-bezier(.2,.7,.2,1) var(--site-motion-delay, 0ms) backwards;
  }
  .site-header .mobile-menu[open] nav { animation: site-menu .2s ease-out; }
  .report-playground .demo-result:not([hidden]),
  .lab .onec-result:not([hidden]),
  .calc-page .calc-results:not([hidden]),
  .home .contact-status.is-success,
  .home .contact-status.is-error {
    animation: site-result .34s ease-out;
  }

  .site-header .main-nav a {
    position: relative;
    opacity: 1;
    transition: color .2s ease;
  }
  .site-header .main-nav a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -7px;
    left: 0;
    height: 2px;
    background: var(--lime);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .24s cubic-bezier(.2,.7,.2,1);
  }
  .site-header .main-nav a:hover,
  .site-header .main-nav a:focus-visible { color: var(--lime); opacity: 1; }
  .site-header .main-nav a:hover::after,
  .site-header .main-nav a:focus-visible::after { transform: scaleX(1); }

  .site-header .header-contact span,
  .home .action span[aria-hidden],
  .home .project-more-link span,
  .case--editorial .case-button>span:last-child,
  .case--editorial .case-demo-cta>span:last-child,
  .home .contact-button>span:last-child {
    display: inline-block;
    transition: transform .24s ease;
  }
  .site-header .header-contact:hover span,
  .site-header .header-contact:focus-visible span,
  .home .action:hover span[aria-hidden],
  .home .action:focus-visible span[aria-hidden],
  .home .project-more-link:hover span,
  .case--editorial .case-button:hover>span:last-child,
  .case--editorial .case-demo-cta:hover>span:last-child,
  .home .contact-button:hover>span:last-child { transform: translate3d(3px, -2px, 0); }

  .demo-catalog-card,
  .about-next a,
  .case--editorial .case-next a {
    transition: transform .24s ease, border-color .24s ease, box-shadow .24s ease;
  }
  .demo-catalog-card:hover,
  .demo-catalog-card:focus-within,
  .about-next a:hover,
  .about-next a:focus-visible,
  .case--editorial .case-next a:hover,
  .case--editorial .case-next a:focus-visible {
    transform: translateY(-4px);
    border-color: var(--lime);
    box-shadow: 0 14px 30px #0003;
  }
  .about-skill-card,
  .case--editorial .detail-card,
  .calc-page .calc-scenario-grid article {
    transition: background-color .25s ease, border-color .25s ease;
  }
  .about-skill-card:hover { background-color: #e6ffa0; }
  .case--editorial .detail-card:hover { border-color: var(--case-accent); background-color: #23392b; }

  .home .contact-form :is(input:not([type=hidden]), select, textarea),
  .calc-page :is(input, select),
  .report-playground :is(input, select) { transition: border-color .2s ease, box-shadow .2s ease; }
  .home .contact-form :is(input:not([type=hidden]), select, textarea):focus-visible {
    box-shadow: 0 3px 0 #315d2b55;
  }
  .lab :is(.tg-scenarios, .onec-scenarios) button:hover,
  .lab :is(.tg-scenarios, .onec-scenarios) button:focus-visible {
    border-color: var(--lime);
  }
  .lab .tg-timeline-item { transition: border-color .22s ease, background-color .22s ease; }
  .lab .tg-timeline-item.is-active { border-color: var(--lime); background-color: #294331; }

  :is(.home .action, .home .project-more-link, .case--editorial .case-button,
      .demo-catalog-actions a, .about-hero-links a, .lab button,
      .report-playground button, .calc-page button, .contact-button):active {
    transform: scale(.985);
  }
}

/* Same-origin multi-page navigation. Unsupported browsers keep native links. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  /* A single stable shared element, not snapshots of every project card. */
  .site-header .brand { view-transition-name: portfolio-brand; }
  ::view-transition-group(root),
  ::view-transition-group(portfolio-brand),
  ::view-transition-old(root),
  ::view-transition-new(root),
  ::view-transition-old(portfolio-brand),
  ::view-transition-new(portfolio-brand) {
    animation-duration: 220ms;
    animation-timing-function: cubic-bezier(.2,.7,.2,1);
  }
}
