/* Smartentre track visuals (P.5) — one shared component for the "Two tracks"
   sections on the homepage and the Academy page.
   Two small product-UI illustrations sharing the site's demo language: thin
   borders, radius-md, a mono title bar with an "Example" tag, and the cyan
   accent. The HTML is already the final static state (READY assistant,
   completed terminal session); assets/js/track-visuals.js only animates it.
   No images, gradients, glows or shadows. */

/* Placement: under the track's own content, aligned across both columns. */
.track__visual { align-self: stretch; margin-top: auto; padding-top: var(--space-7); }

.tv {
  display: block;
  width: 100%;
  max-width: 26rem;
  padding: 0;
  border: 1px solid var(--site-border-strong);
  border-radius: var(--radius-md);
  background: var(--site-surface);
  color: var(--site-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}
/* Hover / focus: emphasis only (replay is click, tap, Enter or Space). */
.tv:focus-visible { outline-offset: 3px; border-color: var(--site-accent); }
@media (hover: hover) {
  .tv:hover { border-color: var(--site-text-muted); }
  .tv:hover .tv__title { color: var(--site-text); }
}
.tv__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 40px;
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--site-border);
}
.tv__title { font-family: var(--font-mono); font-size: var(--text-mono); color: var(--site-text-muted); transition: color var(--dur) var(--ease); }
/* Both bodies share one height (the terminal's eight lines), so the pair matches. */
.tv__body { display: flex; align-items: center; min-height: 11.75rem; padding: var(--space-4) var(--space-5); }
.tv__cursor { color: var(--site-accent-text); }
.tv.is-live .tv__cursor, .tv.is-live .term__cursor { animation: tv-blink 1.1s steps(1) infinite; }
.tv.is-paused, .tv.is-paused * { animation-play-state: paused !important; }
@keyframes tv-blink { 50% { opacity: 0; } }

/* ── AI track: pixel assistant ──────────────────────────────────────────
   A 15 × 13 pixel face on a fixed grid unit. States (data-state on the
   button): idle · listening · thinking · ready. */
.tv--ai .tv__body { gap: var(--space-6); }
.px-face { --u: 5px; position: relative; flex-shrink: 0; width: calc(15 * var(--u)); height: calc(13 * var(--u)); }
.px { position: absolute; display: block; background: var(--site-text); }
.px-tip { left: calc(6 * var(--u)); top: 0; width: calc(3 * var(--u)); height: var(--u); background: var(--site-accent); }
.px-wave { top: 0; width: var(--u); height: var(--u); background: var(--site-accent); opacity: 0; }
.px-wave--l { left: calc(4 * var(--u)); }
.px-wave--r { left: calc(10 * var(--u)); }
.px-stem { left: calc(7 * var(--u)); top: var(--u); width: var(--u); height: calc(2 * var(--u)); }
.px-head { left: var(--u); top: calc(3 * var(--u)); width: calc(13 * var(--u)); height: calc(10 * var(--u)); border: var(--u) solid var(--site-text); background: var(--site-surface); }
.px-ear { top: calc(6 * var(--u)); width: var(--u); height: calc(4 * var(--u)); }
.px-ear--l { left: 0; }
.px-ear--r { left: calc(14 * var(--u)); }
.px-eye { top: calc(6 * var(--u)); width: calc(2 * var(--u)); height: calc(2 * var(--u)); }
.px-eye--l { left: calc(4 * var(--u)); }
.px-eye--r { left: calc(9 * var(--u)); }
.px-m { top: calc(10 * var(--u)); width: var(--u); height: var(--u); }
.px-m--1 { left: calc(5 * var(--u)); }
.px-m--2 { left: calc(6 * var(--u)); }
.px-m--3 { left: calc(7 * var(--u)); }
.px-m--4 { left: calc(8 * var(--u)); }
.px-m--5 { left: calc(9 * var(--u)); }

/* idle: neutral mouth, antenna dimmed */
.tv--ai[data-state="idle"] .px-tip { opacity: 0.45; }
.tv--ai[data-state="idle"] .px-m--1, .tv--ai[data-state="idle"] .px-m--5 { opacity: 0; }
/* blink (idle only, brief) */
.tv--ai.is-blink .px-eye { top: calc(7 * var(--u)); height: var(--u); }
/* listening: eyes glance one pixel toward the sound, ears and antenna signal
   pixels take the accent, mouth pixels step like a small level meter */
