/* The PDF preview overlay has its own sheet so a page without the reader
   (the FCA catalog, #3144) can load it alone. @import must come first. */
@import url('pdf_preview_overlay.css');

/* 
 * Consolidated UI Styles for LeX-Ray
 * This file contains all UI styles for overlays, boxes, and interactive elements
 */

/* ===== UI Box Container ===== */
.ui-boxes-container {
    position: fixed;
    top: 90px; /* Below fixed header (80px) + 10px breathing room */
    right: 20px;
    z-index: 1070; /* Above header (1050) */
    max-width: 400px;
    width: calc(100% - 40px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===== UI Box Base Styles ===== */
.ui-box {
    width: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background-color: white;
    transition: all 0.3s ease;
}

/* ===== Navigate Overlay ===== */
.navigate-overlay {
    background-color: transparent;
    z-index: 1071;
}

.navigate-container {
    position: relative;
    width: 100%;
    padding: 10px 15px;
    border-radius: 8px;
    background-color: white;
    display: flex;
    align-items: center;
    border: 1px solid #ffffff;
    background-clip: padding-box;
    transition: all 0.3s ease;
}

.navigate-input {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 5px 0;
    background: transparent;
}

.navigate-input::placeholder {
    color: #999;
}

.navigate-close {
    cursor: pointer;
    margin-left: 10px;
    font-size: 24px;
    line-height: 1;
    color: #6c757d;
}

.hash-symbol {
    margin-right: 10px;
    color: #6c757d;
    font-size: 18px;
    font-weight: bold;
    user-select: none;
}

.navigate-container.success {
    background-color: #d4edda;
    border: 2px solid #28a745;
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.2);
    transition: all 0.2s ease-out;
}

.navigate-container.warning {
    background-color: #fff3cd;
    border: 2px solid #ffa500;
    box-shadow: 0 2px 10px rgba(255, 165, 0, 0.2);
    animation: shake 0.4s ease-in-out;
}

.navigate-container.invalid {
    background-color: #f8d7da;
    border: 2px solid #ff3333;
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.15);
    animation: shake 0.4s ease-in-out;
}

/* ===== Resource Preview Loading ===== */
.resource-preview-link.loading {
    opacity: 0.7;
    position: relative;
}

.resource-preview-link.loading::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border: 2px solid #6c757d;
    border-radius: 50%;
    border-top-color: transparent;
    animation: loading-spin-positioned 1s linear infinite;
}

@keyframes loading-spin-positioned {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* ===== Search Highlighting — CSS Custom Highlight API ===== */
/* These use ::highlight() pseudo-elements backed by Range objects.
   The legislation DOM is NEVER modified — no text-node splitting,
   no span wrapping, no replaceChild.  Zero risk of text corruption. */

::highlight(search-match) {
    background-color: #ffeb3b;
}
::highlight(semantic-match) {
    background-color: #f8bbd0;
}
::highlight(search-current) {
    background-color: #ff9800;
}

/* Definition link highlight (classList on <a> tags, not text wrapping) */
.definition-highlight {
    background-color: #c8e6c9;
    border-radius: 2px;
    padding: 0 2px;
}

/* Current match for definition nav (still class-based) */
.definition-highlight.omni-nav-current {
    background-color: #ff9800;
    outline: 2px solid #e65100;
    outline-offset: 0;
    margin: 0;
}

/* ===== Card Highlighting Styles ===== */
.celex-card.filter-match {
    border-left: 4px solid #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

.celex-card.revealed-by-navigation {
    border-left: 4px solid #007bff;
    border-right: 4px solid #007bff;
    box-shadow: 0 0 12px rgba(0, 123, 255, 0.5);
    animation: pulse 1.5s ease-in-out;
}

/* When filtering is active, dim non-matching cards. Scoped to the reading
   surface (#legislation): a bare .celex-card selector also caught provision
   fragments quoted elsewhere (the logic page's side pane), which are display
   material, never filter subjects. (On the loader path this rule is inert
   anyway — the shadow boundary hides body.filtering-active — so the scope
   only ever mattered on light-DOM surfaces.) */
body.filtering-active #legislation .celex-card:not(.filter-match) {
    opacity: 0.5;
}

#legislation.legislation-reordering-active .celex-card:not(.filter-match) {
    opacity: 0.5;
}

