/* EZPZ Trading brand for the public EZRA pages (/ezra/, examples, tours) and the EZRA docs (/learn/ezra/).
 * EZRA is a tool inside EZPZ Trading, so these pages wear the site's colours and sit in its real header and
 * footer (partials/_site_header.html, _site_footer.html). Loaded last by partials/_site_assets.html, after the
 * site's global CSS (theme3 style.css: Bootstrap + the theme) and the EZRA stack.
 *
 * This is the ONE EZRA stylesheet allowed raw hex values (test_assets.py): they are the site header's own colours
 * (frontend/templates/theme3/elements/header.html: --ez-accent #9467FE, --ez-accent2 #7c4dde, --ez-accent3
 * #c4a3ff, --ez-h-bg #261355, --ez-panel-bg #1e0e44, dropdown #1c0b3c) and EZRA v10's dark tokens
 * (ezra-tokens.css) restored inside product frames.
 *
 * 1. Sticky geometry: --ezp-site-h, --ezp-subnav-h, --ezp-sticky-top (the docs use --ezp-sticky-top too).
 * 2. Brand tokens on .ezp-page; contrast checked (WCAG AA) on #160930, #1e0e44 and #261355:
 *    --text 13.7+, --muted 6.9+, --faint 5.0+, --p-text 7.6+; --p #9467FE is 4.3+ (accents, rings, lines).
 *    White on #9467FE is only 3.7:1, so white text sits on --p-fill #7c4dde (5.3:1) and the primary button
 *    gradient keeps every stop at 4.5:1 or more.
 * 3. .ezp-app-frame: the EZRA app's own dark tokens come back inside every frame that shows the product.
 * 4. Site CSS bleed: theme3 style.css styles bare elements (h1-h6, p, ul, li, section, footer, code, a); inside
 *    .ezra-root those go back to the browser defaults EZRA was built on. Plus the two real class collisions
 *    with the site header (.ez-menu, .ez-avatar) and its --ez-h custom property.
 * 5. Brand pieces: page glow, sweep line, eyebrows, primary buttons, the sub-nav, the hero title. */

/* ── 1. Sticky geometry ──
 * The site header (.site-header) is position: sticky at top 0 (header.html), so the page needs no top padding.
 * Its bar is --ez-h tall (5.5rem, 3.75rem up to 1060px; header.html sets both on :root) plus .main-bar's 1px
 * border. It is read on :root because inside .ezra-root --ez-h is EZRA's heading colour (ezra.css). */
