/**
 * Ralli legal pages - visual alignment with index.html (Framer export)
 * Tokens mirror --token-* from the main site.
 */

:root {
  --ralli-text: rgb(51, 51, 51);
  --ralli-text-soft: rgba(51, 51, 51, 0.78);
  --ralli-text-muted: rgba(51, 51, 51, 0.45);
  --ralli-text-faint: rgba(51, 51, 51, 0.38);
  --ralli-pink: rgb(252, 174, 222);
  --ralli-pink-soft: rgba(252, 174, 222, 0.35);
  --ralli-cyan: rgb(98, 221, 221);
  --ralli-cyan-soft: rgba(98, 221, 221, 0.28);
  --ralli-yellow: rgb(255, 221, 0);
  --ralli-yellow-soft: rgba(255, 221, 0, 0.3);
  --ralli-border: rgba(0, 0, 0, 0.08);
  --ralli-nav-h: 64px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.legal-doc,
body.legal-doc {
  margin: 0;
  min-height: 100%;
}

body.legal-doc {
  font-family: "Baloo 2", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ralli-text);
  background: #fff;
  position: relative;
  overflow-x: hidden;
}

/* Soft pastel blobs - footer / page background feel from landing */
.legal-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #fff;
}

.legal-bg__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.42;
  animation: legal-blob-float 22s var(--ease-out) infinite;
}

.legal-bg__blob--1 {
  width: min(55vw, 420px);
  height: min(55vw, 420px);
  background: var(--ralli-yellow-soft);
  top: -8%;
  right: -5%;
  animation-delay: 0s;
}

.legal-bg__blob--2 {
  width: min(45vw, 360px);
  height: min(45vw, 360px);
  background: var(--ralli-pink-soft);
  bottom: 15%;
  left: -10%;
  animation-delay: -7s;
}

.legal-bg__blob--3 {
  width: min(40vw, 320px);
  height: min(40vw, 320px);
  background: var(--ralli-cyan-soft);
  bottom: -5%;
  right: 20%;
  animation-delay: -14s;
}

@keyframes legal-blob-float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(2%, -3%) scale(1.03);
  }
  66% {
    transform: translate(-2%, 2%) scale(0.98);
  }
}

/* Nav - sticky bar like Framer header */
.legal-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 40px);
  height: var(--ralli-nav-h);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ralli-border);
  animation: legal-nav-in 0.55s var(--ease-out) both;
}

@keyframes legal-nav-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Wordmark matches index header (images/main-logo.svg, ~100×36) */
.legal-nav-logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease-out), opacity 0.2s var(--ease-out);
}

.legal-nav-logo:hover {
  opacity: 0.92;
  transform: scale(1.02);
}

.legal-nav-logo__img {
  height: 40px;
  width: auto;
  max-width: min(200px, 48vw);
  display: block;
  object-fit: contain;
  object-position: left center;
}

@media (max-width: 520px) {
  .legal-nav-logo__img {
    height: 34px;
    max-width: min(180px, 58vw);
  }
}

.legal-nav-back {
  font-size: 13px;
  font-weight: 500;
  color: var(--ralli-text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.legal-nav-back:hover {
  color: var(--ralli-text);
}

.legal-nav-back::before {
  content: "←";
  font-size: 15px;
  transition: transform 0.2s var(--ease-out);
}

.legal-nav-back:hover::before {
  transform: translateX(-3px);
}

/* Main column */
.legal-page {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 72px) clamp(20px, 4vw, 40px) 100px;
  animation: legal-page-in 0.65s var(--ease-out) 0.08s both;
}

@keyframes legal-page-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.legal-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ralli-text-faint);
  margin-bottom: 16px;
}

.legal-page h1 {
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(32px, 7vw, 56px);
  line-height: 1.02;
  letter-spacing: 0.02em;
  color: var(--ralli-text);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.legal-effective {
  font-size: 13px;
  color: var(--ralli-text-muted);
  margin-bottom: 40px;
}

.legal-intro {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ralli-text-soft);
  margin-bottom: 48px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--ralli-border);
}

.legal-section {
  margin-bottom: 44px;
  animation: legal-section-in 0.45s var(--ease-out) 0.14s both;
}

@keyframes legal-section-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.legal-page h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ralli-text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.legal-section-lead {
  font-size: 15px;
  color: var(--ralli-text-soft);
  margin-bottom: 12px;
}

.legal-page ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legal-page li {
  font-size: 15px;
  color: rgba(51, 51, 51, 0.82);
  padding-left: 22px;
  position: relative;
}

.legal-page li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ralli-pink), var(--ralli-cyan));
  opacity: 0.85;
}

.legal-page li strong {
  color: var(--ralli-text);
  font-weight: 600;
}

.legal-note {
  display: inline-block;
  margin-top: 12px;
  font-size: 14px;
  font-style: italic;
  color: var(--ralli-text-muted);
}

/* Warning (terms) */
.legal-warning {
  background: linear-gradient(
    90deg,
    rgba(255, 221, 0, 0.12) 0%,
    rgba(255, 255, 255, 0.95) 100%
  );
  border-left: 3px solid var(--ralli-yellow);
  border-radius: 0 12px 12px 0;
  padding: 14px 20px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--ralli-text-soft);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

/* Contact / support card - pink accent like CTA */
.legal-contact {
  margin-top: 52px;
  padding: 28px 32px;
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(252, 174, 222, 0.1) 0%,
    #fff 48%
  );
  border: 1px solid rgba(252, 174, 222, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
  animation: legal-section-in 0.55s var(--ease-out) 0.45s both;
}

.legal-contact h2 {
  border: none;
  padding: 0;
  margin-bottom: 10px;
  font-size: 18px;
}

.legal-contact p {
  font-size: 15px;
  color: var(--ralli-text-soft);
}

.legal-contact a,
.legal-page a.legal-inline-link {
  color: var(--ralli-text);
  font-weight: 600;
  text-decoration: none;
  background-image: linear-gradient(transparent 60%, var(--ralli-pink-soft) 60%);
  background-size: 100% 100%;
  transition: color 0.2s, background-image 0.2s;
}

.legal-contact a:hover,
.legal-page a.legal-inline-link:hover {
  color: #222;
  background-image: linear-gradient(transparent 40%, var(--ralli-pink) 40%);
}

/* Footer - matches index legal strip tone */
.legal-footer {
  position: relative;
  z-index: 1;
  margin-top: 72px;
  padding: 24px clamp(20px, 4vw, 40px);
  border-top: 1px solid var(--ralli-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  animation: legal-page-in 0.5s var(--ease-out) 0.2s both;
}

.legal-footer p {
  font-size: 12px;
  color: var(--ralli-text-faint);
  letter-spacing: 0.02em;
}

.legal-footer-links {
  display: flex;
  gap: 20px;
}

.legal-footer-links a {
  font-size: 12px;
  color: var(--ralli-text-faint);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s var(--ease-out);
}

.legal-footer-links a:hover {
  color: var(--ralli-text);
}

.legal-footer-links a.is-active {
  color: var(--ralli-text);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
