/* ==========================================================================
   Wibto — inner pages (Privacy, Terms, Support, 404)
   Loaded after styles.css; uses only its tokens.
   ========================================================================== */

.page { position: relative; overflow: hidden; padding-block: var(--s-10) var(--s-12); }
.page > .hex-grid {
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 520px);
  mask-image: linear-gradient(to bottom, #000, transparent 520px);
}
.page__inner { position: relative; max-width: calc(760px + var(--gutter) * 2); }
.page .eyebrow { margin-bottom: 20px; }

/* ---------- Readable long-form ---------- */
.legal { font-size: 17px; line-height: 1.7; color: var(--soft); overflow-wrap: break-word; }
.legal h1 {
  font-size: clamp(40px, 6vw, 64px); font-weight: 800; line-height: 1.02; letter-spacing: -.035em;
  color: var(--text); text-wrap: balance;
}
.legal__meta { margin-top: var(--s-2); font-family: var(--font-mono); font-size: 13px; letter-spacing: .06em; color: var(--muted); }
.legal__lead { margin-top: var(--s-2); font-size: var(--fs-lead); line-height: 1.55; color: var(--muted); }
.legal__meta + *, .legal__lead + * { margin-top: var(--s-6); }

.legal > * + *, .legal section > * + * { margin-top: var(--s-2); }
.legal section { margin-top: var(--s-8); }
.legal h2 { font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; color: var(--text); text-wrap: balance; }
.legal h2 + * { margin-top: 20px; }
.legal section > h3 { margin-top: var(--s-4); }
.legal h3 { font-size: 20px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; color: var(--text); }
.legal h2 + h3 { margin-top: var(--s-3); }
.legal h3 + * { margin-top: var(--s-1); }

.legal strong { font-weight: 600; color: var(--text); }
.legal .em { font-weight: 600; color: var(--text); }
.legal .note { font-style: italic; color: var(--dim); }
.legal a { color: var(--accent-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.legal a:hover { color: var(--accent-hover); }

.legal__list { padding-left: 1.25em; list-style: disc; }
.legal__list li::marker { color: var(--accent); }
.legal__list li + li { margin-top: var(--s-1); }

.legal__foot {
  margin-top: var(--s-8); padding-top: var(--s-3); border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; color: var(--muted);
}

/* Tables scroll inside their own box so the page never scrolls sideways */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card);
}
.legal table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
.legal th, .legal td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-soft); }
.legal th + th, .legal td + td { border-left: 1px solid var(--border-soft); }
.legal thead th { background: var(--chip); font-size: 14px; font-weight: 600; color: var(--text); }
.legal tbody tr:last-child td { border-bottom: 0; }
.legal td:first-child { color: var(--text); }

/* ---------- Support ---------- */
.contacts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.contacts li { display: flex; }
.legal a.contact {
  flex: 1; display: flex; flex-direction: column; gap: 4px; padding: var(--s-3);
  color: var(--text); text-decoration: none; transition: border-color .2s;
}
.legal a.contact:hover { border-color: var(--accent); color: var(--text); }
.contact__icon {
  width: 40px; height: 40px; margin-bottom: 12px; border-radius: 12px;
  display: grid; place-items: center; background: var(--chip); color: var(--accent);
}
.contact__icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.contact__title { font-size: 17px; font-weight: 600; line-height: 1.35; }
.contact__addr { font-family: var(--font-mono); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.legal a.contact:hover .contact__title { color: var(--accent-link); }

.legal .contacts + h2 { margin-top: var(--s-8); }
.legal .support__group { margin-top: var(--s-5); }
.support__cat {
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
}
.legal h3.support__cat { color: var(--accent); font-size: var(--fs-label); }
.legal .support__cat + .faq__list { margin-top: var(--s-2); }
.faq__item h4 { margin: 0; font-size: inherit; font-weight: inherit; }
.support .faq__btn { padding: 22px 0; font-size: 18px; }
.support .faq__a p { font-size: 16px; }

.support__links {
  display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4);
  margin-top: var(--s-8) !important; padding-top: var(--s-3); border-top: 1px solid var(--border-soft);
  font-size: 15px;
}
.legal .support__links a { color: var(--muted); text-decoration: none; }
.legal .support__links a:hover { color: var(--accent-link); }

/* ---------- Delete account ---------- */
.legal__steps { counter-reset: step; display: grid; gap: 12px; }
.legal__steps li {
  counter-increment: step; position: relative;
  min-height: 32px; padding-left: 48px; padding-top: 2px;
}
.legal__steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--chip); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--accent);
}
.callout {
  padding: 20px var(--s-3); border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--accent);
}
.legal .callout { margin-top: var(--s-3); }
.callout__title { font-weight: 700; color: var(--text); }
.callout__title + p { margin-top: 4px; }

/* ---------- Articles (guides, comparisons) ---------- */
.legal .article__cta { margin-top: var(--s-4); }
.legal .article__cta a { text-decoration: none; }
.legal .legal__steps + p { margin-top: var(--s-3); }

/* ---------- 404 ---------- */
.page--center { min-height: calc(100vh - var(--nav-h)); display: flex; align-items: center; }
.notfound { display: flex; flex-direction: column; align-items: center; text-align: center; }
.notfound .lead { margin-inline: auto; }
.notfound .btn { margin-top: var(--s-5); }

/* ---------- App link fallbacks (/join, /profile) ---------- */
.invite .lead { margin-top: var(--s-3); max-width: 560px; }
.invite__code {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--s-2); margin-top: var(--s-4);
  padding: 12px 12px 12px var(--s-3); border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border);
}
.invite__code[hidden] { display: none; }
.invite__code-value { font-family: var(--font-mono); font-size: 28px; font-weight: 700; letter-spacing: .08em; color: var(--text); }
.notfound .invite__copy { margin-top: 0; height: 40px; padding: 0 16px; font-size: 14px; }
.invite__actions { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); margin-top: var(--s-5); }
.notfound .invite__actions .btn { margin-top: 0; }
.invite__actions .btn[hidden] { display: none; }

/* ---------- Tablet / mobile ---------- */
@media (max-width: 1199px) {
  .contacts { gap: 12px; }
  .legal a.contact { padding: 20px; }
}

@media (max-width: 768px) {
  .page { padding-block: var(--s-6) var(--s-10); }
  .legal { font-size: 16px; line-height: 1.65; }
  .legal section { margin-top: var(--s-6); }
  .legal h2 { font-size: 24px; }
  .legal h3 { font-size: 18px; }
  /* Tables become one card per row, each cell labelled with its column name */
  .table-wrap { overflow: visible; border: 0; border-radius: 0; background: none; }
  .legal table, .legal tbody, .legal tr, .legal td { display: block; width: auto; min-width: 0; }
  .legal thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .legal tbody tr { padding: 4px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); }
  .legal tbody tr + tr { margin-top: 12px; }
  .legal td { padding: 12px 0; font-size: 15px; border-left: 0 !important; border-bottom: 1px solid var(--border-soft); }
  .legal tbody tr td:last-child { border-bottom: 0; }
  .legal td::before {
    content: attr(data-label); display: block; margin-bottom: 4px;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  }
  .legal td:first-child { font-weight: 600; }
  .contacts { grid-template-columns: minmax(0, 1fr); }
  .support .faq__btn { min-height: 64px; padding: 18px 0; font-size: 17px; }
  .support .faq__a p { font-size: 15px; }
}
