/* NouwaCore robot guide (rbg-) — the robot as part of the page, not a widget.
   Markup: partials/robot/{figure,dock}.blade.php · Behaviour: assets/js/robot-guide.js
   The robot is a transparent cut-out standing freely next to its line — no box, no background.
   It is still, except for ONE entrance each time the visitor reaches its section (it rises in while a
   light ring opens on the floor), then it stays put. Tokens from foundation.css; transform/opacity
   only; no entrance under prefers-reduced-motion. */

/* ---- The figure ------------------------------------------------------------------- */
.rbg {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  /* the render is cut at the legs: let the bottom fade out instead of ending on a hard edge */
  -webkit-mask-image: linear-gradient(180deg, #000 68%, transparent 97%);
          mask-image: linear-gradient(180deg, #000 68%, transparent 97%);
}
.rbg__img {               /* the head (300×538): centred, sized so the face fills the dock and the neck fades */
  position: absolute;
  left: 14%;
  top: 0;
  width: 72%;
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(10, 10, 11, 0.28));
}
/* until the visitor reaches it, the robot waits out of sight (JS only — without JS it is simply shown) */
.js .rbg-dock:not(.is-active) .rbg { opacity: 0; }
/* the entrance: once per arrival, then still */
.rbg.is-arriving { animation: rbg-arrive 1100ms var(--nc-ease-cinema) both; }

/* ---- Docks ---------------------------------------------------------------------------- */
.rbg-dock { position: relative; }
.rbg-dock__slot { position: relative; isolation: isolate; }

/* inline dock: a compact docking pod + the robot's line beside it */
.rbg-dock--inline {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-top: var(--nc-space-6);
}
.rbg-dock--inline .rbg-dock__slot { width: 150px; height: 196px; }
/* the floor it stands on: a soft shadow, lit red while the robot is here */
.rbg-dock--inline .rbg-dock__slot::before,
.rbg-dock--inline .rbg-dock__slot::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: 2px;
  width: 120px;
  height: 18px;
  margin-left: -60px;
  border-radius: 50%;
  pointer-events: none;
}
.rbg-dock--inline .rbg-dock__slot::before {
  background: radial-gradient(closest-side, rgba(10, 10, 11, 0.22), transparent);
  transition: background 600ms var(--nc-ease-out);
}
.rbg-dock--inline.is-active .rbg-dock__slot::before { background: radial-gradient(closest-side, rgba(161, 13, 24, 0.4), rgba(161, 13, 24, 0.08) 70%, transparent); }
.rbg-dock--inline .rbg-dock__slot::after { border: 1.5px solid rgba(161, 13, 24, 0.7); opacity: 0; }
.rbg-dock--inline.is-landing .rbg-dock__slot::after { animation: rbg-land 1200ms var(--nc-ease-out) 250ms 1 both; }

/* the robot's line */
.rbg-say {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--nc-border-strong);
  border-radius: 16px;
  background: var(--nc-surface);
  box-shadow: var(--nc-shadow-sm);
  transition: opacity var(--nc-dur-slow) var(--nc-ease-out), border-color var(--nc-dur-slow), transform var(--nc-dur-slow) var(--nc-ease-out);
}
.rbg-say > * { margin: 0; }
.rbg-dock--inline .rbg-say::before {     /* tail toward the pod */
  content: '';
  position: absolute;
  top: 50%;
  inset-inline-start: -7px;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-inline-start: 1px solid var(--nc-border-strong);
  border-bottom: 1px solid var(--nc-border-strong);
  background: var(--nc-surface);
  transform: rotate(45deg);
  transition: border-color var(--nc-dur-slow);
}
[dir="rtl"] .rbg-dock--inline .rbg-say::before { transform: rotate(-45deg); }
.rbg-say__text { color: var(--nc-text); font-size: 0.875rem; font-weight: var(--nc-weight-medium); line-height: 1.5; text-wrap: pretty; }
.rbg-say__acts { display: flex; flex-wrap: wrap; gap: 8px; }
.js .rbg-dock--inline:not(.is-active) .rbg-say { opacity: 0.6; }
.rbg-dock.is-active .rbg-say { border-color: rgba(161, 13, 24, 0.45); }
.rbg-dock--inline.is-active .rbg-say::before { border-color: rgba(161, 13, 24, 0.45); }
.js .rbg-dock.is-speaking .rbg-say { animation: rbg-say-in 520ms var(--nc-ease-cinema) 1; }

