@import "tokens.css";

/* Shared by privacy.html, terms.html and delete-account.html: the reading
 * layout for a policy page, the EN/RU language toggle, the footer and the
 * delete-account forms. style.css supplies the panel, topbar, buttons and base
 * type; this file only adds what those three pages need on top of it. */

/* A visitor whose saved language is Russian gets it before the first paint: the
 * inline script in <head> sets lang, and these rules show the Russian blocks that
 * still carry `hidden` until legal.js runs. style.css forces [hidden] off with
 * !important, so these need it too, and the higher specificity decides. */
html[lang="ru"] [data-lang="en"] { display: none !important; }
html[lang="ru"] span[data-lang="ru"] { display: inline !important; }
html[lang="ru"] div[data-lang="ru"] { display: block !important; }

/* Accessible-but-not-visible: the recovery form's <label> is read out by a
 * screen reader and not drawn. */
.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* One column for the title and the text, so their left edges line up. */
.legal-col { max-width: calc(var(--hp) * 34); margin-inline: auto; }

.legal-head { padding: calc(var(--hp) * 1.6) calc(var(--hp) * 1.2) calc(var(--hp) * 0.4); }
.legal-head h1 {
  font-family: var(--ui); font-weight: 600; letter-spacing: -.01em;
  font-size: clamp(26px, 6vw, 34px); line-height: 1.15; margin: 0 0 8px;
}
.legal-head .fine { margin: 0; }

.lang-toggle { display: inline-flex; gap: 6px; margin: 14px 0 0; }
.lang-btn {
  font-family: var(--ui); font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: var(--control);
  color: var(--ink-dim); cursor: pointer;
}
.lang-btn[aria-pressed="true"] { background: #fff; color: #111; border-color: transparent; }

.legal-body {
  padding: calc(var(--hp) * 0.8) calc(var(--hp) * 1.2) calc(var(--hp) * 2.4);
  /* Addresses and long words break rather than push the page sideways on a phone. */
  overflow-wrap: break-word;
}
.legal-body h2 {
  font-family: var(--ui); font-weight: 600; font-size: 21px; line-height: 1.3;
  letter-spacing: -.01em; margin: 44px 0 12px;
}
.legal-body h3 {
  font-family: var(--ui); font-weight: 600; font-size: 17px; line-height: 1.35;
  margin: 28px 0 8px;
}
.legal-body h2:first-child { margin-top: 12px; }
.legal-body h2 + h3 { margin-top: 16px; }
/* The column already keeps lines short; style.css's 68ch would make paragraphs
 * narrower than the lists between them. */
.legal-body p { margin: 0 0 12px; max-width: none; }
.legal-body ul, .legal-body ol { margin: 0 0 14px; padding-left: 1.3em; }
.legal-body li { margin: 0 0 7px; }
.legal-body li::marker { color: var(--ink-dim); }
/* The sticky top bar would cover a heading or clause a link scrolls to. */
.legal-body [id] { scroll-margin-top: 72px; }

/* Links read as links on a phone, where nothing hovers: a quiet underline that
 * turns full white on hover and focus. A long address may break anywhere. */
.legal-body a {
  color: inherit; border: 0;
  text-decoration: underline; text-decoration-thickness: 1px;
  text-decoration-color: rgba(255, 255, 255, .38); text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.legal-body a:hover, .legal-body a:focus-visible { text-decoration-color: var(--ink); }
/* Short things that read badly split, such as r3al.ee/delete-account or an
 * article number like 6(1)(c), stay on one line. */
.legal-body .nw { white-space: nowrap; overflow-wrap: normal; }

/* ── footer, as on the landing ─────────────────────────────────── */
.legal-foot {
  border-top: 1px solid var(--hairline);
  padding: 22px calc(var(--hp) * 1.2) calc(26px + env(safe-area-inset-bottom, 0px));
  text-align: center; font-size: 13px; line-height: 1.5; color: var(--ink-dim);
}
.legal-foot .links {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; justify-content: center;
}
/* The dot is silent for a screen reader: the list already says where one item ends. */
.legal-foot .links li + li::before { content: "·"; content: "·" / ""; margin: 0 .6em; }
.legal-foot .links a {
  display: inline-block; padding: 3px 0;
  color: inherit; text-decoration: none; border: 0;
}
.legal-foot .links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.legal-foot .links a[aria-current="page"] { color: var(--ink); }
.legal-foot .by { margin: 4px 0 0; }
/* On a phone the row wraps, and a wrapped row must not start with a dot: there
 * the items are set apart by space alone. */
@media (max-width: 559px) {
  .legal-foot .links { column-gap: 18px; }
  .legal-foot .links li + li::before { content: none; }
}

/* ── the delete-account forms ──────────────────────────────────── */
.legal-form { margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.legal-input {
  font-family: var(--data); font-size: 15px; letter-spacing: .04em;
  padding: 12px 14px; min-height: 48px; flex: 1 1 240px; min-width: 0;
  border-radius: var(--r-tile); border: 1px solid var(--hairline);
  background: var(--surface-2); color: var(--ink);
}
.legal-input:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.legal-input:disabled { opacity: .6; }
.legal-result {
  margin-top: 12px; font-size: 14px; padding: 10px 12px;
  border-radius: var(--r-tile); border: 1px solid var(--hairline);
  background: var(--surface-2);
}
/* .legal-body p would otherwise take the gap above the box away. */
.legal-body .legal-result { margin: 12px 0; }
.legal-result[data-tone="ok"] { border-color: var(--fam-channel); }
.legal-result[data-tone="error"] { border-color: var(--record); }

/* The account form: fields under their labels, one per line, and the button
 * under them: two fields of the row form's 240px and a button do not fit side by
 * side on a phone. */
.legal-form-stack { flex-direction: column; align-items: stretch; max-width: 420px; }
.legal-form-stack .btn { align-self: flex-start; }
.legal-field { display: flex; flex-direction: column; gap: 6px; }
.legal-label { font-size: 13px; color: var(--ink-dim); }
/* Inside the column a flex-basis is a height: without this the field takes
 * the row form's 240px as its own height. */
.legal-field .legal-input { flex: none; }
/* The monospace face and letter spacing are for the recovery code; an address
 * and a password are set in the text face, like the rest of the page. */
.legal-input-text { font-family: var(--ui); letter-spacing: 0; }

.legal-body .btn:disabled { opacity: .5; cursor: default; }
.btn-danger { background: var(--record); color: #fff; }
.btn-danger:active { background: #d63a31; }

/* The question asked before a delete is sent. It takes focus when it opens, so
 * a screen reader reads it out, but it is not a control and draws no ring. */
.legal-confirm {
  margin-top: 12px; padding: 12px 14px; max-width: 520px;
  border-radius: var(--r-tile); border: 1px solid var(--record);
  background: var(--surface-2);
}
.legal-confirm [tabindex="-1"]:focus { outline: none; }
/* The question names the address, and a long one has no space to break at. */
.legal-confirm p { overflow-wrap: break-word; }
.legal-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* Without a gap the paragraph under a form touches its last box or answer. */
.legal-body [data-delete] { margin-bottom: 16px; }
