/*
 * Astrid Motion System
 * A restrained, reusable enhancement for every public page.
 * Never hides content unless motion.js successfully enables progressive reveals.
 * Respects OS-level reduced-motion preferences.
 * Palette remains #3D09AC, #121212 and #F8F8F8.
 */
:root {
  --astrid-ease: cubic-bezier(.22, 1, .36, 1);
  --astrid-soft-ease: cubic-bezier(.2, .75, .28, 1);
}

/* Readable without animation: state classes are only applied by JavaScript. */
@media (prefers-reduced-motion: no-preference) {
  /* Entrance of the opening editorial copy, followed by the actual product visual. */
  .motion-ready .hero-copy,
  .motion-ready .page-hero-copy {
    animation: astrid-intro-up .85s var(--astrid-ease) both;
  }
  .motion-ready .hero-art,
  .motion-ready .page-hero-visual {
    animation: astrid-intro-up 1.05s var(--astrid-ease) .12s both;
  }
  .motion-ready .hero-benefits,
  .motion-ready .benefit-strip {
    animation: astrid-intro-up .85s var(--astrid-ease) .24s both;
  }

  /* Real scroll-triggered entrance, never a static invisible fallback. */
  .motion-ready .motion-reveal {
    opacity: 0;
    transform: translate3d(0, 23px, 0);
    transition:
      opacity .72s ease var(--motion-delay, 0ms),
      transform .82s var(--astrid-ease) var(--motion-delay, 0ms);
  }
  .motion-ready .motion-reveal.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  /* These motions stop when the visuals are outside the viewport. */
  .motion-ready .hero-phone.motion-play,
  .motion-ready .product-device.motion-play,
  .motion-ready .household-preview.motion-play {
    animation: astrid-device-float 7s ease-in-out infinite alternate;
  }
  .motion-ready .hero-robot.motion-play,
  .motion-ready .product-companion.motion-play,
  .motion-ready .discovery-astrid.motion-play,
  .motion-ready .join-astrid img.motion-play,
  .motion-ready .home-premium-image > img.motion-play {
    animation: astrid-character-breathe 5.7s ease-in-out infinite alternate;
  }
  .motion-ready .hero-float.motion-play,
  .motion-ready .product-float.motion-play,
  .motion-ready .premium-floating-note.motion-play {
    animation: astrid-soft-drift 6.5s ease-in-out infinite alternate;
  }
  .motion-ready .product-orbit.motion-play,
  .motion-ready .stage-circle.motion-play {
    animation: astrid-orbit-drift 13s ease-in-out infinite alternate;
  }
  .motion-ready .product-orbit.orbit-two.motion-play,
  .motion-ready .stage-circle-two.motion-play { animation-direction: alternate-reverse; }

  /* Product UI is deliberately illustrative; small movement makes it easier to scan. */
  .motion-ready .hero-phone.motion-play .phone-summary-progress i,
  .motion-ready .product-device.motion-play .device-highlight-progress i,
  .motion-ready .product-device.motion-play .device-progress-track em {
    transform-origin: left center;
    animation: astrid-progress-arrive 1.2s var(--astrid-ease) .6s both;
  }
  .motion-ready .demo-content-inner {
    animation: astrid-demo-switch .34s var(--astrid-ease) both;
  }

  /* The mobile menu opens without changing its centring transform. */
  .motion-ready .mobile-nav:not([hidden]) {
    animation: astrid-menu-enter .26s var(--astrid-ease) both;
  }
  .motion-ready .mobile-nav:not([hidden]) a {
    animation: astrid-menu-item .3s var(--astrid-ease) both;
  }
  .motion-ready .mobile-nav:not([hidden]) a:nth-child(2) { animation-delay: 35ms; }
  .motion-ready .mobile-nav:not([hidden]) a:nth-child(3) { animation-delay: 70ms; }
  .motion-ready .mobile-nav:not([hidden]) a:nth-child(4) { animation-delay: 105ms; }
  .motion-ready .mobile-nav:not([hidden]) a:nth-child(5) { animation-delay: 140ms; }

  /* Native details stay accessible and usable with keyboard/assistive technology. */
  .motion-ready .faq-list details[open] > :not(summary),
  .motion-ready .comparison-details[open] > :not(summary) {
    animation: astrid-accordion-in .3s var(--astrid-ease) both;
  }
  .motion-ready .faq-list summary svg,
  .motion-ready .comparison-details summary svg {
    transition: transform .25s var(--astrid-ease);
  }

  @keyframes astrid-intro-up {
    from { opacity: 0; transform: translate3d(0, 22px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
  }
  @keyframes astrid-device-float {
    from { translate: 0 0; }
    to { translate: 0 -9px; }
  }
  @keyframes astrid-character-breathe {
    from { translate: 0 0; }
    to { translate: 0 -7px; }
  }
  @keyframes astrid-soft-drift {
    from { translate: 0 2px; }
    to { translate: 0 -7px; }
  }
  @keyframes astrid-orbit-drift {
    from { translate: 0 0; opacity: .6; }
    to { translate: 9px -10px; opacity: .95; }
  }
  @keyframes astrid-progress-arrive {
    from { scale: .35 1; }
    to { scale: 1 1; }
  }
  @keyframes astrid-demo-switch {
    from { opacity: .25; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes astrid-menu-enter {
    from { opacity: 0; translate: 0 -8px; }
    to { opacity: 1; translate: 0 0; }
  }
  @keyframes astrid-menu-item {
    from { opacity: 0; translate: 0 5px; }
    to { opacity: 1; translate: 0 0; }
  }
  @keyframes astrid-accordion-in {
    from { opacity: .45; translate: 0 -5px; }
    to { opacity: 1; translate: 0 0; }
  }
}

/* Interaction is just as considered as entrance animation. */
.site-header .header-inner {
  transition: box-shadow .35s ease, border-color .35s ease, background-color .35s ease;
}
.site-header.is-scrolled .header-inner {
  border-color: rgba(61, 9, 172, .18);
  box-shadow: 0 16px 48px rgba(18, 18, 18, .105);
}
/* Very restrained reading-progress indicator, separate from page scrollbars. */
.site-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: #3D09AC;
  transform: scaleX(var(--astrid-scroll-progress, 0));
  transform-origin: left center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.site-header.is-scrolled::after { opacity: .85; }

/* Form focus and selection communicate purpose, not decoration. */
.form-field input, .form-field select {
  transition: border-color .22s ease, box-shadow .22s ease, background-color .22s ease;
}
.form-field input:focus-visible, .form-field select:focus-visible {
  box-shadow: 0 0 0 4px rgba(61, 9, 172, .08);
}
.faq-list summary, .comparison-details summary {
  transition: color .24s ease, background-color .24s ease;
}
.faq-list summary:hover, .comparison-details summary:hover { color: #3D09AC; }
.demo-tab:focus-visible, .menu-toggle:focus-visible, .button:focus-visible {
  outline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .feature-card, .process-card, .explain-step,
  .expanded-grid article, .premium-benefit, .premium-row,
  .price-card, .discovery-item, .trust-points > div,
  .connection-illustration, .people-illustration,
  .specialist-detail-grid article, .household-member,
  .device-list-row, .device-step, .device-setting {
    transition: translate .3s var(--astrid-ease),
                box-shadow .3s ease, border-color .3s ease,
                background-color .3s ease;
  }
  .feature-card:hover, .process-card:hover, .explain-step:hover,
  .expanded-grid article:hover, .premium-benefit:hover,
  .price-card:hover, .connection-illustration:hover,
  .people-illustration:hover, .specialist-detail-grid article:hover {
    translate: 0 -5px;
    box-shadow: 0 25px 62px rgba(25, 14, 42, .075);
    border-color: rgba(61, 9, 172, .2);
  }
  .discovery-item:hover, .premium-row:hover, .trust-points > div:hover,
  .household-member:hover, .device-list-row:hover,
  .device-step:hover, .device-setting:hover {
    translate: 0 -2px;
  }
  .feature-symbol svg, .process-icon svg, .premium-benefit-icon svg,
  .discovery-item-icon svg, .trust-points > div svg,
  .device-row-icon svg, .premium-row-icon svg {
    transition: transform .32s var(--astrid-ease);
  }
  .feature-card:hover .feature-symbol svg,
  .process-card:hover .process-icon svg,
  .premium-benefit:hover .premium-benefit-icon svg,
  .discovery-item:hover .discovery-item-icon svg,
  .premium-row:hover .premium-row-icon svg {
    transform: scale(1.12) rotate(-5deg);
  }
  .button-primary { position: relative; overflow: hidden; isolation: isolate; }
  .button-primary::after {
    content: '';
    position: absolute;
    top: -40%; bottom: -40%;
    width: 40%;
    left: -55%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.24), transparent);
    transform: skewX(-17deg);
    transition: left .65s var(--astrid-ease);
    pointer-events: none;
  }
  .button-primary:hover::after { left: 115%; }
  .brand img { transition: transform .32s var(--astrid-ease); }
  .brand:hover img { transform: scale(1.025); }
}

/* The animation system must never hide content for people requesting less motion. */
@media (prefers-reduced-motion: reduce) {
  .motion-reveal, .motion-reveal.is-visible,
  .hero-copy, .hero-art, .page-hero-copy, .page-hero-visual {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero-phone, .hero-robot, .product-device, .product-companion,
  .household-preview, .product-float, .hero-float, .discovery-astrid,
  .premium-floating-note, .stage-circle, .product-orbit {
    animation: none !important;
    translate: none !important;
  }
  .site-header::after { display: none; }
  .mobile-nav:not([hidden]), .mobile-nav:not([hidden]) a { animation: none !important; }
}
