/* @level section */

/* launcher — the pre-wasm boot entry (audio-safe boot arc). Boot CHROME: loaded from index.html's <head> so it
   paints before any module evaluates, alongside tokens.css (whose vars it uses — no raw hex, so it themes with
   the app). It is the boot screen, not a modal, so it carries its own classes (never a `-scrim`). Sizes come from
   the --m-size-* scale; the few values without a token live in one local block so no raw px repeats. */

.lch-root {
  --lch-bd: 1px;            /* hairline border */
  --lch-hair: 2px;         /* warming hairline */
  --lch-mark: 26px;        /* brand mark */
  --lch-tile-r: 16px;      /* hero corner */
  --lch-chev: 36px;        /* chevron hit area */
  --lch-dot: 24px;         /* dot hit area (WCAG 2.5.8) */
  --lch-pip: 7px;          /* dot pip */
  --lch-pip-on: 20px;      /* active dot pip width */

  position: fixed;
  inset: 0;
  z-index: var(--m-z-boot);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--m-size-space-6);
  box-sizing: border-box;
  background: var(--m-surface-base);
  color: var(--m-content-primary);
  font-family: var(--m-font-sans, system-ui, -apple-system, sans-serif);
  opacity: 1;
  animation: lch-in 0.28s ease both;
}
.lch-root.is-leaving { opacity: 0; transition: opacity 0.24s ease; }
@keyframes lch-in { from { opacity: 0; } to { opacity: 1; } }

/* The ambient brand wash behind the panel — slow, subtle; it breathes while the engine warms. */
.lch-root::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(58% 48% at 50% 38%, var(--m-accent-tint), transparent 70%);
  animation: lch-breathe 9s ease-in-out infinite;
}

.lch-panel {
  position: relative;
  width: 100%;
  max-width: var(--m-size-extent-13);
  background: var(--m-surface-raised);
  border: var(--lch-bd) solid var(--m-border-default);
  border-radius: 18px;
  padding: var(--m-size-space-5h);
  box-sizing: border-box;
}

.lch-brand { display: flex; align-items: center; gap: var(--m-size-space-2h); }
.lch-mark { width: var(--lch-mark); height: var(--lch-mark); color: var(--m-accent-base); flex: 0 0 auto; }
.lch-word { font-size: var(--m-size-font-lg); font-weight: var(--m-weight-medium); letter-spacing: 0.01em; }

/* The language switcher — a flag button at the end of the brand row, opening the shared context-menu picker. */
.lch-lang {
  margin-inline-start: auto;
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--m-size-space-1);
  padding: var(--m-size-space-1) var(--m-size-space-1h);
  border-radius: var(--m-size-space-2);
  color: var(--m-content-muted);
}
.lch-lang:hover { color: var(--m-content-secondary); background: var(--m-surface-sunken); }
.lch-lang:focus-visible { outline: none; box-shadow: var(--m-glow); }
.lch-lang-flag { width: 20px; height: 15px; border-radius: 2px; display: block; object-fit: cover; box-shadow: 0 0 0 var(--lch-bd) var(--m-border-subtle); }
.lch-lang-caret { font-size: var(--m-size-font-2xs); line-height: 1; }

.lch-hairline { height: var(--lch-hair); border-radius: var(--lch-hair); background: var(--m-surface-pressed); overflow: hidden; margin: var(--m-size-space-3h) 0 var(--m-size-space-2); }
.lch-hairline-fill { height: 100%; width: 4%; border-radius: var(--lch-hair); background: var(--m-accent-base); animation: lch-warm 9s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.lch-root.is-ready .lch-hairline-fill { width: 100%; transition: width 0.3s ease; }
.lch-root.is-ready .lch-hairline { opacity: 0; transition: opacity 0.5s ease 0.25s; }
@keyframes lch-warm { from { width: 4%; } to { width: 72%; } }

.lch-warm { display: flex; align-items: center; gap: var(--m-size-space-1h); font-size: var(--m-size-font-xs); color: var(--m-content-muted); margin-bottom: var(--m-size-space-3h); }
.lch-warm-pip { width: var(--lch-pip); height: var(--lch-pip); border-radius: 50%; background: var(--m-accent-base); animation: lch-pulse 1.6s ease-in-out infinite; }
.lch-root.is-ready .lch-warm-pip { animation: none; }

.lch-head { font-size: var(--m-size-font-sm); color: var(--m-content-secondary); margin-bottom: var(--m-size-space-3); }

/* The carousel SHELL (launcher-carousel.js): a row of CO-PRESENT doors — the primary modes shown together — with
   any extras (Resume, …) scrollable past them, a peeking edge the cue. The wrapper is display:contents so the
   carousel/dots/live flow as panel children (no extra box). chevron · scroll-snap strip · chevron. */
.lch-carousel-shell { display: contents; }
.lch-carousel { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--m-size-space-1); }
.lch-strip {
  display: flex;
  gap: var(--m-size-space-3h);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: var(--m-size-space-1) var(--m-size-space-0h);
  scrollbar-width: none;
}
.lch-strip::-webkit-scrollbar { display: none; }
.lch-strip:focus-visible { outline: none; }

