/* =========================================================================
   X-RAY MODE  ·  Radiograph view
   Near-black film background. Cool blue-white luminous ink.

   Ghost strategy: dim only TOP-LEVEL section elements (.arival-section)
   so opacity stacking does not trap LIT children inside ghosted parents.
   LIT sections get opacity:1 !important on the same element → no conflict.

   Four states (no traffic-light colour, no chips):
     [data-xr-state="lit"]      — schema present + claim matches copy
     [data-xr-state="mismatch"] — schema present but claim not in copy
     [data-xr-state="none"]     — explicitly no schema (labelled hollow gap)
   Sections with no data-xray and no state class stay at the base ghost level.

   Education layer (new):
     - Per-state plain-English captions in the schema sheet
     - READ / QUOTE / ACT ladder HUD (top-left)
     - Bookable sections: louder luminous treatment + "AI CAN BOOK THIS"
     - Citation panel: real @graph fields, footnoted
     - Guided reveal overlay
     - None-section tappable with explanatory sheet

   Mobile-first. prefers-reduced-motion aware.
   ========================================================================= */

:root{
  --xr-film:        #05070b;              /* near-black film base */
  --xr-ink:         #cfe6ff;              /* luminous blue-white: LIT text */
  --xr-ink-dim:     #6b8aaa;              /* dim ink: secondary / readable */
  --xr-edge:        rgba(207,230,255,.55);/* LIT outline */
  --xr-glow:        rgba(207,230,255,.12);/* LIT inner glow */
  --xr-dash:        rgba(207,230,255,.32);/* MISMATCH dashed outline (base, overridden for drift) */
  --xr-none-edge:   rgba(207,230,255,.22);/* NONE dashed hollow outline */
  --xr-none-ink:    rgba(207,230,255,.42);/* NONE marker text */
  --xr-transition:  260ms ease;
  /* Drift / mismatch danger tokens — single intentional warm-amber accent.
     The radiograph is otherwise colourless; amber is the one semantic signal. */
  --xr-warn:        #e8a030;              /* amber warning: mismatch outline, banner, callout */
  --xr-warn-dim:    rgba(232,160,48,.55); /* dimmed amber for marker dot / secondary */
  --xr-warn-glow:   rgba(232,160,48,.10); /* subtle amber inner glow on mismatch section */
  --xr-warn-bg:     rgba(232,160,48,.08); /* very faint amber tint on mismatch section bg */
  --xr-warn-pulse:  rgba(232,160,48,.28); /* pulse ring colour */
  /* Bookable amplifier tokens */
  --xr-book-edge:   rgba(207,230,255,.85);/* brighter outline for bookable */
  --xr-book-glow:   rgba(207,230,255,.28);/* stronger glow for bookable */
  --xr-book-pulse:  rgba(207,230,255,.35);/* bookable pulse ring */
}

/* Markers only visible in AI mode */
.xr-marker { display:none; }


/* =========================================================================
   AI VIEW: body.xray
   ========================================================================= */

body.xray {
  background: var(--xr-film) !important;
  transition: background var(--xr-transition);
}

/* Vignette — fixed dark ellipse over the entire viewport */
body.xray::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99900;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 90% at 50% 50%,
    transparent 35%,
    rgba(0,0,0,.68) 100%);
}

/* Scan-line — subtle horizontal lines drifting */
body.xray::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99901;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 3px,
    rgba(0,0,0,.035) 3px,
    rgba(0,0,0,.035) 4px
  );
  animation: xr-scanline 10s linear infinite;
}

@keyframes xr-scanline {
  from { background-position: 0 0; }
  to   { background-position: 0 400px; }
}

/* Flatten global site background in AI mode */
body.xray,
body.xray .wp-site-blocks,
body.xray main {
  background-color: var(--xr-film) !important;
}

/* Ghost header and footer */
body.xray header,
body.xray footer {
  opacity: .08;
  filter: saturate(0);
  transition: opacity var(--xr-transition), filter var(--xr-transition);
}

/*
   Ghost ALL top-level sections by default.
   Target .arival-section (the CSS class on every pattern outer wrapper).
   This avoids opacity stacking: each section is independently at the ghost
   level; LIT state on the same element overrides to opacity:1.
*/
body.xray .arival-section {
  opacity: .1;
  filter: saturate(0) blur(0.4px);
  background-color: transparent !important;
  transition: opacity var(--xr-transition), filter var(--xr-transition);
}

/* None sections: tappable cursor in AI mode */
body.xray .arival-section[data-xr-state="none"] {
  cursor: pointer;
}

/* Flatten coloured backgrounds inside any section in AI mode */
body.xray .arival-section [class*="has-background"],
body.xray .arival-section .has-base-background-color,
body.xray .arival-section .has-base-2-background-color {
  background-color: transparent !important;
}

/* Cover block overlays and background images — flatten them */
body.xray .wp-block-cover__background { opacity: .05 !important; }
body.xray .wp-block-cover__image-background {
  opacity: .08 !important;
  filter: grayscale(1) brightness(.4);
}

/* LIT sections are tappable/clickable in AI mode — show a pointer. */
body.xray .arival-section[data-xr-state="lit"],
body.xray [data-xray][data-xr-state="lit"],
body.xray [data-xr-state="lit"] {
  cursor: pointer;
}

