
/* =============================================================================
   BLACK SIGNAL — css/screens/title.css (layout only)
   The title screen and the auth screens. No frame here: the wordmark sits
   centered a little above the middle with its two actions directly under it,
   the ticker and the policy links hold the bottom, and the kunda glyph turns
   slowly behind everything in the theme color.
   ============================================================================= */
@layer screens {

/* ── Title ─────────────────────────────────────────────────────────────── */
.bs-welcome {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* never the ticker's intrinsic width */
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
.bs-welcome > * { min-width: 0; }
.bs-welcome .wlc-top-bar,
.bs-welcome .wlc-stage,
.bs-welcome .wlc-foot { position: relative; z-index: 1; }

.bs-welcome .wlc-top-bar {
  width: 100%;
  max-width: calc(var(--sig-col) + var(--sig-gutter) * 2);
  margin: 0 auto;
  padding: 16px var(--sig-gutter);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-bottom: 1px solid var(--sig-rule);
}

.bs-welcome .wlc-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px var(--sig-gutter) 10vh;   /* the group sits a little above center */
  text-align: center;
}
/* Lift the content stage above the decorative star glyph (.wlc-ghost is
   position:absolute, so it paints over non-positioned siblings even at the same
   z-index — which made the opaque Login/Sign Up buttons look see-through). */
.bs-welcome .wlc-stage { position: relative; z-index: 2; }
.bs-auth-screen .auth-main { position: relative; z-index: 2; }
.bs-welcome .wlc-wordmark-wrap { display: flex; flex-direction: column; align-items: center; align-self: center; width: auto; }
.bs-welcome .wlc-wordmark {
  text-align: center;
  margin: 0;                       /* the editorial left offset is gone */
  max-width: 6.3ch;                /* keeps BLACK / SIGNAL on two lines */
}
.bs-welcome .wlc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: min(100%, 520px);
  margin: 40px auto 0;
  align-self: center;
}
.bs-welcome .wlc-btn {
  height: 54px;
  margin: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase;
  clip-path: none;
}
/* Keep the existing button appearance and accent sweep unchanged. An opaque
   backing remains painted while the gradient changes size, preventing the
   brief see-through frame on the welcome actions. */