.lch-hero {
  flex: 0 0 30%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  appearance: none;
  background: var(--m-surface-sunken);
  border: var(--lch-bd) solid var(--m-border-subtle);
  border-radius: var(--lch-tile-r);
  padding: var(--m-size-space-4h) var(--m-size-space-2h);   /* tighter horizontal so the title fits at co-present width */
  cursor: pointer;
  color: inherit;
  text-align: start;
  font: inherit;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.lch-hero:hover { border-color: var(--m-border-emphasis); }
.lch-hero:active { transform: scale(0.99); }
.lch-hero:focus-visible { outline: none; border-color: var(--m-accent-base); box-shadow: var(--m-glow); }
/* The CURRENT door — what Return loads. A persistent accent ring picks it out among the co-present doors (roving
   focus keyboard-focuses it too; this is the always-on cue, even without a focus ring). */
.lch-hero.is-current { border-color: var(--m-accent-base); box-shadow: var(--m-glow); }
@media (max-width: 560px) { .lch-hero { flex-basis: 78%; } }   /* narrow screens: doors stay legible, swipe instead of co-present */

.lch-tile-art { width: 100%; }
.lch-tile-art svg { width: 100%; height: auto; display: block; }
.lch-tile-name { font-size: var(--m-size-font-md); font-weight: var(--m-weight-medium); margin-top: var(--m-size-space-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lch-tile-tag { font-size: var(--m-size-font-sm); color: var(--m-content-secondary); margin-top: var(--m-size-space-0h); line-height: 1.4; }
.lch-tile-meta { font-size: var(--m-size-font-xs); color: var(--m-content-muted); margin-top: var(--m-size-space-1h); }

.lch-tile-accent { background: var(--m-accent-tint); border-color: var(--m-accent-line); }
.lch-tile-accent .lch-tile-tag, .lch-tile-accent .lch-tile-meta { color: var(--m-content-secondary); }

.lch-hero.is-pending { opacity: 0.72; cursor: default; animation: lch-pulse 1.1s ease-in-out infinite; }

.lch-chev {
  appearance: none;
  width: var(--lch-chev);
  height: var(--lch-chev);
  border-radius: 50%;
  background: var(--m-surface-raised);
  border: var(--lch-bd) solid var(--m-border-default);
  color: var(--m-content-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--m-size-font-lg);
  line-height: 1;
}
.lch-chev:hover { color: var(--m-content-primary); border-color: var(--m-border-emphasis); }
.lch-chev:focus-visible { outline: none; box-shadow: var(--m-glow); }

.lch-dots { display: flex; justify-content: center; gap: var(--m-size-space-1h); margin-top: var(--m-size-space-3h); }
.lch-dot { appearance: none; background: none; border: none; cursor: pointer; width: var(--lch-dot); height: var(--lch-dot); padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.lch-dot > span { width: var(--lch-pip); height: var(--lch-pip); border-radius: 50%; background: var(--m-border-emphasis); transition: width 0.18s ease, background 0.18s ease; }
.lch-dot[aria-current="true"] > span { width: var(--lch-pip-on); border-radius: var(--lch-hair); background: var(--m-accent-base); }
.lch-dot:focus-visible { outline: none; box-shadow: var(--m-glow); border-radius: 50%; }

.lch-tails { display: flex; justify-content: center; gap: var(--m-size-space-5h); margin-top: var(--m-size-space-4h); }
.lch-tail {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--m-content-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--m-size-space-1h);
  padding: var(--m-size-space-1) var(--m-size-space-1h);
  border-radius: var(--m-size-space-2);
  font: inherit;
  font-size: var(--m-size-font-sm);
}
.lch-tail:hover { color: var(--m-content-secondary); }
.lch-tail:focus-visible { outline: none; box-shadow: var(--m-glow); }

.lch-live { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Living illustrations — the wait reads as a preview: a running sequence, a tracking playhead, a flowing patch. */
@keyframes lch-breathe { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
@keyframes lch-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes lch-sweep { from { transform: translateX(0); } to { transform: translateX(168px); } }
@keyframes lch-track { 0% { transform: translateX(-120px); } 100% { transform: translateX(44px); } }
@keyframes lch-flow { to { stroke-dashoffset: -88; } }
.lch-ph { animation: lch-sweep 4s linear infinite; }
.lch-pad { animation: lch-pulse 2.4s ease-in-out infinite; }
.lch-track { animation: lch-track 4.2s ease-in-out infinite alternate; }
.lch-jacks { animation: lch-pulse 2.8s ease-in-out infinite; }
.lch-cable { stroke-dasharray: 8 80; animation: lch-flow 2.2s linear infinite; }
.lch-ring { animation: lch-pulse 2.6s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .lch-root, .lch-root::before, .lch-hairline-fill, .lch-warm-pip,
  .lch-ph, .lch-pad, .lch-track, .lch-jacks, .lch-cable, .lch-ring, .lch-hero.is-pending { animation: none; }
  .lch-hairline-fill { width: 60%; }
  .lch-cable { stroke-dasharray: none; }
  .lch-strip { scroll-behavior: auto; }
}
