/* Motion. Everything here runs only for people who haven't asked their device for reduced motion,
   and every starting state lives inside that query, so without it the pages are simply still. */

/* Shooting stars and a slow nebula drift behind everything (the layer is in base.html). */
.sky-fx { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sky-fx i { position: absolute; width: 140px; height: 1.5px; border-radius: 2px; opacity: 0; transform-origin: left center;
  background: linear-gradient(270deg, rgba(255,255,255,.95), rgba(247,224,173,.4) 30%, rgba(255,255,255,0)); }
.sky-fx i:nth-child(1) { top: 6%; left: 88%; }
.sky-fx i:nth-child(2) { top: 20%; left: 62%; }
.sky-fx i:nth-child(3) { top: 3%; left: 42%; }

/* Smooth fades between pages, where the browser can (Safari 18.2+, Chrome 126+); the bars stay put. */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.tabbar { view-transition-name: tabbar; }

@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

@media (prefers-reduced-motion: no-preference) {
  /* ---- the sky ---- */
  .sky-fx i:nth-child(1) { animation: shoot 11s linear 2s infinite; }
  .sky-fx i:nth-child(2) { animation: shoot 15s linear 7s infinite; }
  .sky-fx i:nth-child(3) { animation: shoot 19s linear 12s infinite; }
  @keyframes shoot {
    0% { opacity: 0; transform: translate(0, 0) rotate(145deg) scaleX(.3); }
    1.5% { opacity: 1; }
    7% { opacity: 0; transform: translate(-360px, 250px) rotate(145deg) scaleX(1); }
    100% { opacity: 0; transform: translate(-360px, 250px) rotate(145deg); }
  }
  .sky-fx::before, .sky-fx::after { content: ""; position: absolute; width: 90vmax; height: 90vmax; border-radius: 50%; }
  .sky-fx::before { left: -35vmax; top: -40vmax; background: radial-gradient(closest-side, rgba(143,125,255,.13), transparent);
    animation: drift 40s ease-in-out infinite alternate; }
  .sky-fx::after { right: -40vmax; bottom: -45vmax; background: radial-gradient(closest-side, rgba(233,194,123,.09), transparent);
    animation: drift 52s ease-in-out infinite alternate-reverse; }
  @keyframes drift { to { transform: translate(12vmax, 8vmax) scale(1.15); } }

  ::view-transition-old(root) { animation: page-out .2s ease both; }
  ::view-transition-new(root) { animation: page-in .35s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes page-out { to { opacity: 0; transform: translateY(-6px); } }
  @keyframes page-in { from { opacity: 0; transform: translateY(12px); } }

  /* ---- arriving: the hero, then everything else as it scrolls into view (app.js adds .reveal and .in) ---- */
  .hero .copy > * { animation: rise .9s cubic-bezier(.2,.7,.2,1) backwards; }
  .hero .copy > :nth-child(2) { animation-delay: .08s; }
  .hero .copy > :nth-child(3) { animation-delay: .18s; }
  .hero .copy > :nth-child(4) { animation-delay: .28s; }
  .hero .copy > :nth-child(5) { animation-delay: .38s; }
  .hero .visual { animation: wheel-in 1.6s cubic-bezier(.2,.7,.2,1) backwards; }
  @keyframes rise { from { opacity: 0; transform: translateY(22px); } }
  @keyframes wheel-in { from { opacity: 0; transform: scale(.82) rotate(-25deg); } }
  .js .reveal { opacity: 0; transform: translateY(26px) scale(.985);
    transition: opacity .8s ease var(--d, 0s), transform .9s cubic-bezier(.2,.7,.2,1) var(--d, 0s); }
  .js .reveal.in { opacity: 1; transform: none; }

  /* ---- the headline's gold catches the light ---- */
  .display { background-image: linear-gradient(110deg, #fffaf0 15%, var(--gold-2) 35%, #fff8ea 48%, var(--gold) 62%, #fffaf0 85%);
    background-size: 260% 100%; animation: shine 9s ease-in-out infinite alternate; }
  @keyframes shine { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

  /* ---- the sky wheel: rays draw in, planets arrive one by one, each sends out a slow ping; labels stay upright ---- */
  .sw-ray { stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw 1.1s ease forwards; animation-delay: calc(.5s + var(--i) * 110ms); }
  .sw-planet { transform-box: fill-box; transform-origin: center; animation: pop .8s cubic-bezier(.3,1.6,.5,1) backwards;
    animation-delay: calc(.7s + var(--i) * 110ms); }
  .sw-ping { transform-box: fill-box; transform-origin: center; opacity: 0; stroke-width: 1;
    animation: ping 5s ease-out infinite; animation-delay: calc(2s + var(--i) * .55s); }
  .sw-glyph, .sw-label { transform-box: fill-box; transform-origin: center; animation: turn-back 480s linear infinite; }
  @keyframes pop { from { opacity: 0; transform: scale(0); } }
  @keyframes ping { 0% { opacity: .75; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(2.8); } }
  @keyframes turn-back { to { transform: rotate(360deg); } }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  .hero .sky-wheel { transform: translate(calc(var(--mx, 0) * -16px), calc(var(--my, 0) * -16px)); transition: transform .4s ease-out; }
  .hero .visual::before { transform: translate(calc(var(--mx, 0) * 10px), calc(var(--my, 0) * 10px)); transition: transform .5s ease-out; }

  /* ---- cards and buttons ---- */
  .card.glow::before { background: conic-gradient(from var(--angle), rgba(247,224,173,.7), transparent 22%, transparent 40%,
      rgba(143,125,255,.6) 50%, transparent 62%, transparent 80%, rgba(247,224,173,.7)); animation: orbit-border 9s linear infinite; }
  @keyframes orbit-border { to { --angle: 360deg; } }
  .card, .chip, .btn { will-change: auto; }
  .feature:hover { transform: translateY(-6px); box-shadow: 0 28px 70px rgba(0,0,0,.35), 0 0 0 1px rgba(233,194,123,.25); }
  .feature .art svg { animation: float 6s ease-in-out infinite; }
  .feature:nth-child(2) .art svg { animation-delay: -1.5s; }
  .feature:nth-child(3) .art svg { animation-delay: -3s; }
  .feature:nth-child(4) .art svg { animation-delay: -4.5s; }
  .starter .art svg, .empty .art svg { animation: float 6s ease-in-out infinite; }
  @keyframes float { 50% { transform: translateY(-7px); } }
  .btn.primary { position: relative; overflow: hidden; isolation: isolate; }
  .btn.primary::after { content: ""; position: absolute; inset: 0; z-index: -1; transform: translateX(-130%);
    background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.6) 50%, transparent 75%); }
  .btn.primary:hover::after { transition: transform .8s ease; transform: translateX(130%); }
  .hero .btn.primary::after, .cta-band .btn.primary::after { animation: sheen 5.5s ease-in-out 2.5s infinite; }
  @keyframes sheen { 0%, 70% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
  .btn:hover { transform: translateY(-1px); }
  .step .num { animation: halo 3.6s ease-in-out infinite; }
  .step:nth-child(2) .num { animation-delay: -1.2s; } .step:nth-child(3) .num { animation-delay: -2.4s; }
  @keyframes halo { 50% { box-shadow: 0 0 0 7px rgba(233,194,123,.12), 0 0 34px rgba(233,194,123,.55); } }
  .tabbar a svg { transition: transform .25s cubic-bezier(.3,1.6,.5,1), filter .25s; }
  .tabbar a.on svg { transform: translateY(-2px); filter: drop-shadow(0 0 7px rgba(233,194,123,.7)); }
  .chip { transition: transform .2s ease, border-color .2s, background .2s; }
  .chip:hover { transform: translateY(-2px); }


  /* ---- the birth chart draws itself, then the planets appear house by house ---- */
  .north-chart .nc-frame, .north-chart .nc-lines path { stroke-dasharray: 1700; stroke-dashoffset: 1700; animation: draw 1.8s ease forwards; }
  .north-chart .nc-lines path:last-child { animation-delay: .35s; }
  .north-chart .nc-sign, .north-chart .nc-asc { animation: fade 0.6s ease 1.1s backwards; }
  .north-chart .nc-planets { animation: fade .7s ease backwards; animation-delay: calc(1.2s + var(--i, 0) * 70ms); }
  @keyframes fade { from { opacity: 0; } }

  /* ---- the match: the ring fills, the number counts up (app.js), the bars grow ---- */
  .score-ring { animation: ring 1.8s cubic-bezier(.2,.7,.2,1) .3s backwards; }
  @keyframes ring { from { stroke-dasharray: 0 527.8; } }
  .js .koota.reveal .bar i { transform: scaleX(0); transform-origin: left; transition: transform 1.1s cubic-bezier(.2,.7,.2,1) calc(var(--d, 0s) + .25s); }
  .js .koota.in .bar i { transform: none; }

  /* ---- details opening ---- */
  .how-panel:not([hidden]), .show-how .how { animation: rise .5s cubic-bezier(.2,.7,.2,1) backwards; }

  /* ---- the conversation ---- */
  .msg { animation: msg-in .5s cubic-bezier(.2,.7,.2,1) backwards; }
  .msg.user { animation-name: msg-in-right; }
  @keyframes msg-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
  @keyframes msg-in-right { from { opacity: 0; transform: translate(14px, 8px) scale(.98); } }
  .answer.streaming > :last-child::after { content: ""; display: inline-block; width: .5em; height: .5em; margin-left: 4px; border-radius: 50%;
    background: var(--gold); box-shadow: 0 0 10px var(--gold); vertical-align: middle; animation: blink-star 1s ease-in-out infinite; }
  @keyframes blink-star { 50% { opacity: .25; transform: scale(.6); } }
  .composer form { transition: box-shadow .3s, border-color .3s; }
  .composer form:focus-within { border-color: var(--gold); box-shadow: 0 16px 50px rgba(0,0,0,.45), 0 0 0 4px rgba(233,194,123,.12), 0 0 40px rgba(233,194,123,.15); }
}

/* People ask: two rows that drift slowly in opposite directions and can be swiped (app.js scrolls them and
   doubles each row so it loops). Without motion they simply wrap, and their copies hide. */
.marquee.looping { overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.marquee.looping::-webkit-scrollbar { display: none; }
.marquee-track { display: flex; gap: 10px; width: max-content; padding-right: 10px; }
.marquee { overflow: hidden; margin: 0 -16px 10px; padding: 4px 16px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); }
.marquee:not(.looping) { overflow: visible; -webkit-mask-image: none; mask-image: none; margin: 0 0 10px; padding: 0; }
.marquee:not(.looping) .marquee-track { flex-wrap: wrap; width: auto; padding: 0; }
@media (prefers-reduced-motion: reduce) {
  .marquee .marquee-track { flex-wrap: wrap; width: auto; animation: none; }
  .marquee { overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .marquee [data-clone] { display: none; }
}
