/* The service agreement (/agreement/, 24.10.2026): a contract in the site's paper and ink. The document layout is site.css's
   (.doc, .tldr, .toc, .doc-meta, .field, .chip, .btn); this file adds what a contract needs: the parties, the price tables,
   numbered clauses, the annex, the signing form with its pad, the signed copy and the printed one. Scoped under .agr.
   Logical properties only: the page is RTL. Strict CSP: no inline styles; the script only toggles classes and draws on the
   canvas. */

.agr-terms { display: grid; gap: 18px; justify-items: start; inline-size: 100%; }
.agr-terms > * { max-inline-size: 820px; }
/* the terms page (/terms, 24.10): parts B and C, the subscribers' service terms and the processing terms, under the site's own part A */
.agr-terms-parts { display: grid; gap: 18px; justify-items: start; inline-size: 100%; }
.agr-terms-parts > * { max-inline-size: 820px; }
.agr-head { display: grid; gap: 18px; justify-items: start; }
.agr-lead { color: var(--ink2); font-size: 18px; line-height: 1.6; text-wrap: pretty; }
.agr-note { font-size: 15.5px; color: var(--ink2); }

/* the parties */
.agr-parties { display: grid; gap: 14px; inline-size: 100%; }
@media (min-width: 720px) { .agr-parties { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.agr-party, .agr-company { display: grid; gap: 6px; align-content: start; min-inline-size: 0; padding: 20px 22px; border-radius: var(--r-card); background-color: var(--white); box-shadow: inset 0 0 0 1.5px var(--line); }
.agr .role { color: var(--ink2); font: 800 14px/1.3 var(--body); letter-spacing: .02em; }
.agr .who { color: var(--ink); font: 400 24px/1.25 var(--display); }
.agr-party p, .agr-company p { font-size: 17px; line-height: 1.55; }
.agr-party .as { color: var(--ink2); font-size: 15px; }

/* numbered clauses: the number hangs at the start, the text keeps one edge */
.agr .cl { display: grid; grid-template-columns: 3em minmax(0, 1fr); column-gap: 12px; align-items: baseline; }
.agr .cl-n { color: var(--ink); font: 800 16.5px/1.6 var(--body); font-variant-numeric: tabular-nums; }
.agr .cl-body { display: grid; gap: 12px; min-inline-size: 0; }
.agr .cl-sub { display: grid; gap: 8px; padding-inline-start: 0; list-style: none; }
.agr .cl-sub li { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); align-items: baseline; }
.agr .cl-sub li > b { color: var(--ink); font-weight: 800; }
.agr .cl-sub.dots { padding-inline-start: 22px; list-style: disc; }
.agr .cl-sub.dots li { display: list-item; }

/* tables: the commercial terms and the vendors. On a phone every row becomes a short block */
.agr-table { inline-size: 100%; border-collapse: collapse; border-block-start: 1.5px solid var(--line); font-size: 17px; line-height: 1.5; }
.agr-table th, .agr-table td { padding: 13px 14px; border-block-end: 1.5px solid var(--line); text-align: start; vertical-align: top; }
.agr-table thead th { padding-block: 10px; background-color: var(--paper2); color: var(--ink2); font-size: 14.5px; font-weight: 800; }
.agr-table tbody th { inline-size: 30%; color: var(--ink); font-weight: 800; }
.agr-table td { color: var(--ink2); }
.agr-table .agr-price { color: var(--ink); font: 400 20px/1.35 var(--display); white-space: nowrap; font-variant-numeric: tabular-nums; }
.agr-vendors { font-size: 16px; }
.agr-vendors tbody th { inline-size: 22%; }
@media (max-width: 700px) {
  .agr-table thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .agr-table, .agr-table tbody, .agr-table tr, .agr-table th, .agr-table td { display: block; inline-size: auto; }
  .agr-table tr { padding-block: 12px; border-block-end: 1.5px solid var(--line); }
  .agr-table th, .agr-table td { padding: 2px 0; border: 0; }
  .agr-table tbody th { inline-size: auto; }
  .agr-table .agr-price { white-space: normal; }
}

/* the annex starts on its own, under a hairline */
.agr-annex { padding-block-start: 22px; border-block-start: 1.5px solid var(--line2); }
.agr-annex > .kicker { justify-self: start; margin-block-start: 8px; }
.agr-annex > h2 { margin-block-start: 0; }

/* signing */
.agr-sign { display: grid; gap: 20px; inline-size: 100%; max-inline-size: 820px; margin-block-start: 34px; padding: clamp(22px, 3.4vw, 40px); border-radius: var(--r-card); background-color: var(--paper2); scroll-margin-block-start: 96px; }
.doc .agr-sign h2 { margin-block-start: 0; }
.agr-company { background-color: var(--white); }
.agr-form { display: grid; gap: 26px; }
.agr-set { display: grid; gap: 14px; min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.agr-set legend { margin-block-end: 6px; padding: 0; color: var(--ink); font: 400 25px/1.2 var(--display); }
.agr-row { display: grid; gap: 14px; }
@media (min-width: 680px) { .agr-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.agr .field { align-content: start; margin: 0; min-inline-size: 0; }
.agr .hint { color: var(--ink2); font-size: 15px; line-height: 1.45; }
.agr-plans .chip span { min-block-size: 54px; line-height: 1.3; padding-block: 8px; text-wrap: balance; }

/* the pad: a white sheet with a signing line and the × it starts from */
.sig-box { position: relative; inline-size: 100%; max-inline-size: 620px; aspect-ratio: 12 / 5; overflow: hidden; border-radius: var(--r-btn); background-color: var(--white); box-shadow: inset 0 0 0 1.5px var(--line2); }
.sig-box::after { content: ''; position: absolute; inset-inline: 7%; inset-block-end: 24%; border-block-end: 1.5px solid var(--line2); pointer-events: none; }
.sig-box canvas { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; touch-action: none; cursor: crosshair; }
.sig-box.bad { box-shadow: inset 0 0 0 2.5px var(--red); }
.sig-x { position: absolute; inset-inline-start: 7%; inset-block-end: calc(24% + 6px); color: var(--ink2); font: 700 20px/1 var(--body); pointer-events: none; }
.sig-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #6e817d; font-size: 17px; pointer-events: none; }
.sig-box.has-ink .sig-empty { display: none; }
.sig-tools { display: flex; flex-wrap: wrap; gap: 10px; }
.agr .btn.small { min-block-size: 46px; padding-inline: 18px; font-size: 16px; }
.sig-typed-wrap { display: grid; gap: 14px; }
.sig-typed > span { position: absolute; inset-inline: 10%; inset-block-end: calc(24% + 4px); overflow: hidden; color: var(--ink); font: 400 clamp(28px, 6vw, 46px)/1.15 var(--display); white-space: nowrap; text-overflow: ellipsis; }

/* consents: the whole line is the target */
.agr-consents { gap: 10px; }
.agr-check { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; min-block-size: 44px; padding-block: 6px; color: var(--ink); font-size: 17.5px; line-height: 1.5; cursor: pointer; }
.agr-check input { inline-size: 22px; block-size: 22px; margin: 3px 0 0; accent-color: var(--ink); cursor: pointer; }
.agr-check.bad span { color: var(--red); font-weight: 700; }
.agr-privacy { color: var(--ink2); font-size: 15px; line-height: 1.55; }
.agr .form-alert { margin: 0; }
.agr-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.agr-actions .btn { padding-inline: 26px; }
.agr .btn[aria-busy='true'] { opacity: .7; cursor: progress; }
.agr-fp { color: var(--ink2); font-size: 14px; }
.agr-fp .ltr { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13.5px; }

/* the signed copy */
.agr-signed { display: grid; gap: 14px; padding: clamp(20px, 3vw, 32px); border-radius: var(--r-card); background-color: var(--sage); }
.agr-signed:focus { outline: none; }
.agr-signed h3 { color: var(--ink); font: 400 clamp(28px, 3vw, 36px)/1.15 var(--display); }
.agr-signed p { color: var(--ink); font-size: 17px; line-height: 1.55; overflow-wrap: anywhere; }
.agr-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; margin: 0; font-size: 17px; }
.agr-dl dt { color: var(--ink); font-weight: 800; }
.agr-dl dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 460px) { .agr-dl { grid-template-columns: minmax(0, 1fr); gap: 0; } .agr-dl dd { margin-block-end: 8px; } }
.agr-sig-out { padding: 10px 14px; border-radius: var(--r-btn); background-color: var(--white); justify-self: start; inline-size: min(100%, 380px); }
.agr-sig-out svg { display: block; inline-size: 100%; block-size: auto; }
.agr-sig-out .typed { color: var(--ink); font: 400 40px/1.2 var(--display); overflow-wrap: anywhere; }

/* the password page of the agreement pages (worker/index.js) */
.agr-lock-form { inline-size: min(100%, 420px); }
.agr-lock-form .field input { direction: ltr; text-align: start; }

/* the paper version exists only on paper */
.agr-paper { display: none; }

@media print {
  @page { size: A4; margin: 15mm 14mm; }
  html, body { background: #fff !important; }
  body { color: #000; font-size: 11pt; line-height: 1.5; }
  .skip, .nav, .foot, .crumbs, [data-no-print], .sig-tools { display: none !important; }
  .doc-page { padding: 0 !important; }
  .wrap { inline-size: 100% !important; }
  .doc > *, .agr-terms > *, .agr-sign { max-inline-size: none !important; }
  .doc p, .doc li, .agr-table td, .agr .role, .agr-lead, .agr-note { color: #000 !important; }
  .doc h2 { margin-block-start: 14pt; font-size: 16pt; break-after: avoid; }
  .agr-head h1 { font-size: 26pt; }
  .tldr, .agr-party, .agr-company, .agr-sign, .agr-signed, .agr-sig-out { border: 1px solid #888; background: #fff !important; box-shadow: none !important; }
  .agr-table thead th { background: #fff !important; }
  .agr .cl, .agr-table tr, .agr-party, .agr-signed { break-inside: avoid; }
  .agr-annex { break-before: page; }
  .agr-sign { break-before: page; margin: 0; padding: 12pt; }
  a { color: #000 !important; text-decoration: none; }
  mark { background: none; font-weight: 800; }
  .agr:not(.is-signed) .agr-paper { display: block !important; }
  .agr-paper .paper-grid { display: grid; gap: 14pt; margin-block-start: 10pt; }
  .agr-paper p { display: flex; align-items: flex-end; gap: 8pt; font-size: 11.5pt; }
  .agr-paper .line { flex: 1; min-inline-size: 40mm; border-block-end: 1px solid #000; block-size: 14pt; }
  .agr-paper .line.tall { block-size: 34pt; }
}

@media (prefers-reduced-motion: reduce) { .agr * { transition: none !important; } }
