/* ==========================================================================
   Terms & Conditions — the /terms page, and the payment step's dialog.

   Not from the export, which had no terms page. Both render partials/terms, so
   the document rules below are shared and the dialog's are the payment step's
   only. Colours, fonts and spacing are base.css's tokens.
   ========================================================================== */

/* --- The document -------------------------------------------------------- */
.terms {
  max-width: 76ch;
}

.terms p {
  font-size: 15.5px;
  color: var(--color-text-muted);
  line-height: 1.7;
  margin: 0 0 var(--space-4);
}

.terms p.terms__meta {
  font-size: 14px;
  color: var(--color-text-dim);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-2);
}

.terms p.terms__meta + p:not(.terms__meta) {
  margin-top: var(--space-5);
}

.terms strong {
  color: var(--color-text);
  font-weight: 600;
}

.terms__heading {
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--color-text);
  margin: var(--space-6) 0 var(--space-3);
}

.terms__address {
  font-style: normal;
  font-size: 15.5px;
  color: var(--color-text-muted);
  line-height: 1.7;
  border-left: 2px solid var(--color-line-strong);
  padding-left: var(--space-4);
  margin: 0 0 var(--space-4);
}

/* The statutory notice the ACL requires to be stated as written — set apart so it
   reads as the law's words rather than ours. */
.terms__notice {
  border: 1px solid var(--color-line);
  border-left: 2px solid var(--color-accent);
  background: var(--color-accent-100);
  padding: var(--space-4) var(--space-5);
  margin: 0 0 var(--space-4);
}

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

/* --- The page ------------------------------------------------------------ */
.terms-page__title {
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
  margin: var(--space-3) 0 var(--space-6);
}

/* --- The dialog ---------------------------------------------------------- */
/* The cart's removal dialog, restated rather than shared: that one lives in
   cart.css, which the payment step does not load. */
.terms-dialog {
  width: min(760px, calc(100% - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid rgba(244, 241, 228, 0.24);
  background: var(--color-surface);
  color: var(--color-text);
}

.terms-dialog::backdrop {
  background: rgba(6, 12, 9, 0.78);
}

/* The page behind stays where it was while the terms are read. */
html:has(.terms-dialog[open]) {
  overflow: hidden;
}

.terms-dialog__panel {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 900px);
}

.terms-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.terms-dialog__head form {
  margin: 0;
}

.terms-dialog__title {
  font-size: 24px;
  letter-spacing: 0.02em;
}

.terms-dialog__close {
  background: none;
  border: 0;
  padding: 0 var(--space-1);
  color: var(--color-text-muted);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.terms-dialog__close:hover {
  color: var(--color-accent);
}

.terms-dialog__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-5);
}

.terms-dialog__body .terms__heading {
  font-size: 19px;
  margin-top: var(--space-5);
}

.terms-dialog__foot {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-divider);
}

@media (max-width: 620px) {
  .terms-dialog__head,
  .terms-dialog__body,
  .terms-dialog__foot {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
  .terms-dialog__panel { max-height: 90vh; }
  .terms p,
  .terms__address { font-size: 15px; }
}

/* --- Print --------------------------------------------------------------- */
/* The HTML is the only copy of the terms, so a printed one comes from here. */
@media print {
  .site-nav,
  .site-footer { display: none; }
  body { background: #fff; color: #000; }
  .terms-page__title,
  .terms__heading,
  .terms strong { color: #000; }
  .terms p,
  .terms p.terms__meta,
  .terms__address { color: #222; }
  .terms__notice { background: none; border-color: #000; }
  .accent { color: inherit; }
}
