/* ==========================================================================
   Tendease concept site: shared styles for every page.
   Tailwind (CDN) handles layout and colour. This file holds the brand
   helpers, the motion, and the few components Tailwind can't express.

   Motion rules used throughout:
   - Only transform and opacity are animated.
   - Hidden "before" states only apply when <html> has the class "js"
     (added by the small inline script in each page's <head>).
   - If anything goes wrong, <html> gets the class "show-all" and every
     hidden state is switched off, so content can't stay invisible.
   - prefers-reduced-motion: nothing is hidden, the finished state shows.
   ========================================================================== */

/* ---------- Brand helpers ---------- */
body { font-family: 'Inter', system-ui, sans-serif; }
.font-display { font-family: 'Space Grotesk', system-ui, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.text-gradient { background: linear-gradient(95deg, #5B5BD6, #2DD4BF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bg-gradient-brand { background: linear-gradient(135deg, #5B5BD6, #2DD4BF); }

/* ---------- Floating "Spec work" menu (portfolio chrome) ---------- */
#specBtn.open .l1 { transform: translateY(5px) rotate(45deg); }
#specBtn.open .l2 { opacity: 0; }
#specBtn.open .l3 { transform: translateY(-5px) rotate(-45deg); }
.spec-line { transition: transform .3s ease, opacity .2s ease; }

/* ---------- Keyboard focus ---------- */
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #5B5BD6; outline-offset: 3px;
}
.on-dark a:focus-visible, .on-dark button:focus-visible, .on-dark input:focus-visible { outline-color: #2DD4BF; }
.peer:focus-visible + .opt-card { outline: 3px solid #5B5BD6; outline-offset: 3px; }
.skip-link { position: fixed; left: 50%; top: 8px; z-index: 120; transform: translate(-50%, -200%); background: #0B1220; color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.skip-link:focus { transform: translate(-50%, 0); }

/* ---------- Buttons: soft rounded, subtle lift on hover ---------- */
.btn { transition: transform .25s cubic-bezier(.2,1,.3,1), box-shadow .25s ease, background-color .25s ease; }
.btn:hover { transform: translateY(-2px); }

/* ---------- Header nav ---------- */
.nav-link { position: relative; display: inline-flex; align-items: center; min-height: 44px; transition: color .2s ease; }
.nav-link::after { content: ''; position: absolute; left: 0; right: 0; bottom: 8px; height: 2px; border-radius: 2px; background: linear-gradient(95deg, #5B5BD6, #2DD4BF); transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.nav-link:hover { color: #0B1220; }
.nav-link:hover::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); }
.nav-link[aria-current="page"] { color: #0B1220; font-weight: 600; }
.m-link { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 12px; }
.m-link[aria-current="page"] { background: #F4F3FF; color: #0B1220; font-weight: 600; }

/* Mobile dropdown: open by default without JS, toggled with JS */
html.js #siteNav:not(.open) { display: none; }
@media (max-width: 1023px) { html.show-all #siteNav { display: block; } }

/* Mobile "start trial" bar: always there without JS, slides in on scroll with JS */
#mobileCta { transition: transform .4s cubic-bezier(.2,.8,.2,1); }
html.js #mobileCta:not(.show) { transform: translateY(120%); }
html.show-all #mobileCta { transform: none; }

/* ---------- Scroll reveals ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2,.8,.2,1), transform .7s cubic-bezier(.2,.8,.2,1); }
  html.js .reveal.in { opacity: 1; transform: none; }
  html.js .stagger > * { opacity: 0; transform: translateY(18px); transition: opacity .6s cubic-bezier(.2,.8,.2,1), transform .6s cubic-bezier(.2,.8,.2,1); }
  html.js .stagger.in > * { opacity: 1; transform: none; transition-delay: calc(var(--i, 0) * 85ms); }
  html.show-all .reveal, html.show-all .stagger > * { opacity: 1 !important; transform: none !important; }

  /* Entrance for content already on screen at load (page heroes) */
  html.js .rise { animation: rise .8s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: var(--d, 0s); }
  html.js.pre .rise { animation-delay: calc(1.25s + var(--d, 0s)); }
  html.show-all .rise { animation: none !important; }

  /* Soft gradient drift behind heroes and dark sections */
  .drift { animation: drift 16s ease-in-out infinite alternate; will-change: transform; }
  .drift-b { animation-duration: 21s; animation-direction: alternate-reverse; }

  /* Smooth page-to-page fade in browsers that support it */
  @view-transition { navigation: auto; }
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-36px, 28px, 0) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto !important; } }
@media print { .reveal, .stagger > * { opacity: 1 !important; transform: none !important; } }

/* ---------- Preloader (home page, once per visit, CSS only) ---------- */
#preloader { display: none; position: fixed; inset: 0; z-index: 100; background: #0B1220; align-items: center; justify-content: center; pointer-events: none; }
#preloader .pl-stage { position: relative; height: 56px; }
#preloader .pl-ring, #preloader .pl-wave { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
#preloader .pl-ring { align-items: center; }
#preloader .pl-wave { opacity: 0; }
#plWord { opacity: 0; }
.ring-pulse { animation: ringpulse 1s ease-in-out infinite; }
.wave-bar { animation: wavebar .9s ease-in-out infinite; transform-origin: bottom; }
@keyframes ringpulse { 0%,100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.08); } }
@keyframes wavebar { 0%,100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
@keyframes plOut { to { opacity: 0; } }
@keyframes plIn { to { opacity: 1; } }
@keyframes plWordIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes plLeave { to { transform: translateY(-100%); opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  html.js.pre #preloader { display: flex; animation: plLeave .65s cubic-bezier(.6,0,.3,1) 1.3s forwards; }
  html.js.pre #preloader .pl-ring { animation: plOut .2s ease .45s forwards; }
  html.js.pre #preloader .pl-wave { animation: plIn .25s ease .5s forwards; }
  html.js.pre #plWord { animation: plWordIn .45s ease .7s forwards; }
  html.show-all #preloader { display: none !important; }
}

/* ---------- Mouse-reactive hero glow (moved with transform only) ---------- */
.hero-glow { position: absolute; left: 50%; top: 20%; width: 760px; height: 760px; margin: -380px 0 0 -380px; border-radius: 50%; background: radial-gradient(closest-side, rgba(91,91,214,.33), rgba(91,91,214,0)); pointer-events: none; transition: transform .5s cubic-bezier(.2,.8,.2,1); will-change: transform; }

/* ---------- Sticky step rail (setup sequence) ---------- */
.step-num { transition: color .3s ease, background-color .3s ease, transform .3s ease; }
.step.active .step-num { background: linear-gradient(135deg,#5B5BD6,#2DD4BF); color: white; transform: scale(1.08); }
.step-title { transition: color .3s ease; }
.step.active .step-title { color: #0B1220; }

/* Connecting line that draws across the four setup steps on the home page */
.draw-line { transform-origin: left; }
@media (prefers-reduced-motion: no-preference) {
  html.js .stagger .draw-line { transform: scaleX(0); opacity: 1; transition: transform 1.1s cubic-bezier(.2,.8,.2,1) .25s; }
  html.js .stagger.in .draw-line { transform: scaleX(1); }
  html.show-all .stagger .draw-line { transform: none !important; }
}

/* Setup checklist ticks */
@media (prefers-reduced-motion: no-preference) {
  html.js:not(.show-all) #checklist .check-mark svg { opacity: 0; transform: scale(.3); transition: opacity .3s ease, transform .45s cubic-bezier(.2,1.6,.4,1); transition-delay: calc(var(--i, 0) * 320ms); }
  html.js:not(.show-all) #checklist.ticked .check-mark svg { opacity: 1; transform: none; }
}

/* ==========================================================================
   SIGNATURE: the call being handled.
   The finished call is plain HTML (edit the words in the page). With JS the
   pieces start hidden and play in order: ring, transcript, calendar slot,
   text summary. site.js adds "armed" while it plays and "done" when finished.
   ========================================================================== */
.call-wave span { display: block; width: 3px; border-radius: 3px; background: #2DD4BF; transform-origin: bottom; transform: scaleY(.35); }
.call-ping { opacity: 0; }
.call-slot-fill { transform-origin: left; }
.beat-num { transition: background-color .3s ease, color .3s ease, transform .3s ease; }
.beat.is-on .beat-num { background: linear-gradient(135deg,#5B5BD6,#2DD4BF); color: #fff; transform: scale(1.08); }

@media (prefers-reduced-motion: no-preference) {
  .call-line { transition: opacity .35s ease, transform .5s cubic-bezier(.2,1,.3,1); }
  .call-line .w { transition: opacity .16s ease; }
  .call-slot-fill { transition: transform .8s cubic-bezier(.2,.8,.2,1); }
  .call-slot-text { transition: opacity .4s ease .45s; }
  .call-sms { transition: opacity .5s ease, transform .7s cubic-bezier(.2,1.2,.3,1); }

  /* Before site.js has run: keep the call quiet so the finished state doesn't flash */
  html.js:not(.show-all) .call:not(.done):not(.armed) .call-line,
  html.js:not(.show-all) .call:not(.done):not(.armed) .call-slot-fill,
  html.js:not(.show-all) .call:not(.done):not(.armed) .call-slot-text,
  html.js:not(.show-all) .call:not(.done):not(.armed) .call-sms { opacity: 0; }

  /* While a call is waiting to play or playing ("armed" is set by site.js) */
  .call.armed .call-line { opacity: 0; transform: translateY(10px) scale(.98); }
  .call.armed .call-line.on { opacity: 1; transform: none; }
  .call.armed .call-line .w { opacity: 0; }
  .call.armed .call-line .w.on { opacity: 1; }
  .call.armed:not(.p-book) .call-slot-fill { transform: scaleX(0); }
  .call.armed:not(.p-book) .call-slot-text { opacity: 0; transition-delay: 0s; }
  .call.armed:not(.p-text) .call-sms { opacity: 0; transform: translateY(26px) scale(.96); }

  .call.p-ring .call-phone { animation: ringpulse .45s ease-in-out infinite; }
  .call.p-ring .call-ping { animation: ping 1.1s ease-out infinite; }
  .call.p-live .call-wave span { animation: wavebar .8s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 110ms); }
}
@keyframes ping { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.1); } }

/* ---------- Trial form confirmation ---------- */
[hidden] { display: none !important; }
.trial-bar { transform-origin: left; transform: scaleX(0); }
@media (prefers-reduced-motion: no-preference) {
  .trial-ok { animation: rise .5s cubic-bezier(.2,.8,.2,1) backwards; }
  .trial-ok .trial-bar { animation: fillbar 1.8s linear .1s forwards; }
}
@media (prefers-reduced-motion: reduce) { .trial-bar { transform: none; } }
@keyframes fillbar { to { transform: scaleX(1); } }

/* ---------- Sign-up flow (start.html) ---------- */
html:not(.js) .js-only { display: none; }
.flow-ready .flow [data-step]:not(.is-current) { display: none; }
.flow-ready:not(.is-done) #startDone { display: none; }
.flow-ready.is-done .flow { display: none; }
.flow-bar { transform-origin: left; transform: scaleX(.25); transition: transform .6s cubic-bezier(.2,.8,.2,1); }
@media (prefers-reduced-motion: no-preference) {
  .flow-ready .flow [data-step].is-current { animation: rise .45s cubic-bezier(.2,.8,.2,1) backwards; }
  .flow-ready.is-done #startDone .pop { animation: pop .6s cubic-bezier(.2,1.5,.4,1) backwards; }
  .flow-ready.is-done #startDone .slide-in { animation: slidein .7s cubic-bezier(.2,1.1,.3,1) .5s backwards; }
}
@keyframes pop { from { opacity: 0; transform: scale(.5); } }
@keyframes slidein { from { opacity: 0; transform: translateY(26px) scale(.96); } }

/* ---------- Pricing calculator ---------- */
input[type="range"].calc-range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; cursor: pointer; }
input[type="range"].calc-range::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(95deg, #5B5BD6, #2DD4BF); }
input[type="range"].calc-range::-moz-range-track { height: 6px; border-radius: 6px; background: linear-gradient(95deg, #5B5BD6, #2DD4BF); }
input[type="range"].calc-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #fff; border: 3px solid #0B1220; box-shadow: 0 4px 12px rgba(11,18,32,.25); }
input[type="range"].calc-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid #0B1220; box-shadow: 0 4px 12px rgba(11,18,32,.25); }

/* ---------- FAQ ---------- */
details > summary { list-style: none; min-height: 44px; }
details > summary::-webkit-details-marker { display: none; }