.bs-welcome .wlc-actions > .wlc-btn.bs-sweep {
  background-color: var(--sig-black) !important;
  isolation: isolate;
}
.bs-welcome .wlc-btn-secondary { border-left-width: 0; }
.bs-welcome .wlc-btn-tertiary {
  margin-top: 22px;
  font-family: var(--sig-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: none;
}
.bs-welcome .wlc-btn-tertiary::after { content: none; }   /* the arrow is in the text */
.bs-welcome .wlc-signed-in {
  margin-top: 18px;
  font-family: var(--sig-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--sig-ink-dim);
}

.bs-welcome .wlc-foot {
  width: 100%;
  max-width: calc(var(--sig-col) + var(--sig-gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--sig-gutter) 22px;
}
.bs-welcome .wlc-ticker-wrap { width: 100%; height: 36px; margin: 0; overflow: hidden; border-top: 1px solid var(--sig-rule); border-bottom: 1px solid var(--sig-rule); mask-image: none; -webkit-mask-image: none; }
.bs-welcome .wlc-ticker-inner { height: 100%; align-items: center; }
.bs-welcome .wlc-legal { margin-top: 16px; text-align: left; justify-content: flex-start; }

/* The glyph: as large as the space between the top bar and the footer
   allows, centered in it, slow, theme-colored. The ghost is placed in the
   grid's middle row (an absolutely positioned grid child takes that row as
   its box) and is a size container, so the glyph is the largest square that
   fits: min(width, height). kunda-glyph.png is the art cropped to the circle
   it sweeps when it turns, so nothing is ever cut off at any angle. */
.bs-welcome .wlc-ghost,
.bs-auth-screen .wlc-ghost {
  display: block;
  position: absolute;
  grid-row: 2 / 3; grid-column: 1 / 2;
  inset: 0;
  width: auto; height: auto;
  transform: none;          /* the legacy anchor was translated by half the viewport */
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  container-type: size;
}
.bs-welcome .wlc-ghost::after,
.bs-auth-screen .wlc-ghost::after {
  position: absolute;
  left: 50%; top: 50%;
  width: min(100cqw, 100cqh); height: min(100cqw, 100cqh);
  transform: translate(-50%, -50%);
  -webkit-mask: url('../../kunda-glyph.png') center / contain no-repeat;
  mask: url('../../kunda-glyph.png') center / contain no-repeat;
  opacity: 0.12;
  z-index: 0;
  animation: ghostSpin 30s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .bs-welcome .wlc-ghost::after, .bs-auth-screen .wlc-ghost::after { animation: none; }
}

/* ── Auth screens: the title's background, the modal's panel ───────────── */
.bs-auth-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
/* Smooth, quick entrance in place of the retired multi-second handoff. */
.bs-auth-screen .auth-panel { animation: bs-auth-in 220ms var(--ease-sharp, ease-out) both; }
/* Pure opacity fade — no translate. The auth panel must not slide on load (it
   compounded with the screen-transition cascade into a visible shift). */
@keyframes bs-auth-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .bs-auth-screen .auth-panel { animation: none; }
}
.bs-auth-screen > * { min-width: 0; }
.bs-auth-screen .auth-top-bar,
.bs-auth-screen .auth-main { position: relative; z-index: 1; }
.bs-auth-screen .auth-top-bar {
  width: 100%;
  max-width: calc(var(--sig-col) + var(--sig-gutter) * 2);
  margin: 0 auto;
  padding: 16px var(--sig-gutter);
  display: flex; align-items: center; justify-content: flex-end;
  border-bottom: 1px solid var(--sig-rule);
}
.bs-auth-screen .auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;          /* the panel is centered on the page… */
  justify-content: flex-start;  /* …and sits a little above the middle */
  min-height: 0;
  padding: 7vh var(--sig-gutter) 48px;
}
.bs-auth-screen .auth-panel {
  position: static;
  transform: none;
  clip-path: none;          /* the modal shell's closed state does not apply: this panel is the page */
  opacity: 1;
  transition: none;
  pointer-events: auto;
  width: min(100%, 520px);
  max-height: none;
  padding: 0;
}
.bs-auth-screen .auth-panel { display: block; overflow: visible; }
.bs-auth-screen .auth-panel-body { display: block; max-height: none; overflow: visible; padding: 24px 28px 26px; }
.bs-auth-screen .auth-panel-title { margin: 0; }
.bs-auth-screen .auth-form { display: flex; flex-direction: column; gap: 6px; }
.bs-auth-screen .auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 18px; }
.bs-auth-screen .auth-actions .wlc-btn { height: 50px; margin: 0; display: inline-flex; align-items: center; justify-content: center; clip-path: none; font-family: var(--font-display); font-weight: 700; font-size: 12.5px; letter-spacing: 0.18em; text-transform: uppercase; }
.bs-auth-screen .auth-actions .wlc-btn + .wlc-btn { border-left-width: 0; }
.bs-auth-screen .auth-google { width: 100%; height: 48px; margin: 0 0 14px; display: inline-flex; align-items: center; justify-content: center; clip-path: none; font-family: var(--font-display); font-weight: 700; font-size: 12.5px; letter-spacing: 0.18em; text-transform: uppercase; }
.bs-auth-screen .auth-link { align-self: flex-start; margin-top: 10px; font-family: var(--sig-mono); font-size: 12px; letter-spacing: 0.04em; text-transform: none; }
.bs-auth-screen .auth-right-rail { display: none; }

