/* Synced copy of kaleidr-studio-ui packages/landing-ui/src/satellite.css; edit that file, then run 03_code/.claude/scripts/sync-satellite-css.ps1 -Fix. sha256:342f620e3b959fb1e41342d641f52479fe325663177c527044bb939b64661291 */
/* Satellite shell: the chrome studio, analytics and the template store share --
   the left rail, the floating account button's place, the page scrollbars and
   the project / template card shell. ONE stylesheet for all three. studio-ui
   and analytics-ui import it from @kaleidr/landing-ui; template-ui ships a
   synced copy at customizer/vendor/satellite.css. Edit it HERE, then run
   03_code/.claude/scripts/sync-satellite-css.ps1 -Fix.

   Surfaces are soft: painted in the page's own color and lifted by a
   light/dark shadow pair instead of a fill and a border. Over a brand photo
   (sky / universe) the pair has nothing to read against, so the tokens below
   switch to a frosted surface, one drop shadow and tinted states. auth-core's
   account button and menu read the same tokens.

   Host contract: --s-bg, --s-primary and --s-text* from the theme scale,
   `data-theme` / `data-background` on <html>, --s-rail-w-collapsed, and
   --s-rail-w (the rail column's width, resolved by each host from the rail's
   `is-collapsed` state at its own phone breakpoint). --s-degraded-h, when a
   host sets it, pushes the rail and the account button below its banner. */

:root {
  --k-rail-inset: 8px;
  --k-rail-head-h: 56px;
  /* One control size: the rail toggle and the account button (auth-core). */
  --s-control-size: 34px;
  /* The light/dark pair every soft surface is lifted and pressed with,
     derived from the page background. */
  --s-elev-shade: color-mix(in srgb, var(--s-bg), #0f172a 15%);
  --s-elev-light: color-mix(in srgb, var(--s-bg), #fff 60%);
  --s-soft-bg: var(--s-bg);
  --s-soft-blur: none;
  --s-elev-raised: -5px -5px 12px var(--s-elev-light), 5px 5px 14px var(--s-elev-shade);
  --s-elev-raised-sm: -2px -2px 6px var(--s-elev-light), 3px 3px 8px var(--s-elev-shade);
  --s-elev-raised-lg: -7px -7px 16px var(--s-elev-light), 8px 8px 20px var(--s-elev-shade);
  --s-elev-pressed: inset 3px 3px 6px var(--s-elev-shade), inset -3px -3px 6px var(--s-elev-light);
  --k-control-bg: var(--s-bg);
  --k-hover-fill: transparent;
  --k-press-fill: transparent;
  --k-groove: var(--s-elev-shade);
  --k-groove-light: var(--s-elev-light);
}
html[data-theme="dark"] {
  --s-elev-shade: color-mix(in srgb, var(--s-bg), #000 55%);
  --s-elev-light: color-mix(in srgb, var(--s-bg), #fff 7%);
}
:is(html[data-background="sky"], html[data-background="universe"]) {
  --s-soft-bg: color-mix(in srgb, var(--s-bg) 55%, transparent);
  --s-soft-blur: blur(14px);
  --s-elev-raised: 0 10px 30px rgba(0, 0, 0, 0.18);
  --s-elev-raised-sm: none;
  --s-elev-raised-lg: 0 14px 36px rgba(0, 0, 0, 0.24);
  --s-elev-pressed: none;
  --k-control-bg: transparent;
  --k-hover-fill: color-mix(in srgb, var(--s-text) 8%, transparent);
  --k-press-fill: color-mix(in srgb, var(--s-text) 12%, transparent);
  --k-groove: color-mix(in srgb, var(--s-text) 12%, transparent);
  --k-groove-light: transparent;
}

/* One keyboard-focus ring, in the UI highlight color, never the browser's
   black default. In `base`, so any component rule or Tailwind utility
   (`outline-none`) still wins; `:root` lifts it over preflight's Firefox
   `:-moz-focusring { outline: auto }` inside that layer. The color sits on
   every element so a `transition` on outline-color never fades the ring in
   from the dark text color. */
@layer base {
  :where(*) {
    outline-color: var(--s-primary);
  }
  :root :focus-visible {
    outline: 2px solid var(--s-primary);
    outline-offset: 2px;
  }
}

/* ---- Rail ---- */
.k-rail {
  position: sticky;
  top: calc(var(--s-degraded-h, 0px) + var(--k-rail-inset));
  z-index: 30;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: max(0px, calc(var(--s-rail-w) - 2 * var(--k-rail-inset)));
  height: calc(100dvh - var(--s-degraded-h, 0px) - 2 * var(--k-rail-inset));
  margin: var(--k-rail-inset);
  border-radius: 20px;
  background: var(--s-soft-bg);
  -webkit-backdrop-filter: var(--s-soft-blur);
  backdrop-filter: var(--s-soft-blur);
  box-shadow: var(--s-elev-raised);
  transition: width 0.2s ease;
}

.k-rail-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--k-rail-head-h);
  padding: 0 10px 0 16px;
}
.k-rail.is-collapsed .k-rail-head {
  justify-content: center;
  padding: 0;
}

.k-rail-toggle {
  display: grid;
  place-items: center;
  width: var(--s-control-size);
  height: var(--s-control-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--k-control-bg);
  color: var(--s-text-secondary);
  box-shadow: var(--s-elev-raised-sm);
  cursor: pointer;
  transition: box-shadow 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.k-rail-toggle:hover {
  color: var(--s-text);
  background-image: linear-gradient(var(--k-hover-fill), var(--k-hover-fill));
}
.k-rail-toggle:active {
  box-shadow: var(--s-elev-pressed);
}

.k-rail-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px;
}
.k-rail-nav,
.k-rail-list,
.k-rail-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.k-rail-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
/* A groove, not a rule: a shadow line over a highlight line. */
.k-rail-group {
  position: relative;
  padding: 10px 8px 8px;
}
.k-rail-group::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: var(--k-groove);
  box-shadow: 0 1px 0 var(--k-groove-light);
}

.k-rail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--s-text-secondary);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.k-rail-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Collapsed: the short label stacks under the icon so each function reads
   without hovering. */
