/* Legal documents — shared with marketing site tokens */

.legal-page {
  min-height: 100vh;
  background: var(--z-surface, #f8fafc);
  color: var(--z-ink, #0c0a12);
  padding: 1.5rem 1.25rem 3rem;
}

.legal-top {
  max-width: 48rem;
  margin: 0 auto 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.legal-back {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--z-purple-700, #6d28d9);
  text-decoration: none;
}

.legal-back:hover {
  text-decoration: underline;
}

.legal-lang {
  margin: 0;
  font-size: 0.88rem;
}

.legal-lang a {
  color: var(--z-muted, #64748b);
  font-weight: 500;
}

.legal-lang a:hover {
  color: var(--z-purple-700, #6d28d9);
}

.legal-doc {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 2.5rem;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.legal-doc h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--z-ink, #0c0a12);
}

.legal-meta {
  margin: 0 0 1.75rem;
  font-size: 0.85rem;
  color: var(--z-muted, #64748b);
}

.legal-doc h2 {
  margin: 2rem 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--z-ink, #0c0a12);
}

.legal-doc h2:first-of-type {
  margin-top: 0;
}

.legal-doc p,
.legal-doc li {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--z-ink-soft, #1e1b2e);
}

.legal-doc p {
  margin: 0 0 0.85rem;
}

.legal-doc ul,
.legal-doc ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.legal-doc li {
  margin-bottom: 0.4rem;
}

.legal-doc strong {
  font-weight: 600;
  color: var(--z-ink, #0c0a12);
}

.legal-doc a {
  color: var(--z-purple-700, #6d28d9);
  word-break: break-word;
}

.legal-highlight {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border-radius: 0.65rem;
  background: rgba(139, 92, 246, 0.08);
  border-left: 3px solid var(--z-purple-500, #8b5cf6);
  font-size: 0.88rem;
  color: var(--z-muted, #64748b);
}

.legal-highlight p:last-child {
  margin-bottom: 0;
}

/* Modal en index (rutas hash: #terms-es, #terms-en, #privacy-es, #privacy-en) */
dialog.legal-modal {
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  max-width: none;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
}

dialog.legal-modal::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
}

.legal-modal__shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  box-sizing: border-box;
}

.legal-modal__scrim {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 0;
}

.legal-modal__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(94vw, 48rem);
  max-height: min(92vh, 52rem);
  min-height: 0;
  background: #fff;
  border-radius: 1.125rem;
  box-shadow:
    0 0 0 1px rgba(109, 40, 217, 0.12),
    0 25px 60px -12px rgba(30, 27, 75, 0.45);
  overflow: hidden;
}

.legal-modal__panel::before {
  content: '';
  display: block;
  height: 3px;
  flex-shrink: 0;
  background: linear-gradient(90deg, var(--z-purple-800, #5b21b6), var(--z-purple-500, #8b5cf6));
}

.legal-modal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0.65rem 0.85rem 0.65rem 1.25rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  background: linear-gradient(180deg, #faf5ff 0%, #ffffff 100%);
}

.legal-modal__close {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(109, 40, 217, 0.1);
  color: var(--z-purple-800, #5b21b6);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease,
    transform 0.12s ease;
  -webkit-appearance: none;
  appearance: none;
}

.legal-modal__close:hover {
  background: rgba(109, 40, 217, 0.18);
}

.legal-modal__close:active {
  transform: scale(0.96);
}

.legal-modal__close:focus-visible {
  outline: 2px solid var(--z-accent, #eab308);
  outline-offset: 2px;
}

.legal-modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 1.5rem 2rem;
  background: #fff;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.legal-modal__body .legal-doc {
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.legal-modal__body .legal-doc h1 {
  margin-top: 0;
}

.legal-modal__body .legal-highlight {
  background: rgba(139, 92, 246, 0.07);
  border-left-color: var(--z-purple-500, #8b5cf6);
}

.legal-modal__loading,
.legal-modal__error {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--z-muted, #64748b);
}

.legal-modal__error {
  color: #b91c1c;
}