@media (max-width: 599px) {
  .bs-welcome .wlc-stage { padding: 16px var(--sig-gutter) 8vh; }
  .bs-welcome .wlc-wordmark { font-size: clamp(64px, 19vw, 96px); }
  .bs-welcome .wlc-actions { grid-template-columns: 1fr; width: 100%; margin-top: 30px; }
  .bs-welcome .wlc-btn-secondary { border-left-width: 1px; border-top-width: 0; }
  .bs-welcome .wlc-btn { height: 50px; }
  .bs-auth-screen .auth-main { padding: 20px var(--sig-gutter) 32px; }
  .bs-auth-screen .auth-actions { grid-template-columns: 1fr; }
  .bs-auth-screen .auth-actions .wlc-btn + .wlc-btn { border-left-width: 1px; border-top-width: 0; }
  .bs-auth-screen .auth-panel-body { padding: 18px 16px 20px; }
}

/* ── Wordmark reveal: Refined Decode ─────────────────────────────────────
   On load the word scrambles through glyphs and resolves letter by letter
   (decode) at 120ms/letter; each settling glyph eases out of a soft focus
   rather than snapping. Once resolved it sits still and takes a brief
   "chroma whisper" every 7s — two faint cyan/orange ghosts drift apart and
   rejoin on an eased curve, no hard jumps or inverts. JS in app/02-welcome.js
   (initWordmarkGlitch) builds the per-letter spans and the two chroma layers
   and drives the timing. The legacy data-text ghost is retired so the two
   treatments don't fight. */
.bs-welcome .wlc-wordmark { position: relative; }
.bs-welcome .wlc-wordmark::after { content: none; }        /* retire the old ghost glitch */
.bs-welcome .wlc-wm-line { display: block; white-space: nowrap; }  /* never wrap mid-decode — wide scrambled glyphs must not add a line and shove the buttons */
.bs-welcome .wlc-wordmark .ch {
  display: inline-block;
  transition: color .5s cubic-bezier(.22, .61, .36, 1),
              filter .5s cubic-bezier(.22, .61, .36, 1),
              text-shadow .5s cubic-bezier(.22, .61, .36, 1);
}
/* A glyph still resolving: a brighter tint of the user's chosen accent. Both
   --orange and --orange-light are set per-theme by applyTheme, and the glow uses
   currentColor, so the decode always matches the active theme colour (and tracks
   a live theme switch — unlike color-mix(var()), which doesn't recompute). */
.bs-welcome .wlc-wordmark .ch.is-scrambling {
  color: var(--orange-light, #ff7a3c);
  filter: blur(2.2px);
  text-shadow: 0 0 20px currentColor;
}

/* Two chroma layers sit exactly over the resolved word (screen-blended, so
   invisible at rest) and only drift during the idle whisper. They mirror the
   wordmark's own centering (text-align + block lines) for an exact overlay. */
.bs-welcome .wlc-chroma {
  position: absolute; inset: 0; width: 100%;
  text-align: center;
  opacity: 0; mix-blend-mode: screen; pointer-events: none;
  text-shadow: none;
}
.bs-welcome .wlc-chroma.c { color: #7fe6ff; }
.bs-welcome .wlc-chroma.o { color: var(--orange); }
.bs-welcome .wlc-wordmark.flick .wlc-chroma.c { animation: wlcChromaC 1.1s cubic-bezier(.22, .61, .36, 1); }
.bs-welcome .wlc-wordmark.flick .wlc-chroma.o { animation: wlcChromaO 1.1s cubic-bezier(.22, .61, .36, 1); }

@keyframes wlcChromaC { 0%{opacity:0;transform:translateX(0)} 30%{opacity:.5;transform:translateX(-5px)} 60%{opacity:.25;transform:translateX(-2px)} 100%{opacity:0;transform:translateX(0)} }
@keyframes wlcChromaO { 0%{opacity:0;transform:translateX(0)} 30%{opacity:.4;transform:translateX(5px)} 60%{opacity:.2;transform:translateX(2px)} 100%{opacity:0;transform:translateX(0)} }

@media (prefers-reduced-motion: reduce) {
  .bs-welcome .wlc-wordmark .ch { transition: none; }
  .bs-welcome .wlc-wordmark.flick .wlc-chroma { animation: none; }
}

}
