/* The PNG assets are unchanged. This layer uses their existing alpha channels. */
html,
body {
  margin: 0;
  background: #fff;
}

/* The selected preview surface owns its canvas, regardless of OS preference. */
html { color-scheme: only light; }

body {
  color: var(--ttsc-color-ink, #101720);
  font-family: Inter, Arial, sans-serif;
}

.motion-shell {
  width: 100%;
}

.motion-logo {
  position: relative;
  width: min(100%, calc((100dvh - 152px) * 3));
  margin: 0 auto;
  line-height: 0;
  /* Measured high-alpha blue bounds of the unchanged 2172 × 724 lockup. */
  --icon-x: 5.709024%;
  --icon-y: 22.790055%;
  --icon-width: 20.441989%;
  --icon-height: 56.767956%;
  --logo-alpha: url("ttsc-logo.png");
  --cell-electric: color-mix(in srgb, var(--ttsc-color-cobalt, #3864ff) 32%, #e1f5ff);
  --cell-electric-soft: color-mix(in srgb, var(--ttsc-color-cobalt, #3864ff) 52%, white);
  --cell-deep: color-mix(in srgb, var(--ttsc-color-cobalt, #3864ff) 34%, #041445);
  --cell-accent: var(--ttsc-motion-accent, #58d5ff);
}

.motion-logo[data-variant="icon"] {
  width: min(100%, 240px, max(80px, calc(100dvh - 168px)));
  margin-inline: auto;
  /* Measured high-alpha blue bounds of the unchanged 1254 × 1254 symbol. */
  --icon-x: 15.789474%;
  --icon-y: 20.733652%;
  --icon-width: 70.175439%;
  --icon-height: 67.304625%;
  --logo-alpha: url("ttsc-symbol.png");
}

.motion-logo__image {
  display: block;
  width: 100%;
  height: auto;
}

/* A static alpha overlay recolors only the wordmark on black. The cobalt icon
   remains the supplied image; its contour, aperture and artwork bytes are intact. */
.motion-logo__wordmark {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #fff;
  -webkit-mask-image: var(--logo-alpha);
  mask-image: var(--logo-alpha);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  mask-mode: alpha;
  clip-path: inset(0 0 0 28%);
}

html[data-theme="black"],
html[data-theme="black"] body {
  background: #000;
  color: #fff;
}

html[data-theme="black"] { color-scheme: only dark; }

html[data-theme="black"] .motion-logo[data-variant="full"] .motion-logo__wordmark {
  display: block;
}

.motion-logo__mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* The full-image alpha mask preserves every approved contour and aperture. */
  -webkit-mask-image: var(--logo-alpha);
  mask-image: var(--logo-alpha);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  mask-mode: alpha;
}

.motion-logo__flux {
  position: absolute;
  left: var(--icon-x);
  top: var(--icon-y);
  width: var(--icon-width);
  height: var(--icon-height);
  overflow: hidden;
}

.motion-logo__cell {
  position: absolute;
  width: calc(94% / var(--ttsc-motion-columns, 14));
  aspect-ratio: 1;
  background: var(--cell-tone, var(--cell-electric));
  opacity: var(--ttsc-motion-intensity-low, 0);
  animation: ttsc-processing-pulse var(--ttsc-motion-cycle, 2.4s) ease-in-out infinite;
  animation-delay: calc(var(--ttsc-motion-cycle, 2.4s) * var(--cell-phase, 0));
  animation-play-state: paused;
}

.motion-logo__cell[data-accent="true"] {
  background: var(--cell-accent);
  animation-name: ttsc-electric-accent;
  animation-duration: calc(var(--ttsc-motion-cycle, 2.4s) * 2);
  animation-delay: calc(var(--ttsc-motion-cycle, 2.4s) * 2 * var(--cell-phase, 0));
}

.motion-logo[data-running="true"] .motion-logo__cell {
  animation-play-state: running;
}

.motion-logo[data-reduced="true"] .motion-logo__mask {
  display: none;
}

@keyframes ttsc-processing-pulse {
  0%, 64%, 100% { opacity: var(--ttsc-motion-intensity-low, 0); }
  10% { opacity: calc(var(--ttsc-motion-intensity-high, 1) * 0.72); }
  24% { opacity: var(--ttsc-motion-intensity-high, 1); }
  42% { opacity: calc(var(--ttsc-motion-intensity-high, 1) * 0.76); }
  52% { opacity: calc(var(--ttsc-motion-intensity-high, 1) * 0.35); }
}

@keyframes ttsc-electric-accent {
  0%, 60%, 96%, 100% { opacity: var(--ttsc-motion-intensity-low, 0); }
  68%, 86% { opacity: calc(var(--ttsc-motion-intensity-high, 1) * 0.7); }
  76% { opacity: var(--ttsc-motion-intensity-high, 1); }
}

.motion-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 12px 0 6px;
  font-size: 12px;
  line-height: 1.5;
}

.motion-controls[hidden],
.motion-controls [hidden] {
  display: none;
}

.motion-controls button,
.motion-controls select {
  min-height: 36px;
  border: 1px solid #b7c2d1;
  border-radius: 6px;
  background: #fff;
  color: #101720;
  font: inherit;
  padding: 6px 10px;
}

.motion-controls button:not(:disabled),
.motion-controls select {
  cursor: pointer;
}

.motion-controls button:disabled {
  color: #5a6576;
  cursor: default;
}

.motion-controls :focus-visible {
  outline: 2px solid var(--ttsc-color-cobalt, #3864ff);
  outline-offset: 2px;
}

.motion-status {
  flex-basis: 100%;
  padding: 0 10px;
  color: var(--ttsc-color-ink, #101720);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

html[data-theme="black"] .motion-status {
  color: #e4eaf2;
}

html[data-theme="black"] .motion-controls button,
html[data-theme="black"] .motion-controls select {
  border-color: #57677d;
  background: #182337;
  color: #fff;
}

html[data-theme="black"] .motion-controls button:disabled {
  color: #b8c3d3;
}

.motion-no-script {
  margin: 8px 0;
  font-size: 12px;
  text-align: center;
}

html[data-embed="true"] .motion-controls {
  display: none;
}

html[data-embed="true"] .motion-logo {
  width: min(100%, calc(100dvh * 3));
}

html[data-embed="true"] .motion-logo[data-variant="icon"] {
  width: min(100%, 100dvh);
}

html[data-reduced-motion="true"] .motion-controls {
  display: flex;
}

html[data-reduced-motion="true"] .motion-logo {
  width: min(100%, max(80px, calc((100dvh - 170px) * 3)));
}

html[data-reduced-motion="true"] .motion-logo[data-variant="icon"] {
  width: min(100%, 240px, max(80px, calc(100dvh - 186px)));
}

@media (prefers-reduced-motion: reduce) {
  .motion-logo:not([data-motion-override="true"]) .motion-logo__mask { display: none; }
  .motion-logo:not([data-motion-override="true"]) .motion-logo__cell { animation: none; }
}

/* Keep decorative artwork legible while the controls follow system colors. */
@media (forced-colors: active) {
  .motion-logo { forced-color-adjust: none; background: #fff; }
  html[data-theme="black"] .motion-logo { background: #000; }
}

@media print {
  html, html[data-theme="black"] { color-scheme: only light; }
  html, body, html[data-theme="black"], html[data-theme="black"] body { background: #fff; color: #101720; }
  .motion-logo__wordmark { display: none !important; }
  .motion-logo__mask, .motion-controls, .motion-no-script { display: none; }
  .motion-logo__cell { animation: none; }
  .motion-logo, .motion-logo[data-variant="icon"] { width: 100%; background: #fff; }
  html[data-theme="black"] .motion-logo { background: #fff; }
}

@supports not ((mask-image: url("ttsc-logo.png")) or (-webkit-mask-image: url("ttsc-logo.png"))) {
  .motion-logo__mask { display: none; }
  .motion-logo__wordmark { display: none !important; }
  html[data-theme="black"] .motion-logo[data-variant="full"] { background: #fff; }
}

/* Decorative navigation embeds use the host's canvas and external pause control.
   Preview surfaces and their reduced-motion controls retain their normal layout. */
html[data-placement="navigation"],
html[data-placement="navigation"] body { background: transparent; }
html[data-placement="navigation"] .motion-controls,
html[data-placement="navigation"] .motion-no-script { display: none !important; }
html[data-placement="navigation"] .motion-logo { width: 100%; }
html[data-placement="navigation"] .motion-logo[data-variant="icon"] { width: min(100%, 100dvh); }
@media print {
  html[data-placement="navigation"],
  html[data-placement="navigation"] body { background: #fff; }
}

/* Transparent corporate embeds retain white words without an opaque dark UA canvas. */
html[data-placement="navigation"]{color-scheme:only light}
