/* Red Rabbit Robotics — redrabbitrobotics.ai */

:root {
  /* Brand theme: black, off-white, rabbit red */
  --bg: #030303;
  --fg: #f2f2f2;
  --fg-2: rgba(242, 242, 242, 0.62);
  --fg-3: rgba(242, 242, 242, 0.38);
  --line: rgba(242, 242, 242, 0.14);
  --line-2: rgba(242, 242, 242, 0.3);   /* hairlines that sit over video */
  --red: #800000;        /* logo red */
  --red-live: #d9261c;   /* the same red, lifted so small marks read on black */

  --sans: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --pad: clamp(16px, 2.6vw, 40px);   /* side gutter */
  --edge: clamp(16px, 2vw, 24px);    /* distance from top / bottom edges */
  --tb: 0px;                         /* height of a collapsing mobile browser toolbar */
  --headline: clamp(2.5rem, 1rem + 5.6vw, 7rem);   /* hero headline size; the scroll arrow's position reads it too */

  /* Set from main.js as the page scrolls */
  --p: 0;     /* hero scroll progress, 0 to 1 */
  --e: 0;     /* eased progress used for the pull-back */
  --out: 0;   /* 0 to 1 as the hero scrolls away after the pull-back */
  --fit: 1;   /* scale at which the whole video fits inside the frame */
  --glow: 1;
  --tuck: 0px;   /* how far the statement sits up under the hero's bottom band; main.js measures it */  /* 0 to 1 over the last stretch of the page; strength of the red glow under the statement */

  color-scheme: dark;
}

@supports (height: 100lvh) {
  :root { --tb: calc(100lvh - 100svh); }
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html {
  background: var(--bg);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
img, svg, video { display: block; }

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

/* ---------- Header ---------- */

.bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: var(--edge) var(--pad);
  padding-top: max(var(--edge), env(safe-area-inset-top));
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
/* Soft shade behind the header so it stays readable over whatever scrolls under it */
.bar::before {
  content: "";
  position: absolute;
  inset: 0 0 -56px 0;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(3, 3, 3, 0.66), rgba(3, 3, 3, 0));
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--fg);
  border-radius: 3px;
}
.brand__mark img { width: 26px; height: 26px; }
.brand__name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg);
  background: rgba(16, 16, 16, 0.5);
  border: 1px solid var(--line);
  border-radius: 3px;
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.chip:hover {
  background: var(--fg);
  border-color: var(--fg);
  color: #000;
}
.chip--solid {
  background: var(--fg);
  border-color: var(--fg);
  color: #000;
}
.chip--solid:hover {
  background: rgba(16, 16, 16, 0.5);
  border-color: var(--line);
  color: var(--fg);
}
.chip--lg {
  height: clamp(50px, 44px + 0.9vw, 60px);
  padding: 0 clamp(24px, 20px + 0.6vw, 30px);
  font-size: clamp(14px, 12.6px + 0.24vw, 17px);
}
.chip--lg svg { transition: transform 0.25s ease; }
.chip--lg:hover svg { transform: translateX(3px); }
.chip--icon { width: 40px; padding: 0; }
.chip--icon svg { fill: currentColor; }
.chip--icon .i-play { display: none; }
.chip--icon.is-paused .i-play { display: block; }
.chip--icon.is-paused .i-pause { display: none; }

/* ---------- Hero ---------- */

/* The hero holds still for 60 viewport heights of scrolling, which is exactly as long as the
   pull-back takes (main.js), then lets go. It sits above the statement, which tucks its empty
   top under the hero's bottom band. */
.stage {
  position: relative;
  z-index: 1;
  height: 160vh;
  height: 160lvh;
}

.pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  background: var(--bg);
  container-type: size;
}

/* The video box: sized to cover the screen, scaled back on scroll until all four cameras fit. */
.feed {
  position: absolute;
  left: 50%;
  top: 50%;
  aspect-ratio: 16 / 9;
  width: max(100vw, 100vh * 16 / 9);
  width: max(100cqw, 100cqh * 16 / 9);
  overflow: hidden;
  border-radius: calc(var(--e) * 6px);
  background: #000;
  transform: translate(-50%, -50%) scale(calc(1 + (var(--fit) - 1) * var(--e)));
  will-change: transform;
}
/* The two videos take turns. Each sits in its own layer; the second fades in over the first
   and back out again (main.js decides when). */