/* Hide structural headings when filtering or reordering (scoped to the
   reading surface for the same reason as the dim rule above) */
body.filtering-active #legislation .structural-element,
body.filtering-active #legislation .first-structural-container,
body.reordering-active #legislation .structural-element,
body.reordering-active #legislation .first-structural-container {
    display: none;
}

#legislation.legislation-reordering-active .structural-element,
#legislation.legislation-reordering-active .first-structural-container {
    display: none;
}

/* Hide non-matching cards during reorder (class-based to beat specificity) */
.reorder-hidden {
    display: none !important;
}

/* ===== Animations ===== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 rgba(0, 123, 255, 0.5); }
    50% { box-shadow: 0 0 20px rgba(0, 123, 255, 0.8); }
    100% { box-shadow: 0 0 12px rgba(0, 123, 255, 0.5); }
}

/* ===== Resource Preview Popover Styles ===== */
.resource-preview-popover {
    max-width: 900px !important;
    width: 900px !important;
    height: 700px !important;
    border: none;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    z-index: 1072 !important; /* Above search overlays */
    position: fixed !important;
    transform: none !important;
    display: flex !important;
    flex-direction: column !important;
}

.resource-preview-popover .popover-body {
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.resource-preview-popover .popover-arrow {
    display: none !important;
}

.resource-preview-container {
    min-width: 900px;
    font-family: var(--ss-font-primary);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.resource-preview-header {
    background: linear-gradient(135deg, #f96a71 0%, #f71b26 100%);
    color: white;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.resource-preview-content {
    background: white;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.resource-preview-content object,
.resource-preview-content iframe {
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
}

.external-resource-notice,
.error-notice,
.loading-content {
    padding: 30px;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-content {
    background: #f8f9fa;
}

.external-resource-notice .btn,
.error-notice .btn {
    margin-top: 15px;
}

.pdf-fallback {
    padding: 60px;
    text-align: center;
    color: #6c757d;
}

.pdf-fallback p {
    margin: 12px 0;
}

.pdf-fallback i {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
    .ui-boxes-container {
        top: 10px;
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
        max-width: none;
    }
    
    .resource-preview-popover {
        max-width: 95vw !important;
        width: 95vw !important;
        left: 2.5vw !important;
        top: 50px !important;
    }
    
    .resource-preview-container {
        min-width: 90vw;
    }
    
    .resource-preview-content object,
    .resource-preview-content iframe {
        height: 400px !important;
    }
    
    .loading-content {
        height: 400px !important;
    }
}

/* --- Semantic Search Results (Issue #581) --- */

.semantic-results {
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    padding: 4px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* --- Semantic results: terms header (shown once above the rows) --- */
.semantic-results-header {
    padding: 4px 10px;
    font-size: 11px;
    color: #666;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.semantic-results-header .hl-semantic {
    color: #1565c0;
    font-style: italic;
}

/* --- Semantic results: table rows --- */
.semantic-result-item {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 3px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}

.semantic-result-item:last-child {
    border-bottom: none;
}

.semantic-result-item:hover {
    background: #f0f4ff;
}

.semantic-result-item .chunk-badge {
    display: inline-block;
    width: 42px;
    padding: 1px 5px;
    margin-right: 8px;
    font-size: 11px;
    font-family: var(--badge-font);
    font-weight: var(--badge-font-weight);
    text-align: center;
    color: #fff;
    background: #e8868a;
    border-radius: 3px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.semantic-result-item .chunk-badge--recital {
    background: #5c6bc0;
}

.semantic-result-item .chunk-badge--definition {
    background: var(--definition-link-color);
}

.semantic-result-item .match-type {
    font-size: 10px;
    font-weight: 600;
    width: 38px;
    margin-right: 8px;
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.semantic-result-item .match--literal  { color: #d84315; }
.semantic-result-item .match--semantic { color: #1565c0; }
.semantic-result-item .match--both     { color: #5c6bc0; }

.semantic-result-item .chunk-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #444;
}

/* --- Categorised filter suggestions dropdown (#1281) --- */
.omni-suggest__section {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 2px;
}

.omni-suggest__section:last-child {
    border-bottom: none;
}

.omni-suggest__title {
    padding: 5px 10px 2px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #999;
}

.omni-suggest__row {
    display: flex;
    align-items: center;
    padding: 3px 10px 3px 14px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    transition: background 0.15s;
}

.omni-suggest__row:hover,
.omni-suggest__row--active {
    background: #fff3cd;
}

.omni-suggest__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.omni-suggest__count {
    flex-shrink: 0;
    margin-left: 8px;
    padding: 0 6px;
    font-size: 11px;
    border-radius: 8px;
    background: #f0f0f0;
    color: #777;
}

/* Match-type tooltip (= / ~) */
.match-type[data-tip] {
    position: relative;
    cursor: default;
}

.match-type[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    margin-bottom: 4px;
    padding: 4px 8px;
    background: #333;
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    font-style: normal;
    white-space: nowrap;
    border-radius: 4px;
    z-index: 100;
    pointer-events: none;
}

/* Flash animation when scrolling to a semantic match */
.semantic-highlight-flash {
    animation: semantic-flash 2s ease-out;
}

@keyframes semantic-flash {
    0% { box-shadow: 0 0 0 3px rgba(129, 212, 250, 0.6); }
    100% { box-shadow: none; }
}

/* ===== Omni Search Bar (lives inside .toc-sidebar) ===== */

.omni-search {
    --omni-collapse-duration: 0.25s;
    /* Trigger pinks scoped here so the whole trigger palette is reviewable in one place.
       Values unchanged — they deliberately match the .toc-btn salmon family. */
    --omni-trigger-bg: #ffd4d6;
    --omni-trigger-bg-hover: #ffb8bb;
    --omni-trigger-border: #ffb8bb;
    --omni-trigger-border-hover: #ff9ca0;
    --omni-trigger-active-fg: #f96a71;
    position: relative;       /* anchor for the expanded body + results */
    display: flex;
    flex-direction: row;
    align-items: stretch;
    margin-bottom: 0.5rem;
    z-index: 1;               /* above sibling toc-grid buttons */
    font-family: var(--ss-font-primary);
}

/* --- Trigger button — matches .toc-btn look in collapsed state --- */
.omni-search__trigger {
    display: block;
    width: var(--toc-button-width, 50px);
    text-align: center;
    padding: 0.25rem 0.1rem;     /* identical to .toc-btn */
    white-space: nowrap;
    overflow: hidden;
    border-radius: 3px;
    font-weight: bold;
    background: var(--omni-trigger-bg);
    border: 1px solid var(--omni-trigger-border);
    color: #333;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease, border-radius 0.2s;
}

.omni-search__trigger:hover {
    background: var(--omni-trigger-bg-hover);
    border-color: var(--omni-trigger-border-hover);
}

/* A press/click buffered before the bar is live (celex_early_keys.js, #3035):
   the trigger holds its hover look so the control reads as received rather
   than dead; the live bar clears the class when it drains the intent. */
.omni-search--armed .omni-search__trigger {
    background: var(--omni-trigger-bg-hover);
    border-color: var(--omni-trigger-border-hover);
    color: var(--omni-trigger-active-fg);
}

/* --- Logic-view toggle — the `l` trigger next to the omni trigger (#1429).
   Opens the in-reader logic overlay (celex_logic_view.js). Relocated here from
   the retired celex_logic_view.css so it survives that file's deletion; matches
   the omni trigger footprint (--toc-button-width). --- */
/* The reader-side entry affordance moved to the toc-grid (.toc-logic-btn in
   celex.css): while the overlay is closed this button is redundant chrome, so
   it shows only in its pressed state — travelling with the omni bar into the
   overlay toolbar as the "back to the text" control. :not([aria-pressed='true'])
   rather than [aria-pressed='false'] so CLOSED is the default: markup rendered
   before JS stamps the attribute must not paint the trigger. */
.logic-view-trigger:not([aria-pressed='true']) {
    display: none;
}

.logic-view-trigger {
    display: block;
    width: var(--toc-button-width, 50px);
    text-align: center;
    padding: 0.25rem 0.1rem;
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    border-radius: 3px;
    font-weight: bold;
    background: #eef0ff;
    border: 1px solid #c7cdfc;
    color: #4338ca;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.logic-view-trigger:hover {
    background: #dfe3ff;
    border-color: #aab4fa;
}

.logic-view-trigger[aria-pressed='true'] {
    background: #4338ca;
    border-color: #4338ca;
    color: #fff;
}

/* --- Panel (fixed container for bar + results as one unit) ---
   Collapsed: zero-width via right trick. Expanded: stretches from content
   left edge to floodlight right edge. JS sets --omni-panel-top / left / right. */
.omni-search__panel {
    position: fixed;
    top: var(--omni-panel-top, 0);
    left: var(--omni-panel-left, 66px);
    right: calc(100vw - var(--omni-panel-left, 66px)); /* collapsed: zero width */
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    opacity: 0;
    transition: right var(--omni-collapse-duration) ease, opacity var(--omni-collapse-duration) ease;
    pointer-events: none;
    z-index: 1070;
}

/* --- Bar (input + toggles row inside panel) --- */
.omni-search__bar {
    display: flex;
    align-items: center;
    height: var(--omni-bar-height, 51px);
    padding: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

/* --- Collapsed state --- */
.omni-search--collapsed .omni-search__panel {
    right: calc(100vw - var(--omni-panel-left, 66px));
    opacity: 0;
    pointer-events: none;
}

/* --- Expanded state --- */
.omni-search--expanded .omni-search__trigger {
    background: white;
    color: var(--omni-trigger-active-fg);
    border-color: #ddd;
}

.omni-search--expanded .omni-search__panel {
    right: var(--omni-panel-right, 20px); /* align with floodlight right edge */
    opacity: 1;
    padding: 4px 10px;
    pointer-events: auto;
    border: 1px solid #ddd;
}

/* --- Input wrapper (holds pill chips + input + ghost overlay) --- */
.omni-search__input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

/* Filter pill chips (#1280 / #1286) live in components.css §3 — they are the
   Handbook browse bar's facet pills too since #1909, and that page loads no
   celex_ui.css. What stays here is the coupling that IS this bar's: the ghost
   overlay below is offset past the chip row by `--omni-chips-w`. */

/* --- Input --- */
.omni-search__input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 4px 4px;
    background: transparent;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.omni-search__input::placeholder {
    color: #999;
}

/* Ghost text: sits behind the input, same font, shows completion suffix.
   When pill chips are present the input starts after them, so the overlay is
   shifted by the measured chip-row width (--omni-chips-w, set by
   celex_omni_chips.js on render). */
.omni-search__ghost {
    position: absolute;
    top: 0;
    left: var(--omni-chips-w, 0px);
    right: 0;
    bottom: 0;
    padding: 4px 4px;
    font-size: 14px;
    font-family: inherit;
    line-height: inherit;
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
    color: transparent;
    z-index: 0;
}
.omni-search__ghost-suffix {
    color: #aaa;
}

/* --- Toggle group (includes mode toggles + nav buttons) --- */
.omni-search__toggles {
    display: flex;
    gap: 3px;
    margin: 0 3px;
}

.omni-search__toggle {
    width: 26px;
    height: 26px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f8f8;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

.omni-search__toggle:hover {
    background: #eee;
    color: #555;
}

/* Active states */
.omni-search__toggle--active-filter {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.omni-search__toggle--active-semantic {
    background: #d6eaff;
    border-color: #007bff;
    color: #004085;
}

.omni-search__toggle--active-reorder {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.omni-search__toggle--active-preview {
    background: #f3e5f5;
    border-color: #9c27b0;
    color: #6a1b9a;
}

/* Inert — toggle has no effect for the current query (e.g. semantic/reorder
   during a d:/d+: definition filter). Dimmed so the UI doesn't imply it's live. */
.omni-search__toggle--inert {
    opacity: 0.4;
    background: #f8f8f8;
    border-color: #ddd;
    color: #888;
}


/* --- Counter --- */
.omni-search__counter {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background-color: #007bff;
    color: white;
    font-size: 11px;
    font-weight: bold;
    margin: 0 3px;
    padding: 0 5px;
    transition: background-color 0.3s ease;
}

/* A provisional total ("1 / ~17"): the highlighter is still counting the
   offscreen matches, and the exact total replaces it when it settles (#3034). */
.omni-search__counter--provisional {
    opacity: 0.8;
}

/* The lexical ladder answered from a relaxed rung (#3034, search.md P3/P5):
   no card holds the typed phrase, so the cards shown hold all of its words.
   Said, not implied — the list answers a looser question than the one typed. */
.omni-search__relaxed {
    color: var(--lx-text-muted);
    font-size: 11px;
    margin: 0 3px;
    max-width: 16em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.omni-search__relaxed[hidden] {
    display: none;
}

/* Quiet "refining…" note while the semantic leg is pending (#3034). The
   counter already shows the lexical answer; this only says a re-ordering may
   still come, so it stays small and muted. Created by celex_omni_search.js. */
.omni-search__refining {
    color: var(--lx-text-muted);
    font-size: 11px;
    font-style: italic;
    margin: 0 3px;
    white-space: nowrap;
}

.omni-search__refining[hidden] {
    display: none;
}

/* Blue pill for per-card match count in preview results */
.match-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background-color: #007bff;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 0 4px;
    margin: 0 4px;
}

/* --- Close button --- */
.omni-search__close {
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    font-size: 13px;
    color: #999;
    cursor: pointer;
    padding: 0;
    margin: 0 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.omni-search__close:hover {
    color: #333;
}

/* --- Results (flows inside panel below the bar) ---
   Height reveal is INSTANT (max-height is not transitioned): a max-height
   transition here intermittently froze at 0, clipping the rendered results to
   zero height (invisible) while the content offset still reserved their space —
   a big empty gap with no results. Snapping max-height to its target is reliable
   (and snappier); only the opacity fades. (#1429) */
.omni-search__results {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    border-top: none;
    transition: opacity var(--omni-collapse-duration) ease;
}

.omni-search__results--visible {
    max-height: var(--omni-results-max-height, 300px);
    overflow-y: auto;
    opacity: 1;
    border-top: 1px solid #eee;
}

/* --- Shimmer skeleton for preview panel --- */
.shimmer-hint {
    padding: 6px 12px 2px;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

.shimmer-row {
    pointer-events: none;
}

.shimmer-bar {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #eee 25%, #e0e0e0 50%, #eee 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Responsive: hide on mobile (TOC hidden there) --- */
@media (max-width: 991px) {
    .omni-search {
        display: none;
    }
}

/* --- Embedded logic overlay: the base HIDE lives here, not in logic_page.css
   (#1460).

   `includes/_logic_browser.html` ships the #logic-page scaffold inside BOTH
   reader templates (celex.html and loader.html), but logic_page.css — which
   used to carry `#logic-page[data-embedded='true'] { display: none }` — is
   injected LAZILY by celex_logic_view.js on the first press. Until that sheet
   landed the scaffold therefore had no hide rule at all: it sat in normal document flow at
   the end of the reader, and pressing `l` mounted the statement list + the
   provision pane into visible, unstyled in-flow content that then snapped to
   position:fixed when the stylesheet finally applied. That is the "flash of
   unformatted text" on the legislation pane.

   Keeping the base hide in a sheet the reader ALWAYS loads makes the scaffold
   inert by default, so a not-yet-styled overlay is invisible rather than ugly.
   logic_page.css's `#logic-page[data-embedded='true'].lp-open { display: block }`
   still wins the cascade on merit — it adds a class, so it is strictly more
   specific — regardless of stylesheet order. Do not add `display` to the
   scaffold as an inline style attribute: that would outrank .lp-open and the
   overlay could never open.

   This is the ONLY base hide rule: logic_page.css's embedded block
   deliberately carries no `display: none` of its own (two sources of truth
   for the scaffold's hidden state drifted once already — see its note). */
#logic-page[data-embedded='true'] {
    display: none;
}
