/* NoteHarbor "flow" motion layer (2026-11-09), loaded last. Pairs with flow.js.
   One easing family, transform/opacity only, and nothing here hides content
   when JavaScript or animations do not run (all states default to visible). */
:root { --flow-ease: cubic-bezier(.16, 1, .3, 1); --flow-blue: 56, 152, 255; }

/* ---- Hero: the product window rises into place in 3D, then catches the light ---- */
body[data-home] .hero { position: relative; isolation: isolate; }
.flow-aurora {
  position: absolute; inset: -12% -8% auto; height: 118%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 32% at 28% 34%, rgba(11, 132, 243, .20), transparent 70%),
    radial-gradient(34% 30% at 74% 42%, rgba(56, 189, 248, .13), transparent 72%),
    radial-gradient(30% 26% at 52% 78%, rgba(99, 102, 241, .10), transparent 70%);
  opacity: .9; will-change: transform;
}
@media (prefers-reduced-motion: no-preference) {
  .flow-aurora { animation: flow-drift 22s ease-in-out infinite alternate; }
  .flow-paused .flow-aurora { animation-play-state: paused; }
}
@keyframes flow-drift {
  0% { transform: translate3d(-2%, 0, 0) scale(1); }
  50% { transform: translate3d(2%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(0, 2%, 0) scale(1.02); }
}

@media (prefers-reduced-motion: no-preference) and (min-width: 761px) {
  body[data-home] .product-surface { animation: flow-window-rise 1100ms var(--flow-ease) 360ms both; transform-origin: 50% 0; }
  body[data-home] .product-frame { position: relative; overflow: hidden; }
  body[data-home] .product-frame::after {
    content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3;
    background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .10) 48%, rgba(255, 255, 255, .02) 54%, transparent 62%);
    transform: translateX(-120%); animation: flow-sheen 1500ms ease-out 1250ms 1 both;
  }
}
@keyframes flow-window-rise {
  from { opacity: 0; transform: perspective(1600px) translate3d(0, 70px, 0) rotateX(18deg) scale(.93); }
  60% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
@keyframes flow-sheen { to { transform: translateX(120%); } }

/* Magnetic primary button (flow.js sets the offsets; individual transform property composes with existing ones). */
body[data-home] .hero-ctas [data-store] { translate: var(--magnet-x, 0px) var(--magnet-y, 0px); transition: translate 380ms var(--flow-ease), box-shadow 220ms ease; }
@media (hover: hover) and (pointer: fine) {
  body[data-home] .hero-ctas [data-store]:hover { box-shadow: 0 10px 34px -10px rgba(var(--flow-blue), .55); }
}

/* ---- Section headings: each word rises from behind its own line, crisp, no blur ---- */
@keyframes nh-word-arrive {
  from { opacity: 0; transform: translate3d(0, .62em, 0) rotate(1.5deg); clip-path: inset(0 0 100% 0); }
  to { opacity: 1; transform: none; clip-path: inset(-.1em -.1em -.3em -.1em); }
}
@media (prefers-reduced-motion: no-preference) {
  .scroll-motion .section-heading.motion-reveal.motion-seen .motion-word {
    animation: nh-word-arrive 620ms var(--flow-ease) calc(var(--word-order, 0) * 38ms) both;
  }
  html[dir=rtl] .scroll-motion .section-heading.motion-reveal.motion-seen .motion-word { animation-name: nh-word-arrive-rtl; }
}
@keyframes nh-word-arrive-rtl {
  from { opacity: 0; transform: translate3d(0, .62em, 0) rotate(-1.5deg); clip-path: inset(0 0 100% 0); }
  to { opacity: 1; transform: none; clip-path: inset(-.1em -.1em -.3em -.1em); }
}

/* ---- Feature stories: media drifts with the scroll and a soft glow follows the story you are reading ---- */
html.flow-on body[data-home] :is(.story-row .story-visual, .library-preview, .orbit-gallery) {
  translate: 0 var(--flow-y, 0px); scale: var(--flow-s, 1);
}
body[data-home] .story-row > .story-copy, body[data-home] .story-row > .story-visual { position: relative; z-index: 1; }
body[data-home] .story-row > .flow-glow {
  grid-row: 1; grid-column: 2; align-self: center; justify-self: center; z-index: 0;
  width: 78%; height: 68%; pointer-events: none; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--flow-blue), .28), rgba(var(--flow-blue), .08) 55%, transparent 100%);
  filter: blur(36px); opacity: var(--flow-focus, 0); will-change: opacity;
}
body[data-home] .story-row:nth-child(even) > .flow-glow { grid-column: 1; }
html:not(.flow-on) body[data-home] .story-row > .flow-glow { display: none; }
@media (max-width: 760px) {
  body[data-home] .story-row > .flow-glow, body[data-home] .story-row:nth-child(even) > .flow-glow { display: none; }
}

/* Story entrances: media unveils from a slight zoom with a rounded mask instead of a plain fade. */
@media (prefers-reduced-motion: no-preference) and (min-width: 761px) {
  body[data-home].story-motion .story-row .story-visual {
    clip-path: inset(6% 4% 6% 4% round 22px);
    transition: opacity 420ms ease-out, transform 760ms var(--flow-ease), clip-path 900ms var(--flow-ease) !important;
  }
  body[data-home].story-motion .story-row.story-entered .story-visual,
  body[data-home].story-motion .story-row:focus-within .story-visual { clip-path: inset(0 0 0 0 round 16px); }
}

/* ---- Cards: pointer spotlight and a small lift ---- */
.flow-card { position: relative; }
.flow-spot {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  opacity: 0; transition: opacity 260ms ease;
  background:
    radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--flow-blue), .13), transparent 62%);
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .flow-card:hover > .flow-spot { opacity: 1; }
  body[data-home] :is(.price-card, .stacking-card, .studio-edition-card) { transition-property: translate, border-color, box-shadow, background-color; transition-duration: 380ms; transition-timing-function: var(--flow-ease); }
  body[data-home] :is(.price-card, .studio-edition-card):hover { translate: 0 -4px; box-shadow: 0 22px 48px -24px rgba(0, 0, 0, .6), 0 0 0 1px rgba(var(--flow-blue), .22); }
}

@media (prefers-reduced-motion: reduce) {
  .flow-aurora { animation: none; }
  .flow-glow, .flow-spot { display: none; }
  body[data-home] .hero-ctas [data-store] { translate: none; }
  body[data-home].story-motion .story-row .story-visual { clip-path: none !important; }
}
