/* anim.css — анимации, инфографика, reveal */

/* ---------- Reveal on scroll ---------- */
/* Elements without .in get a soft fade; .in is the visible state.
   No-JS / failed-observer case: still visible (opacity 1 fallback). */
.reveal {
  opacity: 1;
  transform: none;
  transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1);
}
.reveal-anim {
  opacity: 0;
  transform: translateY(24px);
}
.reveal-anim.in {
  opacity: 1;
  transform: none;
}
.reveal-d-1 { transition-delay: .08s; }
.reveal-d-2 { transition-delay: .16s; }
.reveal-d-3 { transition-delay: .24s; }
.reveal-d-4 { transition-delay: .32s; }
.reveal-d-5 { transition-delay: .40s; }
.reveal-d-6 { transition-delay: .48s; }

/* ---------- Cycle diagram (Hero) ---------- */
.cycle-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 540px;
  margin: 0 auto;
}
.cycle-svg {
  width: 100%;
  height: 100%;
  color: var(--ink-soft);
}
.cycle-arc {
  transform-origin: 50% 50%;
  animation: cycle-rotate 28s linear infinite;
}
.cycle-outer {
  transform-origin: 50% 50%;
  animation: cycle-rotate-rev 60s linear infinite;
}
@keyframes cycle-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes cycle-rotate-rev {
  from { transform: rotate(360deg); }
  to   { transform: rotate(0deg); }
}

.cycle-node {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 120px;
  opacity: 0;
  animation: node-in .8s cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes node-in {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}
.cycle-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  margin: 0 auto 10px;
  box-shadow: 0 0 0 6px color-mix(in oklab, var(--bg) 70%, transparent),
              0 0 0 7px var(--line);
  animation: pulse 3.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 6px color-mix(in oklab, var(--bg) 70%, transparent), 0 0 0 7px var(--line); }
  50%      { box-shadow: 0 0 0 10px color-mix(in oklab, var(--bg) 50%, transparent), 0 0 0 11px var(--line-soft); }
}
.cycle-label {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.cycle-sub {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 4px;
  white-space: nowrap;
}

@media (max-width: 540px) {
  .cycle-node { width: 100px; }
  .cycle-label { font-size: 14px; }
  .cycle-sub { font-size: 9px; }
}

/* ---------- Hover lifts ---------- */
.benefit, .product, .process-step {
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease, border-color .25s ease;
}
.benefit:hover, .product:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px -28px color-mix(in oklab, var(--ink) 30%, transparent);
}
.process-step:hover {
  background: color-mix(in oklab, var(--bg-card) 70%, var(--accent) 6%);
}

/* ---------- Marquee strip (optional accent) ---------- */
.marquee {
  display: flex;
  gap: 64px;
  white-space: nowrap;
  font-family: var(--f-display);
  font-size: clamp(36px, 5vw, 76px);
  letter-spacing: -0.01em;
  font-weight: 500;
  color: var(--ink);
  padding: 56px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.marquee-track {
  display: flex;
  gap: 64px;
  flex-shrink: 0;
  animation: marquee 38s linear infinite;
}
.marquee-track span { display: inline-flex; align-items: center; gap: 36px; }
.marquee-track span::after {
  content: "○";
  font-family: var(--f-mono);
  font-size: 0.35em;
  color: var(--accent);
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Calculator ---------- */
.calc {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 40px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
}
@media (max-width: 900px) { .calc { grid-template-columns: 1fr; padding: 28px; } }
.calc-controls { display: flex; flex-direction: column; gap: 24px; }
.calc-input { display: flex; flex-direction: column; gap: 10px; }
.calc-input .head {
  display: flex; justify-content: space-between; align-items: baseline;
}
.calc-input .head .label {
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
}
.calc-input .head .val {
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.calc-input input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  outline: none;
}
.calc-input input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border: 3px solid var(--bg-card);
}
.calc-input input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--bg-card);
}

.calc-result {
  background: var(--ink);
  color: var(--bg);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: center;
}
[data-mood="forest"] .calc-result { background: var(--accent-2); color: var(--ink); }
.calc-result .head {
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}
.calc-result .big {
  font-family: var(--f-display);
  font-size: clamp(44px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 500;
}
.calc-result .sub { font-size: 14px; opacity: 0.75; line-height: 1.45; }
.calc-result .row {
  display: flex; justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid color-mix(in oklab, currentColor 18%, transparent);
  font-size: 14px;
}
.calc-result .row .k { opacity: 0.65; }

/* ---------- Visual: bug grid (черви walking) ---------- */
.worm-strip {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  overflow: hidden;
}
@media (max-width: 720px) { .worm-strip { grid-template-columns: 1fr; padding: 32px; } }
.worm-art {
  position: relative;
  height: 140px;
  min-width: 280px;
  overflow: hidden;
}
.worm {
  position: absolute;
  height: 8px;
  border-radius: 4px;
  background: var(--accent);
  opacity: 0.85;
  animation: worm-walk 8s linear infinite;
}
.worm::before, .worm::after {
  content: "";
  position: absolute;
  top: 0;
  height: 8px;
  background: var(--accent);
  border-radius: 4px;
}
@keyframes worm-walk {
  0%   { transform: translateX(-100%) scaleX(1); }
  50%  { transform: translateX(50%)  scaleX(0.7); }
  100% { transform: translateX(200%) scaleX(1); }
}

/* ---------- Section transitions ---------- */
.section-bg-soft { background: var(--bg-soft); }
.section-bg-card { background: var(--bg-card); }

/* ---------- Press strip ---------- */
.press-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
  opacity: 0.7;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.press-row span { display: inline-flex; align-items: center; gap: 8px; }
.press-row span::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Mood transition ----------
   (Smooth palette swap when user toggles mood in Tweaks.)
   Scoped to elements that actually display palette tokens, so it
   doesn't fight with .reveal / element-specific transitions. */
body, section, .card, .product, .benefit, .process-step,
.metrics, .metric, .calc, .calc-result, .nav, .footer,
.survey-card, .survey-opt, .survey-text, .chip, .imgph,
.faq-item, .worm-strip {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease;
}