/* Subtle interactive affordance on lit sections */
@media (hover: hover) {
  body.xray .arival-section[data-xr-state="lit"]:hover,
  body.xray [data-xray][data-xr-state="lit"]:hover,
  body.xray [data-xr-state="lit"]:hover {
    outline-color: var(--xr-ink);
    box-shadow:
      0 0 0 1px rgba(207,230,255,.14),
      inset 0 0 32px -16px rgba(207,230,255,.20);
    transition: outline-color 160ms ease, box-shadow 160ms ease;
  }
}

/* Tap hint */
.xr-hint {
  display: none;
}

body.xray .xr-hint {
  display: block;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 99979;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .64rem;
  letter-spacing: .05em;
  color: rgba(207,230,255,.72);
  background: rgba(3,4,8,.82);
  border: 1px solid rgba(207,230,255,.22);
  border-radius: 999px;
  padding: 7px 15px;
  max-width: calc(100vw - 32px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* On narrow screens the hint wraps instead of truncating */
@media (max-width: 560px) {
  body.xray .xr-hint {
    white-space: normal;
    max-width: min(340px, calc(100vw - 32px));
    line-height: 1.4;
  }
}


/* =========================================================================
   LIT STATE  [data-xr-state="lit"]
   Full opacity, sharp, luminous edge, tiny corner marker.
   ========================================================================= */

body.xray .arival-section[data-xr-state="lit"],
body.xray [data-xray][data-xr-state="lit"] {
  opacity: 1 !important;
  filter: none !important;
  position: relative;
  outline: 1px solid var(--xr-edge);
  outline-offset: -2px;
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(207,230,255,.06),
    inset 0 0 32px -16px var(--xr-glow);
}

/* =========================================================================
   BOOKABLE AMPLIFIER — louder luminous treatment for bookable sections.
   CSS targets [data-xr-bookable="true"] which is set by amplifyBookable()
   ONLY on genuinely bookable, schema-gated sections.
   Does NOT restyle plain readable lit sections.
   ========================================================================= */

body.xray .arival-section[data-xr-bookable="true"][data-xr-state="lit"],
body.xray [data-xr-bookable="true"][data-xr-state="lit"] {
  outline: 2px solid var(--xr-book-edge) !important;
  outline-offset: -2px;
  box-shadow:
    0 0 0 3px rgba(207,230,255,.15),
    0 0 22px 4px rgba(207,230,255,.22),
    inset 0 0 48px -18px var(--xr-book-glow) !important;
  animation: xr-bookable-pulse 3s ease-in-out infinite;
}

@keyframes xr-bookable-pulse {
  0%   { box-shadow: 0 0 0 2px rgba(207,230,255,.15), 0 0 18px 3px rgba(207,230,255,.18), inset 0 0 48px -18px var(--xr-book-glow); }
  50%  { box-shadow: 0 0 0 5px rgba(207,230,255,.22), 0 0 36px 8px var(--xr-book-pulse), inset 0 0 48px -18px var(--xr-book-glow); }
  100% { box-shadow: 0 0 0 2px rgba(207,230,255,.15), 0 0 18px 3px rgba(207,230,255,.18), inset 0 0 48px -18px var(--xr-book-glow); }
}

/* Marker on bookable sections: same position, brighter colour */
body.xray [data-xr-bookable="true"][data-xr-state="lit"] > .xr-marker {
  color: rgba(207,230,255,.92) !important;
  font-size: .62rem !important;
  letter-spacing: .09em;
}

body.xray [data-xr-bookable="true"][data-xr-state="lit"] > .xr-marker::before {
  background: #ffffff !important;
  width: 6px !important;
  height: 6px !important;
  box-shadow: 0 0 8px 3px rgba(207,230,255,.8) !important;
}

/* Hover on bookable is even brighter */
@media (hover: hover) {
  body.xray [data-xr-bookable="true"][data-xr-state="lit"]:hover {
    outline-color: #ffffff !important;
    box-shadow:
      0 0 0 5px rgba(207,230,255,.28),
      0 0 40px 12px rgba(207,230,255,.32),
      inset 0 0 48px -18px var(--xr-book-glow) !important;
  }
}

/* Headings in LIT sections — luminous. */
body.xray [data-xr-state="lit"] h1,
body.xray [data-xr-state="lit"] h2,
body.xray [data-xr-state="lit"] h3,
body.xray [data-xr-state="lit"] h4,
body.xray [data-xr-state="lit"] summary {
  color: var(--xr-ink) !important;
  opacity: 1 !important;
  filter: none !important;
}

/* Body text in LIT sections — readable but subdued. */
body.xray .arival-section[data-xr-state="lit"] p,
body.xray [data-xr-state="lit"] .arival-section p,
body.xray [data-xr-state="lit"] p,
body.xray [data-xr-state="lit"] p.has-contrast-color,
body.xray [data-xr-state="lit"] p.has-contrast-soft-color,
body.xray [data-xr-state="lit"] p.has-text-color,
body.xray [data-xr-state="lit"] li,
body.xray [data-xr-state="lit"] a,
body.xray [data-xr-state="lit"] strong,
body.xray [data-xr-state="lit"] span:not(.xr-marker) {
  color: var(--xr-ink-dim) !important;
  opacity: 1 !important;
}

/* CITABLE QUOTE TEXT */
body.xray [data-xr-state="lit"] p.arival-quote,
body.xray [data-xr-state="lit"] p.arival-quote.has-contrast-color,
body.xray [data-xr-state="lit"] p.arival-quote.has-text-color,
body.xray [data-xr-state="lit"] p.arival-quote.has-contrast-soft-color {
  color: var(--xr-ink) !important;
  opacity: 1 !important;
}

/* BYLINE */
body.xray [data-xr-state="lit"] p.arival-byline,
body.xray [data-xr-state="lit"] p.arival-byline.has-small-font-size,
body.xray [data-xr-state="lit"] p.arival-byline span {
  color: var(--xr-ink-dim) !important;
  opacity: 1 !important;
}

/* Images in LIT sections */
body.xray [data-xr-state="lit"] img {
  filter: grayscale(1) contrast(.75) brightness(.45) !important;
  opacity: .38 !important;
}

/* Background colours in LIT sections */
body.xray [data-xr-state="lit"] [class*="has-background"],
body.xray [data-xr-state="lit"] .wp-block-cover__background,
body.xray [data-xr-state="lit"] .arival-review-card,
body.xray [data-xr-state="lit"] .wp-block-group.has-base-background-color,
body.xray [data-xr-state="lit"] .wp-block-group.has-base-2-background-color {
  background-color: transparent !important;
  opacity: 1 !important;
}

/* Review cards */
body.xray [data-xr-state="lit"] .arival-review-card {
  outline: 1px solid rgba(207,230,255,.14);
  outline-offset: -1px;
  border-radius: 4px;
}

/* Tiny readable marker — upper-right, monospace, with luminous dot */
body.xray [data-xr-state="lit"] > .xr-marker {
  display: flex;
  align-items: center;
  gap: 5px;
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 50;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .58rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(207,230,255,.65);
  pointer-events: none;
}

body.xray [data-xr-state="lit"] > .xr-marker::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--xr-ink);
  box-shadow: 0 0 5px 2px rgba(207,230,255,.55);
  flex-shrink: 0;
}


