/* ─────────────────────────────────────────────────────────────────────────────
   Cinema layer (dan, 2026-12-03): one motion, depth and type system for the whole
   site and app, loaded LAST so it can unify the older layers without rewriting them.
   Rules of the house that this file keeps:
   - nothing here covers page content (no overlays), it only styles what is there;
   - every animation stops under prefers-reduced-motion;
   - only transform/opacity/filter animate, so phones stay smooth.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  /* Motion: one spring for things arriving, one in-out for things leaving. */
  --cx-spring: cubic-bezier(.16, 1, .3, 1);
  --cx-out: cubic-bezier(.22, 1, .36, 1);
  --cx-inout: cubic-bezier(.65, 0, .35, 1);
  --cx-t1: .16s; --cx-t2: .32s; --cx-t3: .64s;
  /* Depth: three elevations, soft and tinted toward the brand indigo rather than grey. */
  --cx-sh-1: 0 1px 1px rgba(17, 17, 39, .04), 0 2px 6px -2px rgba(17, 17, 39, .07);
  --cx-sh-2: 0 1px 2px rgba(17, 17, 39, .05), 0 14px 34px -14px rgba(30, 27, 90, .22);
  --cx-sh-3: 0 2px 6px rgba(17, 17, 39, .06), 0 36px 90px -30px rgba(49, 46, 129, .38);
  --cx-accent: var(--accent, #4F46E5);
  --cx-ring: color-mix(in srgb, var(--cx-accent) 55%, transparent);
  --cx-glow: color-mix(in srgb, var(--cx-accent) 14%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root {
    --cx-sh-1: 0 1px 1px rgba(0, 0, 0, .3), 0 2px 8px -2px rgba(0, 0, 0, .4);
    --cx-sh-2: 0 1px 2px rgba(0, 0, 0, .35), 0 16px 40px -16px rgba(0, 0, 0, .7);
    --cx-sh-3: 0 2px 6px rgba(0, 0, 0, .4), 0 40px 100px -30px rgba(0, 0, 0, .85);
    --cx-glow: color-mix(in srgb, var(--cx-accent) 22%, transparent);
  }
}

/* ── Type: Inter's cleaner alternates, balanced headlines, no orphans ── */
body { font-feature-settings: "cv11", "ss01", "ss03"; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, .hero2-l h1 { text-wrap: balance; }
p, li, .sub, .lead { text-wrap: pretty; }
h1 { font-kerning: normal; }
.price, .plan .amt, .proof b, .kpi b, [class*="price"] b, .trial-banner strong { font-variant-numeric: tabular-nums; }
::selection { background: color-mix(in srgb, var(--cx-accent) 24%, transparent); }

/* ── Focus: one visible ring everywhere a keyboard lands ── */
:where(a, button, [role="button"], [role="tab"], input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--cx-ring); outline-offset: 2px; border-radius: inherit;
}

/* ── Buttons: weight you can feel. Lift on hover, press on tap, light sweep on the primary ── */
:where(.btn, .btn-dark, .btn-accent, .provider, .nav-item, .chip, .choice) { -webkit-tap-highlight-color: transparent; }
:where(.btn, .provider) { transition: transform var(--cx-t2) var(--cx-spring), box-shadow var(--cx-t2) var(--cx-out), background-color var(--cx-t1), border-color var(--cx-t1), color var(--cx-t1), opacity var(--cx-t1); }
:where(.btn, .provider):active:not(:disabled) { transform: translateY(0) scale(.97); transition-duration: .08s; }
.btn-dark, .btn-accent, .btn.dark, .provider.dark { position: relative; overflow: hidden; isolation: isolate; }
.btn-dark::before, .btn-accent::before, .provider.dark::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform .7s var(--cx-out);
}
@media (hover: hover) {
  .btn-dark:hover::before, .btn-accent:hover::before, .provider.dark:hover::before { transform: translateX(120%); }
  .btn-dark:hover, .btn-accent:hover, .provider.dark:hover { transform: translateY(-1px); box-shadow: var(--cx-sh-2); opacity: 1; }
}