:root {
  --ezp-site-h: calc(var(--ez-h, 5.5rem) + 1px);
}
:root, .ezp-page {
  --ezp-subnav-h: 52px;   /* the EZRA sub-nav (partials/_header.html), border included */
  --ezp-sticky-top: calc(var(--ezp-site-h) + var(--ezp-subnav-h));
}
@media (max-width: 720px) {
  :root, .ezp-page { --ezp-subnav-h: 48px; }
}
/* focus is never hidden under the sticky site header and sub-nav (WCAG 2.4.11) */
html:has(.ezp-page) { scroll-padding-top: calc(var(--ezp-sticky-top) + 16px); color-scheme: dark; background: #160930; }
html:has(.ezp-page) body { background: #160930; }

/* ── 2. Brand tokens ── */
.ezp-page {
  color-scheme: dark;
  --p:        #9467FE;
  --p-h:      #7c4dde;
  --p-text:   #c4a3ff;
  --p-fill:   #7c4dde;                    /* fills that carry white text: 5.3:1 */
  --on-p:     #ffffff;
  --p1:       rgba(148, 103, 254, .10);
  --p2:       rgba(148, 103, 254, .18);
  --p3:       rgba(148, 103, 254, .34);
  --bg:       #160930;
  --bg2:      #1e0e44;
  --bg3:      #261355;
  --bg4:      #2e1866;
  --card:     #1e0e44;
  --card-2:   #261355;
  --overlay:  rgba(22, 9, 48, .86);
  --border:   rgba(148, 103, 254, .14);
  --border2:  rgba(148, 103, 254, .26);
  --ring:     #c4a3ff;
  --text:     rgba(255, 255, 255, .92);
  --bright:   #ffffff;
  --muted:    rgba(214, 203, 255, .78);
  --faint:    rgba(200, 185, 255, .70);
  --grid:     rgba(148, 103, 254, .10);
  --skeleton: rgba(148, 103, 254, .08);
  --skeleton-hi: rgba(148, 103, 254, .16);
  --focus-halo: 0 0 0 3px rgba(148, 103, 254, .18);
  --sweep: linear-gradient(90deg, transparent, #7c4dde 25%, #9467FE 50%, #c4a3ff 75%, transparent);
  --ezp-btn-bg: linear-gradient(135deg, #8657ee, #7c4dde 50%, #6b3ccc);   /* white text >= 4.5:1 on every stop */
  --ezp-btn-bg-h: linear-gradient(135deg, #7c4dde, #6b3ccc);
  --ezp-btn-edge: #7c4dde;
  --ezp-btn-glow: 0 0 0 1px rgba(255, 255, 255, .10) inset, 0 8px 28px rgba(148, 103, 254, .45);
  color: var(--text);
}
/* the page itself: a soft violet glow at the top on the site's deep purple */
.ezp-page:not(.ezp-part) { background: radial-gradient(70% 40% at 50% 0%, rgba(148, 103, 254, .10), transparent 70%), #160930; }

/* ── 3. The product looks like the product: EZRA v10's dark tokens (ezra-tokens.css .ezra-root) inside frames ── */
.ezp-app-frame {
  color-scheme: dark;
  --p:        #6759d1;
  --p-h:      #5548c1;
  --p-text:   #b3a9ff;
  --p-fill:   #6759d1;
  --on-p:     #ffffff;
  --p1:       rgba(103, 89, 209, .08);
  --p2:       rgba(103, 89, 209, .16);
  --p3:       rgba(103, 89, 209, .28);
  --bg:       #111118;
  --bg2:      #161622;
  --bg3:      #1a1a26;
  --bg4:      #222232;
  --card:     #161622;
  --card-2:   #1a1a26;
  --overlay:  rgba(10, 10, 16, .72);
  --border:   rgba(255, 255, 255, .07);
  --border2:  rgba(255, 255, 255, .12);
  --ring:     #9d92f5;
  --text:     #dcdce8;
  --bright:   #f0f0f8;
  --muted:    rgba(180, 175, 215, .86);
  --faint:    rgba(180, 175, 215, .72);
  --grid:     rgba(255, 255, 255, .055);
  --skeleton: rgba(255, 255, 255, .045);
  --skeleton-hi: rgba(255, 255, 255, .085);
  --focus-halo: 0 0 0 3px rgba(103, 89, 209, .16);
  --ezp-btn-bg: #6759d1;
  --ezp-btn-bg-h: #5548c1;
  --ezp-btn-edge: #6759d1;
  --ezp-btn-glow: none;
  color: var(--text);
}

/* ── 4. Site CSS bleed and collisions ──
 * :where() keeps each reset at one element's specificity: it beats theme3's bare element rules (loaded earlier)
 * and loses to every EZRA class rule. `revert` goes back to the browser default EZRA was designed on. */
:where(.ezra-root) :is(h1, h2, h3, h4, h5, h6) { font-family: revert; font-size: revert; font-weight: revert; line-height: revert; margin: revert; }
:where(.ezra-root) p { margin: revert; }
:where(.ezra-root) :is(ul, ol) { margin: revert; padding: revert; }
:where(.ezra-root) li { list-style: revert; }
:where(.ezra-root) :is(section, footer) { position: revert; z-index: revert; color: revert; background-color: revert; margin-right: revert; }   /* theme3: section { z-index: 1 } traps sticky bars; footer { background: #001288 } */
:where(.ezra-root) code { color: revert; font-size: revert; word-wrap: revert; }
:where(.ezra-root) a { transition: revert; }   /* theme3: a { transition: all .8s } */
:where(.ezra-root) label { display: revert; }
/* --ez-h: header.html sets it on :root as the bar height (5.5rem); ezra.css reads it as a heading colour with a
   currentColor fallback. Reset at every EZRA root so headings without their own --ez-h fall back as designed. */
.ezra-root { --ez-h: initial; }
/* .ez-menu: header.html's `.ez-menu { display: flex; height: var(--ez-h); padding: 0 ... }` is the site nav list;
   EZRA's .ez-menu is a popover (css/ezra-ui.css). Put EZRA's back inside EZRA. */
.ezra-root .ez-menu { display: block; height: auto; margin: 0; padding: var(--sp-1); gap: normal; align-items: normal; list-style: none; }
.ezra-root .ez-hist-menu { display: flex; flex-direction: column; gap: 2px; }
/* textarea: theme3 sets every textarea to height 150px; EZRA's composer sizes itself (min/max height only) */
:where(.ezra-root) textarea { height: auto; }
/* blockquote: theme3 makes it bold on a tinted panel (style.css); answers use EZRA's own quote style */
:where(.ezra-root) blockquote { font-weight: revert; background: revert; line-height: revert; position: revert; z-index: revert; }
/* the other direction: css/ezra-ui.css's popover `.ez-menu { position: absolute; min-width: 200px; ... }` is unscoped and
   matches the site header's nav list (<ul class="ez-menu">), pulling it out of the phone drawer's flow. Reset only
   properties the header never sets, so the header's own rules still apply. */
.site-header .ez-menu { position: static; min-width: 0; z-index: auto; background: none; border: 0; border-radius: 0; box-shadow: none; }
/* .ez-avatar: ezra.css's 26px black disc would restyle the site header's account initials; keep the header's look */
.site-header .ez-avatar { width: auto; height: auto; display: inline; place-items: normal; flex-shrink: 1; overflow: visible; border-radius: 0; background: none; box-shadow: none; }

/* ── 5. Brand pieces ── */
/* primary buttons: the site's violet gradient (inside frames, EZRA's flat --p) */
.ezra-root .ez-btn.is-primary { background: var(--ezp-btn-bg, var(--p)); border-color: var(--ezp-btn-edge, var(--p)); box-shadow: var(--ezp-btn-glow, none); }
.ezra-root .ez-btn.is-primary:hover:not(:disabled, [aria-disabled="true"]) { background: var(--ezp-btn-bg-h, var(--p-h)); border-color: var(--ezp-btn-edge, var(--p-h)); }
/* white text on a violet fill uses --p-fill (AA) */
.ezp-page :is(.ezp-bubble, .ezx-noscript-q) { background: var(--p-fill); }
.ezp-page .ezt-chapter[aria-current="step"] .ezt-chapter-n { background: var(--p-fill); border-color: var(--p-fill); }
.ezp-skip.ezp-page { background: var(--p-fill); color: var(--on-p); transition: none; }

/* eyebrows and section accents: a short sweep line before (and after, when centred) */
.ezp-page .ez-eyebrow:not(.ezp-app-frame *) { display: inline-flex; align-items: center; gap: 10px; color: var(--p-text); --ez-h: var(--p-text); }
.ezp-page .ez-eyebrow:not(.ezp-app-frame *)::before { content: ""; flex: none; width: 28px; height: 2px; border-radius: 2px; background: var(--sweep); }
.ezp-page .is-center > .ez-eyebrow:not(.ezp-app-frame *)::after { content: ""; flex: none; width: 28px; height: 2px; border-radius: 2px; background: var(--sweep); }

/* the hero title's emphasis in the site's light-to-violet gradient */
.ezp-page .ezp-hero-em { background: linear-gradient(90deg, #e2d4ff, #c4a3ff 35%, #9467FE 75%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* the EZRA sub-nav under the site header: the site bar's colour, a sweep line at its foot */
.ezp-header.ezp-page { background: rgba(22, 9, 48, .9); border-bottom: 1px solid var(--border); }
.ezp-header.ezp-page::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--sweep); pointer-events: none; }
.ezp-header .ezp-nav-link[aria-current="page"] { background: var(--p1); box-shadow: inset 0 -2px 0 var(--p); }

/* product frames glow in the site's violet */
.ezp-page :is(.ezp-frame, .ezx-window, .ezt-window) { box-shadow: 0 12px 40px rgba(0, 0, 0, .5), 0 0 0 1px rgba(148, 103, 254, .18), 0 0 96px rgba(148, 103, 254, .22); border-color: rgba(148, 103, 254, .26); }

@media (forced-colors: active) {
  .ezp-header.ezp-page::after, .ezp-page .ez-eyebrow::before, .ezp-page .ez-eyebrow::after { display: none; }
}

/* ── 6. Record mode (staff, ?record=1): the screen recording shows the EZRA window only, never the site chrome ── */
html:has(.ezt-page.is-recording) :is(.site-header, .ezp-header, .ezp-skip, .ezp-disclaimer) { display: none !important; }
