/* Story — scroll-driven scrollytelling */

.story {
  position: relative;
  padding: 100px 0 0;
}

.story__header {
  text-align: center;
  margin-bottom: 48px;
}

.story__scroll-hint {
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.story-scrolly__stage {
  position: relative;
  z-index: 1;
}

.story-scrolly {
  height: 380vh;
  position: relative;
}

.story-scrolly__pin {
  height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.story-scrolly__stage {
  display: grid;
  grid-template-columns: 48px 1fr 1.1fr;
  gap: 48px;
  align-items: center;
  width: 100%;
}

.story-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 280px;
  position: relative;
}

.story-rail__track {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.story-rail__fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--accent-blue-light), var(--accent-safe));
  transform: scaleY(0);
  transform-origin: top;
  will-change: transform;
}

.story-rail__dot {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #141414;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
  margin: 28px 0;
}

.story-rail__dot.is-lit {
  border-color: var(--accent-blue-light);
  color: #fff;
  box-shadow: 0 0 20px rgba(43, 108, 176, 0.35);
}

.story-device-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

.story-device {
  position: relative;
  width: 260px;
}

.story-device__bezel {
  position: relative;
  z-index: 2;
  background: linear-gradient(155deg, #2a2a2a 0%, #141414 50%, #1e1e1e 100%);
  border-radius: 40px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.story-device__notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 26px;
  background: #0a0a0a;
  border-radius: 0 0 16px 16px;
  z-index: 4;
}

.story-device__screen {
  position: relative;
  height: 480px;
  border-radius: 32px;
  background: #0c0c0c;
  overflow: hidden;
}

.story-device__aura {
  position: absolute;
  inset: -20%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--aura-color, rgba(43, 108, 176, 0.2)) 0%, transparent 65%);
  filter: blur(40px);
  pointer-events: none;
}

.device-scene {
  position: absolute;
  inset: 0;
  padding: 44px 16px 16px;
  display: flex;
  flex-direction: column;
}

.device-scene--risk {
  background: linear-gradient(180deg, #120a0a 0%, #0c0c0c 100%);
}

.device-scene--scan {
  background: linear-gradient(180deg, #0a0f18 0%, #0c0c0c 100%);
}

.device-scene--safe {
  background: linear-gradient(180deg, #0a120e 0%, #0c0c0c 100%);
}

.device-scene__status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  padding: 0 4px;
}

.device-scene__time {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.device-scene__date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.device-scene__notif {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.device-scene__notif strong {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.device-scene__notif span {
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.device-scene__notif-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.device-scene__notif--warn {
  background: rgba(166, 124, 0, 0.12);
  border: 1px solid rgba(166, 124, 0, 0.25);
}

.device-scene__notif--danger {
  background: rgba(184, 59, 59, 0.12);
  border: 1px solid rgba(184, 59, 59, 0.28);
}

.device-scene__notif--battery {
  background: rgba(43, 108, 176, 0.1);
  border: 1px solid rgba(43, 108, 176, 0.22);
}

.device-scene__risk-pulse {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-danger);
  box-shadow: 0 0 0 0 rgba(184, 59, 59, 0.5);
  animation: riskPulse 2s ease-out infinite;
}

@keyframes riskPulse {
  0% { box-shadow: 0 0 0 0 rgba(184, 59, 59, 0.5); }
  70% { box-shadow: 0 0 0 16px rgba(184, 59, 59, 0); }
  100% { box-shadow: 0 0 0 0 rgba(184, 59, 59, 0); }
}

.device-scene__appbar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue-light);
  margin-bottom: 16px;
}

.device-scene__appbar svg {
  width: 18px;
  height: 18px;
}

.device-scene__scanner {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 16px;
}

.device-scene__scanner > svg {
  width: 100%;
  height: 100%;
}

.device-scene__ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-scene__pct {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.device-scene__pct-suffix {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-blue-light);
  margin-left: 1px;
}

.device-scene__terminal {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(43, 108, 176, 0.2);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.62rem;
  line-height: 1.7;
  color: var(--text-secondary);
  overflow: hidden;
}

.device-scene__term-line--alert {
  color: var(--accent-danger);
}

.device-scene__term-line--ok {
  color: var(--accent-safe);
}

.device-scene__shield-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 24px 0 28px;
}

.device-scene__shield-hero svg {
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 8px 24px rgba(61, 122, 92, 0.35));
}

.device-scene__shield-hero span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-safe);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.device-scene__metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.device-scene__metric {
  text-align: center;
  padding: 12px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.device-scene__metric-val {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.device-scene__metric-val small {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-safe);
}

.device-scene__metric-label {
  display: block;
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

.story-copy {
  position: relative;
  min-height: 340px;
}

.story-beat {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.story-beat__num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-blue-light);
  letter-spacing: 0.2em;
  margin-bottom: 16px;
}

.story-beat__title {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.story-beat__text {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 24px;
  max-width: 480px;
}

.story-beat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.story-beat__meter {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
  max-width: 320px;
}

.story-beat__meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-blue-light));
  border-radius: 3px;
  will-change: width;
}

.story-beat__status {
  font-size: 0.8rem;
  color: var(--accent-blue-light);
  font-weight: 500;
}

.story-beat__results {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.story-beat__result {
  padding: 16px 20px;
  background: #1A1A1A;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  text-align: center;
  min-width: 90px;
}

.story-beat__result-val {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-safe);
  line-height: 1.1;
}

.story-beat__result-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-safe);
}

.story-beat__result-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.story-scrolly--stacked {
  height: auto;
}

.story-scrolly--stacked .story-scrolly__pin {
  height: auto;
  position: static;
}

.story-scrolly--stacked .story-scrolly__stage {
  grid-template-columns: 1fr;
  gap: 32px;
}

.story-scrolly--stacked .story-rail {
  display: none;
}

.story-scrolly--stacked .story-copy {
  min-height: auto;
  display: flex;
  flex-direction: column;
  gap: 64px;
}

.story-scrolly--stacked .story-beat {
  position: relative;
  opacity: 1;
  pointer-events: auto;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.story-scrolly--stacked .story-beat:last-child {
  border-bottom: none;
}

.story-scrolly--stacked .device-scene {
  position: absolute;
  inset: 0;
}

.story-scrolly--stacked .story-device-wrap {
  order: -1;
}

@media (max-width: 1024px) {
  .story-scrolly__stage {
    grid-template-columns: 36px 1fr 1fr;
    gap: 32px;
  }

  .story-device {
    width: 230px;
  }

  .story-device__screen {
    height: 440px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .device-scene__term-line {
    opacity: 1 !important;
    transform: none !important;
  }
}
