/* Product showcase (T05, Figma 307:3097): AI-agent app mockup on a rainbow glow.
   Desktop shows all three panes; tablet drops the review panel; mobile shows the chat only. */
.s-showcase {
  /* Mockup-only values: the app UI uses system UI and mono type, not the site fonts. */
  --sc-ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --sc-mono-font: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sc-ink: rgb(0 0 0 / 0.85);
  --sc-win-h: 709px;
  --sc-side-w: 218px;
  --sc-right-w: 320px;
  --sc-ok: #42bc00;
  --sc-add: #779b0b;
  --sc-del: #d15117;
  --sc-err: #f85149;

  position: relative;
  padding-block: var(--space-12) var(--section-y);
  isolation: isolate;
  overflow-x: clip; /* glow is wider than the viewport */
}
.s-showcase__sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.s-showcase__inner { position: relative; }

/* Rainbow glow: sits behind the window and bleeds up into the hero. Blob positions are weighted by size and opacity so the glow balances on 50%.
   --sc-glow-y nudges it up (negative) or down (positive). */
.s-showcase { --sc-glow-y: -90px; }
.s-showcase__glow {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: calc(-180px + var(--sc-glow-y));
  width: min(1608px, 140vw);
  height: 478px;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    radial-gradient(28% 55% at 27% 62%, rgb(255 137 4 / 0.5), transparent 70%),
    radial-gradient(24% 50% at 42% 70%, rgb(253 199 0 / 0.4), transparent 70%),
    radial-gradient(22% 50% at 55% 66%, rgb(154 230 0 / 0.25), transparent 70%),
    radial-gradient(26% 55% at 68% 60%, rgb(94 233 181 / 0.45), transparent 70%),
    radial-gradient(22% 45% at 81% 58%, rgb(0 146 184 / 0.25), transparent 70%);
  filter: blur(40px);
}

.s-showcase__app { position: relative; }
.s-showcase__app::before { /* soft drop shadow under the window, per Figma 307:3109 */
  content: "";
  position: absolute;
  inset: var(--space-6) 0 0;
  z-index: -1;
  border-radius: var(--radius-md);
  background: linear-gradient(to bottom, var(--black-10) 39%, #000);
  opacity: 0.1;
  filter: blur(22px);
}

.s-showcase__window {
  display: flex;
  height: var(--sc-win-h);
  overflow: hidden;
  background: var(--stone-100);
  border: 1px solid var(--border-thin);
  border-radius: 14px;
  font-family: var(--sc-ui-font);
  font-size: 13px;
  line-height: 16px;
  letter-spacing: -0.1px;
  color: var(--sc-ink);
  text-align: left;
  user-select: none;
}

/* Icons */
.sc-ic {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sc-ic--sm { width: 13px; height: 13px; }
.sc-ic--xs { width: 9px; height: 9px; opacity: 0.5; }
.sc-ic--muted { opacity: 0.5; }
.sc-ic--orange { color: var(--orange-500); }
.sc-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Left sidebar ---------- */
.sc-side {
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--sc-side-w);
  padding: var(--space-2);
  font-size: 14px;
}
.sc-side__top { display: flex; align-items: center; gap: var(--space-4); height: 28px; padding-left: var(--space-2); }
.sc-lights { display: flex; gap: 8px; }
.sc-lights i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.sc-lights i:nth-child(2) { background: #febc2e; }
.sc-lights i:nth-child(3) { background: #28c840; }
.sc-icons { display: flex; gap: var(--space-3); opacity: 0.6; }
.sc-icons--end { margin-left: auto; }

.sc-nav { list-style: none; padding: 0; margin-top: var(--space-3); }
.sc-nav li,
.sc-nav-item { display: flex; align-items: center; gap: var(--space-3); height: 32px; padding-inline: var(--space-2); border-radius: 6px; }

.sc-workspace { margin-top: var(--space-4); }
.sc-workspace__label { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2); font-size: 11px; opacity: 0.85; }
.sc-project { display: flex; align-items: center; gap: var(--space-3); height: 32px; padding-inline: var(--space-2); }
.sc-project .sc-ellipsis { flex: 1; }
.sc-threads { list-style: none; padding: 0 0 var(--space-2) 26px; font-size: 13.5px; }
.sc-threads li { display: flex; align-items: center; height: 27px; padding-inline: var(--space-2); border-radius: 4px; }
.sc-threads li.is-active { background: var(--black-5); }

.sc-side__bottom { margin-top: auto; }
.sc-user { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); }
.sc-user__avatar {
  width: 28px; height: 28px; border-radius: 6px;
  background: radial-gradient(circle at 50% 38%, #fff 0 18%, transparent 19%), radial-gradient(ellipse at 50% 100%, #fff 0 32%, transparent 33%), var(--orange-900);
}
.sc-user__meta { flex: 1; display: flex; flex-direction: column; }
.sc-user__meta b { font-weight: 500; }
.sc-user__meta small { font-size: 11px; opacity: 0.6; }

/* ---------- Main chat ---------- */
.sc-main {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding-inline: var(--space-4);
  background: var(--base-high);
}
.sc-main__glow { /* faint rainbow under the composer (Figma "gradient") */
  position: absolute; left: -16px; right: 0; bottom: 0; height: 193px; pointer-events: none;
  background:
    radial-gradient(30% 40% at 25% 100%, rgb(255 137 4 / 0.12), transparent 70%),
    radial-gradient(30% 40% at 55% 100%, rgb(253 199 0 / 0.1), transparent 70%),
    radial-gradient(30% 40% at 85% 100%, rgb(94 233 181 / 0.12), transparent 70%);
}
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-2) 0; }
.sc-head__title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-head__tools { display: flex; align-items: center; gap: var(--space-4); color: var(--black-60); }
.sc-pill { padding: 3px var(--space-2); border: 1px solid var(--border-thin); border-radius: 5px; font-size: 12px; color: var(--sc-ink); }
.sc-caret { display: inline-flex; align-items: center; gap: 2px; }

