/* Homepage motion layer - subtle, presentation only, applied across the whole page.
   Uses `translate` / `opacity` / `scale` (not `transform`) so it never fights existing transforms (the hero card's rocking, the tool-card hover lift).
   Everything animated here is switched off for visitors who ask for reduced motion. */

/* ---------- page-wide ambient glow + cursor glow (fixed, always behind the content) ---------- */
.ds-ambient, .ds-cursor { position: fixed; pointer-events: none; z-index: -1; }
.ds-ambient {
  inset: -15%;
  background:
    radial-gradient(26% 34% at 30% 40%, rgba(31, 160, 132, .12), transparent 70%),
    radial-gradient(22% 30% at 74% 56%, rgba(70, 130, 200, .08), transparent 72%),
    radial-gradient(24% 30% at 50% 92%, rgba(31, 160, 132, .07), transparent 72%);
}
html[data-theme="dark"] .ds-ambient {
  background:
    radial-gradient(26% 34% at 30% 40%, rgba(80, 210, 170, .10), transparent 70%),
    radial-gradient(22% 30% at 74% 56%, rgba(100, 150, 230, .08), transparent 72%),
    radial-gradient(24% 30% at 50% 92%, rgba(80, 210, 170, .06), transparent 72%);
}
.ds-cursor {
  left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px; opacity: 0; transition: opacity .6s ease;
  background: radial-gradient(closest-side, rgba(31, 160, 132, .10), transparent 100%);
}
html[data-theme="dark"] .ds-cursor { background: radial-gradient(closest-side, rgba(110, 230, 190, .08), transparent 100%); }
.ds-home .home-hero { position: relative; }

