/* The Terms and the consent screen. Colours and sizes come from the theme variables. */

/* ---- the screen that asks for acceptance, and the page that lets anyone read the Terms ---- */
.consent-card, .terms-reader { max-width: 58rem; margin-inline: auto; padding: 1.4rem 1.6rem 1.6rem; }
.consent-head h2, .terms-reader-head h2 { font-size: var(--step-3); margin: 0; }
.consent-head h2:focus { outline: none; }
.consent-head .who { margin: 0.2rem 0 0.7rem; font-size: var(--step--1); overflow-wrap: anywhere; }
.consent-head p { max-width: 62ch; }

.terms-scroll {
  position: relative; max-height: min(28rem, 58vh); overflow: auto; margin: 0.9rem 0 0.5rem;
  padding: 1rem 1.2rem 1.2rem; border: 2px solid var(--line-strong); border-radius: var(--radius-small); background: var(--surface-soft);
}
.terms-scroll:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.terms-scroll.in-dialog { max-height: min(60vh, 34rem); margin: 0; }

.terms-doc { font-size: var(--step-0); line-height: 1.6; }
.terms-doc h3 { font-size: var(--step-1); margin: 0 0 0.5rem; }
.terms-meta { margin: 0 0 0.6rem; color: var(--ink-soft); font-size: var(--step--1); font-weight: 700; }
.terms-intro { max-width: 64ch; margin: 0 0 1rem; }
.terms-summary { margin: 0 0 1.1rem; padding: 0.8rem 1rem 0.9rem; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--sun); border-radius: 4px var(--radius-small) var(--radius-small) 4px; }
.terms-summary ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.terms-summary li { margin: 0.3rem 0; }
.terms-toc { margin: 0 0 1.4rem; }
.terms-toc ol { margin: 0.3rem 0 0; padding-left: 1.4rem; columns: 2 18rem; column-gap: 2rem; }
.terms-toc li { margin: 0.15rem 0; break-inside: avoid; }
.terms-section { margin: 0 0 1.4rem; scroll-margin-top: 0.5rem; }
.terms-section h3 { padding-bottom: 0.25rem; border-bottom: 2px solid var(--line); }
.clauses { list-style: none; margin: 0; padding: 0; }
.clauses li { display: grid; grid-template-columns: 3.1rem minmax(0, 1fr); gap: 0.2rem; margin: 0.55rem 0; }
.clauses .num { color: var(--ink-soft); font-weight: 800; font-variant-numeric: tabular-nums; font-size: var(--step--1); padding-top: 0.12rem; }
.clauses .tx { overflow-wrap: anywhere; max-width: 68ch; }
.terms-acks ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.terms-acks li { margin: 0.35rem 0; }

.consent-tools { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0 0 0.9rem; font-size: var(--step--1); }

/* ---- the boxes to tick, the typed name, the buttons ---- */
.acks { border: 0; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.acks legend { font-weight: 800; font-size: var(--step-0); padding: 0; margin-bottom: 0.4rem; }
.ack { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr); gap: 0.7rem; align-items: start; padding: 0.65rem 0.85rem; border: 2px solid var(--line); border-radius: var(--radius-small); background: var(--surface); cursor: pointer; font-weight: 600; }
.ack input { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; accent-color: var(--primary); }
.ack:has(input:checked) { border-color: var(--good); background: #eef9ee; }
.ack:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.consent-name { max-width: 30rem; margin-bottom: 0.4rem; }
.consent-name label { display: block; font-weight: 800; margin-bottom: 0.3rem; }
.consent-buttons { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; align-items: center; margin-top: 0.8rem; }
.consent-buttons .btn.primary { padding-inline: 1.6rem; min-height: 2.9rem; }
.consent-buttons .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.consent-card > .field-note { max-width: 62ch; margin: 0.9rem 0 0; color: var(--ink-soft); font-size: var(--step--1); }

.terms-reader-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.7rem 1rem; margin-bottom: 0.4rem; }
.terms-reader .terms-doc { margin-top: 0.8rem; }

/* ---- the notice under the Google sign-in button ---- */
.terms-notice { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .consent-card, .terms-reader { padding: 1rem; }
  .clauses li { grid-template-columns: 2.6rem minmax(0, 1fr); }
  .terms-scroll { padding: 0.8rem; }
}

/* a printout holds the Terms only: no boxes, buttons or scroll frame */
@media print {
  .consent-actions, .acks, .consent-name, .consent-card > .field-note, .terms-notice, .consent-head .who { display: none !important; }
  .terms-scroll { max-height: none; overflow: visible; border: 0; background: none; padding: 0; }
  .consent-card, .terms-reader { border: 0; padding: 0; max-width: none; }
}