/* =========================================================================
   MISMATCH STATE  [data-xr-state="mismatch"]
   ========================================================================= */

body.xray .arival-section[data-xr-state="mismatch"],
body.xray [data-xray][data-xr-state="mismatch"] {
  opacity: 1 !important;
  filter: saturate(.08) !important;
  position: relative;
  outline: 2px dashed var(--xr-warn);
  outline-offset: -3px;
  border-radius: 4px;
  background-color: var(--xr-warn-bg) !important;
  box-shadow:
    0 0 0 1px rgba(232,160,48,.18),
    inset 0 0 40px -18px var(--xr-warn-glow);
  animation: xr-mismatch-pulse 2.4s ease-in-out infinite;
}

@keyframes xr-mismatch-pulse {
  0%   { box-shadow: 0 0 0 1px rgba(232,160,48,.18), inset 0 0 40px -18px var(--xr-warn-glow); }
  50%  { box-shadow: 0 0 0 4px rgba(232,160,48,.24), 0 0 18px 2px var(--xr-warn-pulse), inset 0 0 40px -18px var(--xr-warn-glow); }
  100% { box-shadow: 0 0 0 1px rgba(232,160,48,.18), inset 0 0 40px -18px var(--xr-warn-glow); }
}

body.xray [data-xr-state="mismatch"] h1,
body.xray [data-xr-state="mismatch"] h2,
body.xray [data-xr-state="mismatch"] h3,
body.xray [data-xr-state="mismatch"] h4,
body.xray [data-xr-state="mismatch"] summary {
  color: rgba(232,160,48,.85) !important;
  opacity: 1 !important;
  filter: none !important;
}

body.xray [data-xr-state="mismatch"] p,
body.xray [data-xr-state="mismatch"] li,
body.xray [data-xr-state="mismatch"] strong,
body.xray [data-xr-state="mismatch"] span:not(.xr-marker):not(.xr-drift-callout-title) {
  color: rgba(207,185,140,.80) !important;
  opacity: 1 !important;
  filter: none !important;
}

body.xray [data-xr-state="mismatch"] [class*="has-background"],
body.xray [data-xr-state="mismatch"] .wp-block-cover__background {
  background-color: transparent !important;
  opacity: .04 !important;
}

/* Mismatch marker */
body.xray [data-xr-state="mismatch"] > .xr-marker {
  display: flex;
  align-items: center;
  gap: 5px;
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 50;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .58rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--xr-warn);
  pointer-events: none;
}

body.xray [data-xr-state="mismatch"] > .xr-marker::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 7px solid var(--xr-warn);
  flex-shrink: 0;
}


/* =========================================================================
   NONE STATE  [data-xr-state="none"]
   ========================================================================= */

body.xray .arival-section[data-xr-state="none"],
body.xray [data-xray="none"][data-xr-state="none"] {
  opacity: .35 !important;
  filter: saturate(0) !important;
  position: relative;
  outline: 1px dashed var(--xr-none-edge);
  outline-offset: -2px;
  border-radius: 4px;
}

body.xray .arival-section[data-xr-state="none"] .wp-block-cover__background,
body.xray .arival-section[data-xr-state="none"] [class*="has-background"] {
  opacity: .04 !important;
  background-color: transparent !important;
}

