/* 10 Testing (Figma 2114:2967 desktop, 2116:4365 tablet, 2115:3814 phone). */

.testing { padding-block: var(--space-9); }
.testing-inner { display: flex; flex-direction: column; gap: var(--space-7); }

/* Test Center: the pink crop of the brush (the third best-agent picture's) at 90% over accent soft, two glass cards
   over it (4 Nov: option C of the options page; Security's panel above keeps the blue crop).
   Desktop: 64 px in from the top and left (74 right), cards 620 and 420 wide, 40 apart, the result 76 px lower;
   padding scales with the content width below 1440. */
.testing-center {
  position: relative; isolation: isolate; overflow: hidden; border-radius: var(--radius-lg);
  background: var(--accent-soft);
  display: flex; align-items: flex-start; gap: 40px;
  padding: 5.2545% 6.0755% 5.2545% 5.2545%;
}
.testing-bg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.testing-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 20px; padding: var(--space-5);
  border: 1px solid var(--surface-card); border-radius: var(--radius-md);   /* Figma counts the stroke in the layout */
  background: linear-gradient(180deg, color-mix(in srgb, var(--c-panel) 66%, transparent),
    color-mix(in srgb, var(--c-panel-deep) 66%, transparent));   /* the shadow is the glass's (.glass) */
}
.testing-call { flex: 0 1 620px; min-width: 0; }
.testing-result { flex: 0 1 420px; min-width: 0; margin-top: 76px; gap: 24px; }

/* Player: play button, the call's waveform (Waveform: ink secondary, the flagged part violet), marker and playhead. */
.testing-player {
  /* Waveform unit --u: desktop draws 1.316 px bars 1.975 px apart (up to 21 px high), tablet and phone at 0.35484 of
     that. Where the player is narrower, the waveform shrinks to fit: its bars and gaps are 468 units, and the button,
     its gap and the two 6 px gaps between the parts take 66 px of the player's inner width. */
  --wf-max: 1px;
  --u: min(var(--wf-max), (100cqw - 66px) / 468);
  container-type: inline-size;
  align-self: stretch; position: relative; display: flex; align-items: center; gap: 14px;
  height: 92px; padding: 0 20px 0 var(--space-4); border-radius: var(--radius-md); background: var(--surface-card);
}
.testing-play { flex: none; transition: background-color var(--motion-hover) var(--ease-settle); }
.testing-play:hover { background: var(--accent-soft); }
.testing-wave { align-self: stretch; display: flex; gap: 6px; min-width: 0; }
.testing-wave-part, .testing-bars {   /* each part 156 units wide (48 bars, 47 gaps), bars spread across it */
  flex: none; display: flex; align-items: center; justify-content: space-between; width: calc(156 * var(--u));
}
.testing-wave-part--flag { position: relative; }
.testing-wave i {
  flex: none; width: calc(1.316 * var(--u)); height: calc(var(--h) * max(var(--u), .9px));   /* a phone's narrow bars keep their height */
  border-radius: var(--radius-full); background: var(--ink-secondary);
}
.testing-wave-part--flag i { background: var(--accent); }
/* Quieter outside the flagged moment, so the eye goes to it */
.testing-wave-part:not(.testing-wave-part--flag) i { opacity: .42; }
.testing-marker {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
  background: var(--surface-inverse); color: var(--ink-on-dark); white-space: nowrap;
}
/* The marker is at the label size (14/20), so the player is 92 high: the marker clear above the waveform, the playhead
   from under the marker to 8 px above the player's foot */
.testing-playhead { position: absolute; top: 38px; left: 50%; width: 2px; height: 46px; background: var(--ink-primary); }

/* Transcript line, S */
.testing-line { align-self: stretch; display: flex; align-items: flex-start; gap: var(--space-3); }
.testing-avatar { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--radius-full); }
.testing-avatar--caller { background: var(--surface-card); box-shadow: inset 0 0 0 1px var(--border-strong); }
.testing-avatar--agent { background: var(--accent); }
.testing-said { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.testing-said s { text-decoration-thickness: from-font; text-decoration-skip-ink: none; }

/* AI suggestion */
.testing-ai {
  align-self: stretch; display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); padding: 20px;
  border-radius: var(--radius-md); background: var(--surface-card); box-shadow: inset 0 0 0 1px var(--border-subtle);
}
/* German on a narrow card (Suggestion's rule): "Übernehmen und neu testen" no longer fits a suggestion under 262.4 px
   at 20 px in, so there the suggestion is 12 px in, and the label 8 px in where its own 17 would wrap it: the action
   stays on one line down to a 228.4 px suggestion. Each is a step on the width of its box, so a wider card and English
   stay as they are. */
