/* ════════════════════════════════════════════════════════════════════════
   ChatPVT Cinny polish stylesheet
   ════════════════════════════════════════════════════════════════════════
   Keep this stylesheet tiny and low-risk. This is presentation polish,
   not a full theming surface, and a first-paint companion to the JS
   shims that own steady-state behaviour:

     - cinny-auto-sso.js     auto-clicks Cinny's SSO link on /login/*
     - cinny-navigation.js   redirects /, /home/, /explore/ to /direct/
                             and hides sidebar/right-panel UI elements

   Rules are grouped from broadest (cross-cutting overlay) to narrowest
   (single auth-screen elements). When CSS alone cannot identify the
   right element — text content, combined SVG-and-text matches, smart
   parent-conditional hiding — the JS shim handles it instead.
   ════════════════════════════════════════════════════════════════════════ */


/* === Cross-cutting overlay =========================================== */

/* Hide the body while either shim is mid-navigation. Two classes share
   these rules:
     - chatpvt-auto-sso-pending     set by cinny-auto-sso.js on /login/*
                                    so users don't see Cinny's provider
                                    chooser before MAS takes over.
     - chatpvt-direct-landing-pending  set by cinny-navigation.js on /,
                                       /home/, and /explore/ so users
                                       don't see a Cinny default surface
                                       before the redirect to /direct/.
   Both classes clear once the navigation lands or times out, so the
   underlying screen stays available on failure. */
html.chatpvt-auto-sso-pending,
html.chatpvt-direct-landing-pending {
  background: #000 !important;
}

html.chatpvt-auto-sso-pending body,
html.chatpvt-direct-landing-pending body {
  visibility: hidden !important;
}


/* === In-app dark theme: charcoal ground ============================= */

/* Recolour Cinny's dark theme so the whole app — chat UI, panels, splash,
   and login — sits on the ChatPVT account-portal charcoal instead of
   Cinny's neutral grey. Cinny's active dark theme (_15q3ngn1) defines a
   neutral-grey background/surface ramp (#1A1A1A -> #595959) as folds
   theme tokens; this redefines only those background/surface tokens,
   shifting the hue grey -> teal-charcoal while preserving each token's
   lightness, so Cinny's surface/elevation contrast (and legibility) stays
   intact. Text, icons, the lavender accent, and the green/amber/red
   semantic colours are deliberately left untouched — this is a background
   change (accent -> mint would be a separate call). #091213 and #152021
   are the portal's base and elevated shades (charcoal-900/800); the rest
   are teal-charcoal at the same lightness as the grey they replace.
   Build-specific: the theme class _15q3ngn1 and the --oq6d0xx token names
   are vanilla-extract hashes (Cinny v4.12.2) — re-verify on upgrade by
   re-extracting the dark theme block (the one whose --oq6d070 is a dark
   grey) from /assets/index-*.css. Scoped to the standard dark theme; the
   warm dark theme (_15q3ngn2) and the light themes are left alone. */
._15q3ngn1 {
  --oq6d070: #091213 !important;
  --oq6d071: #152021 !important;
  --oq6d072: #1d2a29 !important;
  --oq6d073: #2b3839 !important;
  --oq6d075: #152021 !important;
  --oq6d076: #1d2a29 !important;
  --oq6d077: #2b3839 !important;
  --oq6d078: #374746 !important;
  --oq6d07a: #1d2a29 !important;
  --oq6d07b: #2b3839 !important;
  --oq6d07c: #374746 !important;
  --oq6d07d: #455353 !important;
  --oq6d07t: #091213 !important;
  --oq6d07u: #2b3839 !important;
  --oq6d07v: #374746 !important;
  --oq6d07w: #455353 !important;
  --oq6d07x: #51625f !important;
}


/* === Splash screen =================================================== */

/* Hide the "Cinny" wordmark on the loading splash (SplashScreen.tsx ->
   css.SplashScreenFooter) — the screen shown while the client boots and
   while Matrix sync is catching up ("Heating up"). The splash root
   carries css.SplashScreen, whose only rule is
   `min-height:100%;background-color:var(--oq6d070);color:var(--oq6d074)`,
   hashed to _1xwzt1x0 in the Cinny v4.12.2 build. The footer holding the
   H2 wordmark is the root's last child; the spinner and status text are
   earlier children and stay visible. CSS cannot match the "Cinny" text
   node directly, so this anchors on the splash root and hides only its
   footer box. _1xwzt1x0 is a build-specific vanilla-extract hash —
   re-verify on Cinny upgrade by finding that min-height:100%
   Container-colour rule in /assets/index-*.css (it is also the only
   class alongside the radial-gradient dot pattern _4lbgaj0 on the
   splash, but not the auth root _15upz2y0). */
._1xwzt1x0 > div:last-child {
  display: none !important;
}

