/* ============================================================
   LIGHT AS FEEDBACK IN ROBOTICS – project page only
   Scene, configurator and prototype styles, scoped to .rl-*
   so the rest of the site is untouched.
   ============================================================ */

.rl-study,
.rl-prototype {
  --rl-muted: rgba(245, 245, 245, 0.62);
  --rl-hover: rgba(245, 245, 245, 0.08);
  --rl-focus: #99cfff;
}

.rl-study [hidden] { display: none !important; }

.rl-sr-only,
.rl-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.rl-study :is(button, input):focus-visible,
.rl-choice input:focus-visible + span,
.rl-prototype :is(a, video):focus-visible {
  outline: 2px solid var(--rl-focus);
  outline-offset: 3px;
}

/* --- Scene ------------------------------------------------- */

.rl-study { margin: 0 0 96px; }

.rl-scene {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 2.45;
  background: #394550;
}

/* Keep the photograph and its light in one coordinate system at every crop. */
.rl-world {
  position: absolute;
  width: 100%;
  aspect-ratio: 2;
  top: 50%;
  transform: translateY(-50%);
}

.rl-world img { width: 100%; height: 100%; display: block; }

.rl-lamp {
  position: absolute;
  left: 65.56%;
  top: 47.22%;
  width: 3.44%;
  height: max(.52%, 1.5px);
  display: flex;
  justify-content: space-between;
  --light-color: #1eff00;
}

.rl-strip {
  position: relative;
  width: 35%;
  height: 100%;
  border-radius: 100px;
  background: color-mix(in srgb, var(--light-color) 50%, #010200);
}

.rl-beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.rl-study[data-pattern="sweep"] .rl-beam {
  width: 38%;
  background: linear-gradient(90deg, transparent, var(--light-color) 38% 62%, transparent);
  filter: drop-shadow(0 0 1px var(--light-color));
}

.rl-study[data-pattern="pulse"] .rl-beam {
  background: var(--light-color);
  box-shadow: 0 0 2px var(--light-color);
}

.rl-study[data-pattern="attachment"] .rl-strip { background: transparent; }
.rl-study[data-pattern="attachment"] .rl-beam { display: none; }

.rl-study[data-pattern="attachment"] .rl-lamp[data-secure="false"] .rl-vehicle-right {
  background: #ff2420;
  box-shadow: 0 0 1.5px #ff2826;
  animation: rl-latch-attention 2s ease-in-out infinite;
}

@keyframes rl-latch-attention {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

.rl-study[data-pattern="attachment"] .rl-lamp[data-secure="true"] .rl-strip {
  background: #1eff00;
  box-shadow: 0 0 1.5px #51e73d;
}

.rl-study[data-pattern="attachment"][data-playing="false"] .rl-lamp[data-secure="false"] .rl-vehicle-right {
  animation-play-state: paused;
}

/* The site shortens all CSS animations under reduced motion. Here the
   preview starts paused instead, so pressing Play must still show the
   real two-second warning. */
@media (prefers-reduced-motion: reduce) {
  .rl-study[data-pattern="attachment"] .rl-lamp[data-secure="false"] .rl-vehicle-right {
    animation-duration: 2s !important;
    animation-iteration-count: infinite !important;
  }
}

/* --- Controls ---------------------------------------------- */

.rl-study figcaption { font-size: 14px; }

.rl-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--grey-line);
}

.rl-patterns,
.rl-choices,
.rl-choice > span,
.rl-playback { display: flex; align-items: center; }

.rl-patterns { margin: 0; padding: 0; border: 0; min-width: 0; gap: 18px; }

.rl-control-label,
.rl-tune-panel h2 {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--grey-dim);
}

.rl-choices { gap: 4px; flex-wrap: wrap; }
.rl-choice { position: relative; cursor: pointer; }

.rl-choice > span {
  gap: 9px;
  border: 1px solid var(--grey-line);
  min-height: 44px;
  padding: 7px 15px;
  font-size: 14px;
  line-height: 1.3;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.rl-choice small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--rl-muted);
}

.rl-choice input:checked + span {
  background: var(--white);
  border-color: var(--white);
  color: var(--black);
}

.rl-choice input:checked + span small { color: rgba(10, 10, 10, 0.6); }

.rl-choice:hover input:not(:checked) + span,
.rl-playback:hover,
.rl-reset:hover,
.rl-behavior-note button:hover { background: var(--rl-hover); }

.rl-sweep-mark { border-radius: 40%; width: 19px; height: 3px; background: linear-gradient(90deg, transparent, currentColor); }
.rl-pulse-mark { height: 9px; width: 11px; border-inline: 3px solid currentColor; transform: skew(-15deg); }
.rl-latch-mark { width: 19px; height: 4px; border-inline: 6px solid currentColor; }

.rl-playback {
  min-height: 44px;
  gap: 9px;
  padding: 0 10px;
  font-size: 14px;
  color: var(--white);
  transition: background 0.2s;
}

