/* ----------------------------------------------------------------------------------------
 * Prospera — Terms and Conditions
 *
 * Two surfaces, one document:
 *   .terms-page          the standalone page (with a sticky contents rail)
 *   .terms-modal-overlay the consent popup
 *
 * `.terms-doc` and everything under it is the document itself and is styled
 * once, so the two can never drift apart.
 *
 * Set as a legal document rather than a marketing page: a single measured
 * column, clause numbers hanging in the margin where they can be cited, and no
 * decoration that would compete with the reading.
 * -------------------------------------------------------------------------------------- */

.terms-page,
.terms-modal-overlay {
  --tc-ink: var(--primary-color, #0d3b66);
  --tc-muted: var(--text-color, #4a4a4a);
  --tc-line: rgba(13, 59, 102, 0.12);
  --tc-tint: var(--secondary-color, #eef6f5);
  --tc-accent: var(--accent-color, #2fa8a0);
  --tc-measure: 68ch;
}

/* ---------------------------------------------------------------- Document */

.terms-doc__meta {
  margin: 0 0 26px;
  font-family: var(--default-font, sans-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tc-muted);
  opacity: 0.65;
}

.terms-doc__intro {
  max-width: var(--tc-measure);
  margin-bottom: 40px;
  padding: 22px 26px;
  border-inline-start: 3px solid var(--tc-accent);
  border-radius: 4px;
  background: var(--tc-tint);
}

.terms-doc__intro p {
  margin: 0 0 10px;
  font-family: var(--default-font, sans-serif);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--tc-muted);
}

.terms-doc__intro p:last-child {
  margin-bottom: 0;
}

.terms-sec {
  max-width: var(--tc-measure);
  margin-bottom: 34px;
  /* Anchor links from the contents rail should not land under a sticky header. */
  scroll-margin-top: 110px;
}

.terms-sec:last-child {
  margin-bottom: 0;
}

.terms-sec__title {
  position: relative;
  margin: 0 0 12px;
  font-family: var(--accent-font, serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--tc-ink);
}

.terms-sec__n {
  display: inline-block;
  min-width: 26px;
  font-family: var(--default-font, sans-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--tc-accent);
  font-variant-numeric: tabular-nums;
}

/* Given a margin to hang in, the number moves out of the text block so the
   heading lines up with the body copy underneath it — the way a clause is set
   in the printed document it came from. */
@media only screen and (min-width: 992px) {
  .terms-sec__n {
    position: absolute;
    inset-inline-start: -38px;
    top: 0.42em;
    min-width: 0;
  }
}

.terms-sec p {
  margin: 0 0 12px;
  font-family: var(--default-font, sans-serif);
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--tc-muted);
}

.terms-sec p:last-child {
  margin-bottom: 0;
}

.terms-list {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.terms-list li {
  position: relative;
  margin-bottom: 8px;
  padding-inline-start: 24px;
  font-family: var(--default-font, sans-serif);
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--tc-muted);
}

.terms-list li::before {
  content: '';
  position: absolute;
  inset-inline-start: 2px;
  top: 0.72em;
  width: 8px;
  height: 8px;
  border-radius: 8px 2px 8px 2px;
  background: var(--tc-accent);
}

.terms-error {
  padding: 40px 0;
  font-family: var(--default-font, sans-serif);
  font-size: 15px;
  color: var(--tc-muted);
  text-align: center;
}

/* ---------------------------------------------------------------- Contents rail */

.terms-toc {
  align-self: start;
}

.terms-toc__title {
  margin: 0 0 14px;
  font-family: var(--default-font, sans-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--tc-ink);
}

.terms-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.terms-toc__list li {
  margin-bottom: 2px;
}

.terms-toc__list a {
  display: flex;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--default-font, sans-serif);
  font-size: 13px;
  line-height: 1.45;
  color: var(--tc-muted);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.terms-toc__n {
  flex: 0 0 auto;
  min-width: 16px;
  font-weight: 600;
  color: var(--tc-accent);
  font-variant-numeric: tabular-nums;
}

.terms-toc__list a:hover,
.terms-toc__list a:focus-visible {
  background: var(--tc-tint);
  color: var(--tc-ink);
}

.terms-toc__list a.is-current {
  background: var(--tc-tint);
  color: var(--tc-ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- Page */

.terms-page {
  padding: 90px 0 100px;
}

.terms-page .terms-doc {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.terms-page .terms-toc {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding-inline-end: 6px;
}

.terms-page-head {
  margin-bottom: 46px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--tc-line);
}

.terms-page-head h1 {
  margin: 0 0 10px;
  font-family: var(--accent-font, serif);
  font-size: 42px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--tc-ink);
}

.terms-page-head p {
  max-width: 62ch;
  margin: 0;
  font-family: var(--default-font, sans-serif);
  font-size: 15px;
  line-height: 1.7;
  color: var(--tc-muted);
}

@media only screen and (max-width: 991px) {
  .terms-page {
    padding: 60px 0 70px;
  }

  .terms-page .terms-doc {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .terms-page .terms-toc {
    position: static;
    max-height: none;
    padding: 20px 22px;
    border-radius: 12px;
    background: var(--tc-tint);
  }

  .terms-page-head h1 {
    font-size: 32px;
  }

  .terms-sec__title {
    font-size: 19px;
  }
}

/* ---------------------------------------------------------------- Popup */

.terms-modal-overlay {
  position: fixed;
  inset: 0;
  /* Above the services dialog (9990) and the booking modal (9999): consent is
     always asked on top of whatever prompted it. */
  z-index: 10010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 32, 56, 0.66);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

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

.terms-modal-overlay.is-open {
  opacity: 1;
}

.terms-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 780px;
  max-height: 88vh;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 70px rgba(8, 32, 56, 0.34);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.terms-modal-overlay.is-open .terms-modal {
  transform: none;
}

.terms-modal__head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--tc-line);
}

.terms-modal__title {
  margin: 0;
  font-family: var(--accent-font, serif);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--tc-ink);
}

.terms-modal__close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--tc-line);
  border-radius: 50%;
  background: transparent;
  color: var(--tc-ink);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.terms-modal__close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.terms-modal__close:hover,
