/* =========================================================
   COMMISSIONS — LEGAL MODAL
   Commission-page-only overlay. No separate legal route.
   ========================================================= */

.commission-legal-link {
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
}

.commission-legal-link:hover,
.commission-legal-link:focus-visible {
  color: var(--text);
}

.commission-legal-link:focus-visible,
.legal-modal__close:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

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

.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 46px);
}

.legal-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  cursor: zoom-out;
}

.legal-modal__panel {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  height: min(88vh, 920px);
  height: min(88svh, 920px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--accent);
  background: var(--background);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.08);
}

.legal-modal__header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding: 26px 70px 22px 32px;
  border-bottom: 1px solid var(--accent);
  background: var(--background);
}

.legal-modal__eyebrow,
.legal-modal__version {
  margin: 0;
  color: var(--accent-text);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.legal-modal__header h2 {
  margin: 8px 0 8px;
  font-size: clamp(1.65rem, 3vw, 3rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.legal-modal__version {
  color: var(--muted);
  font-weight: 500;
}

.legal-modal__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.legal-modal__close:hover {
  color: var(--accent-text);
}

.legal-modal__scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  padding: 54px 0 72px;
  background: var(--background);
}

.legal-modal__scroll:focus {
  outline: none;
}

.legal-terms {
  width: min(calc(100% - 64px), 930px);
  margin: 0 auto;
  color: var(--text);
}

.legal-terms__intro {
  max-width: 840px;
  margin: 0 0 34px;
  font-size: clamp(1rem, 1.25vw, 1.16rem);
  line-height: 1.65;
}

.legal-terms__business {
  margin: 0 0 58px;
  padding: 20px 0;
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid #dddddd;
}

.legal-terms__business-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.42fr) minmax(0, 1fr);
  gap: 22px;
  padding: 5px 0;
}

.legal-terms__business dt,
.legal-terms__business dd {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.legal-terms__business dt {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legal-terms__section {
  padding: 0 0 48px;
}

.legal-terms__section + .legal-terms__section {
  padding-top: 4px;
}

.legal-terms__section h3 {
  margin: 0 0 18px;
  padding-top: 6px;
  color: var(--text);
  font-size: clamp(1rem, 1.25vw, 1.18rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.012em;
}

.legal-terms__section h3::after {
  content: "";
  display: block;
  width: 34px;
  height: 2px;
  margin-top: 10px;
  background: var(--accent);
}

.legal-terms p,
.legal-terms li,
.legal-terms blockquote {
  font-size: clamp(0.88rem, 1vw, 1rem);
  line-height: 1.68;
}

.legal-terms p {
  margin: 0 0 16px;
}

.legal-terms__list {
  margin: 0 0 20px;
  padding-left: 1.25rem;
}

.legal-terms__list li {
  margin: 0 0 6px;
  padding-left: 5px;
}

.legal-terms blockquote {
  margin: 18px 0 22px;
  padding: 18px 20px;
  border-left: 2px solid var(--accent);
  background: #fafafa;
}

.legal-terms h4 {
  margin: 24px 0 12px;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Reuse the site's existing pink chevron arrows, but anchor them to the modal. */
.legal-modal__arrow.scroll-cue {
  position: absolute !important;
  left: 50% !important;
  z-index: 5;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.legal-modal__arrow.scroll-cue:not(.is-visible) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.legal-modal__arrow--up.scroll-cue {
  top: 132px !important;
  bottom: auto !important;
}

.legal-modal__arrow--down.scroll-cue {
  top: auto !important;
  bottom: 16px !important;
}

@media (max-width: 700px) {
  .legal-modal {
    padding: 10px;
  }

  .legal-modal__panel {
    width: 100%;
    height: 94vh;
    height: 94svh;
  }

  .legal-modal__header {
    padding: 22px 58px 18px 20px;
  }

  .legal-modal__close {
    top: 14px;
    right: 14px;
  }

  .legal-modal__scroll {
    padding-top: 48px;
    padding-bottom: 66px;
  }

  .legal-terms {
    width: min(calc(100% - 36px), 930px);
  }

  .legal-terms__business-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 8px 0;
  }

  .legal-modal__arrow--up.scroll-cue {
    top: 122px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legal-modal__scroll {
    scroll-behavior: auto;
  }
}
