/* Relationship Story — rs-* (fullscreen + embed) */

.rs-root {
  --rs-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rs-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.rs-root--fullscreen {
  --rs-chrome-h: 52px;
}

.rs-root--fullscreen .rs-stage {
  position: fixed;
  inset: var(--rs-chrome-h, 52px) 0 0;
  display: grid;
  grid-template-columns: 1fr min(400px, 36vw);
  overflow: hidden;
  min-height: 0;
}

.rs-root--embed .rs-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr min(340px, 40%);
  gap: 0;
  min-height: min(520px, 62vh);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(165deg, rgba(12, 16, 28, 0.95), rgba(6, 8, 14, 0.98));
}

.rs-scene {
  position: relative;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rs-scene__blur {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 42% 48%, rgba(142, 180, 255, 0.12), transparent 60%),
    radial-gradient(ellipse 40% 35% at 70% 30%, rgba(232, 201, 138, 0.08), transparent 55%);
}

.rs-hero {
  position: relative;
  z-index: 10;
  text-align: center;
  transform: scale(0.94);
  opacity: 0;
  transition:
    transform 0.9s var(--rs-ease-out),
    opacity 0.7s var(--rs-ease-out),
    filter 0.55s var(--rs-ease);
}

.rs-hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(56vw, 440px);
  height: min(56vw, 440px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(232, 201, 138, 0.14) 0%,
    rgba(142, 180, 255, 0.06) 38%,
    transparent 68%
  );
  filter: blur(32px);
  z-index: -2;
  pointer-events: none;
  animation: rsHeroBloom 7s ease-in-out infinite;
}

.rs-hero.is-visible {
  transform: scale(1);
  opacity: 1;
}

.rs-hero.is-linked {
  filter: brightness(1.06);
}

.rs-hero.is-linked .rs-hero__sym {
  text-shadow: 0 0 48px rgba(232, 201, 138, 0.18);
}

@keyframes rsHeroBloom {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

.rs-root--embed .rs-hero__sym {
  font-size: clamp(48px, 10vw, 88px);
}

.rs-root--fullscreen .rs-hero__sym {
  font-size: clamp(72px, 14vw, 140px);
}

.rs-hero__halo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(52vw, 420px);
  height: min(52vw, 420px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(232, 201, 138, 0.22) 0%,
    rgba(232, 201, 138, 0.08) 42%,
    transparent 70%
  );
  filter: blur(28px);
  animation: rsHalo 6s ease-in-out infinite;
  transition: opacity 0.55s var(--rs-ease), transform 0.55s var(--rs-ease);
}

.rs-hero.is-linked .rs-hero__halo {
  opacity: 1;
  background: radial-gradient(
    circle,
    rgba(232, 201, 138, 0.28) 0%,
    rgba(142, 180, 255, 0.1) 45%,
    transparent 72%
  );
}

@keyframes rsHalo {
  0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
}

.rs-scene--rel-active .rs-scene__blur {
  background:
    radial-gradient(ellipse 50% 42% at 44% 46%, rgba(142, 180, 255, 0.14), transparent 58%),
    radial-gradient(ellipse 38% 32% at 68% 32%, rgba(232, 201, 138, 0.12), transparent 52%);
}

.rs-hero__sym {
  display: block;
  font-family: var(--display, "Playfair Display", serif);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--text, #f2f4f9);
}

.rs-hero__name {
  display: block;
  margin-top: 10px;
  font-family: var(--mono, monospace);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold, #e8c98a);
}

.rs-relatives {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
}

.rs-card {
  position: absolute;
  pointer-events: auto;
  width: min(188px, 38vw);
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(155deg, rgba(26, 32, 54, 0.92), rgba(10, 12, 22, 0.8));
  backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translate(-50%, -50%) translateY(28px) scale(0.92);
  filter: blur(6px);
  transition:
    opacity 0.55s var(--rs-ease),
    transform 0.65s var(--rs-ease-out),
    filter 0.55s var(--rs-ease),
    border-color 0.45s var(--rs-ease),
    box-shadow 0.55s var(--rs-ease),
    background 0.45s var(--rs-ease);
}

.rs-card.is-in {
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0) scale(1);
  filter: blur(0) brightness(1);
}