.take {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000 url("assets/poster-landscape.jpg") center / cover no-repeat;
}
.take--b {
  z-index: 1;
  background-image: url("assets/demo2-poster.jpg");
  opacity: 0;
  transition: opacity 1.1s ease-in-out;
}
.pin.is-b .take--b { opacity: 1; }
.take video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hairline gutters between the four cameras */
.take--a::before,
.take--a::after {
  content: "";
  position: absolute;
  z-index: 1;
  background: var(--bg);
  pointer-events: none;
}
.take--a::before { left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; }
.take--a::after { top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; }

.caption {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.caption::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red-live);
}

.scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.scrim--main {
  background:
    radial-gradient(85% 75% at 0% 100%, rgba(128, 0, 0, 0.34), rgba(128, 0, 0, 0) 70%),
    linear-gradient(to top, rgba(3, 3, 3, 0.94) 0%, rgba(3, 3, 3, 0.74) 26%, rgba(3, 3, 3, 0.4) 58%, rgba(3, 3, 3, 0.28) 100%);
  opacity: calc(1 - var(--p) * 1.5);
}

.pitch {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: calc(var(--edge) + var(--tb));
  z-index: 3;
  opacity: calc(1 - var(--p) * 2.6);
  transform: translate3d(0, calc(var(--p) * -56px), 0);
  pointer-events: none;
}
.pitch h1 {
  max-width: 10em;
  font-size: var(--headline);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.pitch .w {
  display: inline-block;
  animation: rise 1s cubic-bezier(0.2, 0.7, 0.1, 1) both;
  animation-delay: calc(0.2s + var(--i) * 70ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(0.3em); filter: blur(10px); }
  to { opacity: 1; transform: none; filter: none; }
}

.caption {
  position: absolute;
  left: var(--pad);
  bottom: calc(var(--edge) + var(--tb));
  z-index: 3;
  height: 40px;
  color: var(--fg-2);
  opacity: calc((var(--p) - 0.6) * 3 - var(--out) * 6);
  pointer-events: none;
}
/* The caption names whichever video is showing */
.caption__swap { display: grid; }
.caption__swap > span { grid-area: 1 / 1; transition: opacity 0.6s ease; }
.caption__swap > span + span,
.pin.is-b .caption__swap > span { opacity: 0; }
.pin.is-b .caption__swap > span + span { opacity: 1; }

.hud {
  position: absolute;
  right: var(--pad);
  bottom: calc(var(--edge) + var(--tb));
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 18px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-2);
  opacity: calc(1 - var(--out) * 6);
}
.hud__time { font-variant-numeric: tabular-nums; }

/* The scroll cue: a tall arrow that keeps falling and fading. No word and no box.
   Clicking it jumps to the statement. On desktop it stands on the bottom edge, halfway
   between the headline's rightmost character and the reel counter:
     the widest line ("transport, and inspect") ends at   --pad + 9.051 x headline size
     the counter starts at                                 100% - --pad - 120px
   and the midpoint of those is 50% + 4.5255 x headline - 60px (4.5255 is half of 9.051). Re-measure the
   9.051 if the headline's wording changes, and the 120px if the counter or pause button
   change size.
   That spot is only for while the headline is on screen. Scrolling fades the headline out
   (.pitch, opacity 1 - 2.6 x --p); once it is fully gone the arrow glides to dead centre,
   and it glides back as soon as any of the headline shows again. --aside is the switch,
   built from the headline's own opacity: 1 while the headline shows at all, 0 once it is
   gone. Keep its 2.6 the same as the one in .pitch. The 4.5255 x headline - 60px in the
   transform is how far the desktop spot is from centre. */
