/* RGB Prism Living Architecture v5 — Global Optical Motion, Chrome Fixes & Layout Physics
 * Strictly obeys REMOTE_CLAUDE.md Section 10 (0 single-edge stripes, uniform 1px borders),
 * BRAND_GUIDELINES.md (0 px font-sizes, 0 RTL letter-spacing), and Modern Web Guidance 1.0.
 */

/* 1. Global Horizontal Overflow Protection (preserves position:sticky) */
html, body { overflow-x: clip; }
main { overflow-x: clip; }

/* 2. Double-Sticky Stacking & TOC Offset Protection */
.rgba-subnav {
  top: clamp(74px, 8.2vh, 86px) !important;
  z-index: 48 !important;
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .72);
}
body.admin-bar .rgba-subnav {
  top: calc(clamp(74px, 8.2vh, 86px) + var(--wp-admin--admin-bar--height, 32px)) !important;
}
.post-aside {
  overflow: visible !important;
  max-height: none !important;
  align-self: stretch !important;
}
.blog-toc, .blog-toc-sticky, .ed-toc, .rgbl-side, .rgbl-toc, .single-toc, nav#toc.toc-card {
  position: sticky !important;
  top: 120px !important;
  max-height: calc(100vh - 144px);
  max-height: calc(100svh - 144px);
  overflow-y: auto;
  scrollbar-width: thin;
}
body.admin-bar .blog-toc,
body.admin-bar .blog-toc-sticky,
body.admin-bar .ed-toc,
body.admin-bar .rgbl-side,
body.admin-bar .rgbl-toc,
body.admin-bar .single-toc,
body.admin-bar nav#toc.toc-card {
  top: calc(120px + var(--wp-admin--admin-bar--height, 32px)) !important;
  max-height: calc(100svh - 176px);
}

/* Fix Learn tooltip overlap above filter pills */
.rgbl-lesson-card, .rgbl-row { position: relative; }
.rgbl-tip, [data-tooltip]::after { z-index: 60; }

/* Free Promo Pill on SEO Tools (replaces broken 0 Toman) */
.rgbr-free-promo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid rgba(46, 230, 168, .42);
  background: rgba(46, 230, 168, .12);
  color: var(--green, #2ee6a8);
  font-size: .78rem;
  font-weight: 800;
}

/* 3. Compositor-Only Spring Physics & Scroll-Driven Choreography */
@property --rgbe-beam-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes rgbe-beam-spin {
  to { --rgbe-beam-angle: 360deg; }
}

@keyframes rgbe-pulse-led {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(1.32); }
}

@keyframes rgbe-view-rise {
  from {
    opacity: .01;
    transform: translate3d(0, 22px, 0) scale(.985);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* Physics-based spring curves (with standard ease-out fallback first per MWG) */
  .btn, .rgbe-tab, .rgbe-pill-btn, .glass.card {
    transition: transform .28s ease-out, border-color .22s ease-out, box-shadow .28s ease-out, background-color .22s ease-out;
    transition-timing-function: linear(0, .38 14%, 1.04 42%, .99 70%, 1), ease-out, ease-out, ease-out;
  }
  .btn:active, .rgbe-tab:active, .rgbe-pill-btn:active {
    transform: scale(.97);
  }
  .glass.card:hover {
    transform: translate3d(0, -3px, 0);
    border-color: var(--border-2, rgba(255, 255, 255, .2));
  }

  /* Native Scroll-Driven View-Timeline Reveal where supported */
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    .rgbe-wow-card,
    main .sec-head,
    .rgbe-optic-reveal {
      animation: rgbe-view-rise auto linear both;
      animation-timeline: view(block);
      animation-range: entry 0% entry 24%;
    }
  }

  /* Uniform 360-degree prismatic conic border aura on featured plans/cards (zero single-edge stripes) */
  .rgbe-featured-aura,
  .pricing-card.featured,
  .plan-card.is-featured {
    position: relative;
    isolation: isolate;
  }
  .rgbe-featured-aura::after,
  .pricing-card.featured::after,
  .plan-card.is-featured::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--rgbe-beam-angle), rgba(255, 77, 106, .52), rgba(176, 107, 255, .52), rgba(77, 159, 255, .58), rgba(46, 230, 168, .55), rgba(255, 77, 106, .52));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
    z-index: 2;
    animation: rgbe-beam-spin 9s linear infinite;
  }
}

