/* ============================================================
   Polarly landing — legal.css
   Document styling for the legal pages (Terms / Privacy, uk + en).
   Loaded AFTER css/style.css and reuses its design tokens (:root),
   header (.site-header), footer (.site-footer), .container, .brand
   and .lang-switch. Plain CSS, no build step (spec 032 §3 / spec 068).
   ============================================================ */

/* Language switch rendered as links (one file per language) rather than
   the homepage's JS buttons. Kill the global anchor underline; reuse the
   pill look from style.css (.lang-switch / .lang-switch__btn). */
.lang-switch__btn,
.lang-switch__btn:hover {
  text-decoration: none;
}

/* ----------------------------- doc head -------------------------- */
.legal {
  padding-block: clamp(28px, 5vw, 48px) 0;
}

.legal-head {
  padding-bottom: clamp(20px, 3vw, 28px);
}

.eyebrow {
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.legal-head h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-top: 10px;
}

.rule {
  height: 3px;
  width: 120px;
  margin: 20px 0 16px;
  border-radius: var(--r-pill);
  background: var(--grad);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-2);
  font-size: 0.9rem;
}

.meta b {
  color: var(--text);
  font-weight: 600;
}

/* ---------------------------- layout grid ------------------------ */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding-block: 24px clamp(48px, 8vw, 72px);
}

@media (min-width: 881px) {
  .grid {
    grid-template-columns: 236px 1fr;
    gap: 44px;
  }
}

/* ------------------------------- TOC ----------------------------- */
nav.toc {
  font-size: 0.875rem;
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

nav.toc > details {
  padding: 4px 6px;
}

nav.toc summary {
  cursor: pointer;
  padding: 12px;
  font-weight: 600;
  list-style: none;
  color: var(--text);
}

nav.toc summary::-webkit-details-marker {
  display: none;
}

nav.toc summary::after {
  content: "⌄";
  float: right;
  color: var(--text-3);
}

nav.toc[open] summary::after,
nav.toc details[open] summary::after {
  content: "⌃";
}

.toc-title {
  display: none;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

nav.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: t;
}

nav.toc li {
  counter-increment: t;
  margin: 2px 0;
}

nav.toc a {
  display: flex;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r);
  color: var(--text-2);
  line-height: 1.35;
}

nav.toc a::before {
  content: counter(t, decimal-leading-zero);
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  font-weight: 600;
  opacity: 0.65;
}

nav.toc a:hover {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--text);
  text-decoration: none;
}

/* On desktop the TOC is a plain sticky sidebar: no card chrome, no
   <summary> toggle, list always open. */
@media (min-width: 881px) {
  nav.toc {
    position: sticky;
    top: 88px; /* clears the 64px sticky header + breathing room */
    align-self: start;
    margin-bottom: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    max-height: calc(100vh - 112px);
    overflow: auto;
  }

  nav.toc summary {
    display: none;
  }

  nav.toc .toc-title {
    display: block;
  }

  nav.toc details > ol {
    display: block !important;
  }
}

/* ---------------------------- content ---------------------------- */
article {
  max-width: 780px;
  min-width: 0;
}

.intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
  font-size: 0.95rem;
  margin-bottom: 30px;
}

.intro strong {
  color: var(--text);
}

section.clause {
  padding: 8px 0 6px;
  scroll-margin-top: 88px; /* sticky header height + gap, so anchors don't hide */
}

section.clause h2 {
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 30px 0 10px;
  display: flex;
  gap: 12px;
  align-items: baseline;
}

section.clause h2 .num {
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 700;
  min-width: 26px;
}

section.clause h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 18px 0 6px;
}

article p {
  margin: 0 0 12px;
}

article ul {
  margin: 6px 0 14px;
  padding-left: 20px;
  list-style: disc;
}

article ol {
  margin: 6px 0 14px;
  padding-left: 22px;
  list-style: decimal;
}

article li {
  margin: 6px 0;
}

/* Callout — mirrors the app's single-construction callout (spec 033):
   semantic tint + left accent bar, color carries the meaning. */
.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-radius: var(--r);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 0.95rem;
}

.callout b {
  display: block;
  margin-bottom: 4px;
}

/* ----------------------------- tables ---------------------------- */
/* Tables sit in a .tablecard wrapper (existing markup): a surface card
   that also scrolls horizontally on narrow screens. */
.tablecard {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
  background: var(--surface);
  margin: 12px 0 20px;
}

.tablecard table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9rem;
}

.tablecard th,
.tablecard td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.tablecard th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  background: var(--surface-2);
}

.tablecard td {
  color: var(--text-2);
}

.tablecard tbody tr:last-child td {
  border-bottom: none;
}

/* ------------------------- back-to-top / .ph --------------------- */
.top {
  display: inline-block;
  margin-top: 6px;
}

/* Former template placeholders now hold final values — render as plain
   text (no dashed underline that would read as "not filled in"). */
.ph {
  background: none;
  border: 0;
  padding: 0;
  font-weight: inherit;
  white-space: normal;
}

/* ----------------------------- footer ---------------------------- */
.legal-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

/* ----------------------------- print ----------------------------- */
@media print {
  .site-header,
  nav.toc,
  .top,
  .lang-switch,
  .legal-footer__links {
    display: none;
  }

  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
  }

  .grid {
    display: block;
    padding: 0;
  }

  .rule {
    background: #000;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .callout,
  .intro,
  .tablecard {
    box-shadow: none;
  }
}
