/*
 * WebHelp search-box visibility — driven by the publishing scenario (issue #178).
 *
 * The student edition is the trainee-filtered Oxygen pass: once the
 * instructor-only content (Analysis Sheets, vessel names) is stripped, the
 * remaining grams are images with no text body, so the WebHelp search box only
 * ever returns "no results" and should be hidden. The instructor edition keeps
 * its search box — it carries searchable text.
 *
 * WHICH edition is being published is decided at BUILD time, from what the
 * DITAVAL the scenario already passes actually DOES:
 *
 *   instructor  →  args.filter does not exclude audience -trainee  →  box shown
 *   student     →  args.filter DOES exclude audience -trainee      →  box hidden
 *
 * xslt/inc/customSearchFlag.xsl reads `args.filter`, opens the DITAVAL, and
 * injects a hidden marker on EVERY generated page via the
 * `webhelp.fragment.after.header` fragment point. The marker is always present
 * and carries one of two classes:
 *
 *   .wh-search-hidden  → student edition; the rule below fires
 *   .wh-search-shown   → instructor edition; nothing below matches it
 *
 * `.wh-search-shown` deliberately has no rule. It exists so a published page
 * can be grepped to confirm the mechanism ran at all — this only executes
 * inside a real Oxygen publish, so an always-absent marker could not
 * distinguish "the fragment never arrived" from "it decided to show".
 *
 * No dedicated parameter, deliberately: the student edition IS the
 * trainee-filtered pass, so the setting that makes it so is also what
 * identifies it — there is nothing extra to remember when the scenarios are
 * rebuilt. And the test is on what the DITAVAL *does*, not what it is called:
 * matching the filename `trainee.ditaval` was tried and failed in a real
 * publish, because DITA-OT merges the filter into its own
 * `ditaot.generated.ditaval` before these pages are built. See that
 * stylesheet's header for the full argument.
 *
 * WHAT CHANGED, AND WHY (issue #178). This file used to infer the edition from
 * the page content instead:
 *
 *     body:not(:has(.gf-persistent)) #searchForm { display: none !important; }
 *
 * generate_dita.py stamps a hidden, instructor-only `<p class="gf-persistent">`
 * onto every TOPIC and the trainee DITAVAL strips it, so marker-present meant
 * instructor and marker-absent meant student. That inference holds only on
 * pages built from a topic. Oxygen builds `index.html` from the ditamap and
 * generates `search.html` outright, so neither carries the marker in EITHER
 * edition — and the instructor lost the search box on the tiles landing page,
 * which with webhelp.show.main.page.tiles=yes is the instructor's main entry
 * point. Inverting the test fixes that at both ends: nothing is hidden unless
 * the student edition is positively identified.
 *
 * `#searchForm` is the stable id Oxygen WebHelp Responsive gives the search
 * input widget on every generated page (welcome/index, topic, search-results),
 * so one rule covers all of them. `:has()` is the same selector mechanism the
 * project's theme already relies on; it is used here only to hoist the marker
 * test to <body>, so the rule does not depend on where in the page Oxygen
 * happens to put the search form.
 */

/* The instructor content marker generate_dita.py stamps on every topic is a
   signal, not content — never render the empty paragraph itself. It no longer
   drives the rule below, but it is still emitted, and still must not show. */
.gf-persistent {
    display: none !important;
}

/* Hide the search box only where the student edition is positively identified,
   i.e. where the scenario's DITAVAL excludes the instructor audience. Applies
   to every page type, the tiles landing page and the search-results page
   included.

   Hide the whole BAND, not just the form inside it. `.wh_search_input` carries
   `padding: 40px 0` and a background image of its own (`115px 0` on the tiles
   page), so suppressing only `#searchForm` left the student edition with an
   empty ~80px strip under the header on every page. And since
   ../search-in-header/ moves that band into the header bar, an emptied one
   would sit there as a blank control beside the top menu. Both selectors are
   kept: the container is what reclaims the space, and `#searchForm` is the
   belt-and-braces one that still holds if a future template renders the form
   outside this wrapper. */
body:has(.wh-search-hidden) .wh_search_input,
body:has(.wh-search-hidden) #searchForm {
    display: none !important;
}
