/* QuaPact R3-R21 proof — integration layer.
   R21 CSS provides the product look; R2 scene.css/js provide the animated world.
   This file only adapts layout, demo controls and the single-help integration. */

body.r3 {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #081d18;
  color: var(--ink);
}

.r3-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: #081d18;
}

.r3-scene.qp-scene-root {
  height: 100%;
  min-height: 100%;
}

.r3-scene .qp-scene-hero,
.r3-scene .qp-scene-panel,
.r3-scene .qp-scene-help {
  display: none !important;
}

.r3-scene.qp-scene-root::before {
  display: none !important;
}

.r3-scene .qp-scene-asset--background {
  object-position: center 48%;
}

.r3-scene.qp-scene-root--workspace .qp-scene-world {
  filter: saturate(.55) brightness(.55) contrast(1.02);
}

body[data-r3-mode="hero"] .r3-scene .qp-scene-guardian {
  width: min(36vw, 500px);
  right: 4.5%;
  bottom: 112px;
  opacity: .96;
}

body[data-r3-mode="workspace"] .r3-scene .qp-scene-guardian {
  display: none;
}

/* ---------- Demo dock ---------- */

.r3-dock {
  position: relative;
  z-index: 40;
  flex: 0 0 auto;
  min-height: 56px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(8, 30, 25, .97);
  border-bottom: 1px solid rgba(216, 194, 145, .28);
  color: #f4efe2;
}

.r3-dock-label {
  margin-right: auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: #d8c69c;
  white-space: nowrap;
}

.r3-dock-group {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .07);
}

.r3-dock-btn {
  min-height: 44px;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #e8ecdf;
  font: 650 12px/1.2 "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.r3-dock-btn:hover {
  background: rgba(255, 255, 255, .1);
}

.r3-dock-btn[aria-pressed="true"] {
  background: #ead8b2;
  color: #173b30;
}

.r3-dock-btn:focus-visible {
  outline: 3px solid #ffe6a4;
  outline-offset: 2px;
}

/* ---------- Views ---------- */

#r3-app {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.r3-view {
  flex: 1 1 auto;
  min-height: 0;
}

.r3-hero.hero {
  height: 100%;
  min-height: 0;
  max-height: none;
  background: transparent;
}

.r3-hero .hero-inner {
  height: 100%;
  padding-top: 24px;
  padding-bottom: 24px;
}

.r3-hero .hero-copy {
  width: min(650px, 61%);
  padding-bottom: 96px;
}

.r3-hero .hero-values {
  bottom: 22px;
}

.r3-hero .hero-nav-actions .btn {
  min-height: 44px;
}

.r3-workspace.workspace {
  height: 100%;
  min-height: 0;
  background: linear-gradient(125deg, rgba(10, 31, 26, .58), rgba(10, 31, 26, .38));
}

body[data-r3-theme="moonlit"] .r3-workspace {
  background: linear-gradient(125deg, rgba(6, 18, 32, .68), rgba(8, 20, 38, .42));
}

.r3-workspace .app-shell {
  height: 100%;
  min-height: 0;
  padding: 22px;
}

.r3-workspace .main-panel {
  min-height: 0;
}

.r3-workspace [aria-disabled="true"] {
  pointer-events: none;
  opacity: .55;
}

.r3-workspace .sidebar-help {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 7px;
}

.r3-workspace .sidebar-help:hover {
  background: rgba(255, 255, 255, .08);
}

.r3-workspace .sidebar-help:focus-visible {
  outline: 3px solid #ffe6a4;
  outline-offset: 2px;
}

.r3-mobile-scene {
  display: none;
}

/* ---------- Toast ---------- */

.r3-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 120;
  width: max-content;
  max-width: min(560px, calc(100% - 24px));
  margin: 0;
  padding: 11px 15px;
  border-radius: 11px;
  border: 1px solid rgba(234, 216, 178, .65);
  background: rgba(9, 31, 25, .96);
  color: #fbf3df;
  font: 600 12.5px/1.45 "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  text-align: center;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .35);
}

/* ---------- Mobile / narrow layout ---------- */