.rbg-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--nc-border-strong);
  border-radius: 999px;
  color: var(--nc-text);
  font-size: 0.75rem;
  font-weight: var(--nc-weight-semibold);
  text-decoration: none;
  transition: border-color var(--nc-dur-fast), background-color var(--nc-dur-fast), color var(--nc-dur-fast);
}
.rbg-act:hover { border-color: var(--nc-text); }
.rbg-act--primary { border-color: var(--nc-red-500); background: var(--nc-red-500); color: #FFFFFF; }
.rbg-act--primary:hover { border-color: var(--nc-red-600); background: var(--nc-red-600); color: #FFFFFF; }
.rbg-act:focus-visible { outline: none; box-shadow: var(--nc-ring); }
.rbg-act__arrow { display: inline-block; }
[dir="rtl"] .rbg-act__arrow { transform: scaleX(-1); }

/* ---- Hero stage --------------------------------------------------------------------- */
.rbg-dock--stage { position: relative; }
.rbg-dock--stage .rbg-dock__slot {
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  aspect-ratio: 680 / 768;
  max-height: min(640px, calc(100svh - var(--nc-nav-h) - 120px));
  border-radius: 32px;
  overflow: hidden;
  background:
    radial-gradient(60% 45% at 50% 100%, rgba(161, 13, 24, 0.28), transparent 70%),
    radial-gradient(70% 60% at 50% 30%, #15171C, #0A0A0B 70%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 60px 120px -50px rgba(10, 10, 11, 0.75),
    0 -40px 120px -80px rgba(161, 13, 24, 0.5);
}
:root[data-theme="dark"] .rbg-dock--stage .rbg-dock__slot { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1) inset, 0 60px 140px -50px rgba(0, 0, 0, 0.9), 0 0 120px -40px rgba(161, 13, 24, 0.35); }
/* the render's own scene dissolves into the stage */
.rbg-dock--stage .rbg__img {
  -webkit-mask-image: radial-gradient(75% 82% at 50% 42%, #000 58%, transparent 100%);
          mask-image: radial-gradient(75% 82% at 50% 42%, #000 58%, transparent 100%);
}

.rbg-stage__floor {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 7%;
  z-index: 4;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 100, 112, 0.9), transparent);
  box-shadow: 0 0 24px 4px rgba(161, 13, 24, 0.45);
  pointer-events: none;
}
.rbg-stage__tag {
  position: absolute;
  top: 18px;
  inset-inline-start: 18px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(10, 10, 11, 0.6);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  color: #F5F5F2;
  font-family: var(--nc-font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}
html[lang="ar"] .rbg-stage__tag { text-transform: none; letter-spacing: 0; font-size: 0.75rem; }
.rbg-stage__tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--nc-red-500); box-shadow: 0 0 0 3px rgba(161, 13, 24, 0.25); }
.rbg-dock--stage:not(.is-active) .rbg-stage__tag i { background: rgba(255, 255, 255, 0.3); box-shadow: none; }

/* the hero line sits over the stage's edge, toward the headline */
.rbg-dock--stage .rbg-say {
  position: absolute;
  bottom: 9%;
  inset-inline-start: -28px;
  z-index: 5;
  width: min(330px, 78%);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(17, 18, 20, 0.88);
  -webkit-backdrop-filter: blur(14px);
          backdrop-filter: blur(14px);
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
  --nc-text: #F5F5F2;
  --nc-border-strong: rgba(255, 255, 255, 0.2);
  --nc-ring: 0 0 0 2px #111214, 0 0 0 4px var(--nc-red-300);
}
.rbg-dock--stage.is-active .rbg-say { border-color: rgba(161, 13, 24, 0.55); }
.rbg-dock--stage .rbg-act:hover { border-color: #FFFFFF; }

/* ---- Footer (final call to action) ----------------------------------------------------- */
.nf .rbg-dock--inline { margin-top: 0; max-width: 520px; }

/* the CTA the robot points at gets one gentle pulse when the robot arrives */
[data-rbg-cta].is-pointed .ui-btn--primary { animation: rbg-cta 1400ms var(--nc-ease-out) 2; }

/* ---- Motion ----------------------------------------------------------------------------- */
@keyframes rbg-arrive {
  from { opacity: 0; transform: translateY(26px) scale(0.94); filter: brightness(1.5); }
  55% { opacity: 1; }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes rbg-land { from { opacity: 0.9; transform: scale(0.4); } to { opacity: 0; transform: scale(1.5); } }
@keyframes rbg-say-in { from { opacity: 0; transform: translateY(8px); } to { transform: none; } }
@keyframes rbg-cta { 0% { box-shadow: var(--nc-shadow-primary), 0 0 0 0 rgba(161, 13, 24, 0.55); } 70% { box-shadow: var(--nc-shadow-primary), 0 0 0 14px rgba(161, 13, 24, 0); } 100% { box-shadow: var(--nc-shadow-primary), 0 0 0 0 rgba(161, 13, 24, 0); } }
[dir="rtl"] .rbg { --rbg-dir: 1; }

/* ---- Responsive -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .rbg-dock--stage .rbg-say { inset-inline-start: 12px; width: min(300px, calc(100% - 24px)); }
}
@media (max-width: 860px) {
  .rbg-dock--stage .rbg-dock__slot { max-width: 420px; max-height: 460px; }
  .rbg-dock--stage .rbg-say { inset-inline-start: 0; }
}
@media (max-width: 560px) {
  /* in the page flow, compact: the stage becomes a framed portrait with the line below it */
  .rbg-dock--stage { display: grid; justify-items: center; gap: 0; }
  .rbg-dock--stage .rbg-dock__slot { width: min(100%, 300px); max-height: 340px; border-radius: 24px; }
  .rbg-dock--stage .rbg-say { position: relative; inset: auto; bottom: auto; width: min(100%, 340px); margin-top: -36px; }
  .rbg-dock--inline { grid-template-columns: 100px minmax(0, 1fr); gap: 10px; }
  .rbg-dock--inline .rbg-dock__slot { width: 100px; height: 132px; }
  .rbg-dock--inline .rbg-dock__slot::before, .rbg-dock--inline .rbg-dock__slot::after { width: 84px; margin-left: -42px; height: 14px; }
  .rbg-say { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .rbg, .rbg *, .rbg-say, .rbg-dock *, [data-rbg-cta] * { animation: none !important; transition: none !important; }
}

/* ---- No robot (2026-11-11) -------------------------------------------------------------
   The owner retired the robot figure. A dock is now just its line and actions, full width,
   always at full strength (nothing marks it active any more) and without the tail toward the pod. */
.rbg-dock--inline { grid-template-columns: minmax(0, 1fr); gap: 0; }
.rbg-dock--inline .rbg-dock__slot,
.rbg { display: none; }
.rbg-dock--inline .rbg-say::before { display: none; }
.js .rbg-dock--inline:not(.is-active) .rbg-say { opacity: 1; }
