:root {
  color-scheme: light;
}

body.legal-page {
  margin: 0;
  background: #f8fafc;
  color: #334155;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.legal-page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(226, 232, 240, 0.92);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.legal-page-nav {
  display: flex;
  max-width: 900px;
  min-height: 68px;
  margin: 0 auto;
  padding: 0 24px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #0f172a;
  font-weight: 750;
  text-decoration: none;
}

.legal-brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.legal-back-link {
  color: #8a1c36;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.legal-back-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-page-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}

.legal-eyebrow {
  margin: 0 0 14px;
  color: #8a1c36;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.legal-document {
  font-size: 16px;
  line-height: 1.75;
}

.legal-document h1,
.legal-document h2,
.legal-document h3,
.legal-document h4 {
  color: #0f172a;
  line-height: 1.25;
  scroll-margin-top: 92px;
}

.legal-document h1 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: -0.035em;
}

.legal-document h2 {
  margin: 48px 0 14px;
  font-size: 1.45rem;
  letter-spacing: -0.015em;
}

.legal-document h3 {
  margin: 32px 0 10px;
  font-size: 1.1rem;
}

.legal-document p {
  margin: 0 0 18px;
}

.legal-document ul,
.legal-document ol {
  margin: 0 0 22px;
  padding-left: 1.5rem;
}

.legal-document li {
  margin: 7px 0;
  padding-left: 0.25rem;
}

.legal-document strong {
  color: #1e293b;
  font-weight: 700;
}

.legal-document a {
  color: #8a1c36;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.legal-document hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
}

body.legal-modal-open {
  overflow: hidden;
}

.legal-modal {
  width: min(900px, calc(100vw - 32px));
  max-width: none;
  height: min(820px, calc(100dvh - 32px));
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
}

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

.legal-modal[open] {
  animation: legal-modal-in 180ms ease-out;
}

.legal-modal-shell {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.legal-modal-header {
  display: flex;
  padding: 18px 18px 18px 24px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.legal-modal-title {
  margin: 0;
  color: #0f172a;
  font-size: 1.15rem;
  font-weight: 750;
}

.legal-modal-close {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 24px;
  line-height: 1;
}

.legal-modal-close:hover {
  border-color: #f0cad4;
  background: #fcf4f6;
  color: #8a1c36;
}

.legal-modal-close:focus-visible,
.legal-back-link:focus-visible,
.legal-document a:focus-visible {
  outline: 3px solid rgba(138, 28, 54, 0.28);
  outline-offset: 3px;
}

.legal-modal-content {
  overflow: auto;
  padding: 30px clamp(22px, 5vw, 52px) 40px;
  overscroll-behavior: contain;
}

.legal-modal-content .legal-document h2:first-of-type {
  margin-top: 34px;
}

.legal-modal-footer {
  margin: 0;
  padding: 13px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}

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

@media (max-width: 600px) {
  .legal-page-main {
    padding-top: 44px;
  }

  .legal-back-link {
    font-size: 13px;
  }

  .legal-modal {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .legal-modal-content {
    padding-top: 24px;
  }

  .legal-modal-footer {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legal-modal[open] {
    animation: none;
  }
}