/* ── Surfaces: cards rest on a soft shadow and rise toward the pointer ── */
:where(.card, .feat, .proof, .plan, .choice, .agent, .kpi, .starter, .pj-card) { transition: transform var(--cx-t2) var(--cx-spring), box-shadow var(--cx-t2) var(--cx-out), border-color var(--cx-t1), background-color var(--cx-t1); }
.feat, .proof { box-shadow: var(--cx-sh-1); }
@media (hover: hover) and (pointer: fine) {
  .feat:hover, .proof:hover, .plan:hover { transform: translateY(-2px); box-shadow: var(--cx-sh-2); border-color: color-mix(in srgb, var(--cx-accent) 26%, var(--border, var(--line, #ddd))); }
  /* Pointer light: cinema.js sets --mx/--my on hover so a faint glow follows the cursor across the card. */
  .cx-light { background-image: radial-gradient(420px circle at var(--mx, 50%) var(--my, -40%), var(--cx-glow), transparent 55%); }
}

/* ── Glass: sticky bars read as a sheet of frosted glass, not a flat strip ── */
.topbar {
  background: color-mix(in srgb, var(--bg, #fff) 78%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
}

/* ── Landing (the welcome screen at /): a slow ambient light behind the hero ── */
.onboard::before { inset: -12%; transform: translate3d(0, 0, 0); will-change: transform; }
.onboard:has(.ob-hero)::before {
  background:
    radial-gradient(820px 520px at 72% 4%, rgba(99, 102, 241, .16), transparent 62%),
    radial-gradient(640px 460px at 8% 92%, rgba(168, 85, 247, .11), transparent 60%),
    radial-gradient(520px 380px at 40% 40%, rgba(56, 189, 248, .06), transparent 60%);
}
/* Hero choreography: logo, headline, copy, buttons, then proof cards, each a beat after the last. */
#onboard :is(.hero2-l, .sa-hero-l) > *, #onboard .hero2-r > * { animation: cx-rise var(--cx-t3) var(--cx-spring) both; }
#onboard :is(.hero2-l, .sa-hero-l) > :nth-child(1) { animation-delay: .02s; }
#onboard :is(.hero2-l, .sa-hero-l) > :nth-child(2) { animation-delay: .08s; animation-duration: .8s; }
#onboard :is(.hero2-l, .sa-hero-l) > :nth-child(3) { animation-delay: .16s; }
#onboard :is(.hero2-l, .sa-hero-l) > :nth-child(4) { animation-delay: .24s; }
#onboard :is(.hero2-l, .sa-hero-l) > :nth-child(n+5) { animation-delay: .32s; }
#onboard .hero2-r > :nth-child(1) { animation-delay: .18s; }
#onboard .hero2-r > :nth-child(2) { animation-delay: .3s; }
#onboard .hero2-r > :nth-child(3) { animation-delay: .38s; }
#onboard .hero2-r > :nth-child(n+4) { animation-delay: .46s; }
:is(.hero2-l, .sa-hero-l) h1 { letter-spacing: -.035em; }
@media (max-width: 560px) {
  /* Phone: the wordmark already carries the logo up top, so the hero tile shrinks and the
     headline lands higher; both buttons go full width so the thumb finds them. */
  :is(.hero2-l, .sa-hero-l) > .mark.lg { zoom: .66; }
  .ob-body { padding-top: 8px; }
  .hero2-cta { flex-direction: column; align-items: stretch; }
  .hero2-cta > * { width: 100%; justify-content: center; }
  :is(.hero2-l, .sa-hero-l) h1 { font-size: 32px; line-height: 1.08; margin-top: 10px; }
}
/* The welcome pet pill sits in the app's top bar; while the welcome screen is open there is
   no top bar, so it moves to the bottom corner instead of covering the Close button. */
body:has(.onboard.open) .gr.gr-app.gr-min { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); right: 16px; }

/* ── Marketing hero (site.css pages): the same ambient light, kept behind the text ── */
main > .sec:first-of-type, .wrap > .sec:first-of-type { position: relative; isolation: isolate; }
main > .sec:first-of-type::before, .wrap > .sec:first-of-type::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none; inset: -40px 0 0 0;
  background: radial-gradient(520px 340px at 68% 18%, color-mix(in srgb, var(--accent, #3B3BD6) 9%, transparent), transparent 70%),
              radial-gradient(420px 300px at 6% 88%, color-mix(in srgb, var(--accent2, #7C3AED) 6%, transparent), transparent 70%);
  /* Fade every edge so the light never shows a box outline. */
  -webkit-mask-image: radial-gradient(farthest-side, #000 72%, transparent); mask-image: radial-gradient(farthest-side, #000 72%, transparent);
}

/* ── App views: arrive with depth (rise + un-blur), leave quickly ── */
::view-transition-old(view) { animation: cx-view-out .14s var(--cx-inout) both; }
::view-transition-new(view) { animation: cx-view-in .42s var(--cx-spring) both; }
@keyframes cx-view-out { to { opacity: 0; transform: translateY(-4px) scale(.995); } }
@keyframes cx-view-in { from { opacity: 0; transform: translateY(10px) scale(.995); filter: blur(4px); } }

/* Home composer: the one thing to do on Home gets a quiet halo when it has focus. */
.composer, .cmp, .home .composer-box { transition: box-shadow var(--cx-t2) var(--cx-out), border-color var(--cx-t1); }
.composer:focus-within, .cmp:focus-within { box-shadow: 0 0 0 4px var(--cx-glow), var(--cx-sh-2); }

/* Free-preview strip: one slim line on phones instead of a tall block above the composer. */
@media (max-width: 760px) {
  .trial-banner { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; font-size: 12.5px; border-radius: 12px; }
  .trial-banner > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .trial-banner .trial-bar { display: none; }
  .trial-banner .btn { height: 30px; }
}

/* ── Loading: a shimmer instead of a dash while numbers load ── */
.cx-skel, .skel {
  color: transparent !important; border-radius: 8px; min-height: 1em;
  background: linear-gradient(90deg, var(--hover, rgba(0,0,0,.05)) 0%, color-mix(in srgb, var(--hover, rgba(0,0,0,.05)) 40%, transparent) 50%, var(--hover, rgba(0,0,0,.05)) 100%);
  background-size: 200% 100%; animation: cx-shimmer 1.4s linear infinite;
}

@keyframes cx-rise { from { opacity: 0; transform: translateY(16px); filter: blur(6px); } }
@keyframes cx-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes cx-drift { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(-2.5%, 1.5%, 0) scale(1.04); } 100% { transform: translate3d(2%, -1%, 0) scale(1.02); } }

@media (prefers-reduced-motion: no-preference) {
  .onboard:has(.ob-hero)::before { animation: cx-drift 26s var(--cx-inout) infinite alternate; }
}
@media (prefers-reduced-motion: reduce) {
  #onboard :is(.hero2-l, .sa-hero-l) > *, #onboard .hero2-r > *, .cx-skel, .skel { animation: none !important; }
  ::view-transition-old(view), ::view-transition-new(view) { animation: none !important; }
  :where(.btn, .provider, .card, .feat, .proof, .plan, .choice) { transition: none !important; }
  .btn-dark::before, .btn-accent::before, .provider.dark::before { display: none; }
}

/* ── Hero film: an example run, issue to tested pull request (v8/scroll-agents.js heroFilmHTML) ── */
.cx-film {
  --f-bg: #0D0D14; --f-line: rgba(255, 255, 255, .09); --f-text: #ECECF3; --f-text2: #A9A9BC; --f-ok: #4ADE80; --f-bad: #FCA5A5; --f-acc: #A5B4FC;
  position: relative; width: 100%; margin: 4px 0 0; padding: 0; border-radius: 20px; overflow: hidden; text-align: left;
  background: radial-gradient(120% 80% at 100% 0%, rgba(99, 102, 241, .22), transparent 60%), var(--f-bg);
  border: 1px solid var(--f-line); color: var(--f-text); box-shadow: var(--cx-sh-3);
  font: 500 13px/1.45 Inter, system-ui, -apple-system, sans-serif;
  animation: cx-rise .8s var(--cx-spring) .2s both;
}
.cx-film-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--f-line); }
.cx-film-mark { display: inline-flex; width: 18px; height: 18px; color: #fff; }
.cx-film-mark svg { width: 100%; height: 100%; }
.cx-film-h b { font-weight: 650; }
.cx-film-tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, .08); color: var(--f-text2); }
.cx-film-live { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font: 500 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--f-text2); font-variant-numeric: tabular-nums; }
.cx-film-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--f-ok); box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: cx-pulse 1.6s ease-out infinite; }
.cx-film.cx-film-done .cx-film-live i { animation: none; }
.cx-film-steps { list-style: none; margin: 0; padding: 10px 14px 12px; display: grid; gap: 2px; min-height: 236px; }
.cx-film-steps > li { display: grid; grid-template-columns: 18px 1fr; column-gap: 10px; align-items: start; padding: 5px 0; opacity: .0; transform: translateY(6px); filter: blur(3px); transition: opacity .5s var(--cx-out), transform .6s var(--cx-spring), filter .5s var(--cx-out); }
.cx-film-steps > li.on { opacity: 1; transform: none; filter: none; }
.cx-film-steps > li > svg { margin-top: 2px; color: var(--f-acc); }
.cx-film-steps > li.bad > svg { color: var(--f-bad); }
.cx-film-steps > li.good > svg { color: var(--f-ok); }
.cx-film-steps > li.good > span b { color: var(--f-ok); }
.cx-film-steps code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--f-text); background: rgba(255, 255, 255, .07); padding: 1px 5px; border-radius: 5px; }
.cx-diff, .cx-bar { grid-column: 2; margin-top: 6px; }
.cx-diff { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; border-radius: 8px; overflow: hidden; border: 1px solid var(--f-line); }
.cx-diff > div { padding: 2px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-diff .del { background: rgba(248, 113, 113, .12); color: var(--f-bad); }
.cx-diff .add { background: rgba(74, 222, 128, .12); color: var(--f-ok); }
.cx-count { font-variant-numeric: tabular-nums; color: var(--f-ok); }
.cx-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.cx-bar i { display: block; height: 100%; background: linear-gradient(90deg, #4ADE80, #22D3EE); transform: scaleX(0); transform-origin: 0 50%; transition: transform .12s linear; }
.cx-film-proof { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--f-line); }
.cx-film-proof > span { padding: 10px 12px; font-size: 11.5px; line-height: 1.35; color: var(--f-text2); }
.cx-film-proof > span + span { border-left: 1px solid var(--f-line); }
.cx-film-proof b { display: block; font-size: 15px; color: var(--f-text); letter-spacing: -.01em; margin-bottom: 2px; }
.sa-hero-r { gap: 10px; }
@media (max-width: 720px) {
  .cx-film-steps { min-height: 0; }
  .cx-film-proof b { font-size: 14px; }
}
@keyframes cx-pulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .55); } 100% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } }
@media (prefers-reduced-motion: reduce) {
  .cx-film, .cx-film-live i { animation: none; }
  .cx-film-steps > li { opacity: 1; transform: none; filter: none; transition: none; }
}