.terms-modal__close:focus-visible {
  background: var(--tc-ink);
  color: #fff;
}

.terms-modal__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 26px 8px;
}

.terms-modal__scroll:focus-visible {
  outline: 2px solid var(--tc-accent);
  outline-offset: -4px;
}

.terms-modal__scroll .terms-doc {
  display: block;
}

.terms-modal__scroll .terms-sec {
  scroll-margin-top: 0;
}

.terms-modal__foot {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 26px;
  border-top: 1px solid var(--tc-line);
  background: #fff;
}

.terms-modal__actions {
  display: flex;
  gap: 10px;
}

.terms-modal__page {
  font-family: var(--default-font, sans-serif);
  font-size: 13px;
  font-weight: 500;
  color: var(--tc-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.terms-modal__page:hover {
  color: var(--tc-ink);
}

/* ---------------------------------------------------------------- Consent */

.terms-consent {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  flex: 1 1 260px;
  margin: 0;
  cursor: pointer;
}

/* The real checkbox stays in the accessibility tree and keeps its own focus
   ring — it is only moved out of sight. */
.terms-consent input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.terms-consent__box {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid rgba(13, 59, 102, 0.3);
  border-radius: 5px;
  background: #fff;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.terms-consent__box svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.terms-consent input:checked + .terms-consent__box {
  border-color: var(--tc-accent);
  background: var(--tc-accent);
}

.terms-consent input:checked + .terms-consent__box svg {
  opacity: 1;
  transform: scale(1);
}

.terms-consent input:focus-visible + .terms-consent__box {
  outline: 2px solid var(--tc-ink);
  outline-offset: 2px;
}

.terms-consent__text {
  font-family: var(--default-font, sans-serif);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--tc-ink);
}

/* ---------------------------------------------------------------- Buttons */

.terms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: 100px;
  background: var(--tc-ink);
  font-family: var(--default-font, sans-serif);
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease,
    border-color 0.25s ease, opacity 0.25s ease;
}

.terms-btn:hover:not(:disabled),
.terms-btn:focus-visible:not(:disabled) {
  background: var(--tc-accent);
}

.terms-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.terms-btn--ghost {
  background: transparent;
  border-color: var(--tc-line);
  color: var(--tc-ink);
}

.terms-btn--ghost:hover,
.terms-btn--ghost:focus-visible {
  background: var(--tc-tint);
  color: var(--tc-ink);
}

/* ---------------------------------------------------------------- Inline consent */

/* The same agreement, offered inside a form rather than a dialog. */
.terms-inline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 18px;
  cursor: pointer;
}

.terms-inline input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.terms-inline .terms-consent__box {
  width: 19px;
  height: 19px;
}

.terms-inline__text {
  font-family: var(--default-font, sans-serif);
  font-size: 13px;
  line-height: 1.55;
  color: var(--tc-muted);
}

.terms-inline__link {
  color: var(--tc-accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.terms-inline__link:hover {
  color: var(--tc-ink);
}

@media only screen and (max-width: 575px) {
  .terms-modal-overlay {
    padding: 10px;
  }

  .terms-modal {
    max-height: 94vh;
  }

  .terms-modal__head {
    padding: 18px 18px 14px;
  }

  .terms-modal__title {
    font-size: 20px;
  }

  .terms-modal__scroll {
    padding: 18px 18px 4px;
  }

  .terms-modal__foot {
    padding: 14px 18px;
  }

  .terms-modal__actions {
    width: 100%;
  }

  .terms-modal__actions .terms-btn {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .terms-modal-overlay,
  .terms-modal,
  .terms-btn,
  .terms-consent__box,
  .terms-consent__box svg,
  .terms-toc__list a {
    transition: none;
  }

  .terms-modal {
    transform: none;
  }
}