/* NONE marker */
body.xray [data-xr-state="none"] > .xr-marker {
  display: flex;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 50;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .55rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--xr-none-ink);
  pointer-events: none;
  white-space: pre;
  line-height: 1.3;
  text-align: right;
}

body.xray [data-xr-state="none"] > .xr-marker::before {
  content: "∅";
  font-size: .72rem;
  color: var(--xr-none-ink);
  line-height: 1;
  flex-shrink: 0;
  white-space: normal;
}


/* =========================================================================
   DRIFT DEMO CONTROLS
   ========================================================================= */

.xr-drift-btn {
  display: none;
  position: fixed;
  right: 22px;
  bottom: calc(170px + env(safe-area-inset-bottom));
  z-index: 99980;
  background: rgba(3,4,8,.94);
  color: rgba(207,230,255,.75);
  border: 1px solid rgba(207,230,255,.32);
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: ui-monospace, Menlo, monospace;
  min-height: 44px;
  min-width: 44px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

body.xray .xr-drift-btn {
  display: block;
}

.xr-drift-btn:hover,
.xr-drift-btn:focus-visible {
  color: var(--xr-ink);
  border-color: rgba(207,230,255,.36);
  outline: none;
}

.xr-drift-btn.active {
  color: var(--xr-warn);
  border-color: var(--xr-warn-dim);
  background: rgba(232,160,48,.10);
}

.xr-drift-btn:focus-visible {
  outline: 2px solid var(--xr-ink);
  outline-offset: 3px;
}

/* Persistent banner */
.xr-drift-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99998;
  background: rgba(5,7,11,.97);
  border-bottom: 2px solid var(--xr-warn);
  color: var(--xr-warn);
  font-family: ui-monospace, Menlo, monospace;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-align: center;
  padding: 10px 16px;
  pointer-events: none;
  box-shadow: 0 6px 18px -6px rgba(0,0,0,.7);
}

/* When the drift banner is showing, drop the top-anchored controls below it so
   the full-width warning no longer covers them. Desktop only: below 900px the
   mobile rule already parks these at top:84px, clear of the banner. */
@media (min-width: 901px) {
  body.xray.xr-drift-on .xr-ladder,
  body.xray.xr-drift-on .xr-sheet-btn {
    top: calc(58px + env(safe-area-inset-top));
  }
  body.xray.xr-drift-on .xr-cit-btn {
    top: calc(116px + env(safe-area-inset-top));
  }
}

/* Section callout */
.xr-drift-callout {
  position: relative;
  margin: 16px 0 0;
  padding: 14px 16px 14px 18px;
  border-left: 3px solid var(--xr-warn);
  background: rgba(232,160,48,.07);
  border-radius: 0 6px 6px 0;
}

.xr-drift-callout-title {
  display: block;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--xr-warn) !important;
  margin-bottom: 6px;
}

.xr-drift-callout-body {
  font-family: ui-monospace, Menlo, monospace;
  font-size: .72rem;
  line-height: 1.55;
  color: rgba(207,185,140,.80) !important;
  margin: 0;
  opacity: 1 !important;
  filter: none !important;
}

body.xray [data-xr-state="mismatch"] .xr-drift-callout,
body.xray [data-xr-state="mismatch"] .xr-drift-callout-title,
body.xray [data-xr-state="mismatch"] .xr-drift-callout-body {
  opacity: 1 !important;
  filter: none !important;
}


/* =========================================================================
   BLOG POST section states
   ========================================================================= */

body.xray h1.wp-block-post-title,
body.xray h1.entry-title {
  opacity: .1;
  filter: saturate(0);
  transition: opacity var(--xr-transition), filter var(--xr-transition);
}

body.xray .wp-block-post-content h2,
body.xray .wp-block-post-content h3,
body.xray .wp-block-post-content p,
body.xray .entry-content h2,
body.xray .entry-content h3,
body.xray .entry-content p,
body.xray .entry-content ul,
body.xray .entry-content ol,
body.xray .entry-content figure,
body.xray .wp-block-post-content figure,
body.xray .wp-block-post-content .wp-block-image,
body.xray .wp-block-post-content .wp-block-details {
  opacity: .1;
  filter: saturate(0);
  transition: opacity var(--xr-transition), filter var(--xr-transition);
}

/* Rank Math FAQ block */
body.xray #rank-math-faq,
body.xray .rank-math-block {
  opacity: .1;
  filter: saturate(0);
  transition: opacity var(--xr-transition), filter var(--xr-transition);
}

/* Post-level navigation / comments */
body.xray .wp-block-post-content .wp-block-query,
body.xray .wp-block-post-content .wp-block-post-navigation-link,
body.xray .comment-respond,
body.xray .comment-form {
  opacity: .05;
  filter: saturate(0);
}

/* LIFT: LIT state on blog post elements */
body.xray [data-xr-state="lit"][data-xray-node-ids] {
  cursor: pointer;
}

body.xray h1.wp-block-post-title[data-xr-state="lit"],
body.xray h1.entry-title[data-xr-state="lit"] {
  opacity: 1 !important;
  filter: none !important;
  color: var(--xr-ink) !important;
  outline: 1px solid var(--xr-edge);
  outline-offset: 4px;
  border-radius: 3px;
  cursor: pointer;
}

body.xray p[data-xr-state="lit"] {
  opacity: 1 !important;
  filter: none !important;
  color: var(--xr-ink-dim) !important;
  outline: 1px solid var(--xr-edge);
  outline-offset: 4px;
  border-radius: 3px;
  cursor: pointer;
}