.sc-tabs { display: flex; align-items: center; height: 44px; margin-inline: var(--space-2); border-bottom: 1px solid var(--border-thin); }
.sc-tab { display: inline-flex; align-items: center; gap: 6px; height: 100%; padding-inline: var(--space-2); color: var(--black-60); }
.sc-tab.is-active { color: var(--sc-ink); box-shadow: inset 0 -2px 0 var(--sc-ok); }
.sc-tabs__end { display: flex; gap: var(--space-4); margin-left: auto; color: var(--black-60); }

.sc-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-6) var(--space-4); overflow: hidden; }
.sc-bubble { align-self: flex-end; padding: 8px var(--space-3); background: var(--stone-100); border-radius: 28px; font-size: 13.5px; }
.sc-ai { display: flex; flex-direction: column; gap: var(--space-3); }
.sc-steps { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.sc-steps li { display: flex; align-items: center; gap: var(--space-3); }
.sc-steps .sc-ic { opacity: 0.5; }
.sc-code {
  margin: var(--space-1) var(--space-6) 0;
  padding: 14px;
  background: var(--black-5);
  border: 1px solid var(--border-thin);
  border-radius: 4px;
  font-family: var(--sc-mono-font);
  font-size: 11px;
  line-height: 14px;
  color: #000;
  white-space: pre;
  overflow: hidden;
}
.sc-status { display: flex; align-items: center; gap: var(--space-2); }
.sc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sc-ok); }

.sc-composer { position: relative; padding-bottom: var(--space-1); }
.sc-composer__box {
  display: flex; flex-direction: column; justify-content: space-between; height: 100px;
  padding: var(--space-3) var(--space-3) var(--space-2);
  background: var(--base-high);
  border: 1px solid var(--border-thin);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}
.sc-composer__placeholder { color: var(--black-60); }
.sc-composer__row { display: flex; align-items: center; gap: var(--space-3); font-size: 11px; }
.sc-round { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--border-thin); border-radius: 50%; }
.sc-model { display: inline-flex; align-items: center; gap: 6px; }
.sc-mic { display: grid; place-items: center; width: 24px; height: 24px; margin-left: auto; border-radius: 50%; background: #000; color: #fff; }
.sc-composer__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); height: 40px; padding-inline: var(--space-6); }
.sc-composer__foot > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sc-composer__branch { font-size: 12px; }
.sc-ring { width: 13px; height: 13px; border: 2px solid var(--red-500); border-top-color: transparent; border-radius: 50%; }

/* ---------- Right review panel ---------- */
.sc-right { flex: none; width: var(--sc-right-w); padding: var(--space-2); background: var(--base-high); }
.sc-panel {
  display: flex; flex-direction: column; height: 100%;
  padding-inline: var(--space-2);
  background: var(--stone-50);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius-sm);
}
.sc-panel__tabs { display: flex; align-items: center; gap: var(--space-2); height: 46px; padding-inline: var(--space-2); border-bottom: 1px solid var(--border-thin); font-weight: 500; }
.sc-panel__tabs > span:not(.sc-diff) { opacity: 0.5; }
.sc-panel__tabs > span.is-active { opacity: 1; }
.sc-diff { margin-left: auto; color: var(--black-60); }
.sc-diff b { font-weight: 500; color: var(--sc-add); }
.sc-diff em { font-style: normal; color: var(--sc-del); }