.rl-playback-mark { width: 9px; height: 11px; border-inline: 3px solid currentColor; }

.rl-study[data-playing="false"] .rl-playback-mark {
  border: 0;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.rl-behavior-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 14px;
}

.rl-behavior-note p { margin: 0; max-width: 64ch; font-size: 15px; line-height: 1.6; }

.rl-behavior-note button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--grey-line);
  font-size: 14px;
  color: var(--white);
  transition: background 0.2s, border-color 0.2s;
}

.rl-behavior-note button:hover { border-color: var(--white); }

/* --- Tuning -------------------------------------------------- */

.rl-tune-panel { border-top: 1px solid var(--grey-line); margin-top: 16px; }
.rl-tune-panel h2 { margin: 16px 0 10px; }

.rl-tuning { display: flex; align-items: center; gap: 24px; padding: 0 0 14px; }
.rl-sliders { flex: 1; min-width: 0; border: 0; padding: 0; margin: 0; }

.rl-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(145px, 100%), 1fr));
  gap: 10px 24px;
}

.rl-study[data-pattern="sweep"] .rl-fields { max-width: 560px; }
.rl-study[data-pattern="attachment"] .rl-fields { max-width: 268px; }

.rl-parameter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 6px;
  align-items: center;
  font-size: 13px;
}

.rl-parameter .rl-reading { font-variant-numeric: tabular-nums; color: var(--rl-muted); }

.rl-parameter input {
  grid-column: 1 / -1;
  width: 100%;
  height: 28px;
  margin: 0;
  accent-color: var(--white);
  cursor: pointer;
}

.rl-color-setting { flex: none; font-size: 13px; }

.rl-color-value {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  color: var(--rl-muted);
  font-variant-numeric: tabular-nums;
}

.rl-color-value input {
  width: 40px;
  height: 28px;
  border: 1px solid var(--grey-line);
  background: transparent;
  cursor: pointer;
}

.rl-reset {
  min-height: 44px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--rl-muted);
  transition: background 0.2s, color 0.2s;
}

.rl-reset:hover { color: var(--white); }

/* --- Physical prototype ------------------------------------ */

.rl-prototype {
  container-type: inline-size;
  padding-top: 32px;
  border-top: 1px solid var(--grey-line);
  margin-bottom: 96px;
}

.rl-prototype-intro { max-width: 900px; margin-bottom: 32px; }

.rl-prototype-intro h2 {
  margin: 0 0 14px;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.rl-prototype-intro p { font-size: 16px; line-height: 1.8; }

/* Video (9:16) and photo (3:4) sit side by side, centered, at one
   shared height: the smaller of what fits on screen and what fits
   across the content width (9/16 + 3/4 = 1.3125). The figure shrinks
   to the pair, so the caption runs under both. */
.rl-prototype-media {
  --rl-gap: 24px;
  --rl-media-h: min(
    calc(100svh - var(--header-h) - 48px),
    calc((100cqw - var(--rl-gap)) / 1.3125)
  );
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.rl-prototype-row {
  display: flex;
  align-items: flex-start;
  gap: var(--rl-gap);
}

.rl-prototype-frame { overflow: hidden; background: var(--grey-subtle); }

.rl-prototype-frame video,
.rl-prototype-frame img {
  display: block;
  height: var(--rl-media-h);
  width: auto;
  max-width: none;
}

.rl-prototype-frame video { aspect-ratio: 720 / 1280; object-fit: contain; }
.rl-prototype-frame img { aspect-ratio: 3 / 4; object-fit: contain; }

.rl-prototype-media figcaption {
  /* Wrap to the media's width instead of widening the figure. */
  width: 0;
  min-width: 100%;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--rl-muted);
}

/* Phones: stack them, each as large as fits on screen. */
@media (max-width: 600px) {
  .rl-prototype-row { flex-direction: column; align-items: center; }
  .rl-prototype-frame video,
  .rl-prototype-frame img {
    height: auto;
    width: auto;
    max-width: 100%;
    max-height: calc(100svh - var(--header-h) - 48px);
  }
}

/* --- Responsive: wider crops keep the robot in view ---------- */

@media (max-width: 750px) {
  .rl-scene { aspect-ratio: 1.65; }
  .rl-world { width: 121.213%; right: 0; }
}

@media (max-width: 560px) {
  .rl-scene { aspect-ratio: 1.23; }
  .rl-world { width: 162.61%; }
  .rl-controls { align-items: end; gap: 4px; }
  .rl-patterns { flex-direction: column; align-items: flex-start; gap: 7px; }
  .rl-choice > span { padding-inline: 10px; gap: 6px; }
  .rl-playback { padding-inline: 5px; }
  .rl-tuning { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding-bottom: 6px; }
  .rl-sliders { grid-column: 1 / -1; }
  .rl-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
  .rl-reset { padding-inline: 0; }
}

@media (max-width: 380px) {
  .rl-choice i { display: none; }
}