.tv--ai[data-state="listening"] .px-eye { transform: translateX(var(--u)); }
.tv--ai[data-state="listening"] .px-ear { background: var(--site-accent); }
.tv--ai[data-state="listening"] .px-wave--l { animation: px-signal 0.6s steps(1) infinite; }
.tv--ai[data-state="listening"] .px-wave--r { animation: px-signal 0.6s steps(1) infinite 0.3s; }
.tv--ai[data-state="listening"] .px-m--1, .tv--ai[data-state="listening"] .px-m--5 { opacity: 0; }
.tv--ai[data-state="listening"] .px-m--2 { animation: px-level 0.5s steps(1) infinite; }
.tv--ai[data-state="listening"] .px-m--3 { animation: px-level 0.5s steps(1) infinite 0.25s; }
.tv--ai[data-state="listening"] .px-m--4 { animation: px-level 0.5s steps(1) infinite 0.12s; }
@keyframes px-signal { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes px-level { 50% { top: calc(9 * var(--u)); height: calc(2 * var(--u)); } }
/* thinking: eyes narrow, one mouth pixel steps across (processing) */
.tv--ai[data-state="thinking"] .px-eye { top: calc(7 * var(--u)); height: var(--u); }
.tv--ai[data-state="thinking"] .px-m:not(.px-m--3) { opacity: 0; }
.tv--ai[data-state="thinking"] .px-m--3 { animation: px-step 0.9s steps(1) infinite; }
@keyframes px-step { 0%, 32% { left: calc(6 * var(--u)); } 33%, 65% { left: calc(7 * var(--u)); } 66%, 100% { left: calc(8 * var(--u)); } }
/* ready (also the static no-JS state): smile, antenna solid */
.tv--ai[data-state="ready"] .px-m--1, .tv--ai[data-state="ready"] .px-m--5 { top: calc(9 * var(--u)); }

.tv__readout { display: grid; gap: var(--space-2); min-width: 0; font-family: var(--font-mono); }
.tv__label { font-size: var(--text-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--site-text-muted); }
.tv__state { min-width: 11ch; font-size: 1rem; line-height: 1.3; color: var(--site-text); white-space: nowrap; }
.tv__dots { display: flex; gap: 4px; }
.tv__dots span { width: 6px; height: 6px; border-radius: 1px; background: var(--site-border-strong); }
.tv--ai[data-state="listening"] .tv__dots span { animation: tv-meter 0.6s steps(1) infinite; }
.tv--ai[data-state="listening"] .tv__dots span:nth-child(2) { animation-delay: 0.2s; }
.tv--ai[data-state="listening"] .tv__dots span:nth-child(3) { animation-delay: 0.4s; }
.tv--ai[data-state="thinking"] .tv__dots span { animation: tv-dot 0.9s steps(1) infinite; }
.tv--ai[data-state="thinking"] .tv__dots span:nth-child(2) { animation-delay: 0.3s; }
.tv--ai[data-state="thinking"] .tv__dots span:nth-child(3) { animation-delay: 0.6s; }
.tv--ai[data-state="ready"] .tv__dots span { background: var(--site-accent); }
@keyframes tv-dot { 0%, 33% { background: var(--site-accent); } 34%, 100% { background: var(--site-border-strong); } }
@keyframes tv-meter { 0%, 49% { background: var(--site-accent); } 50%, 100% { background: var(--site-border-strong); } }

/* ── Cybersecurity track: security review terminal ──────────────────────
   Dark via .surface-dark (token remap). A short typed session: four generic
   commands, each followed by its status line. Lines not reached yet keep
   their space (visibility), so the panel never changes size. */
.term { display: block; font-family: var(--font-mono); font-size: var(--text-mono); line-height: 1.5; }
.term__line { position: relative; display: block; padding-left: var(--space-3); white-space: nowrap; }
.term__cmd { color: var(--site-text); }
.term__prompt { color: var(--site-text-muted); }
.term__res { color: var(--site-text-secondary); }
.term__key { color: var(--site-text-muted); }
.term__status { color: var(--site-accent); }
.term__line.is-pending { visibility: hidden; }
.term__untyped { color: transparent; }
/* Active line: a 2px cyan marker on the left edge. */
.term__line::before {
  content: "";
  position: absolute;
  top: 0.2em;
  bottom: 0.2em;
  left: 0;
  width: 2px;
  background: var(--site-accent);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.term__line.is-active::before { opacity: 1; }
.term__cursor { display: inline-block; width: 0.55em; height: 1.05em; margin-left: 0.15em; vertical-align: -0.15em; background: var(--site-accent); }

@media (max-width: 899.98px) {
  .track__visual { padding-top: var(--space-6); }
  .tv__body { padding: var(--space-4); }
  .tv--ai .tv__body { gap: var(--space-5); }
  .px-face { --u: 4px; }
  /* Stacked: the pair is no longer side by side, so the AI card drops the
     shared (terminal) height and keeps only its own content. */
  .tv--ai .tv__body { min-height: 0; }
}
/* Phones: compact cards — slimmer bar and padding, tighter terminal lines.
   Same content and type size (13 px mono, the site's functional minimum). */
@media (max-width: 639.98px) {
  .track__visual { padding-top: var(--space-4); }
  .tv__bar { min-height: 34px; padding-block: 6px; }
  .tv__body { padding: var(--space-3) var(--space-4); }
  .tv--term .tv__body { min-height: 0; padding-block: 10px; }
  .term { line-height: 1.3; }
}

@media (prefers-reduced-motion: reduce) {
  .tv, .tv *, .tv::before, .tv *::before { animation: none !important; transition: none !important; }
}

/* Course offer + actions in the AI track card (Academy launch): one compact
   price line, Try / Buy side by side (stacked when narrow), course link below. */
.track__offer { margin-top: var(--space-3); font-size: var(--text-body-sm); line-height: 1.55; color: var(--site-text-secondary); }
.track__offer strong { color: var(--site-text); font-weight: 600; }
.track .actions { margin-top: var(--space-6); }
.track .actions .btn { margin-top: 0; }
.track .actions + .btn--text { margin-top: var(--space-4); }
/* A wrapped text link stays left-aligned with its arrow after the last word. */
.track .btn--text { display: inline-block; white-space: normal; text-align: left; line-height: 1.5; padding-block: 10px; }
.track .btn--text .btn__arrow { display: inline-block; margin-left: var(--space-2); }
