/* Under the hood v3 (live): v2 plus avatars for who is acting. The chat starts full width, becomes a phone, and the Grum web app
   slides in beside it. Driven by home-under-hood-v3.js. Every rule is scoped to
   #under-hood.uh-v3 so its appearance stays scoped to the live v3 section. */
#under-hood.uh-v3 .uh-frame { aspect-ratio: 1024 / 760; }

/* phone */
#under-hood.uh-v3 #uh-stage { display: grid; place-items: center; }
#under-hood.uh-v3 .ph {
  position: relative; height: 94%; aspect-ratio: 9 / 19.5; box-sizing: border-box;
  padding: 0.55cqw; border-radius: 3.4cqw; background: var(--code-background);
  box-shadow: 0 0 0 1px var(--fade-20), var(--shadow-modal-base);
  transition: transform 0.8s cubic-bezier(.45,0,.2,1);
}
#under-hood.uh-v3 .ph.side { transform: translateX(-30cqw); }
#under-hood.uh-v3 #uh-stage.reset .ph { transition: none; }
#under-hood.uh-v3 .ph-screen {
  position: relative; height: 100%; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 2.9cqw; background: var(--base-background);
}
#under-hood.uh-v3 .ph-status {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  height: 4.2cqw; padding: 0 2.6cqw; font-size: 1.3cqw; font-weight: var(--body-normal-bold-weight);
}
#under-hood.uh-v3 .ph-island { width: 8.5cqw; height: 2.4cqw; border-radius: var(--corner-full); background: var(--code-background); }
#under-hood.uh-v3 .ph-right { display: flex; align-items: center; gap: 0.5cqw; }
#under-hood.uh-v3 .ph-right b { font-size: 0.85em; padding: 0.05em 0.35em; border-radius: 0.35em; background: var(--white); color: var(--code-background); }
#under-hood.uh-v3 .ph-wifi { width: 1.3cqw; height: 0.9cqw; border-radius: 1.3cqw 1.3cqw 0 0; border: 0.25cqw solid var(--white); border-bottom: 0; box-sizing: border-box; }
#under-hood.uh-v3 .ph-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0.6cqw 1.4cqw 1.2cqw; border-bottom: 1px solid var(--fade-10);
}
#under-hood.uh-v3 .ph-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.6cqw;
  height: 3.6cqw; min-width: 3.6cqw; box-sizing: border-box; border-radius: var(--corner-full);
  background: var(--fade-10); border: 1px solid var(--fade-10);
}
#under-hood.uh-v3 .ph-menu { flex-direction: column; gap: 0.35cqw; }
#under-hood.uh-v3 .ph-menu i { display: block; width: 1.5cqw; height: 0.18cqw; border-radius: var(--corner-full); background: var(--text-on-base); }
#under-hood.uh-v3 .ph-menu i:last-child { width: 0.9cqw; align-self: flex-start; margin-left: 1.05cqw; }
#under-hood.uh-v3 .ph-pill { padding: 0 1.1cqw; gap: 1.4cqw; font-size: 1.5cqw; letter-spacing: 0.1em; }
#under-hood.uh-v3 .ph-ring { width: 1.7cqw; height: 1.7cqw; border-radius: 50%; border: 0.18cqw solid var(--fade-20); border-top-color: var(--text-on-base); box-sizing: border-box; animation: uh-spin 1.2s linear infinite; }
#under-hood.uh-v3 .ph-title { text-align: center; line-height: 1.25; }
#under-hood.uh-v3 .ph-title b { display: block; font-size: 1.35cqw; font-weight: var(--body-normal-bold-weight); }
#under-hood.uh-v3 .ph-title small { font-size: 1.1cqw; color: var(--text-warm); }
#under-hood.uh-v3 .ph-body { position: relative; flex: 1; overflow: hidden; }

/* chat sized for the phone */
#under-hood.uh-v3 #uh-chat { font-size: 1.15cqw; padding: 1.6em 1.2em; gap: 1.3em; background: transparent; }
#under-hood.uh-v3 .bubble { font-size: 1.1em; max-width: 82%; }
#under-hood.uh-v3 .uh-card { width: auto; }
#under-hood.uh-v3 #uh-chat .rv-toast { max-width: 100%; }

/* Grum web app: a browser window beside the phone */
#under-hood.uh-v3 #uh-review .rv-app {
  top: 7%; bottom: 7%; left: 39%; right: 3%;
  grid-template-rows: auto 1fr; font-size: 0.86em;
}
#under-hood.uh-v3 .br-bar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 0.45em;
  padding: 0.6em 0.9em; background: var(--white); border-bottom: 1px solid var(--dark);
}
#under-hood.uh-v3 .br-bar i { width: 0.75em; height: 0.75em; border-radius: 50%; background: var(--dark); }
#under-hood.uh-v3 .br-bar i:nth-child(1) { background: var(--primary-base); }
#under-hood.uh-v3 .br-bar i:nth-child(2) { background: var(--core-error); }
#under-hood.uh-v3 .br-bar i:nth-child(3) { background: var(--green-base); }
#under-hood.uh-v3 .br-bar span {
  flex: 1; max-width: 22em; margin: 0 auto; text-align: center; padding: 0.3em 1em;
  border-radius: var(--corner-full); background: var(--background); color: var(--text-secondary);
  font-size: 0.85em; font-family: var(--font-token);
}

