/* ib-skeleton.css: loading skeletons for the legacy shells and the Next layout.
   Tokens only (public/ib-tokens.css). Class names are ib-skel* only; never reuse
   .ib-phone-prerender (the phone click handoff in app-src/90-app-root.js keys on it).

   .ib-skel            one band: the UI tint (faint white on the dark redesign; grey in light embeds).
   .ib-skel-card       a Card surface and line (--ib-ui-card-surface), like the paywall skeleton rows.
   .ib-skel-line       text-line band (pill, one line high).
   .ib-skel-block      field or chart block.
   .ib-skel-calc       role="status" carrier of the calculator pre-mount ghost (see below). The
                       ghost is the mounted layout, so it holds the page height itself and
                       swapping it for the mounted app moves nothing below it.

   The shimmer moves transform on ::after (smooth on Safari, no repaint of the band).
   Under prefers-reduced-motion the bands are static. */

.ib-skel {
  --ib-skel-band: var(--ib-ui-tint);
  --ib-skel-glint: var(--ib-ui-tint-hover);
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--ib-radius-lg);
  background-color: var(--ib-skel-band);
}
.ib-skel::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(90deg, transparent, var(--ib-skel-glint), transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .ib-skel::after { animation: ib-skel var(--ib-motion-shimmer) var(--ib-ease-out) infinite; }
}
@keyframes ib-skel {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.ib-skel-line { height: var(--ib-space-md); border-radius: var(--ib-radius-pill); }
.ib-skel-block { height: var(--ib-space-touch); }

.ib-skel-card {
  display: flex;
  flex-direction: column;
  gap: var(--ib-space-md);
  padding: var(--ib-space-lg);
  border: 1px solid var(--ib-ui-card-surface-line);
  border-radius: var(--ib-radius-2xl);
  background-color: var(--ib-ui-card-surface);
}

/* Calculator pre-mount (scripts/gen-calc-skeleton.mjs): a ghost of the page's own mounted calculator,
   so the real CSS lays it out and nothing moves on mount. .ib-skel-calc is only the role="status"
   carrier. #root's ghost children are .ib-g-ph (the phone wizard, app width < 760) or .ib-g-dt (the
   desktop grid); one set shows either side of 760. Text runs (.ib-g-t) become tinted bars with
   transparent glyphs; control fills go neutral, so no default choice shows before saved values load. */
.ib-skel-calc { position: absolute; }
.ib-skel-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* #root#root: the ghost copies carry the page's own state rules (selected chips, filled fields), some
   !important with three classes; the doubled id outranks them without touching the real page. */
@media (min-width: 760px) { #root#root > .ib-g-ph { display: none !important; } }
@media (max-width: 759px) { #root#root > .ib-g-dt { display: none !important; } }
html:not(.ib-g-auth) #root#root > .ib-g-in, html.ib-g-auth #root#root > .ib-g-out { display: none !important; }
#root#root :is(.ib-g, .ib-g *) { pointer-events: none; user-select: none; -webkit-user-select: none; animation: none !important; transition: none !important; }
#root#root :is(.ib-g, .ib-g *, .ib-g *::before, .ib-g *::after) { color: transparent !important; -webkit-text-fill-color: transparent !important; text-shadow: none !important; }
#root#root .ib-g :is(svg, img, .ib-qp-tick) { visibility: hidden !important; }
/* The filled-field tick would show a saved choice before it loads. */
#root#root .ib-g .ib-field-label::after { visibility: hidden !important; }
/* The segmented control's sliding pill marks the default choice: neutral until the saved one loads. */
#root#root .ib-g .ib-seg-pill { background: var(--ib-ui-tint) !important; border-color: transparent !important; box-shadow: none !important; }
/* A chosen chip/tab looks like its unchosen siblings until the saved choice loads; other controls keep their own look. */
#root#root .ib-g :is([aria-checked="true"], [aria-pressed="true"], [aria-selected="true"]):not(.ib-seg-btn) {
  border-color: var(--ib-ui-card-surface-line) !important;
  background: var(--ib-ui-tint) !important;
  box-shadow: none !important;
}
#root#root .ib-g-t {
  font-style: inherit;
  border-radius: var(--ib-radius-sm);
  background: var(--ib-ui-tint) !important;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
@media (prefers-reduced-motion: no-preference) {
  #root#root .ib-g .ib-g-t { animation: ib-g-pulse var(--ib-motion-shimmer) var(--ib-ease-out) infinite alternate !important; }
}
@keyframes ib-g-pulse {
  from { opacity: 1; }
  to { opacity: .55; }
}

/* Next loading.tsx that renders its own page (TrackerLandingView signedIn null): a session-dependent
   label or button keeps its box, its text waits as a tinted bar. */
.ib-skel-wait,
.ib-skel-wait * {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  border-color: transparent !important;
  background: var(--ib-ui-tint) !important;
  box-shadow: none !important;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Signed-in Next routes (components/route-ghosts, scripts/gen-route-ghosts.mjs): a ghost of the loaded
   page with its own classes; the wrappers add no box. Same look as the calculator ghost above. */
.ib-rg, .ib-rg-ph, .ib-rg-dt { display: contents; }
@media (min-width: 760px) { .ib-rg-ph { display: none; } }
@media (max-width: 759px) { .ib-rg-dt { display: none; } }
:root body .ib-rg :is(*, *::before, *::after) {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  text-shadow: none !important;
  animation: none !important;
  transition: none !important;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
:root body .ib-rg :is(svg, img) { visibility: hidden !important; }
/* dash.css hides the phone header on the dashboard (html:has(.ib-td)); a desktop-only dashboard ghost
   (account/chat loading) must not hide it on the phone page it stands in for. */
@media (max-width: 759px) {
  html:has(.ib-rg-dt .ib-td):not(:has(.ib-rg-ph .ib-td)) body #ib-top { display: flex; }
}
:root body .ib-rg :is([aria-checked="true"], [aria-pressed="true"], [aria-selected="true"]) {
  border-color: var(--ib-ui-card-surface-line) !important;
  background: var(--ib-ui-tint) !important;
  box-shadow: none !important;
}
:root body .ib-rg .ib-g-t {
  font-style: inherit;
  border-radius: var(--ib-radius-sm);
  background: var(--ib-ui-tint) !important;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
@media (prefers-reduced-motion: no-preference) {
  :root body .ib-rg .ib-g-t { animation: ib-g-pulse var(--ib-motion-shimmer) var(--ib-ease-out) infinite alternate !important; }
}

/* Home pre-mount: stands in for the home.js body below the static hero. LandingPage's own root
   holds min-height 100vh, so this reserve matches it and the footer never flashes up first. */
.ib-skel-home {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--ib-space-lg);
  min-height: 100vh;
  width: 100%;
  max-width: var(--ib-shell, 1180px);
  margin: 0 auto;
  padding: var(--ib-space-lg) var(--ib-space-gutter);
}
.ib-skel-home .ib-skel-sub { width: 72%; align-self: center; }
.ib-skel-home .ib-skel-cta { width: 200px; align-self: center; }
.ib-skel-home .ib-skel-card { min-height: calc(var(--ib-space-touch) * 5); }
.ib-skel-home .ib-skel-label { width: 40%; }
.ib-skel-home .ib-skel-wide { width: 86%; }