.rs-relatives.has-focus .rs-card.is-dimmed {
  opacity: 0.48;
  filter: blur(0) brightness(0.72) saturate(0.85);
  transform: translate(-50%, -50%) translateY(2px) scale(0.98);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.rs-card.is-focus {
  z-index: 20;
  opacity: 1;
  border-color: rgba(232, 201, 138, 0.48);
  background: linear-gradient(155deg, rgba(34, 40, 62, 0.98), rgba(14, 16, 28, 0.92));
  box-shadow:
    0 28px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(232, 201, 138, 0.12),
    0 0 48px rgba(232, 201, 138, 0.14);
  filter: blur(0) brightness(1.08) saturate(1.05);
  transform: translate(-50%, -50%) translateY(-8px) scale(1.06);
}

.rs-card.is-focus .rs-card__sym {
  color: #fff;
}

.rs-card.is-focus .rs-strength__seg.is-on {
  background: rgba(216, 224, 238, 0.5);
}

.rs-card__sym {
  font-family: var(--display, serif);
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 10px;
  line-height: 1;
}

.rs-card__metrics {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rs-card__metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.rs-card__metric span {
  font-family: var(--mono, monospace);
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted, #6b7589);
}

.rs-card__metric--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.rs-card__metric--stack > span {
  margin-bottom: 0;
}

.rs-card__theme {
  font-size: 9px !important;
  color: var(--text-soft, #b8c0d0) !important;
  text-align: right;
  line-height: 1.25;
  max-width: 58%;
}

.rs-aura {
  position: absolute;
  z-index: 5;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse, rgba(232, 201, 138, 0.2), rgba(142, 180, 255, 0.06) 50%, transparent 70%);
  filter: blur(22px);
  transform: translate(-50%, -50%) scale(0.6);
  transition: opacity 0.5s, transform 0.7s, left 0.85s, top 0.85s, width 0.85s, height 0.85s;
}

.rs-aura.is-active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: rsAura 3s ease-in-out infinite;
}

.rs-scene--rel-active .rs-aura.is-active {
  opacity: 1;
  background: radial-gradient(
    ellipse,
    rgba(232, 201, 138, 0.26),
    rgba(142, 180, 255, 0.08) 48%,
    transparent 72%
  );
}

@keyframes rsAura {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

.rs-strength {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rs-strength__track {
  display: flex;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.rs-strength__seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.4s var(--rs-ease);
}

.rs-strength__seg.is-on {
  background: rgba(200, 210, 225, 0.42);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.06);
}

.rs-strength--compact .rs-strength__seg {
  height: 2px;
}

.rs-strength__pct {
  font-family: var(--mono, monospace);
  font-size: 11px;
  font-weight: 500;
  color: rgba(210, 218, 232, 0.75);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.rs-strength--label .rs-strength__pct {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: none;
}

.rs-strength--muted .rs-strength__pct {
  color: var(--muted, #6b7589);
}

.rs-strength--estimated .rs-strength__seg.is-on {
  background: rgba(200, 210, 225, 0.32);
}

.rs-narrative {
  padding: 28px 28px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(165deg, rgba(18, 22, 38, 0.94), rgba(8, 10, 18, 0.9));
}

.rs-root--fullscreen .rs-narrative {
  margin: 20px 20px 20px 0;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.rs-narrative__eyebrow {
  font-family: var(--mono, monospace);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold, #e8c98a);
  margin-bottom: 20px;
  flex-shrink: 0;
}

.rs-narrative__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  flex: 1;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.35s var(--rs-ease);
}

.rs-narrative__body.is-fading {
  opacity: 0.2;
}

.rs-narrative__pair {
  margin: 0 0 4px;
  font-family: var(--mono, monospace);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(200, 210, 228, 0.55);
}

.rs-narrative__insight {
  flex: 0 1 auto;
  padding: 4px 0 8px;
}

.rs-narrative__line {
  margin: 0 0 0.65em;
  font-family: var(--display, "Playfair Display", serif);
  font-size: clamp(20px, 2.35vw, 26px);
  font-weight: 500;
  line-height: 1.36;
  letter-spacing: -0.02em;
  color: var(--text, #f2f4f9);
}

.rs-narrative__line--soft {
  margin-bottom: 0;
  font-family: var(--body, "Inter Tight", system-ui, sans-serif);
  font-size: clamp(14px, 1.55vw, 16px);
  font-weight: 400;
  line-height: 1.5;
  color: rgba(184, 192, 208, 0.88);
}

.rs-narrative__meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 20px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rs-narrative__meta-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rs-narrative__meta-label {
  font-family: var(--mono, monospace);
  font-size: 7px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted, #6b7589);
}

.rs-narrative__theme-val {
  font-size: 13px;
  font-weight: 500;
  color: rgba(210, 218, 232, 0.82);
  letter-spacing: 0.01em;
}

.rs-root--rel-active .rs-narrative__pair {
  color: rgba(232, 201, 138, 0.72);
}

.rs-picker {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 10, 18, 0.85);
  backdrop-filter: blur(16px);
}

.rs-picker button {
  font-family: var(--mono, monospace);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #6b7589);
  cursor: pointer;
  transition: all 0.3s;
}

.rs-picker button:hover,
.rs-picker button.is-active {
  color: var(--gold, #e8c98a);
  border-color: rgba(232, 201, 138, 0.35);
  background: rgba(232, 201, 138, 0.1);
}

@media (max-width: 800px) {
  .rs-root--embed .rs-stage,
  .rs-root--fullscreen .rs-stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .rs-narrative {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 0;
    max-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rs-hero,
  .rs-hero::before,
  .rs-card,
  .rs-aura,
  .rs-hero__halo,
  .rs-narrative__body {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .rs-card.is-focus {
    transform: translate(-50%, -50%) translateY(-4px) scale(1.04);
  }
}