.k-rail.is-collapsed .k-rail-item {
  flex-direction: column;
  gap: 4px;
  padding: 8px 2px;
  text-align: center;
}
.k-rail.is-collapsed .k-rail-label {
  overflow: visible;
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
}

/* Resting: flat. Hover: lifts. Current page or open menu: pressed in. */
.k-rail-item:not(.k-rail-item--primary):hover {
  color: var(--s-text);
  background-color: var(--k-hover-fill);
  box-shadow: var(--s-elev-raised-sm);
}
.k-rail-item:not(.k-rail-item--primary):is([aria-current="page"], [aria-expanded="true"]) {
  color: var(--s-primary);
  background-color: var(--k-press-fill);
  box-shadow: var(--s-elev-pressed);
}

/* The one solid control: the main action keeps its fill and glows in it. */
.k-rail-item--primary {
  background: var(--s-primary);
  color: #fff;
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--s-primary) 60%, transparent);
}
.k-rail-item--primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 20px -4px color-mix(in srgb, var(--s-primary) 70%, transparent);
}
.k-rail-item--primary[aria-expanded="true"] {
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* ---- Account button placement ----
   Level with the rail toggle, and as far from the right edge as the collapsed
   toggle sits from the left. The button is auth-core's `.auth-nav-user-btn`. */
.k-account {
  position: fixed;
  top: calc(var(--s-degraded-h, 0px) + var(--k-rail-inset) + (var(--k-rail-head-h) - var(--s-control-size)) / 2);
  right: calc(var(--k-rail-inset) + (var(--s-rail-w-collapsed) - 2 * var(--k-rail-inset) - var(--s-control-size)) / 2);
  z-index: 31000;
}

/* ---- Scrollbars ----
   A solid thumb in the UI highlight color, like the account button's ring.
   Firefox sits in `base` so a per-element utility (`scrollbar-none`) can still
   win: cascade layer resolves before specificity, and an unlayered `*` would
   outrank every Tailwind utility. */
@layer base {
  @supports (-moz-appearance: none) {
    * {
      scrollbar-width: thin;
      scrollbar-color: var(--s-primary) transparent;
    }
  }
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background: transparent;
}
*::-webkit-scrollbar-button {
  display: none;
}
*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
  background: transparent;
}
/* The transparent border insets the thumb from the window edge. */
*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 100px;
  background: var(--s-primary) padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: color-mix(in srgb, var(--s-primary), #000 12%);
}
*::-webkit-scrollbar-thumb:active {
  background-color: color-mix(in srgb, var(--s-primary), #000 24%);
}

/* ---- Cards ----
   The shell of a project / template card: the rail's soft surface, lifting
   further on hover. The cover, chips and text inside stay with each host. */
.k-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  background: var(--s-soft-bg);
  -webkit-backdrop-filter: var(--s-soft-blur);
  backdrop-filter: var(--s-soft-blur);
  box-shadow: var(--s-elev-raised);
  color: inherit;
  text-align: left;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
/* Clickable cards only (a `role="group"` card holds its own buttons), and not
   while disabled, so a busy card keeps the host's cursor. */
:is(button, a, [role="button"]).k-card:not(:disabled) {
  cursor: pointer;
}
.k-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--s-elev-raised-lg);
}
/* The selected card (studio's live sample preview). */
.k-card.is-active {
  box-shadow: 0 0 0 2px var(--s-primary), var(--s-elev-raised);
}
@media (prefers-reduced-motion: reduce) {
  .k-card:hover {
    transform: none;
  }
}

/* A card cover with no saved thumbnail: the page color with a faint dot grid
   and the project's initial, never a random color. */
.k-card-blank {
  display: grid;
  place-items: center;
  background-color: color-mix(in srgb, var(--s-bg), var(--s-text) 4%);
  background-image: radial-gradient(color-mix(in srgb, var(--s-text) 14%, transparent) 1px, transparent 1.5px);
  background-size: 16px 16px;
  color: color-mix(in srgb, var(--s-text) 32%, transparent);
  font-weight: 600;
  user-select: none;
}
