/* Shared legal dialog for the New flow and project login. */
.lp-legal-open {
  overflow: hidden;
}

.lp-legal-overlay[hidden] {
  display: none;
}

.lp-legal-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.lp-legal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(6px);
}

.lp-legal-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(860px, calc(100vw - 2rem));
  height: min(760px, calc(100dvh - 2rem));
  min-height: 0;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--color-content, #fff);
  color: var(--text-color, #333);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  outline: none;
}

.lp-legal-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid rgba(51, 51, 51, 0.14);
  border-bottom: 1px solid color-mix(in srgb, var(--text-color, #333) 14%, transparent);
  background: var(--color-content, #fff);
}

.lp-legal-header h2 {
  margin: 0;
  font-family: var(--headline-text-font-family), Arial, sans-serif;
  font-size: calc(var(--headline-text-font-size, 24px) * 0.766667);
  font-weight: var(--headline-text-font-weight, 500);
  line-height: var(--headline-text-line-height, 1.2);
  font-style: var(--headline-text-font-style, normal);
  letter-spacing: var(--headline-text-letter-spacing, 0px);
}

.lp-legal-close {
  flex: 0 0 auto;
  min-width: 0;
  border: 1px solid var(--border-neutral, #ccc);
  border-radius: 999px;
  padding: 0.48rem 0.9rem;
  background: transparent;
  color: var(--text-color, #333);
  font-family: var(--button-standard-font-family), Arial, sans-serif;
  font-size: calc(var(--button-standard-font-size, 18px) * 0.782222);
  font-weight: var(--button-standard-font-weight, 400);
  line-height: var(--button-standard-line-height, 1);
  cursor: pointer;
  font-style: var(--button-standard-font-style, normal);
  letter-spacing: var(--button-standard-letter-spacing, 0px);
}

.lp-legal-close:hover {
  border-color: var(--color-accent, #2196f3);
  color: var(--color-accent, #2196f3);
}

.lp-legal-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--white, #fff);
}

.lp-legal-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background: var(--white, #fff);
  color: var(--text-color, #333);
  font-family: var(--full-text-font-family), Arial, sans-serif;
  font-size: calc(var(--full-text-font-size, 18px) * 0.888889);
  font-style: var(--full-text-font-style, normal);
  letter-spacing: var(--full-text-letter-spacing, 0px);
  font-weight: var(--full-text-font-weight, 400);
  line-height: var(--full-text-line-height, normal);
}

.lp-legal-loading[hidden] {
  display: none;
}

.lp-legal-content {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  box-sizing: border-box;
  padding: clamp(1.15rem, 3vw, 2rem);
  opacity: 0;
  color: var(--text-color, #333);
  background: var(--white, #fff);
  font-family: var(--full-text-font-family), Arial, sans-serif;
  font-size: calc(var(--full-text-font-size, 18px) * 0.853333);
  font-weight: var(--full-text-font-weight, 300);
  line-height: var(--full-text-line-height, 1.55);
  transition: opacity 0.18s ease;
  font-style: var(--full-text-font-style, normal);
  letter-spacing: var(--full-text-letter-spacing, 0px);
}

.lp-legal-content.is-loaded {
  opacity: 1;
}

.lp-legal-content:focus {
  outline: none;
}

.lp-legal-content h1,
.lp-legal-content h2,
.lp-legal-content h3 {
  font-family: var(--headline-text-font-family), Arial, sans-serif;
  line-height: var(--headline-text-line-height, 1.2);
  font-style: var(--headline-text-font-style, normal);
  letter-spacing: var(--headline-text-letter-spacing, 0px);
  font-weight: var(--headline-text-font-weight, 400);
  font-size: var(--headline-text-font-size, 24px);
}

.lp-legal-content h1 {
  margin: 0 0 1.2rem;
  font-size: 1.5rem;
  font-weight: 500;
}

.lp-legal-content h2 {
  margin: 1.6rem 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 500;
}

.lp-legal-content h3 {
  margin: 1.1rem 0 0.4rem;
  font-size: 0.98rem;
  font-weight: 500;
}

.lp-legal-content p,
.lp-legal-content ul {
  margin: 0 0 0.85rem;
}

/* Legal documents use normal text flow, even under the New flow's flex reset. */
.lp-legal-content p:not(.lp-legal-error),
.lp-legal-content ul,
.lp-legal-content h1,
.lp-legal-content h2,
.lp-legal-content h3 {
  display: block;
}

.lp-legal-content li {
  display: list-item;
}

.lp-legal-content ul {
  padding-left: 1.25rem;
}

.lp-legal-content a {
  display: inline;
  color: var(--color-accent, #2196f3);
  overflow-wrap: anywhere;
}

.lp-legal-error {
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.lp-legal-footer {
  flex: 0 0 auto;
  padding: 0.75rem 1.1rem 0.95rem;
  border-top: 1px solid rgba(51, 51, 51, 0.1);
  border-top: 1px solid color-mix(in srgb, var(--text-color, #333) 10%, transparent);
  background: var(--color-content, #fff);
  text-align: right;
}

.lp-legal-footer a {
  color: var(--color-accent, #2196f3);
  font-family: var(--full-text-font-family), Arial, sans-serif;
  font-size: calc(var(--full-text-font-size, 18px) * 0.764444);
  text-decoration: none;
  font-style: var(--full-text-font-style, normal);
  letter-spacing: var(--full-text-letter-spacing, 0px);
  font-weight: var(--full-text-font-weight, 400);
  line-height: var(--full-text-line-height, normal);
}

.lp-legal-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .lp-legal-overlay {
    align-items: stretch;
    justify-content: stretch;
    padding: 0.6rem;
  }

  .lp-legal-dialog {
    width: 100%;
    height: calc(100dvh - 1.2rem);
    border-radius: 0.85rem;
  }

  .lp-legal-header {
    padding: 0.85rem 0.9rem;
  }

  .lp-legal-header h2 {
    font-size: 1rem;
  }

  .lp-legal-close {
    padding: 0.42rem 0.72rem;
    font-size: 0.8rem;
  }

  .lp-legal-footer {
    padding: 0.65rem 0.9rem 0.8rem;
  }
}
