/* AI result analysis: one promise, one defining loop and one conversion path. */

html[data-page="ai-analysis"] .analysisMemoryPage .analysisHero {
  min-height: 0;
  padding-top: clamp(76px, 8vw, 116px);
  padding-bottom: clamp(82px, 9vw, 128px);
  background: #ffffff;
}

html[data-page="ai-analysis"] .analysisMemoryPage .analysisHeroInner {
  display: block;
}

html[data-page="ai-analysis"] .analysisMemoryPage .analysisHeroCopy {
  display: grid;
  gap: 22px;
  max-width: 930px;
}

html[data-page="ai-analysis"] .analysisMemoryPage .analysisHero h1 {
  max-width: 13.5ch;
  margin: 0;
  color: var(--green-500, #10391d);
  font-family: var(--font-serif, Georgia, serif);
  font-size: clamp(48px, 6.3vw, 84px);
  font-weight: 400;
  line-height: 0.98;
}

html[data-page="ai-analysis"] .analysisMemoryPage .analysisHero .lead {
  max-width: 72ch;
  margin: 0;
  color: var(--green-400, #40614a);
  font-size: clamp(17px, 1.55vw, 20px);
  line-height: 1.66;
}

.analysisMemoryPage .analysisHeroNote {
  max-width: 64ch;
  margin: 0;
  color: var(--green-300, #708877);
  font-size: 14px;
  line-height: 1.55;
}

.analysisMemoryPage .analysisHeroActions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: center;
  padding-top: 3px;
}

.analysisMemoryPage .analysisHeroSecondary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--blue-600, #315c8c);
  font-weight: 700;
  text-decoration: none;
}

.analysisMemoryPage .analysisHeroSecondary:hover,
.analysisMemoryPage .analysisHeroSecondary:focus-visible {
  color: var(--green-500, #10391d);
}

.analysisLoopSection {
  position: relative;
}

.analysisLegacyAnchor {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.analysisLoopIntro {
  display: grid;
  gap: 18px;
  max-width: 940px;
  margin-bottom: clamp(38px, 5vw, 58px);
}

.analysisLoopIntro .sectionTitle {
  max-width: 16ch;
}

.analysisLoopIntro .sectionText {
  max-width: 68ch;
}

.analysisLoopPanel {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 50%, rgba(132, 220, 206, 0.055), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #fbfcfb 100%);
  box-shadow: 0 18px 46px rgba(16, 57, 29, 0.055);
}

.analysisLoopTrack {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scale(0.64, 0.76);
  transform-origin: 50% 50%;
}

.analysisLoopBase,
.analysisLoopSignal {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.analysisLoopBase {
  stroke-width: 2.15;
  opacity: 0.46;
}

.analysisLoopSignal {
  stroke-width: 4.1;
  stroke-dasharray: 16 84;
  stroke-dashoffset: 100;
  opacity: 0;
  animation: analysisLoopTravel 12s linear infinite;
  animation-delay: var(--loop-delay, 0s);
  animation-play-state: paused;
}

.analysisLoopSegment--1 {
  color: var(--blue-500, #3d73af);
}

.analysisLoopSegment--2 {
  color: var(--aqua-600, #6ab0a5);
}

.analysisLoopSegment--3 {
  color: var(--green-500, #10391d);
}

.analysisLoopSegment--4 {
  color: var(--green-300, #708877);
}

.analysisLoopSignal--1 {
  --loop-delay: 0s;
}

.analysisLoopSignal--2 {
  --loop-delay: 3s;
}

.analysisLoopSignal--3 {
  --loop-delay: 6s;
}

.analysisLoopSignal--4 {
  --loop-delay: 9s;
}

.analysisLoopPanel.is-visible .analysisLoopSignal,
.analysisLoopPanel.is-visible .analysisLoopNode {
  animation-play-state: running;
}

.analysisLoopGrid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(170px, 0.62fr) minmax(250px, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "detect core reuse"
    "explain core report";
  column-gap: clamp(28px, 3vw, 42px);
  row-gap: 34px;
  align-items: stretch;
  min-height: 560px;
  padding: clamp(34px, 4vw, 48px);
}

.analysisLoopNode {
  --node-accent: var(--blue-500, #3d73af);
  --loop-delay: 0s;
  position: relative;
  width: 100%;
  max-width: 350px;
  height: 100%;
  min-height: 184px;
  padding: 21px 22px 20px;
  overflow: hidden;
  border: 1px solid rgba(16, 57, 29, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.045);
  animation: analysisLoopNodeFocus 12s ease-in-out infinite;
  animation-delay: var(--loop-delay);
  animation-play-state: paused;
}

.analysisLoopNode::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--node-accent);
  content: "";
}

.analysisLoopNode--detect {
  --node-accent: var(--blue-500, #3d73af);
  --loop-delay: 0s;
  grid-area: detect;
  align-self: stretch;
  justify-self: end;
  left: auto;
}

.analysisLoopNode--explain {
  --node-accent: var(--aqua-500, #84dcce);
  --loop-delay: 3s;
  grid-area: explain;
  align-self: stretch;
  justify-self: end;
  left: auto;
}

.analysisLoopNode--report {
  --node-accent: var(--green-500, #10391d);
  --loop-delay: 6s;
  grid-area: report;
  align-self: stretch;
  justify-self: start;
  right: auto;
}

.analysisLoopNode--reuse {
  --node-accent: linear-gradient(90deg, var(--blue-500, #3d73af), var(--aqua-500, #84dcce));
  --loop-delay: 9s;
  grid-area: reuse;
  align-self: stretch;
  justify-self: start;
  right: auto;
}

.analysisLoopNodeHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.analysisLoopNodeHeader span {
  color: var(--blue-600, #315c8c);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.analysisLoopNode--explain .analysisLoopNodeHeader span,
.analysisLoopNode--report .analysisLoopNodeHeader span,
.analysisLoopNode--reuse .analysisLoopNodeHeader span {
  color: var(--green-400, #40614a);
}

.analysisLoopNodeHeader b {
  display: block;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  color: var(--green-500, #10391d);
  font-family: var(--font-serif, Georgia, serif);
  font-size: clamp(24px, 2.1vw, 30px);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.03em;
}

.analysisLoopNode h3 {
  margin: 17px 0 0;
  color: var(--green-500, #10391d);
  font-family: var(--font-serif, Georgia, serif);
  font-size: clamp(23px, 2.1vw, 30px);
  font-weight: 400;
  line-height: 1.08;
}

.analysisLoopNode p {
  margin: 11px 0 0;
  color: var(--green-400, #40614a);
  font-size: 13.5px;
  line-height: 1.55;
}

.analysisLoopCore {
  position: relative;
  grid-area: core;
  display: grid;
  align-content: center;
  justify-items: center;
  align-self: center;
  justify-self: center;
  width: clamp(164px, 16vw, 194px);
  aspect-ratio: 1;
  padding: 24px;
  border-radius: 50%;
  background: var(--green-500, #10391d);
  color: #ffffff;
  text-align: center;
  box-shadow:
    0 0 0 13px rgba(16, 57, 29, 0.045),
    0 18px 38px rgba(16, 57, 29, 0.16);
}

.analysisLoopCore::before {
  position: absolute;
  inset: -11px;
  border: 1px solid rgba(132, 220, 206, 0.34);
  border-radius: 50%;
  content: "";
}

.analysisLoopCore img {
  width: 45px;
  height: 45px;
  margin-bottom: 10px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.analysisLoopCore strong {
  max-width: 8ch;
  font-family: var(--font-serif, Georgia, serif);
  font-size: clamp(23px, 2.2vw, 30px);
  font-weight: 400;
  line-height: 1.02;
}

.analysisLoopCore span {
  max-width: 17ch;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.35;
}

html[lang="fi"] .analysisLoopCore {
  padding: 20px;
}

html[lang="fi"] .analysisLoopCore img {
  width: 38px;
  height: 38px;
  margin-bottom: 7px;
}

html[lang="fi"] .analysisLoopCore strong {
  width: 100%;
  max-width: none;
  font-size: clamp(18px, 1.35vw, 20px);
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

html[lang="fi"] .analysisLoopCore span {
  max-width: 15ch;
  margin-top: 6px;
  font-size: 9px;
  line-height: 1.3;
}

.analysisTrustNote {
  max-width: 900px;
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid rgba(16, 57, 29, 0.13);
  color: var(--green-300, #708877);
  font-size: 12.5px;
  line-height: 1.6;
}

.analysisFinalCtaBand {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
  gap: clamp(54px, 8vw, 112px);
  align-items: center;
}

.analysisFinalCtaCopy {
  display: grid;
  gap: 20px;
  max-width: 760px;
}

.analysisFinalCtaCopy .sectionTitle {
  max-width: 15ch;
}

.analysisFinalCtaCopy .ctaText {
  max-width: 62ch;
}

.analysisCtaChecklist {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--green-200, #9fb0a5);
  list-style: none;
}

.analysisCtaChecklist li {
  position: relative;
  padding: 15px 0 15px 28px;
  border-bottom: 1px solid var(--green-200, #9fb0a5);
  color: var(--green-500, #10391d);
  font-weight: 650;
  line-height: 1.45;
}

.analysisCtaChecklist li::before {
  position: absolute;
  top: 21px;
  left: 3px;
  width: 8px;
  height: 8px;
  background: var(--aqua-600, #6ab0a5);
  content: "";
  transform: rotate(45deg);
}

.analysisCtaChecklistNote {
  margin: 17px 0 0;
  color: var(--green-400, #40614a);
  font-size: 12px;
  line-height: 1.5;
}

html[data-page="ai-analysis"] [data-ai-reveal].ai-pending {
  opacity: 0;
  transform: translateY(18px);
}

html[data-page="ai-analysis"] [data-ai-reveal] {
  transition:
    opacity 620ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-page="ai-analysis"] [data-ai-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@keyframes analysisLoopTravel {
  0%,
  4% {
    opacity: 0;
    stroke-dashoffset: 100;
  }
  8% {
    opacity: 0.95;
  }
  26% {
    opacity: 0.95;
    stroke-dashoffset: 0;
  }
  33%,
  100% {
    opacity: 0;
    stroke-dashoffset: -18;
  }
}

@keyframes analysisLoopNodeFocus {
  0%,
  4%,
  34%,
  100% {
    border-color: rgba(16, 57, 29, 0.12);
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.045);
  }
  9%,
  25% {
    border-color: rgba(16, 57, 29, 0.28);
    box-shadow: 0 18px 38px rgba(16, 57, 29, 0.09);
  }
}

@media (max-width: 980px) {
  html[data-page="ai-analysis"] .analysisMemoryPage .analysisHero h1 {
    max-width: 15ch;
  }

  .analysisLoopTrack {
    display: none;
  }

  .analysisLoopPanel {
    min-height: 0;
  }

  .analysisLoopGrid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas:
      "detect"
      "explain"
      "core"
      "report"
      "reuse";
    gap: 16px;
    min-height: 0;
    padding: 26px;
  }

  .analysisLoopNode {
    max-width: none;
    height: auto;
    min-height: 0;
    animation: none;
  }

  .analysisLoopNode--detect,
  .analysisLoopNode--explain,
  .analysisLoopNode--report,
  .analysisLoopNode--reuse {
    right: auto;
    left: auto;
    align-self: auto;
    justify-self: stretch;
  }

  .analysisLoopCore {
    width: 158px;
    height: 158px;
    min-height: 158px;
    max-height: 158px;
    margin: 10px 0;
  }

  html[lang="en"] .analysisLoopCore {
    padding: 16px 13px;
  }

  html[lang="en"] .analysisLoopCore img {
    width: 34px;
    height: 34px;
    margin-bottom: 6px;
  }

  html[lang="en"] .analysisLoopCore strong {
    max-width: 7.5ch;
    font-size: 20px;
    line-height: 0.98;
  }

  html[lang="en"] .analysisLoopCore span {
    max-width: 16ch;
    margin-top: 6px;
    font-size: 9px;
    line-height: 1.2;
  }

  .analysisFinalCtaBand {
    grid-template-columns: 1fr;
    gap: 38px;
  }
}

@media (max-width: 620px) {
  html[data-page="ai-analysis"] .analysisMemoryPage .analysisHero {
    padding-top: 58px;
    padding-bottom: 76px;
  }

  html[data-page="ai-analysis"] .analysisMemoryPage .analysisHero h1 {
    max-width: none;
    font-size: clamp(40px, 12vw, 58px);
  }

  .analysisHeroActions {
    align-items: stretch;
  }

  .analysisHeroSecondary {
    justify-content: center;
  }

  .analysisLoopGrid {
    padding: 18px;
  }

  .analysisLoopNode {
    padding: 19px 18px;
  }

  .analysisLoopCore {
    width: 146px;
    height: 146px;
    min-height: 146px;
    max-height: 146px;
  }

  html[lang="en"] .analysisLoopCore {
    padding: 14px 12px;
  }

  html[lang="en"] .analysisLoopCore img {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
  }

  html[lang="en"] .analysisLoopCore strong {
    max-width: 7.5ch;
    font-size: 19px;
    line-height: 0.98;
  }

  html[lang="en"] .analysisLoopCore span {
    max-width: 16ch;
    margin-top: 5px;
    font-size: 8.5px;
    line-height: 1.2;
  }

  html[lang="fi"] .analysisLoopCore img {
    width: 34px;
    height: 34px;
  }

  html[lang="fi"] .analysisLoopCore strong {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-page="ai-analysis"] [data-ai-reveal],
  .analysisLoopSignal,
  .analysisLoopNode {
    animation: none !important;
    transition: none !important;
  }

  .analysisLoopSignal {
    display: none;
  }
}