/* ── One way to the Agent Assistant (cinema pass): the floating corner button sat over page content on desktop
   and duplicated the top-bar button phones already use. Now the top bar carries it everywhere, labelled on wide screens. ── */
.asst-fab { display: none !important; }
.asst-top { display: inline-flex !important; align-items: center; gap: 6px; }
@media (min-width: 761px) {
  .asst-top { width: auto; padding: 0 12px 0 9px; border: 1px solid var(--border, rgba(0,0,0,.1)); border-radius: 999px; font: 600 13px/1 Inter, system-ui, sans-serif; color: var(--text); }
  .asst-top::after { content: "Assistant"; }
  .asst-top:hover { background: var(--hover); }
  /* The agent pill lives in the top-right corner; the bar keeps that corner free and the Assistant sits just left of it. */
  body:has(.gr.gr-app.gr-min) #topbar { padding-right: 176px; }
  body:has(.gr.gr-app.gr-min) .gr.gr-app.gr-min { right: 16px; }
}

/* ── Empty states that show what will arrive (Daniel's Recent work) ── */
.cx-empty { display: grid; gap: 12px; padding: 18px; border-style: dashed; }
.cx-empty p { margin: 0; color: var(--text2); font-size: 14px; line-height: 1.55; }
.cx-empty p b { color: var(--text); font-weight: 600; }
.cx-ghost { display: grid; gap: 6px; }
.cx-ghost > span { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px; border-radius: 10px; background: var(--hover, rgba(0,0,0,.04)); color: var(--text3); font-size: 12.5px; font-weight: 600; }
.cx-ghost > span::after { content: ""; flex: 1; height: 8px; margin-left: 6px; border-radius: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--text3) 18%, transparent), transparent); }
.cx-ghost > span:nth-child(2)::after { width: 70%; flex: none; } .cx-ghost > span:nth-child(3)::after { width: 45%; flex: none; }
.cx-ghost i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cx-ghost .st-plan { background: #818CF8; } .cx-ghost .st-test { background: #F59E0B; } .cx-ghost .st-pr { background: #22C55E; }