body.xray h2.wp-block-heading[data-xr-state="lit"],
body.xray h2[data-xr-state="lit"] {
  opacity: 1 !important;
  filter: none !important;
  color: var(--xr-ink) !important;
}

body.xray #rank-math-faq[data-xr-state="lit"],
body.xray .rank-math-block[data-xr-state="lit"],
body.xray .wp-block-rank-math-faq-block[data-xr-state="lit"] {
  opacity: 1 !important;
  filter: none !important;
  outline: 1px solid var(--xr-edge);
  outline-offset: -2px;
  border-radius: 4px;
  box-shadow: inset 0 0 24px -12px var(--xr-glow);
  cursor: pointer;
}

body.xray .rank-math-block[data-xr-state="lit"] .rank-math-question {
  color: var(--xr-ink) !important;
}

body.xray .rank-math-block[data-xr-state="lit"] .rank-math-answer p,
body.xray .rank-math-block[data-xr-state="lit"] p {
  opacity: 1 !important;
  filter: none !important;
  color: var(--xr-ink-dim) !important;
}

body.xray .wp-block-details[data-xr-state="lit"] {
  opacity: 1 !important;
  filter: none !important;
  outline: 1px solid var(--xr-edge);
  border-radius: 4px;
  cursor: pointer;
}


/* =========================================================================
   GHOST: images globally in AI mode
   ========================================================================= */

body.xray img {
  filter: grayscale(1) contrast(.7) brightness(.3);
  opacity: .15;
  transition: filter var(--xr-transition), opacity var(--xr-transition);
}

body.xray [data-xr-state="lit"] img {
  filter: grayscale(1) contrast(.78) brightness(.42) !important;
  opacity: .35 !important;
}

/* Keep the concierge launcher, pill, sheet, intro overlay above everything */
body.xray #tc-launch,
body.xray #tc-panel,
body.xray #dd-quiz,
body.xray #dd-intro-overlay,
body.xray #dd-coach {
  opacity: 1 !important;
  filter: none !important;
  z-index: 100001 !important;
}

body.xray .xr-pill,
body.xray .xr-sheet-btn {
  opacity: 1 !important;
  filter: none !important;
}

body.xray .reveal-on-scroll {
  opacity: inherit !important;
  transform: none !important;
}

.editor-styles-wrapper .reveal-on-scroll {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}


/* =========================================================================
   TOGGLE PILL  ·  bottom-centre, 46-48px tap target
   ========================================================================= */