@media (max-width: 820px) {
  .r3-dock {
    gap: 6px;
    padding: 7px 9px;
  }

  .r3-dock-label {
    display: none;
  }

  .r3-dock-group {
    flex: 1 1 auto;
    justify-content: center;
  }

  .r3-dock-btn {
    min-height: 44px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .r3-hero .hero-inner {
    padding: 12px 18px 18px;
  }

  .r3-hero .hero-nav {
    gap: 8px;
  }

  .r3-hero .hero-brand {
    font-size: 22px;
  }

  .r3-hero .hero-copy {
    width: 100%;
    max-width: 100%;
    padding: 34px 0 30px;
  }

  .r3-hero h1 {
    font-size: clamp(38px, 11vw, 48px);
    margin: 18px 0 14px;
  }

  .r3-hero .hero-copy p {
    font-size: 13.5px;
    line-height: 1.55;
    margin-bottom: 18px;
    max-width: 34ch;
  }

  .r3-hero .hero-values {
    display: none;
  }

  .r3-hero .hero-note {
    margin-top: 11px;
    font-size: 10px;
  }

  body[data-r3-mode="hero"] .r3-scene .qp-scene-guardian {
    width: min(72vw, 300px);
    right: -9%;
    bottom: 0;
    opacity: .92;
  }

  .r3-workspace .app-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0;
  }

  .r3-workspace .app-sidebar {
    display: none;
  }

  .r3-workspace .r3-mobile-scene {
    display: block;
    position: relative;
    flex: 0 0 168px;
    min-height: 168px;
    padding: 14px 18px 0;
    overflow: hidden;
    color: #fbf5e7;
  }

  .r3-workspace .r3-mobile-scene::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(7, 25, 21, .58), rgba(7, 25, 21, .18) 75%, rgba(7, 25, 21, .45));
    pointer-events: none;
  }

  .r3-mobile-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .r3-mobile-brand {
    font: 700 18px Georgia, "Times New Roman", serif;
    color: #f6eedc;
  }

  .r3-mobile-brand i {
    font-style: normal;
    color: #d9bd87;
  }

  .r3-mobile-scene h1 {
    position: relative;
    z-index: 2;
    margin: 14px 0 5px;
    max-width: 255px;
    color: #fffdf4;
    font: 700 22px/1.2 Georgia, "Times New Roman", serif;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .45);
  }

  .r3-mobile-scene p {
    position: relative;
    z-index: 2;
    margin: 0;
    max-width: 245px;
    color: #e2e9df;
    font-size: 11px;
    line-height: 1.4;
  }

  .r3-mobile-head {
    position: absolute;
    z-index: 1;
    right: 3px;
    bottom: -14px;
    width: 112px;
    height: 112px;
    object-fit: contain;
    opacity: .9;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .35));
  }

  .r3-help-mobile {
    position: relative;
    z-index: 3;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(238, 221, 188, .55);
    background: rgba(8, 30, 24, .62);
    color: #faf2df;
    font: 700 12px/1.2 "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
  }

  .r3-workspace .main-panel {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0 8px 8px;
    border-radius: 16px;
    border: 1px solid #d9e1d9;
  }

  .r3-workspace .app-topbar,
  .r3-workspace .app-heading,
  .r3-workspace .app-tabs {
    display: none;
  }

  .r3-workspace .app-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 12px 12px 20px;
  }

  .r3-workspace .risk-columns {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
    min-height: 0;
  }

  .r3-workspace .risk-columns .card {
    height: auto;
  }

  .r3-workspace .document-reader {
    max-height: 360px;
  }

  .r3-toast {
    bottom: 12px;
    font-size: 11.5px;
  }
}

@media (max-width: 380px) {
  #r3Motion {
    flex: 1 1 100%;
  }
}

@media (max-height: 620px) and (min-width: 821px) {
  .r3-hero .hero-copy {
    padding-bottom: 40px;
  }

  .r3-hero h1 {
    font-size: 46px;
  }

  .r3-hero .hero-values {
    display: none;
  }

  body[data-r3-mode="hero"] .r3-scene .qp-scene-guardian {
    width: min(30vw, 380px);
    bottom: 20px;
  }
}