/* Align the splash background with the ChatPVT account portal
   (account.chatpvt.com): a flat charcoal ground #091213 — Nuxt UI
   neutral="charcoal" 900 / --ui-bg in dark mode, confirmed live as the
   portal's page background. Cinny's splash root paints
   `background-color: var(--oq6d070)` plus the _4lbgaj0 dot gradient
   `radial-gradient(var(--oq6d072) .125rem, var(--oq6d070) .125rem)`;
   both are overridden here to the brand charcoal, with charcoal-800
   #152021 dots (the portal's elevated-surface shade) kept as a subtle
   texture. background-size (the 2.5rem grid) is inherited from _4lbgaj0. */
._1xwzt1x0 {
  background-color: #091213 !important;
  background-image: radial-gradient(#152021 0.125rem, #091213 0.125rem) !important;
}


/* === Sidebar items =================================================== */

/* Hide Cinny's Home sidebar entry. The navigation shim also hides it
   at runtime (re-applied across Cinny re-renders); this CSS rule is
   the first-paint backup keyed to the stable home SVG path. The
   aria-label fallback covers a future Cinny icon refresh that changes
   the path. */
div:has(> button > svg path[d*="M4.5 10.6736"]),
div:has(> button[aria-label="Home"]) {
  display: none !important;
}

/* Hide Cinny's Explore Community sidebar entry. The navigation shim
   also hides by route/text at runtime; this CSS rule is the first-paint
   backup keyed to the stable compass SVG path shipped by Cinny. */
div:has(> button > svg path[d*="L9.87866 9.87866L16.9497 7.05023"]) {
  display: none !important;
}

/* No CSS first-paint hide for Cinny's Add Space ("+") sidebar entry.
   Its plus SVG path is a generic "add" icon that Cinny also uses for
   in-space "+ Add Room" affordances and other add buttons elsewhere
   in the app; a path-based CSS rule would over-hide and take Add Room
   down with the sidebar Add Space. The navigation shim's first-match
   findButtonBySvgPath lookup hides only the sidebar Add Space cleanly
   (the sidebar renders first in DOM order so the lookup always
   returns it), at the cost of a brief first-paint flash before the
   shim catches up. The Home and Explore hides above are safe at the
   CSS layer because their house and compass icons are unique to
   those affordances. */


/* === Welcome panel branding ========================================== */

/* Strip Cinny branding markers (logo image, source link, sponsor link)
   from the signed-in welcome panel. The navigation shim hides the Home
   sidebar entry and bounces /home/ to /direct/ on first visit per tab,
   so the welcome panel should rarely render; these rules are defence
   in depth for the case where it does. The wildcard on github.com also
   covers the v<version> release link that lives in the same panel. */
img[alt="Cinny Logo"] {
  display: none !important;
}
a[href*="github.com/cinnyapp/cinny"] {
  display: none !important;
}
a[href="https://cinny.in/#sponsor"] {
  display: none !important;
}


/* === Auth screen chrome ============================================== */

/* Hide upstream signed-out header/footer chrome on the auth screens.
   The footer class is used as the page marker so normal in-app headers
   remain visible after sign-in. */
body:has(._15upz2y5) header,
._15upz2y5 {
  display: none !important;
}

/* Remove Cinny's dotted radial-gradient background on the auth wrapper. */
div:has(> ._15upz2y5),
._15upz2y0._4lbgaj0 {
  background-image: none !important;
}

/* Match the auth screen's flat ground to the account portal charcoal
   (#091213), same as the splash. The dot pattern is already removed
   above, so this is a flat brand ground. The auth root _15upz2y0 paints
   `background-color: var(--oq6d070)`; this overrides it. */
._15upz2y0 {
  background-color: #091213 !important;
}

/* Hide self-registration entrypoint; ChatPVT account creation is
   MAS/Logto-controlled, not public Cinny registration. */
p:has(> a[href="/register/chatpvt.com"]) {
  display: none !important;
}

/* ChatPVT brand header (injected by cinny-proxy.conf): fixed 76px top bar plus a
   matching top reserve on the app mount so Cinny content sits below it. Selector
   is the #root mount; adjust to the live scroll container during verify if needed. */
chatpvt-header { position: fixed; inset: 0 0 auto 0; height: 76px; z-index: 2147483000; }
#root { padding-top: 76px; box-sizing: border-box; }

/* Over Cinny's app the header's translucent frosted glass reads as a washed-out
   "blanched" band. Make the bar opaque via its exposed part: drop the backdrop
   blur and the see-through base, keep the brand mint/blue corner tints. */
chatpvt-header::part(header) {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background:
    radial-gradient(120% 180% at 8% 0%, oklch(0.86 0.2 172 / 0.1), transparent 52%),
    radial-gradient(110% 160% at 88% -20%, oklch(0.8 0.18 215 / 0.12), transparent 58%),
    linear-gradient(180deg, oklch(0.17 0.017 200), oklch(0.12 0.012 205));
}
