/* «П думает» — индикатор ожидания ответа Помощника Породотеки.
   Pairs with p-thinking.js; see README.md. Colours come from the site tokens
   (site/assets/css/styles.css) with the brand values as fallbacks. */

.p-thinking {
  --p-thinking-ink: var(--color-ink, #111216);
  --p-thinking-orange: var(--color-action, #FF6A2A);
  --p-thinking-violet: var(--color-assistant, #6A4DFF);
  --p-thinking-peach: var(--color-ear, #FFB48A);
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: var(--p-thinking-size, 32px);
  height: var(--p-thinking-size, 32px);
  vertical-align: middle;
}

/* On a dark surface the graphite part turns white, like the favicon does. */
.p-thinking--dark {
  --p-thinking-ink: #FFFFFF;
}

/* Static logo for pages without JavaScript; hidden once the script mounts. */
.p-thinking > svg {
  display: block;
  width: 100%;
  height: 100%;
}

.p-thinking--live > svg {
  display: none;
}

.p-thinking__spin,
.p-thinking__breath,
.p-thinking__part {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
}

.p-thinking__spin {
  transition: transform 900ms cubic-bezier(.6, 0, .2, 1);
}

.p-thinking__breath {
  animation: p-thinking-breath 2s ease-in-out infinite;
}

/* Every part covers the whole box, so one sheen band crosses the whole letter. */
.p-thinking__part {
  background-image: linear-gradient(115deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .42) 50%, rgba(255, 255, 255, 0) 62%);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  animation: p-thinking-sheen 2.8s ease-in-out infinite;
}

.p-thinking--idle .p-thinking__breath,
.p-thinking--idle .p-thinking__part {
  animation-play-state: paused;
}

@keyframes p-thinking-breath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(.95); }
}

@keyframes p-thinking-sheen {
  0% { background-position: 100% 0; }
  60%, 100% { background-position: 0 0; }
}

@keyframes p-thinking-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

/* Status line: «Помощник Породотеки» + a shimmering verb. */
.p-thinking-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.p-thinking-row[hidden] {
  display: none;
}

.p-thinking-row__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.p-thinking-row__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-assistant-text, #5134E6);
}

.p-thinking-row__verb {
  font-size: 15px;
  line-height: 1.3;
}

.p-thinking-row__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.p-thinking-shimmer {
  color: transparent;
  background: linear-gradient(90deg, #5134E6 0%, #5134E6 38%, #A897FF 50%, #5134E6 62%, #5134E6 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: p-thinking-shimmer 2.2s linear infinite;
}

@keyframes p-thinking-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* Reduced motion: no morphs (the script does not start), no sheen and no
   breathing; the logo only fades softly while the answer is on its way. */
@media (prefers-reduced-motion: reduce) {
  .p-thinking__breath,
  .p-thinking__part,
  .p-thinking-shimmer {
    animation: none;
  }

  .p-thinking__spin,
  .p-thinking__part {
    transition: none !important;
  }

  .p-thinking--playing {
    animation: p-thinking-pulse 1.6s ease-in-out infinite;
  }

  .p-thinking-shimmer {
    color: var(--color-assistant-text, #5134E6);
    background: none;
  }
}
