/* ============================================================
   jb-v2-legacy-hide.css — JobBored v2 redesign (Phase 4)
   ------------------------------------------------------------
   Owner:    Conductor (Phase 4 close-out)
   Purpose:  Hide the legacy in-app chrome when body.jb-v2 is
             set, so the v2 region hosts (Today / Dawn / Pipeline /
             Role / Scribe / Welcome) own the viewport.

   Scope:    All rules are scoped under `body.jb-v2`. With the
             flag OFF this file is a no-op and the legacy UI
             renders byte-for-byte unchanged.

   Intentional non-targets (left visible at all times):
     - #sheetAccessGate* — pre-app login / OAuth gate
     - .settings-modal*  — settings modal owns its own chrome
                           (the v2 toggle lives inside it)
     - .toast-stack      — global toasts apply to both surfaces
     - .modal-overlay    — generic modal overlays apply to both

   What hides:
     - .command-strip.daily-brief-panel — Dawn replaces it.
     - main.main-content — the Pipeline region replaces it.

   What stays:
     - #dashboard itself (its inline display: flex stays in
       force so the page is mounted).

   .top-bar is hidden in JBv2 too: flowing-chrome.js adopts its
   action buttons (sheetLink, materialsBtn, settingsBtn,
   authSection, etc.) into .page-top, so the legacy header is
   reduced to a duplicate logo. It was rendering as a stray
   "Job Bored" stamp at the bottom of pages because #dashboard
   is the last body child and its sticky top-bar got pushed far
   down by the data-region sections that come before it.
   ============================================================ */

body.jb-v2 #dashboard > .command-strip.daily-brief-panel,
body.jb-v2 #dashboard > main.main-content,
body.jb-v2 #dashboard > header.top-bar {
  display: none !important;
}

/* Welcome host is empty when not in onboarding/empty mode —
   collapse it so it doesn't take page real estate. */
body.jb-v2 [data-region="welcome"]:not([data-mode]) {
  display: none;
}

/* ────────────────────────────────────────────────────────────
   Gate v2 regions on auth.
   The four region hosts sit at the top of <body>, ABOVE the
   the pre-app gate (#sheetAccessGateScreen) and
   #dashboard. If we let them render before sign-in, empty-state
   Dawn / Lattice cover the gates and the user can't reach the
   top-bar / settings gear to flip the toggle.
   Solution: only show v2 regions when #dashboard is visible
   (i.e. app.js has run the post-auth path that sets
   #dashboard.style.display to "block" / "flex").
   Default: hide all four regions. Today is gated too (SS-08): above a
   sheet-403 or expired-session gate it said "Nothing is waiting on you
   today" while the app could not read anything.
   ──────────────────────────────────────────────────────────── */
body.jb-v2 .page-top,
body.jb-v2 [data-region="dawn"],
body.jb-v2 [data-region="today"],
body.jb-v2 [data-region="pipeline"],
body.jb-v2 [data-region="role"],
body.jb-v2 [data-region="scribe"],
body.jb-v2 [data-region="welcome"] {
  display: none !important;
}

/* Only when the legacy #dashboard is mounted (post-auth) do
   the v2 regions take over. Each region's own CSS owns its
   layout once revealed. :has() is supported in all modern
   browsers (2023+). */
body.jb-v2:has(#dashboard:not([style*="display: none"])) .page-top {
  display: flex !important;
}
body.jb-v2:has(#dashboard:not([style*="display: none"])) [data-region="dawn"],
body.jb-v2:has(#dashboard:not([style*="display: none"])) [data-region="today"],
body.jb-v2:has(#dashboard:not([style*="display: none"])) [data-region="pipeline"],
body.jb-v2:has(#dashboard:not([style*="display: none"])) [data-region="role"],
body.jb-v2:has(#dashboard:not([style*="display: none"])) [data-region="scribe"] {
  display: block !important;
}

/* Welcome only renders for genuine first-run ONBOARDING.
   The "empty pipeline" state is owned by Dawn (inline headline
   in the Daily Brief). Showing Welcome's full-bleed overlay for
   every empty-pipeline session would cover Dawn + the top-bar
   and trap the user. */
body.jb-v2:has(#dashboard:not([style*="display: none"])) [data-region="welcome"][data-mode="onboarding"] {
  display: flex !important;
}

/* ────────────────────────────────────────────────────────────
   Legacy cover-letter modal
   ------------------------------------------------------------
   The legacy cover-letter authoring surface is the
   `#resumeGenerateModal` overlay (`.modal-overlay.doc-output-modal`).
   Scribe (region:scribe) replaces it. Hidden whenever
   body.jb-v2 is set — the legacy modal must never co-exist with
   Scribe, since both bind to the same #resumeGenerate* ids.

   DS-08: the separate #pipelineSection and .pipeline-board hide
   rules are gone. Under body.jb-v2 pipeline-render.js builds no
   .pipeline-board at all, and #pipelineSection sits inside
   main.main-content, which the rule at the top still hides (it
   holds the legacy toolbar, empty and error states).
   ──────────────────────────────────────────────────────────── */
body.jb-v2 #resumeGenerateModal {
  display: none !important;
}

/* ────────────────────────────────────────────────────────────
   Flowing-page activation gate
   ------------------------------------------------------------
   The flowing-page sections (page chrome, Brief / Pipeline /
   Letter wrappers shipped by the other Phase 2 droids) only
   render when BOTH `body.jb-v2` and `body.flowing` are set.
   Off-flag = legacy untouched. v2-on without flowing keeps
   today's region behavior (Dawn / Lattice / Scribe / Welcome)
   exactly as Phase 3 shipped it.

   This file does not own the flowing-page styling itself —
   that lives in flowing-chrome.css and the per-section CSS the
   other 2.x droids ship. We only document the contract here.
   ──────────────────────────────────────────────────────────── */