.xr-pill {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 99980;
  display: flex;
  background: rgba(3,4,8,.94);
  border: 2px solid #FF2E88;
  border-radius: 999px;
  padding: 4px;
  box-shadow:
    0 8px 32px -8px rgba(0,0,0,.85),
    0 0 0 4px rgba(255,46,136,.16),
    0 0 24px 4px rgba(255,46,136,.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: xr-pill-attract 2.6s ease-in-out infinite;
}

.xr-pill::before {
  content: "See what AI sees";
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #FF2E88;
  color: #fff;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-weight: 800;
  font-size: .72rem;
  letter-spacing: .02em;
  padding: 6px 13px;
  border-radius: 999px;
  box-shadow: 0 10px 24px -8px rgba(255,46,136,.7);
  pointer-events: none;
}

@keyframes xr-pill-attract {
  0%, 100% { box-shadow: 0 8px 32px -8px rgba(0,0,0,.85), 0 0 0 4px rgba(255,46,136,.16), 0 0 22px 3px rgba(255,46,136,.4); }
  50%      { box-shadow: 0 8px 32px -8px rgba(0,0,0,.85), 0 0 0 8px rgba(255,46,136,.26), 0 0 36px 8px rgba(255,46,136,.62); }
}

body.xray .xr-pill { animation: none; }
body.xray .xr-pill::before { display: none; }

.xr-pill button {
  border: none;
  background: none;
  color: rgba(255,255,255,.72);
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .12em;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 46px;
  min-width: 78px;
  transition: background 160ms ease, color 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.xr-pill button.on {
  background: rgba(207,230,255,.10);
  color: var(--xr-ink);
  box-shadow: inset 0 0 0 1px rgba(207,230,255,.22);
}

.xr-pill button:focus-visible {
  outline: 2px solid var(--xr-ink);
  outline-offset: 2px;
}


/* =========================================================================
   SCHEMA BOTTOM SHEET
   ========================================================================= */

.xr-sheet-btn {
  position: fixed;
  right: 16px;
  top: calc(20px + env(safe-area-inset-top));
  z-index: 99980;
  background: rgba(3,4,8,.94);
  color: rgba(207,230,255,.78);
  border: 1px solid rgba(207,230,255,.3);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 700;
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: ui-monospace, Menlo, monospace;
  min-height: 46px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color 160ms ease, border-color 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.xr-sheet-btn:hover,
.xr-sheet-btn:focus-visible {
  color: var(--xr-ink);
  border-color: rgba(207,230,255,.36);
  outline: none;
}

/* Citation button — below schema button, AI view only */
.xr-cit-btn {
  display: none;
  position: fixed;
  right: 16px;
  top: calc(78px + env(safe-area-inset-top));
  z-index: 99980;
  background: rgba(3,4,8,.94);
  color: rgba(207,230,255,.72);
  border: 1px solid rgba(207,230,255,.28);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: .6rem;
  letter-spacing: .06em;
  text-transform: none;
  cursor: pointer;
  font-family: ui-monospace, Menlo, monospace;
  min-height: 44px;
  max-width: 160px;
  text-align: center;
  line-height: 1.35;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color 160ms ease, border-color 160ms ease;
  -webkit-tap-highlight-color: transparent;
  white-space: normal;
}

body.xray .xr-cit-btn {
  display: block;
}

.xr-cit-btn:hover,
.xr-cit-btn:focus-visible {
  color: var(--xr-ink);
  border-color: rgba(207,230,255,.32);
  outline: none;
}

.xr-cit-btn:focus-visible {
  outline: 2px solid var(--xr-ink);
  outline-offset: 3px;
}

.xr-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99990;
  background: #070a12;
  border-top: 1px solid rgba(207,230,255,.15);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.xr-sheet.open { transform: translateY(0); }

.xr-sheet .grab {
  width: 40px;
  height: 4px;
  background: rgba(207,230,255,.14);
  border-radius: 3px;
  margin: 10px auto 4px;
  flex-shrink: 0;
}

.xr-sheet-label {
  padding: 6px 18px 10px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .63rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(207,230,255,.85);
  flex-shrink: 0;
}

/* -------------------------------------------------------------------------
   SHEET CAPTION (education layer)
   Plain-English prose sitting above the JSON.
   Sans-serif so it reads clearly as a different content layer from the JSON.
   ------------------------------------------------------------------------- */
.xr-sheet-caption {
  margin: 0 18px 4px;
  padding: 12px 14px;
  border-left: 2px solid rgba(207,230,255,.22);
  background: rgba(207,230,255,.04);
  border-radius: 0 6px 6px 0;
  flex-shrink: 0;
}

.xr-sheet-caption-text {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: .82rem;
  line-height: 1.55;
  color: rgba(207,230,255,.78);
  margin: 0 0 8px;
}

.xr-sheet-caption-text:last-child {
  margin-bottom: 0;
}

.xr-sheet-caption-move {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: .76rem;
  line-height: 1.5;
  color: rgba(207,230,255,.7);
  margin: 0;
  padding-top: 6px;
  border-top: 1px solid rgba(207,230,255,.10);
}

/* None-section sheet message */
.xr-none-sheet-msg {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.xr-none-icon {
  font-size: 2.4rem;
  color: rgba(207,230,255,.22);
  line-height: 1;
}

.xr-none-sheet-msg p {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: .86rem;
  line-height: 1.6;
  color: rgba(207,230,255,.62);
  margin: 0;
  max-width: 360px;
}

.xr-sheet pre {
  margin: 0;
  padding: 10px 18px 52px;
  overflow: auto;
  color: rgba(207,230,255,.82);
  font-family: ui-monospace, Menlo, monospace;
  font-size: .86rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  overscroll-behavior: contain;
}

/* -------------------------------------------------------------------------
   SYNTAX HIGHLIGHTING TOKEN CLASSES
   ------------------------------------------------------------------------- */

.xr-tok-key {
  color: #dbeeff;
  font-weight: 600;
}

.xr-tok-str {
  color: #e8d9c0;
  font-weight: 400;
}

.xr-tok-num {
  color: #7fd4cf;
  font-weight: 400;
}

.xr-tok-punct {
  color: rgba(207,230,255,.42);
}

.xr-sheet-close {
  position: absolute;
  right: 12px;
  top: 8px;
  background: rgba(207,230,255,.10);
  border: 1px solid rgba(207,230,255,.22);
  border-radius: 50%;
  color: var(--xr-ink);
  font-size: 2.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 160ms ease, border-color 160ms ease;
}

.xr-sheet-close:hover,
.xr-sheet-close:focus-visible {
  background: rgba(207,230,255,.18);
  border-color: rgba(207,230,255,.45);
  color: #ffffff;
}

.xr-sheet-close:focus-visible {
  outline: 2px solid var(--xr-ink);
  outline-offset: 3px;
}


/* =========================================================================
   CITATION PANEL (item 5)
   Plain prose, distinct from the JSON view.
   Renders inside .xr-sheet replacing #xrSheetBody contents.
   ========================================================================= */

.xr-citation-panel {
  padding: 14px 18px 52px;
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}

.xr-citation-intro {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: .76rem;
  line-height: 1.6;
  color: rgba(207,230,255,.68);
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(207,230,255,.08);
}

.xr-citation-sentences {
  margin-bottom: 18px;
}

.xr-citation-text {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: .96rem;
  line-height: 1.7;
  color: rgba(207,230,255,.88);
  margin: 0 0 12px;
}

.xr-citation-clause {
  /* Clause values are verbatim from the graph */
  color: rgba(207,230,255,.88);
}

.xr-citation-footnote {
  font-size: .65rem;
  letter-spacing: .04em;
  color: rgba(207,230,255,.6);
  font-family: ui-monospace, Menlo, monospace;
  vertical-align: super;
  line-height: 1;
  margin-left: 1px;
}

.xr-citation-missing {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: .82rem;
  line-height: 1.55;
  color: rgba(207,230,255,.58);
  margin: 8px 0 0;
  padding: 10px 14px;
  border: 1px dashed rgba(207,230,255,.12);
  border-radius: 6px;
}

.xr-citation-empty {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: .88rem;
  line-height: 1.6;
  color: rgba(207,230,255,.62);
  margin: 0 0 16px;
}

.xr-citation-footer {
  font-family: ui-monospace, Menlo, monospace;
  font-size: .62rem;
  line-height: 1.55;
  color: rgba(207,230,255,.5);
  margin: 16px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(207,230,255,.08);
}

/* Citation list rows (home / tours hub: one row per tour) */
.xr-citation-list {
  list-style: none;
  margin: 2px 0 14px;
  padding: 0;
}

.xr-citation-list-item {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: .92rem;
  line-height: 1.5;
  color: rgba(207,230,255,.9);
  padding: 8px 0;
  border-bottom: 1px solid rgba(207,230,255,.08);
}

.xr-citation-list-item:last-child {
  border-bottom: none;
}

.xr-citation-list-item strong {
  color: var(--xr-ink);
  font-weight: 600;
}

.xr-citation-list-meta {
  color: rgba(207,230,255,.62);
}

.xr-citation-list-desc {
  display: block;
  margin-top: 2px;
  font-size: .82rem;
  color: rgba(207,230,255,.6);
}

.xr-citation-source {
  font-family: ui-monospace, Menlo, monospace;
  font-size: .6rem;
  letter-spacing: .04em;
  color: rgba(207,230,255,.45);
  margin: 0 0 4px;
}


/* =========================================================================
   READ / QUOTE / ACT LADDER HUD (item 3)
   Top-left, AI view only. Mirrors schema button placement.
   Must not cover pill (bottom-centre), schema button (top-right),
   drift button (bottom-right ~170px up), or hint (above pill).
   ========================================================================= */

.xr-ladder {
  display: none;
}

body.xray .xr-ladder {
  display: block;
  position: fixed;
  left: 16px;
  top: calc(20px + env(safe-area-inset-top));
  z-index: 99980;
  background: rgba(3,4,8,.94);
  border: 1px solid rgba(207,230,255,.12);
  border-radius: 10px;
  padding: 10px 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: 220px;
  min-width: 160px;
}

.xr-ladder-title {
  font-family: ui-monospace, Menlo, monospace;
  font-size: .52rem;
  font-weight: 600;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: rgba(207,230,255,.62);
  margin-bottom: 8px;
  line-height: 1.3;
}

.xr-ladder-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
}

.xr-ladder-rung {
  font-family: ui-monospace, Menlo, monospace;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: rgba(207,230,255,.85);
  min-width: 42px;
  flex-shrink: 0;
}

/* ACT rung gets the ink colour to signal it's the payoff */
.xr-ladder-rung-act {
  color: var(--xr-ink) !important;
}

.xr-ladder-desc {
  font-family: ui-monospace, Menlo, monospace;
  font-size: .52rem;
  color: rgba(207,230,255,.6);
  line-height: 1.3;
  flex: 1;
}

.xr-ladder-count {
  font-family: ui-monospace, Menlo, monospace;
  font-size: .72rem;
  font-weight: 700;
  color: rgba(207,230,255,.95);
  min-width: 18px;
  text-align: right;
  flex-shrink: 0;
}

/* On very narrow screens, condense the ladder */
@media (max-width: 375px) {
  body.xray .xr-ladder {
    max-width: 150px;
    min-width: 130px;
    padding: 8px 10px;
  }
  .xr-ladder-desc {
    display: none;
  }
}


/* =========================================================================
   REDUCED MOTION
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  body.xray,
  body.xray .arival-section,
  body.xray header,
  body.xray footer,
  body.xray [data-xr-state],
  .xr-pill button,
  .xr-sheet-btn,
  .xr-sheet-close,
  .xr-drift-btn,
  .xr-cit-btn {
    transition: none !important;
  }

  .xr-pill { animation: none !important; }

  body.xray .arival-section[data-xr-state="lit"]:hover,
  body.xray [data-xray][data-xr-state="lit"]:hover,
  body.xray [data-xr-state="lit"]:hover {
    outline-color: var(--xr-edge);
    box-shadow:
      0 0 0 1px rgba(207,230,255,.06),
      inset 0 0 32px -16px var(--xr-glow);
  }

  body.xray::after {
    animation: none !important;
  }

  /* No pulse on mismatch under reduced motion */
  body.xray .arival-section[data-xr-state="mismatch"],
  body.xray [data-xray][data-xr-state="mismatch"] {
    animation: none !important;
    box-shadow:
      0 0 0 2px rgba(232,160,48,.35),
      inset 0 0 40px -18px var(--xr-warn-glow) !important;
  }

  /* No pulse on bookable under reduced motion */
  body.xray .arival-section[data-xr-bookable="true"][data-xr-state="lit"],
  body.xray [data-xr-bookable="true"][data-xr-state="lit"] {
    animation: none !important;
    box-shadow:
      0 0 0 3px rgba(207,230,255,.20),
      0 0 16px 3px rgba(207,230,255,.16),
      inset 0 0 48px -18px var(--xr-book-glow) !important;
  }

  .xr-sheet {
    transition: none !important;
  }
}

/* Mobile: ensure HUD and buttons do not overlap at narrow viewports */
@media (max-width: 480px) {
  /* Ladder: slightly smaller on mobile */
  body.xray .xr-ladder {
    font-size: .9em;
  }

  /* Citation button: narrower right-side layout */
  .xr-cit-btn {
    font-size: .56rem;
    max-width: 120px;
    padding: 8px 10px;
  }
}


/* =========================================================================
   ALT-TEXT READABLE IMAGES
   An AI reads the alt attribute straight from the HTML, so images with
   meaningful alt are lifted to full colour with the luminous lit edge — the
   same brightness as schema-backed content. The dimming lives on the <img>
   element itself (not parent opacity), so overriding the image directly is
   safe: no opacity stacking. Decorative images (alt="") carry no data-xr-alt
   and stay dark, which is honest.

   Both selectors below carry !important to beat the global `body.xray img`
   ghost (line ~700) and the `[data-xr-state="lit"] img` dim (line ~706); the
   descendant form also out-specifies the lit-img rule.
   ========================================================================= */
body.xray img[data-xr-alt="true"],
body.xray [data-xr-state="lit"] img[data-xr-alt="true"] {
  filter: none !important;
  opacity: 1 !important;
  outline: 1px solid var(--xr-edge);
  outline-offset: 2px;
  border-radius: 4px;
  cursor: pointer;
}

@media (hover: hover) {
  body.xray img[data-xr-alt="true"]:hover {
    outline-color: var(--xr-ink);
    box-shadow: 0 0 0 1px rgba(207,230,255,.14), 0 0 18px 2px rgba(207,230,255,.20);
  }
}

/* ALT TEXT overlay — a caption ribbon across the bottom of the image showing
   the ACTUAL alt value an AI reads, so it is legible without tapping. Anchored
   to the tight .wp-block-image figure that wraps the img. */
.xr-marker-alt { display: none; }

body.xray .xr-marker-alt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 50;
  background: linear-gradient(to top, rgba(3,4,8,.94), rgba(3,4,8,.74));
  border: 1px solid rgba(207,230,255,.26);
  border-radius: 8px;
  padding: 8px 11px;
  pointer-events: none;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

body.xray .xr-marker-alt-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .5rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(207,230,255,.55);
}

body.xray .xr-marker-alt-label::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--xr-ink);
  box-shadow: 0 0 5px 2px rgba(207,230,255,.55);
  flex-shrink: 0;
}