/* 4. Live Ambient Prismatic Aurora Canvas Container */
.rgbe-aurora-host {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.rgbe-aurora-cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: .72;
}
.rgbe-aurora-host > :not(.rgbe-aurora-cv):not(.rgbe-aurora-pause) {
  position: relative;
  z-index: 1;
}
.rgbe-aurora-pause {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-end: 12px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-2, rgba(255, 255, 255, .18));
  background: rgba(7, 9, 15, .78);
  color: var(--text-2, #a9b1c3);
  cursor: pointer;
  font-size: .74rem;
}
.rgbe-aurora-pause:hover { color: #fff; border-color: rgba(77, 159, 255, .55); }

/* 5. Live Infrastructure Status Telemetry & Quick Callback Strip in Footer */
.rgbe-foot-live {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: var(--r-md, 18px);
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  background: linear-gradient(120deg, rgba(46, 230, 168, .05), rgba(77, 159, 255, .05));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.rgbe-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: .84rem;
  font-weight: 700;
  color: var(--text, #eef1f8);
  font-variant-numeric: tabular-nums;
}
.rgbe-status-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green, #2ee6a8);
  box-shadow: 0 0 12px rgba(46, 230, 168, .75);
}
@media (prefers-reduced-motion: no-preference) {
  .rgbe-status-led { animation: rgbe-pulse-led 2.4s ease-in-out infinite; }
}
.rgbe-cb-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.rgbe-cb-form input {
  width: 196px;
  min-height: 40px;
  padding: 8px 13px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--border-2, rgba(255, 255, 255, .18));
  background: rgba(7, 9, 15, .68);
  color: var(--text, #eef1f8);
  font: inherit;
  font-size: .84rem;
}
.rgbe-cb-form button {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid rgba(77, 159, 255, .52);
  background: linear-gradient(120deg, #1d4ed8, #2f6fe0);
  color: #fff;
  font: inherit;
  font-size: .83rem;
  font-weight: 800;
  cursor: pointer;
}

/* 6. Guided 2-Step Contact Intake Enhancements (/contact-us/) */
.rgbe-cf-guide {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: var(--r-md, 18px);
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  background: rgba(255, 255, 255, .03);
  display: grid;
  gap: 14px;
}
.rgbe-cf-row { display: grid; gap: 8px; }
.rgbe-cf-lbl { font-size: .84rem; font-weight: 800; color: var(--text-2, #a9b1c3); }
.rgbe-cf-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.rgbe-cf-chip {
  padding: 7px 13px;
  min-height: 38px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  background: var(--surface, rgba(255, 255, 255, .045));
  color: var(--text-2, #a9b1c3);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
}
.rgbe-cf-chip.is-on {
  color: #fff;
  border-color: rgba(77, 159, 255, .55);
  background: rgba(77, 159, 255, .18);
}
.rgbe-cf-sla {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--green, #2ee6a8);
  font-weight: 700;
}

/* 7. Wave K: Floating Section Compass HUD & Keyboard Shortcuts Studio */
.rgbe-compass-btn {
  position: fixed;
  inset-block-end: 18px;
  inset-inline-start: 18px;
  z-index: 44;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  min-height: 42px;
  max-width: 240px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--border-2, rgba(255, 255, 255, .18));
  background: rgba(9, 13, 25, .86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text, #eef1f8);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .65);
}
.rgbe-compass-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rgbe-compass-btn em { font-style: normal; color: var(--green, #2ee6a8); font-variant-numeric: tabular-nums; flex: none; }
@media (max-width: 720px) { .rgbe-compass-btn { display: none; } }

dialog.rgbe-hud-dlg {
  width: min(460px, calc(100vw - 28px));
  padding: 22px;
  border-radius: var(--r-lg, 24px);
  border: 1px solid var(--border-2, rgba(255, 255, 255, .2));
  background: rgba(9, 13, 25, .96);
  color: var(--text, #eef1f8);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .75);
}
dialog.rgbe-hud-dlg::backdrop { background: rgba(4, 6, 12, .68); backdrop-filter: blur(6px); }
.rgbe-hud-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.rgbe-hud-head h3 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.rgbe-hud-list { display: grid; gap: 6px; max-height: 55svh; overflow-y: auto; }
.rgbe-hud-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border-radius: var(--r-sm, 12px);
  border: 1px solid var(--border, rgba(255, 255, 255, .08));
  background: var(--surface, rgba(255, 255, 255, .04));
  color: var(--text, #eef1f8);
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: start;
}
.rgbe-hud-item:hover, .rgbe-hud-item.is-cur { border-color: rgba(77, 159, 255, .52); background: rgba(77, 159, 255, .14); }
.rgbe-kbd {
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-2, rgba(255, 255, 255, .2));
  background: rgba(255, 255, 255, .06);
  font-family: var(--font-mono, monospace);
  font-size: .75rem;
}

/* 8. Forced-Colors & Reduced-Motion Cleanliness */
@media (forced-colors: active) {
  .rgbe-aurora-cv, .rgbe-featured-aura::after, .pricing-card.featured::after, .plan-card.is-featured::after { display: none; }
  .rgbe-foot-live, .rgbe-cf-guide, .rgbe-compass-btn, dialog.rgbe-hud-dlg { border: 1px solid CanvasText; }
}
