/** How it works scroll story, and the privacy field. */

/* How it works: one word's journey, the stage changes as the steps pass. */
.story {
  padding: clamp(72px, 10vw, 160px) 0;
  background-color: var(--bg-main);
}

.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px;
}

.story-step {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 70vh;
  opacity: 0.25;
  transition: opacity 0.4s ease;
}

.story-step.is-active { opacity: 1; }
.story-step h3 { font-size: clamp(24px, 2.6vw, 36px); letter-spacing: -0.03em; margin-bottom: 12px; }
.story-step p { max-width: 42ch; font-size: 18px; line-height: 1.5; }

.story-stage {
  position: sticky;
  top: calc(50vh - 220px);
  align-self: start;
  height: 440px;
  border-radius: 28px;
  background-color: var(--brand-abyss);
  overflow: hidden;
}

.stage-panel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-step="0"] .stage-panel--install,
[data-step="1"] .stage-panel--watch,
[data-step="2"] .stage-panel--watch,
[data-step="2"] .stage-panel--learn { opacity: 1; transform: none; }

.browser-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(100%, 460px);
  padding: 12px 16px;
  border-radius: 99px;
  background-color: var(--bg-main);
  color: var(--text-muted);
  font-size: 16px;
}

.browser-bar span { flex: 1; }
.browser-bar img { border-radius: 8px; animation: pinPulse 1.8s ease-in-out infinite; }

@keyframes pinPulse {
  50% { transform: scale(1.18); }
}

.stage-subtitle {
  margin-top: auto;
  margin-bottom: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background-color: var(--text-main);
  color: var(--on-brand-abyss);
  font-size: clamp(15px, 1.6vw, 20px);
  font-weight: 600;
  text-align: center;
}

.stage-word { position: relative; display: inline-block; }

.stage-word::after {
  content: "";
  position: absolute;
  inset: auto 0 -2px;
  height: 3px;
  background-color: var(--accent-amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

[data-step="1"] .stage-word,
[data-step="2"] .stage-word { color: var(--accent-amber); }
[data-step="1"] .stage-word::after,
[data-step="2"] .stage-word::after { transform: scaleX(1); }

.stage-panel--learn { align-items: flex-start; padding-top: 32px; }

.stage-card {
  width: min(100%, 320px);
  padding: 20px;
  border-radius: 16px;
  background-color: var(--bg-main);
  transform: translateY(24px);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-step="2"] .stage-card { transform: none; }
.stage-card strong { display: block; font-size: 24px; letter-spacing: -0.02em; }
.stage-card p { font-size: 15px; line-height: 1.45; margin: 4px 0 12px; }
.stage-card em { font-style: normal; font-size: 14px; font-weight: 700; color: var(--primary-blue); }

/* Privacy field */
.privacy-section {
  padding: clamp(72px, 10vw, 160px) 0;
  background-color: var(--primary-hover);
  color: var(--on-brand-abyss);
}

.privacy-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
  gap: 48px;
}

.privacy-section h2 {
  color: inherit;
  font-size: clamp(32px, 4vw, 56px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 24px;
}

.privacy-section p { max-width: 60ch; font-size: 18px; line-height: 1.5; margin-bottom: 24px; }

.privacy-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Words circle inside the device and never leave it: the privacy claim, drawn. */
.device {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 28px;
  background-color: var(--brand-abyss);
  overflow: hidden;
}

.device-orbit {
  position: absolute;
  inset: 0;
}

.device-orbit span {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: clamp(15px, 1.5vw, 20px);
  font-weight: 700;
  /* Words circle the logo but stay level, so they can always be read. */
  transform: rotate(calc(var(--a) + var(--spin))) translateX(clamp(84px, 8vw, 110px)) rotate(calc((var(--a) + var(--spin)) * -1)) translate(-50%, -50%);
  animation: deviceSpin 22s linear infinite;
}

.device-orbit span:nth-child(2n) { color: var(--accent-amber); }

@property --spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

@keyframes deviceSpin {
  to { --spin: 360deg; }
}

.device-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 20px;
  background-color: var(--bg-main);
  display: grid;
  place-items: center;
}

@media (max-width: 900px) {
  .story-grid,
  .privacy-grid { grid-template-columns: minmax(0, 1fr); }
  .story-stage { order: -1; top: 76px; height: 280px; z-index: 1; }
  .story-step { min-height: 46vh; }
}

@media (prefers-reduced-motion: reduce) {
  .device-orbit span,
  .browser-bar img { animation: none; }
  .story-step { opacity: 1; }
}