.cue {
  --aside: clamp(0, (1 - var(--p) * 2.6) * 1000, 1);
  position: absolute;
  left: 50%;
  bottom: calc(var(--edge) + var(--tb));
  z-index: 4;
  padding: 14px 22px 0;
  transform: translateX(calc(-50% + (4.5255 * var(--headline) - 60px) * var(--aside)));
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.1, 1);
  color: var(--fg);
  opacity: calc(1 - var(--out) * 6);
}
.cue svg {
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.7));
  animation: fall 1.8s cubic-bezier(0.5, 0, 0.2, 1) infinite;
}
@keyframes fall {
  0% { transform: translateY(-10px); opacity: 0; }
  35%, 65% { opacity: 1; }
  100% { transform: translateY(8px); opacity: 0; }
}

/* ---------- Statement ---------- */

.about {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 92vh;
  /* The statement starts up underneath the black band below the pulled-back video, so its
     label reaches the screen the moment the hero lets go. --tuck (main.js) is how far: the
     height of that band, or less if the label would end up under it. Only empty black is
     hidden, and the section looks the same once it is in place. */
  margin-top: calc(-1 * var(--tuck));
  padding: clamp(88px, 11vh, 150px) var(--pad) clamp(48px, 6vh, 100px);   /* the top clears the fixed header */
  text-align: center;
  background: var(--bg);
  isolation: isolate;
}
/* Behind the statement: the mobile demo, kept quiet so it reads as texture and the text stays
   the subject. It is black and white (so the only colour in the section is the red), dimmed
   to about an eighth of its brightness, and played slowly (main.js). It fades up out of black
   at the top so the section joins the hero without an edge, and darkens again toward the
   footer. Layers, back to front: video, the dark wash, the red glow, the text. */
.about__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.about__bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(0.9);
}
/* The reel's second video lies over the first and fades in and out, as in the hero.
   Keep the 1.1s in step with FADE in main.js. */
.about__bg video + video {
  opacity: 0;
  transition: opacity 1.1s ease-in-out;
}
.about__bg.is-b video + video { opacity: 1; }
.about__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    var(--bg) 0, var(--bg) var(--tuck), rgba(3, 3, 3, 0.87) calc(var(--tuck) + 20%),
    rgba(3, 3, 3, 0.87) 62%, rgba(3, 3, 3, 0.95) 100%);
}
/* A faint red glow rising from the footer line toward the button, over the video: a wide,
   soft bloom in the logo red with a smaller, slightly brighter core at its base. It is kept
   subtle on purpose; at twice this strength it overwhelmed the section. To turn it up or
   down, change the first alpha in each layer (0.08 and 0.3) and keep the rest.
   It brightens as the page is scrolled to its end and dims on the way back up: --glow runs
   0 to 1 over the last stretch of scrolling (main.js), and squaring it keeps the glow low
   until near the end. */
.about::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(42% 26% at 50% 103%, rgba(217, 38, 28, 0.08), rgba(217, 38, 28, 0) 72%),
    radial-gradient(64% 50% at 50% 106%, rgba(128, 0, 0, 0.3), rgba(128, 0, 0, 0.1) 48%, rgba(128, 0, 0, 0) 78%);
  opacity: calc(var(--glow) * var(--glow));
  pointer-events: none;
}
.about__inner {
  position: relative;   /* keeps the text above the video and the glow */
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: clamp(20px, 2.6vw, 40px);
  width: 100%;
  max-width: 98rem;
}
.eyebrow {
  /* 4vw keeps the label on one line on phones; the other term sets the desktop size */
  font: 500 clamp(12px, min(4vw, 1rem + 0.72vw), 28px)/1.3 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.eyebrow b { font-weight: 500; color: var(--red-live); }
/* "[ Capable + Flexible + Affordable ]" is 35 characters. Below 600px it only stays on one
   line at this size with the letters set closer together. */
@media (max-width: 600px) { .eyebrow { letter-spacing: 0.035em; } }
.about h2 {
  max-width: 15em;
  font-size: clamp(2rem, 1.325rem + 3.8vw, 5.5rem);
  font-weight: 400;
  line-height: 1.03;
  letter-spacing: -0.042em;
  text-wrap: balance;
}
/* Two sentences, both white, each starting on its own line */
.about h2 span { display: block; }
.about h2 span + span { margin-top: 0.22em; }
/* The closing phrase of each sentence gets the red: a thin underline, text stays white */
.about h2 em {
  font-style: normal;
  text-decoration: underline var(--red-live);
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.16em;
}

/* The three boxes: one row on wide screens, one column on narrow ones */
.trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  margin-top: clamp(4px, 0.6vw, 10px);
  padding: 0;
  list-style: none;
  text-align: center;
  border: 1px solid var(--line-2);
}
.trio li {
  display: grid;
  align-content: start;
  gap: clamp(10px, 1vw, 16px);
  padding: clamp(20px, 2.1vw, 34px) clamp(20px, 2.3vw, 36px) clamp(24px, 2.5vw, 40px);
}
.trio li + li { border-left: 1px solid var(--line-2); }
/* "01" in the red of the label's brackets, centred between two hairlines in the same
   off-white as the box outlines. */