body.xray .xr-marker-alt-value {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: .84rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--xr-ink);
}

/* Alt-value bottom sheet */
.xr-alt-sheet-msg {
  padding: 20px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.xr-alt-quote {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--xr-ink);
}

.xr-alt-source {
  font-family: ui-monospace, Menlo, monospace;
  font-size: .66rem;
  line-height: 1.5;
  letter-spacing: .04em;
  color: rgba(207,230,255,.4);
  margin: 0;
}


/* =========================================================================
   "TAP TO SEE THE DATA" AFFORDANCE
   The point of AI view is the raw data an AI reads. That data is one tap away
   (tap a glowing element to open its schema, or an image for its alt), but a
   first-time viewer does not know the glowing things are tappable. These cues
   make the tap obvious without dumping JSON on entry.
   ========================================================================= */

/* 1. Every lit section marker gains a plain-language tap cue. */
body.xray [data-xr-state="lit"] > .xr-marker::after {
  content: " · tap to see the data";
  text-transform: none;
  letter-spacing: .03em;
  font-weight: 400;
  color: rgba(207,230,255,.42);
}

/* 2. Each glowing tour card carries its own persistent cue, since the cards
      share one section-level marker and would otherwise look static. Tapping
      anywhere on a lit card reveals data an AI reads (the image's alt, or the
      card's schema), so the cue is honest across the whole card. */