.sc-panel__body { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6) var(--space-2) var(--space-4); }
.sc-review strong { display: block; margin-bottom: var(--space-2); font-size: 14px; font-weight: 600; }
.sc-review p { color: var(--black-60); line-height: 18px; }
.sc-group { display: flex; flex-direction: column; gap: var(--space-2); }
.sc-group__label { display: flex; align-items: center; font-size: 10px; letter-spacing: 0.3px; text-transform: uppercase; color: var(--black-60); }
.sc-changes { display: flex; align-items: center; gap: var(--space-3); height: 40px; padding-inline: var(--space-3); background: var(--base-high); border: 1px solid var(--border-thin); border-radius: 6px; }
.sc-row { display: flex; align-items: center; gap: var(--space-3); min-height: 28px; }
.sc-row__end { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--black-60); }

.sc-term { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--black-5); }
.sc-term__tabs { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); }
.sc-term__tab { display: inline-flex; align-items: center; gap: 6px; padding: 3px var(--space-2); background: var(--black-5); border-radius: 4px; }
.sc-term__out { margin: 0; padding: var(--space-3) var(--space-2); font-family: var(--sc-mono-font); font-size: 10.5px; line-height: 12px; color: #000; white-space: pre; overflow: hidden; }
.sc-err { color: var(--sc-err); }
.sc-cursor { display: inline-block; width: 6px; height: 12px; vertical-align: -2px; background: #000; animation: sc-blink 1s steps(1) infinite; }
@keyframes sc-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sc-cursor { animation: none; } }

/* ---------- Responsive ---------- */
/* Tablet: drop the review panel. */
@media (max-width: 1023.98px) {
  .s-showcase { --sc-win-h: 620px; --sc-side-w: 200px; }
  .sc-right { display: none; }
}
/* Mobile: chat pane only, height follows content. */
@media (max-width: 767.98px) {
  .s-showcase { padding-top: var(--space-8); }
  .s-showcase__glow { top: calc(-120px + var(--sc-glow-y)); height: 320px; }
  .s-showcase__window { height: auto; border-radius: var(--radius-md); }
  .sc-side { display: none; }
  .sc-main { padding-inline: var(--space-2); }
  .sc-head__tools .sc-caret,
  .sc-head__tools > .sc-ic { display: none; }
  .sc-chat { padding: var(--space-4) var(--space-2); gap: var(--space-4); }
  .sc-code { margin-inline: 0; font-size: 10px; overflow-x: auto; }
  .sc-composer__foot { padding-inline: var(--space-2); }
  .sc-composer__branch { display: none !important; }
}
/* Desktop: Figma 307:3097 is exactly the 709px window, flush under the hero */
@media (min-width: 1024px) {
  .s-showcase { padding-block: 0; }
}

/* ---------- Interactions ---------- */
/* The window enters via data-reveal="scale" on .s-showcase__app (css/motion.css). Everything below is
   this section's own motion: a slow glow, a desktop scroll tilt, the chat and terminal playing in, and
   quiet hover states on the fake UI. The cursor stays default because none of it is a real control. */

.s-showcase__glow { animation: sc-glow 9s var(--ease-in-out) infinite alternate; }
@keyframes sc-glow {
  from { opacity: 0.85; transform: translateX(-50%) scale(1); }
  to { opacity: 1; transform: translateX(-50%) scale(1.05, 1.1); }
}

/* Desktop: the window starts tipped back and flattens as it scrolls up (showcase.js sets --sc-tilt). */
.s-showcase.sc-tilt .s-showcase__app { perspective: 1800px; }
.s-showcase.sc-tilt .s-showcase__window {
  transform: rotateX(var(--sc-tilt, 0deg));
  transform-origin: 50% 0;
  will-change: transform;
}

/* Living details: the review ring spins, the working dot pulses. */
.sc-ring { animation: sc-spin 0.9s linear infinite; }
@keyframes sc-spin { to { transform: rotate(360deg); } }
.sc-dot { animation: sc-pulse 1.6s var(--ease-in-out) infinite; }
@keyframes sc-pulse {
  0% { box-shadow: 0 0 0 0 rgb(66 188 0 / 0.45); }
  70%, 100% { box-shadow: 0 0 0 6px rgb(66 188 0 / 0); }
}
.sc-timer { font-variant-numeric: tabular-nums; }

/* Playback: hidden only once showcase.js has armed the section (JS on, motion allowed),
   then each piece plays in order when .is-playing lands. */
.sc-armed:not(.is-playing) :is(.sc-bubble, .sc-ai > p, .sc-steps li, .sc-status, .sc-term__line) { opacity: 0; }
.sc-armed:not(.is-playing) .sc-code { clip-path: inset(0 0 100% 0); }
.sc-armed:not(.is-playing) .sc-tab.is-active { box-shadow: inset 0 -2px 0 transparent; }

.is-playing .sc-tab.is-active { transition: box-shadow var(--dur-slow) var(--ease-out); }
.is-playing .sc-bubble { animation: sc-bubble 500ms var(--ease-spring) both; transform-origin: 100% 100%; }
.is-playing :is(.sc-ai > p, .sc-steps li, .sc-status) { animation: sc-line 450ms var(--ease-out) both; }
.is-playing .sc-ai > p { animation-delay: 450ms; }
.is-playing .sc-steps li:nth-child(1) { animation-delay: 750ms; }
.is-playing .sc-steps li:nth-child(2) { animation-delay: 950ms; }
.is-playing .sc-steps li:nth-child(3) { animation-delay: 1150ms; }
.is-playing .sc-code { animation: sc-type 1300ms steps(13, end) 1400ms both; } /* 13 lines, written line by line */
.is-playing .sc-status { animation-delay: 2700ms; }
.is-playing .sc-term__line { animation: sc-term 1ms linear both; }
.is-playing .sc-term__line:nth-child(1) { animation-delay: 600ms; }
.is-playing .sc-term__line:nth-child(2) { animation-delay: 1100ms; }
.is-playing .sc-term__line:nth-child(3) { animation-delay: 1350ms; }
.is-playing .sc-term__line:nth-child(4) { animation-delay: 1600ms; }
.is-playing .sc-term__line:nth-child(5) { animation-delay: 2100ms; }
.is-playing .sc-term__line:nth-child(6) { animation-delay: 2400ms; }
.is-playing .sc-term__line:nth-child(7) { animation-delay: 2700ms; }

@keyframes sc-bubble { from { opacity: 0; transform: translateY(8px) scale(0.92); } }
@keyframes sc-line { from { opacity: 0; transform: translateY(6px); } }
@keyframes sc-type { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes sc-term { from { opacity: 0; } to { opacity: 1; } }
.sc-steps li, .sc-ai > p, .sc-status { will-change: auto; }

/* Hover: rows highlight like the real app would, icons brighten, the composer wakes up. */
@media (hover: hover) {
  .s-showcase__window { cursor: default; }
  :is(.sc-nav li, .sc-nav-item, .sc-project, .sc-threads li, .sc-user, .sc-term__tab) {
    transition: background-color var(--dur) var(--ease);
  }
  :is(.sc-nav li, .sc-nav-item, .sc-project, .sc-threads li:not(.is-active), .sc-user):hover { background: var(--black-5); border-radius: 6px; }
  .sc-threads li.is-active:hover { background: var(--black-10); }

  :is(.sc-icons, .sc-head__tools, .sc-tabs__end) > :is(.sc-ic, .sc-caret, .sc-pill),
  .sc-icons .sc-ic, .sc-tab, .sc-panel__tabs > span, .sc-row__end, .sc-term__tabs > .sc-ic {
    transition: color var(--dur) var(--ease), opacity var(--dur) var(--ease), background-color var(--dur) var(--ease);
  }
  .sc-icons .sc-ic:hover { opacity: 1; color: #000; }
  :is(.sc-head__tools, .sc-tabs__end) > :is(.sc-ic, .sc-caret):hover,
  .sc-tab:not(.is-active):hover,
  .sc-row__end:hover { color: var(--sc-ink); }
  .sc-pill:hover { background: var(--black-5); }
  .sc-panel__tabs > span:not(.sc-diff):not(.is-active):hover { opacity: 0.8; }
  .sc-term__tabs > .sc-ic:hover { opacity: 1; }

  .sc-composer__box { transition: border-color var(--dur) var(--ease), box-shadow var(--dur-slow) var(--ease-out); }
  .sc-composer__box:hover { border-color: var(--black-20, rgb(0 0 0 / 0.2)); box-shadow: var(--shadow-md); }
  .sc-round, .sc-mic { transition: transform var(--dur) var(--ease-spring), background-color var(--dur) var(--ease); }
  .sc-round:hover { background: var(--black-5); }
  .sc-mic:hover { transform: scale(1.12); }
  .sc-changes { transition: border-color var(--dur) var(--ease); }
  .sc-changes:hover { border-color: var(--black-20, rgb(0 0 0 / 0.2)); }
}

@media (prefers-reduced-motion: reduce) {
  .s-showcase__glow, .sc-ring, .sc-dot { animation: none; }
  .s-showcase .s-showcase__window { transform: none; }
  .sc-mic:hover { transform: none; }
}