.trio__n {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: clamp(12px, 1.5vw, 24px);
  font: 500 clamp(13px, 0.7rem + 0.3vw, 16px)/1 var(--mono);
  letter-spacing: 0.14em;
  color: var(--red-live);
}
.trio__n::before,
.trio__n::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-2);
}
.trio h3 {
  font-size: clamp(1.625rem, 1.2rem + 1.5vw, 2.75rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.035em;
}
.trio p {
  font-size: clamp(1.125rem, 0.95rem + 0.62vw, 1.625rem);
  line-height: 1.38;
  letter-spacing: -0.012em;
  color: rgba(242, 242, 242, 0.74);   /* a little brighter than --fg-2: it sits over video */
  text-wrap: balance;   /* lines of even length; main.js keeps the three texts to the same number of lines */
  justify-self: center;   /* a text main.js has narrowed stays in the middle of its box */
}
/* In a narrow row the boxes are small, so the text gets a little more of each one */
@media (min-width: 721px) and (max-width: 900px) {
  .trio li { padding-left: 14px; padding-right: 14px; }
}
@media (max-width: 720px) {
  .trio { grid-template-columns: minmax(0, 1fr); }
  .trio li + li { border-left: 0; border-top: 1px solid var(--line-2); }
}

.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.1, 1);
}
.js .reveal:nth-child(2) { transition-delay: 0.08s; }
.js .reveal:nth-child(3) { transition-delay: 0.16s; }
.js .reveal:nth-child(4) { transition-delay: 0.24s; }
.about__cta { margin-top: clamp(4px, 1vw, 12px); }
.js .is-in .reveal { opacity: 1; transform: none; }

/* ---------- Footer ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding: 28px var(--pad) calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font: 500 12px/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-2);
}

/* ---------- Tall screens: the four cameras stack into one column; the mobile demo gets a tall crop ---------- */

@media (max-aspect-ratio: 4/5) {
  .feed {
    aspect-ratio: 4 / 9;
    width: max(100vw, 100vh * 4 / 9);
    width: max(100cqw, 100cqh * 4 / 9);
  }
  .take--a { background-image: url("assets/poster-portrait.jpg"); }
  .take--b { background-image: url("assets/demo2-poster-portrait.jpg"); }
  .take--a::before {
    inset: 0;
    height: auto;
    margin: 0;
    background: repeating-linear-gradient(to bottom,
      var(--bg) 0, var(--bg) 1px,
      transparent 1px, transparent calc(25% - 1px),
      var(--bg) calc(25% - 1px), var(--bg) 25%);
  }
  .take--a::after { content: none; }
  .caption { display: none; }
}

/* Narrow screens: the counter goes, the headline lifts to leave a row beneath it, and the
   scroll arrow sits dead centre in that row with the pause button at the right */
@media (max-width: 800px) {
  .hud__time, .caption { display: none; }
  .pitch { bottom: calc(var(--edge) + var(--tb) + 96px); }
  .cue { --aside: 0; }
}

@media (max-width: 720px) {
  .brand__name { font-size: 14px; }
  .foot { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 359px) {
  .brand__name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pitch .w, .cue svg { animation: none; }
  .cue { transition: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .take--b, .about__bg video, .caption__swap > span { transition: none; }
}