/* ---------- hover touches (mouse devices only) ---------- */
@media (hover: hover) {
  .ds-home .primary-btn, .ds-home .secondary-btn { transition: translate .2s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease; }
  .ds-home .primary-btn:hover, .ds-home .secondary-btn:hover { translate: 0 -2px; box-shadow: 0 10px 22px rgba(23, 41, 64, .16); }
  .ds-home .primary-btn:active, .ds-home .secondary-btn:active { translate: 0 0; box-shadow: none; }
  /* tool cards already lift via the page's own transform rule - keep that, just add a soft shadow to it */
  .ds-home .tool-card { transition: transform .2s, border-color .2s, box-shadow .25s ease; }
  .ds-home .tool-card:hover { box-shadow: 0 22px 54px rgba(23, 41, 64, .15); }
  html[data-theme="dark"] .ds-home .tool-card:hover { box-shadow: 0 22px 54px rgba(0, 0, 0, .45); }
  .ds-home .example-card { transition: translate .25s ease, box-shadow .25s ease, border-color .25s ease; }
  .ds-home .example-card:hover { translate: 0 -3px; box-shadow: 0 22px 54px rgba(23, 41, 64, .15); border-color: #9db5c8; }
  html[data-theme="dark"] .ds-home .example-card:hover { box-shadow: 0 22px 54px rgba(0, 0, 0, .45); border-color: #4c6a66; }
  .ds-home .hero-preview { transition: box-shadow .3s ease; }
  .ds-home .hero-preview:hover { box-shadow: 0 24px 64px rgba(23, 41, 64, .2); }
  /* nav links: underline slides in */
  .ds-home .home-nav nav > a { background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat; background-position: 0 100%; background-size: 0 2px; transition: background-size .25s ease; padding-bottom: 3px; }
  .ds-home .home-nav nav > a:hover { background-size: 100% 2px; }
}

/* ---------- live-card details ---------- */
.hero-preview-funnel .funnel-seg { transition: flex-basis .8s cubic-bezier(.22, 1, .36, 1); }
.hero-preview-funnel .funnel-verdict.ds-pop, .example-verdict.ds-pop { animation: dsPop .55s ease-out; }
@keyframes dsPop { 0% { scale: 1; } 40% { scale: 1.06; } 100% { scale: 1; } }

/* ---------- hand-drawn underline under every section heading (drawn once as it scrolls in) ---------- */
.ds-ul { position: relative; }
.ds-ul::after {
  content: ""; position: absolute; left: 0; bottom: -10px; width: clamp(120px, 14vw, 170px); height: 11px; pointer-events: none;
  background: var(--brand, #0a6b57);
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20190%2014'%20preserveAspectRatio='none'%3E%3Cpath%20d='M3%209.5C34%203%2071%202%2096%206.5S158%2011%20187%205'%20fill='none'%20stroke='black'%20stroke-width='3.4'%20stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%; mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20190%2014'%20preserveAspectRatio='none'%3E%3Cpath%20d='M3%209.5C34%203%2071%202%2096%206.5S158%2011%20187%205'%20fill='none'%20stroke='black'%20stroke-width='3.4'%20stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
  clip-path: inset(0 100% 0 0); transition: clip-path .9s cubic-bezier(.45, 0, .2, 1) .15s;
}
.ds-ul.ds-ul-in::after { clip-path: inset(0 0 0 0); }
.home-end-cta .ds-ul::after { left: 50%; translate: -50% 0; }
.home-pro .ds-ul::after { background: #7dcafa; }
html[data-theme="dark"] .home-pro .ds-ul::after { background: var(--brand, #0a6b57); }

/* ---------- entrance + reveals ---------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes dsRise { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
  @keyframes dsFade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes dsDraw { from { stroke-dashoffset: 200; } to { stroke-dashoffset: 0; } }
  @keyframes dsBar  { from { clip-path: inset(0 100% 0 0 round 999px); } to { clip-path: inset(0 0 0 0 round 999px); } }
  @keyframes dsDrift { from { transform: translate3d(-3%, -2%, 0) scale(1); } to { transform: translate3d(4%, 3%, 0) scale(1.08); } }
  @keyframes dsPulse { 0% { box-shadow: 0 0 0 0 rgba(7, 102, 83, .30); } 70%, 100% { box-shadow: 0 0 0 14px rgba(7, 102, 83, 0); } }

  .ds-ambient { animation: dsDrift 70s ease-in-out infinite alternate; will-change: transform; }

  /* hero copy: one after another */
  .ds-home .hero-copy > .home-free-badge { animation: dsRise .7s cubic-bezier(.22, 1, .36, 1) .00s both; }
  .ds-home .hero-copy > h1               { animation: dsRise .8s cubic-bezier(.22, 1, .36, 1) .08s both; }
  .ds-home .hero-copy > p                { animation: dsRise .8s cubic-bezier(.22, 1, .36, 1) .20s both; }
  .ds-home .hero-copy > .hero-actions    { animation: dsRise .8s cubic-bezier(.22, 1, .36, 1) .32s both; }
  .ds-home .hero-copy > .hero-note       { animation: dsRise .8s cubic-bezier(.22, 1, .36, 1) .44s both; }
  .ds-home .hero-copy .hand-underline path { stroke-dasharray: 200; animation: dsDraw .75s cubic-bezier(.45, 0, .2, 1) both; }
  .ds-home .hero-copy em.hand-em:nth-of-type(1) .hand-underline path { animation-delay: .75s; }
  .ds-home .hero-copy em.hand-em:nth-of-type(2) .hand-underline path { animation-delay: 1.00s; }
  .ds-home .hero-copy em.hand-em:nth-of-type(3) .hand-underline path { animation-delay: 1.25s; }

  /* sample card: its contents cascade in (the card itself keeps its own rocking animation) */
  .hero-preview-funnel .funnel-photo         { animation: dsFade .9s ease .25s both; }
  .hero-preview-funnel .funnel-card-body > *  { animation: dsRise .7s cubic-bezier(.22, 1, .36, 1) both; }
  .hero-preview-funnel .funnel-card-body > :nth-child(1) { animation-delay: .35s; }
  .hero-preview-funnel .funnel-card-body > :nth-child(2) { animation-delay: .42s; }
  .hero-preview-funnel .funnel-card-body > :nth-child(3) { animation-delay: .50s; }
  .hero-preview-funnel .funnel-card-body > :nth-child(4) { animation-delay: .58s; }
  .hero-preview-funnel .funnel-card-body > :nth-child(5) { animation-delay: .66s; }
  .hero-preview-funnel .funnel-card-body > :nth-child(6) { animation-delay: .74s; }
  .hero-preview-funnel .funnel-bar { animation: dsBar 1s cubic-bezier(.22, 1, .36, 1) .95s backwards; }

  /* a very soft ring pulse on the last call-to-action */
  .home-end-cta .primary-btn { animation: dsPulse 3.8s ease-out 1.2s infinite; }
  .home-end-cta .primary-btn:hover { animation: none; }

  /* scroll reveals (classes added by js/home-motion.js, only to things below the fold) */
  .ds-reveal { opacity: 0; translate: 0 16px; }
  .ds-reveal.ds-in { opacity: 1; translate: 0 0; transition: opacity .7s cubic-bezier(.22, 1, .36, 1) var(--ds-d, 0s), translate .7s cubic-bezier(.22, 1, .36, 1) var(--ds-d, 0s); }
}
@media (prefers-reduced-motion: reduce) {
  .ds-ambient { animation: none; }
  .ds-cursor { display: none; }
}