.testing-ai:lang(de) { padding-inline: clamp(var(--space-3), (100% - 262.4px) * 999, calc(var(--space-4) + var(--space-1))); }
.testing-ai:lang(de) > .testing-apply { padding-inline: clamp(var(--space-2), (100% - 222.4px) * 999, 17px); }
.testing-ai-source { align-self: stretch; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.testing-ai-source > .t-small { text-wrap: balance; }   /* on its own line on phones, with no word alone on a line */
.testing-ai-mark { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--accent-soft); }
/* Its press, when the run applies the fix by itself or someone clicks it: it dips and takes the hover's dark ring
   with a violet tint (state, 250 ms); both are an overlay's opacity and a transform, so nothing moves around it. */
.testing-apply {
  position: relative; isolation: isolate;
  transition: background-color var(--motion-hover) var(--ease-settle), border-color var(--motion-hover) var(--ease-settle),
    transform var(--motion-state) var(--ease-settle);
}
.testing-apply::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--ink-primary); background: color-mix(in srgb, var(--accent) 8%, transparent);
  opacity: 0; transition: opacity var(--motion-state) var(--ease-settle);
}
.testing-apply.is-pressed { transform: scale(.96); }
.testing-apply.is-pressed::after { opacity: 1; }

/* Re-run result */
.testing-figure { display: flex; flex-direction: column; align-items: flex-start; }
.testing-value { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.testing-meters { align-self: stretch; display: flex; flex-direction: column; gap: 10px; }
.testing-meter { display: flex; align-items: center; gap: var(--space-4); height: 24px; }
.testing-meter > :first-child { flex: none; width: 56px; }
.testing-meter > :last-child { flex: none; white-space: nowrap; }
.testing-track {
  flex: 1 1 0; min-width: 1px; position: relative; height: 8px; overflow: hidden;
  border-radius: var(--radius-full); background: var(--surface-sunken-deep);
}
.testing-fill {   /* to scale: the fill is the value's share of 40 */
  position: absolute; inset: 0 auto 0 0; width: var(--fill); border-radius: var(--radius-full); background: var(--ink-secondary);
}
.testing-meter--after .testing-fill { background: var(--accent); }

/* The run (/_assets/design/d6565857b9ae07c7/10-testing.js), once, when about a third of the panels scroll into view. Until then the playhead waits at the
   call's start (the first part, the 6 px gap and half the flagged part before it) and the steps after it are hidden,
   the result until the re-run; the script's animations then bring each step to the rest state above. Without the
   script, with ?static or reduced motion these classes are never set, so the section rests as Figma draws it. */
.testing.is-pre .testing-playhead { transform: translateX(calc(-234 * var(--u) - 6px)); }
.testing.is-pre :is(.testing-marker, .testing-line, .testing-ai) { opacity: 0; }
.testing.is-waiting .testing-result { opacity: 0; }
/* Stacked, the result sits a screen below the call: it shows at rest, and its re-run replays when it scrolls into view */
@media (max-width: 1199px) { .testing.is-waiting .testing-result { opacity: 1; } }

@media (max-width: 1199px) {
  .testing { padding-block: var(--space-8); }
  .testing-inner { gap: var(--space-6); }
  .testing-center { flex-direction: column; align-items: stretch; gap: var(--space-4); padding: var(--space-4); }
  .testing-call, .testing-result { flex: none; margin-top: 0; }
  .testing-player { --wf-max: 1.6px; }   /* the stacked cards are wider: the waveform grows to fill the player */
}
/* At 1x Chrome paints bars under 1 px as whole pixels; Figma's render covers them at their width (about half a pixel).
   Below 600 px the waveform shrinks to fit the player, so its bars fall under 1 px there. */
@media (max-width: 599px) and (max-resolution: 1.49dppx) { .testing-wave i { opacity: .47; } }

@media (max-width: 599px) {
  .testing-play { width: 40px; height: 40px; }   /* Icon button stays 40 in the phone frame; the hit area is 44 */
  .testing-play::after { content: ""; position: absolute; inset: -2px; }
  .testing-play { position: relative; }
  .testing-value .t-figure-m { font-size: 44px; line-height: 48px; letter-spacing: -0.8px; }   /* stays System/Figure M */
  .testing-value .t-lead { font-size: 18px; line-height: 28px; letter-spacing: -0.1px; }       /* stays System/Lead */
}
/* Narrow phones: the marker is wider than the room right of the play button, so it takes a row of its own above the
   button and the waveform, and stays inside the player's right edge (from the flagged part's centre there is 50cqw - 7px
   to that edge; the marker's half is about 85 px, plus 4 px clear) */
@media (max-width: 374px) {
  .testing-player { height: 104px; padding-top: 36px; }
  .testing-marker { top: -30px; translate: min(0px, 50cqw - 96px) 0; }
  .testing-playhead { top: 4px; height: 56px; }
}