/* status lines wrap as text in the narrow phone */
#under-hood.uh-v3 #uh-chat .activity { display: block; line-height: 1.45; }
#under-hood.uh-v3 #uh-chat .activity .spin,
#under-hood.uh-v3 #uh-chat .activity .chev { display: inline-grid; vertical-align: -0.25em; margin: 0 0.3em; }
/* cursor lives on the stage (outside the phone's clipped screen) */
#under-hood.uh-v3 #uh-stage > .cursor { font-size: 1.15cqw; z-index: 6; }

/* composer: the developer types here, taps send, and the text lands as a bubble */
#under-hood.uh-v3 .ph-input {
  flex: none; display: flex; align-items: center; gap: 0.8cqw;
  margin: 0 1cqw 1.6cqw; padding: 0.6cqw 0.6cqw 0.6cqw 1.4cqw;
  border-radius: 2cqw; background: var(--fade-10); border: 1px solid var(--fade-10);
  font-size: 1.25cqw;
}
#under-hood.uh-v3 .ph-field { flex: 1; min-width: 0; min-height: 1.4em; line-height: 1.4; }
#under-hood.uh-v3 .ph-field em { font-style: normal; color: var(--text-warm); }
#under-hood.uh-v3 .ph-field .caret {
  display: inline-block; width: 1px; height: 1em; background: currentColor;
  vertical-align: -0.12em; margin-left: var(--xsmall); animation: uh-blink 1s steps(1) infinite;
}
#under-hood.uh-v3 .ph-send {
  flex: none; display: grid; place-items: center; width: 2.6cqw; height: 2.6cqw;
  border-radius: 50%; background: var(--fade-20); color: var(--base-background);
  transition: background 0.2s, transform 0.12s;
}
#under-hood.uh-v3 .ph-send svg { width: 55%; height: 55%; }
#under-hood.uh-v3 .ph-send.ready { background: var(--primary-pink); }
#under-hood.uh-v3 .ph-send.press { transform: scale(0.85); }
#under-hood.uh-v3 #uh-chat #uh-bubble { transition: opacity 0.35s, transform 0.35s; }

/* flat: before the hand-off the thread is a plain full-width chat, no phone */
#under-hood.uh-v3 #uh-stage.flat .ph { height: 100%; width: 100%; aspect-ratio: auto; padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
#under-hood.uh-v3 #uh-stage.flat .ph-screen { border-radius: 0; background: transparent; }
#under-hood.uh-v3 #uh-stage.flat .ph-status,
#under-hood.uh-v3 #uh-stage.flat .ph-head { display: none; }
#under-hood.uh-v3 #uh-stage.flat #uh-chat { font-size: 1.5625cqw; padding: 2.5em 4em; gap: 1.5em; }
#under-hood.uh-v3 #uh-stage.flat .bubble { font-size: 1.2em; max-width: 70%; }
#under-hood.uh-v3 #uh-stage.flat .uh-card { width: 38em; }
#under-hood.uh-v3 #uh-stage.flat .ph-input { font-size: 1.5625cqw; margin: 0 4em 2em; padding: 0.5em 0.5em 0.5em 1.2em; border-radius: 1.4em; gap: 0.8em; }
#under-hood.uh-v3 #uh-stage.flat .ph-send { width: 2.2em; height: 2.2em; }
#under-hood.uh-v3 #uh-stage.flat > .cursor { font-size: 1.5625cqw; }

/* fixes: phone keeps a fixed height, new rows stay fully hidden until they open, the packet is solid */
#under-hood.uh-v3 #uh-stage { grid-template-rows: 100%; grid-template-columns: 100%; }
#under-hood.uh-v3 .ph-body { min-height: 0; }
#under-hood.uh-v3 .rv-colors .rv-new:not(.in) { padding-top: 0; padding-bottom: 0; border-width: 0; }
#under-hood.uh-v3 .packet { background: var(--code-background); color: var(--white); }
/* the packet passes behind the Grum page */
#under-hood.uh-v3 #uh-review .packet { z-index: 0; }
#under-hood.uh-v3 #uh-review .rv-app { z-index: 1; }
#under-hood.uh-v3 #uh-review .lead { z-index: 7; }

/* earlier turns already in the thread, so it never opens on a blank screen;
   new messages stack at the bottom and push older ones up, like a real chat */