body.xray [data-xr-state="lit"] .arival-card {
  position: relative;
}

body.xray [data-xr-state="lit"] .arival-card::before {
  content: "tap to see the data";
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 51;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .52rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(207,230,255,.8);
  background: rgba(3,4,8,.8);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(207,230,255,.28);
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* =========================================================================
   MOBILE HEADER COLLISION FIX (narrow viewports only)
   Below 900px the header collapses to a sticky hamburger bar. Its box is
   16px top padding + 44px hamburger button + 16px bottom padding = ~76px
   (custom.css header padding 1rem/1rem, position:sticky top:0; hamburger
   min 44x44). Three fixed HUD elements otherwise sit in that same top band
   at ALL widths: .xr-sheet-btn + .xr-cit-btn (top-right, over the hamburger)
   and .xr-ladder (top-left, over the square logo). Push all three below the
   header on narrow viewports only. Uniform +64px downward shift
   (20px -> 84px = 76px box + ~8px buffer; the citation button keeps its 58px
   stack offset below the schema button: 78px -> 142px). Only `top` changes;
   every other property stays as defined above. Same 900px breakpoint as the
   nav collapse (custom.css lines 41-48).
   ========================================================================= */
@media (max-width: 900px) {
  .xr-sheet-btn {
    top: calc(84px + env(safe-area-inset-top));
  }
  .xr-cit-btn {
    top: calc(142px + env(safe-area-inset-top));
  }
  /* Ladder's top lives on `body.xray .xr-ladder`; match that specificity so
     the override wins (later source order breaks the tie). */
  body.xray .xr-ladder {
    top: calc(84px + env(safe-area-inset-top));
  }
}