#under-hood.uh-v3 #uh-chat { justify-content: flex-end; }
#under-hood.uh-v3 #uh-chat > * { flex: none; }
#under-hood.uh-v3 .hist-meta { color: var(--text-warm); font-size: 0.95em; font-weight: var(--body-normal-bold-weight); margin-bottom: -0.6em; }
#under-hood.uh-v3 .hist-a { margin: 0; font-size: 1.05em; line-height: 1.5; max-width: 34em; }
/* hidden lines take no space, so the thread really stacks from the bottom; they fade in when shown */
#under-hood.uh-v3 #uh-chat > .off,
#under-hood.uh-v3 #uh-chat > .rv-off { display: none !important; }
#under-hood.uh-v3 #uh-chat > * { transition: opacity 0.35s, transform 0.35s; }
@starting-style {
  #under-hood.uh-v3 #uh-chat > * { opacity: 0; transform: translateY(0.4em); }
}

/* check scene: header band runs edge to edge instead of stopping at the art's box */
#under-hood.uh-v3 #uh-check svg { overflow: visible; }
#under-hood.uh-v3 #uh-check { overflow: hidden; }
/* status-line icons sit centered on the text */
#under-hood.uh-v3 #uh-chat .activity .spin,
#under-hood.uh-v3 #uh-chat .activity .chev { vertical-align: middle; position: relative; top: -0.08em; }

/* the chat's padding no longer eases when it turns into the phone, so text doesn't reflow after landing */
#under-hood.uh-v3 #uh-chat { transition: none; }

/* ---------- v3: who is acting ----------
   Sean (developer) sits by the composer while he asks; the Grum mark floats bottom right
   inside the check scene, so it comes and goes with it; in the split Sean sits under the phone and Balazs
   (design lead) under the Grum app. No names: the cursor labels say who is who. Single-frame
   swaps mark moments: Sean thinks (hand at chin) while he types the request, Balazs thinks while
   the new pattern waits for review, then turns to his screen as he approves. */
#under-hood.uh-v3 .who {
  position: absolute; z-index: 8; display: flex; align-items: center; gap: 1cqw;
  opacity: 0; pointer-events: none;
  transition: left 0.8s cubic-bezier(.45,0,.2,1), bottom 0.8s cubic-bezier(.45,0,.2,1), opacity 0.35s;
}
#under-hood.uh-v3 .who-av {
  position: relative; flex: none; width: 5.6cqw; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 0.25cqw var(--base-background), 0 0.4cqw 1.2cqw var(--fade-dark-20);
  transition: width 0.8s cubic-bezier(.45,0,.2,1);
}
#under-hood.uh-v3 .who-av img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; }
/* these portraits have black corners outside the circle; crop them away */
#under-hood.uh-v3 .who-lead img,
#under-hood.uh-v3 .who-dev .who-think { transform: scale(1.08); }
#under-hood.uh-v3 .who-think,
#under-hood.uh-v3 .who-happy { opacity: 0; }
#under-hood.uh-v3 .who.think .who-think,
#under-hood.uh-v3 .who.happy .who-happy { opacity: 1; }
#under-hood.uh-v3 .who.think .who-av,
#under-hood.uh-v3 .who.happy .who-av { animation: uh-who-pop 0.28s ease-out; }
@keyframes uh-who-pop { 40% { transform: scale(1.08); } }

/* asking: Sean beside the composer of the full-width chat */
#under-hood.uh-v3 [data-who="dev"] .who-dev { opacity: 1; left: 2.2cqw; bottom: 1.6cqw; }
#under-hood.uh-v3 [data-who="dev"] .who-dev .who-av { width: 7.2cqw; }
/* the avatar overlaps the composer's left end; typed text starts just past it */
#under-hood.uh-v3 #uh-stage.flat .ph-input { padding-left: 3em; }
/* the split: each person under their own window */
#under-hood.uh-v3 [data-who="split"] .who { opacity: 1; bottom: 0.9cqw; }
#under-hood.uh-v3 [data-who="split"] .who-av { width: 6.4cqw; }
#under-hood.uh-v3 .who-dev { left: 2.4cqw; bottom: 2.3cqw; }
#under-hood.uh-v3 [data-who="split"] .who-dev { left: 1cqw; }
#under-hood.uh-v3 .who-lead { left: auto; right: 1.2cqw; bottom: -10cqw; }
/* the check: Grum's mark floats over the bottom-right corner, part of the check scene itself */
#under-hood.uh-v3 .who-grum { left: auto; right: 1.2cqw; bottom: 0.9cqw; opacity: 1; z-index: 2; }
#under-hood.uh-v3 .who-grum .who-av { width: 6.4cqw; background: var(--code-background); box-shadow: 0 0 0 0.2cqw var(--primary-pink), 0 0.4cqw 1.2cqw var(--fade-dark-20); }
#under-hood.uh-v3 .who-grum img { inset: 26%; width: 48%; height: 48%; border-radius: 0; }

/* in the split the avatars float over the phone's bottom-left and the Grum app's bottom-right
   corners; the phone's composer text starts past Sean's avatar */
#under-hood.uh-v3 #uh-stage:not(.flat) .ph-input { padding-left: 3.4cqw; }
