/*
 * legal.css — TCG Mart London Legal Page System
 * Depends on tokens.css, base.css, components.css being loaded first.
 * Enqueued only on legal page templates.
 */

/* ── Page wrapper ─────────────────────────────────────────── */

.legal-wrap {
  background: var(--paper-2);
  padding-block: var(--s-9);
}

@media (max-width: 1023px) {
  .legal-wrap { padding-block: 56px; }
}

@media (max-width: 767px) {
  .legal-wrap { padding-block: 40px; }
}

/* ── Two-column grid ──────────────────────────────────────── */

.legal-page {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 64px;
  max-width: var(--col);
  margin-inline: auto;
  padding-inline: var(--s-6);
}

@media (max-width: 767px) {
  .legal-page { padding-inline: 20px; }
}

/* ── Desktop sticky TOC ───────────────────────────────────── */

.lp-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  font-size: 13px;
}

.lp-toc .lp-toc-title {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin-bottom: 14px;
}

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

.lp-toc li {
  counter-increment: lpc;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  line-height: 1.4;
}

.lp-toc li::before {
  content: counter(lpc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
  margin-right: 10px;
}

.lp-toc li.active { color: var(--ink); }
.lp-toc li.active::before { color: var(--amber-deep); }
.lp-toc a { color: inherit; }
.lp-toc li:hover { color: var(--ink); }

/* ── Mobile TOC (details/summary) ────────────────────────── */

.lp-toc-mobile { display: none; }

.lp-toc-mobile summary {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  cursor: pointer;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

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

.lp-toc-mobile summary::after {
  content: "+";
  font-size: 16px;
  color: var(--ink-3);
}

.lp-toc-mobile[open] summary::after { content: "−"; }

.lp-toc-mobile ol {
  list-style: none;
  padding: 0;
  margin: 8px 0 24px;
  counter-reset: lpcm;
}

.lp-toc-mobile li {
  counter-increment: lpcm;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
}

.lp-toc-mobile li::before {
  content: counter(lpcm, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
  margin-right: 10px;
}

.lp-toc-mobile a { color: inherit; }
.lp-toc-mobile li:hover { color: var(--ink); }

/* ── Main column ──────────────────────────────────────────── */

.lp-main { max-width: 64ch; }

/* ── Breadcrumb ───────────────────────────────────────────── */

.lp-crumbs {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 32px;
}

.lp-crumbs .now { color: var(--ink); }

/* ── Eyebrow ──────────────────────────────────────────────── */

.lp-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.lp-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

/* ── Title ────────────────────────────────────────────────── */

.lp-title {
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin: 0 0 16px;
  color: var(--ink);
  max-width: 22ch;
}

.lp-title .ital {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--amber-deep);
}

/* ── Dek ──────────────────────────────────────────────────── */

.lp-dek {
  font-size: 18px;
  color: var(--ink-2);
  max-width: 56ch;
  line-height: 1.5;
  margin: 0 0 24px;
}

/* ── Meta strip ───────────────────────────────────────────── */

.lp-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  margin: 32px 0 40px;
}

.lp-meta .cell {
  padding: 16px 24px 16px 0;
  border-right: 1px dashed var(--line);
}

.lp-meta .cell:last-child { border-right: none; }

.lp-meta .k {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.lp-meta .v {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ── Summary card ─────────────────────────────────────────── */

.lp-summary {
  background: var(--amber-soft);
  border: 1px solid var(--amber-soft);
  border-radius: var(--r-md);
  padding: 22px 24px;
  margin: 0 0 48px;
}

.lp-summary .label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber-deep);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lp-summary .label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber-deep);
  flex-shrink: 0;
}

.lp-summary p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
  max-width: 54ch;
}

/* ── Body typography ──────────────────────────────────────── */

.lp-body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-2);
  font-variant-numeric: oldstyle-nums;
}

.lp-body h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--ink);
  margin: 56px 0 8px;
  line-height: 1.15;
  scroll-margin-top: 100px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.lp-body h2 .sn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--ink-4);
  font-weight: 400;
  text-transform: uppercase;
  flex-shrink: 0;
}

.lp-body h2 .anchor {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity var(--t-micro);
  align-self: center;
  flex-shrink: 0;
  text-decoration: none;
}

.lp-body h2:hover .anchor { opacity: 1; }
.lp-body h2 .anchor:hover { color: var(--ink-2); }

.lp-body h2 + p.section-summary {
  color: var(--ink-3);
  font-size: 14px;
  font-family: var(--mono);
  margin: 0 0 24px;
  max-width: 56ch;
  line-height: 1.5;
  letter-spacing: 0;
  font-variant-numeric: normal;
}

.lp-body h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 32px 0 10px;
  line-height: 1.3;
}

.lp-body p { margin: 0 0 16px; }

.lp-body ul,
.lp-body ol {
  padding-left: 20px;
  margin: 0 0 20px;
  color: var(--ink-2);
}

.lp-body ul li,
.lp-body ol li {
  margin-bottom: 8px;
  padding-left: 4px;
}

.lp-body ul li::marker { color: var(--ink-4); }

.lp-body ol li::marker {
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 0.85em;
}

.lp-body strong { color: var(--ink); }

.lp-body a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--t-micro);
}

.lp-body a:hover { color: var(--amber-deep); }

/* ── Definitions list ─────────────────────────────────────── */

.lp-defs {
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

.lp-def {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.lp-def .t {
  font-weight: 600;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.4;
}

.lp-def .d {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
}

/* ── Contact box ──────────────────────────────────────────── */

.lp-contact {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px 22px;
  margin: 32px 0;
}

.lp-contact .label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.lp-contact .v {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.lp-contact .v a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.lp-contact .v a:hover { color: var(--amber-deep); }

/* ── Cookie / data table ──────────────────────────────────── */

.lp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 24px 0;
}

.lp-table th {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  text-align: left;
  padding: 0 16px 10px 0;
  border-bottom: 1px solid var(--ink);
  font-weight: 500;
  font-variant-numeric: normal;
}

.lp-table td {
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-2);
  line-height: 1.5;
}

.lp-table td:first-child {
  font-family: var(--mono);
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

/* ── Sources ──────────────────────────────────────────────── */

.lp-sources {
  border-top: 1px solid var(--ink);
  margin-top: 64px;
  padding-top: 24px;
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
}

.lp-sources h4 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin: 0 0 14px;
  font-weight: 500;
}

.lp-sources ol {
  padding-left: 20px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.lp-sources ol li { margin-bottom: 6px; }

.lp-sources a {
  color: var(--ink-2);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.lp-sources a:hover { color: var(--ink); }

/* ── Revision history ─────────────────────────────────────── */

.lp-history {
  border-top: 1px solid var(--ink);
  margin-top: 48px;
  padding-top: 24px;
}

.lp-history h4 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin: 0 0 14px;
  font-weight: 500;
}

.lp-history table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lp-history td {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-2);
}

.lp-history td:first-child {
  font-family: var(--mono);
  color: var(--ink);
  width: 110px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lp-history td:nth-child(2) {
  font-family: var(--mono);
  color: var(--ink-3);
  width: 70px;
}

/* ── Document footer actions ──────────────────────────────── */

.lp-foot-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.lp-foot-actions .group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lp-foot-actions .updated {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1000px) {
  .legal-page {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .lp-toc { display: none; }
  .lp-toc-mobile { display: block; }
}

@media (max-width: 767px) {
  .lp-title { font-size: 34px; }

  .lp-summary p { font-size: 17px; }
  .lp-summary { padding: 18px; }

  .lp-body h2 {
    font-size: 22px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .lp-body h2 .sn {
    order: -1;
    width: 100%;
    display: block;
    margin-bottom: 2px;
  }

  .lp-body h2 .anchor { display: none; }
}

@media (max-width: 600px) {
  .lp-meta { grid-template-columns: 1fr; }

  .lp-meta .cell {
    border-right: none;
    border-bottom: 1px dashed var(--line);
    padding-right: 0;
  }

  .lp-meta .cell:last-child { border-bottom: none; }

  .lp-def {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .lp-foot-actions { flex-direction: column; align-items: flex-start; }
  .lp-foot-actions .group { width: 100%; }

  .lp-table td:first-child,
  .lp-history td:first-child {
    white-space: normal;
  }
}

/* ── Print ────────────────────────────────────────────────── */

@media print {
  .lp-toc,
  .lp-toc-mobile,
  .lp-crumbs,
  .lp-foot-actions {
    display: none !important;
  }

  .legal-page {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    max-width: 100%;
  }

  .legal-wrap {
    background: white;
    padding: 0;
  }

  .lp-main { max-width: 100%; }
  .lp-title { font-size: 24pt; }
  .lp-dek { font-size: 12pt; }
  .lp-body { font-size: 11pt; line-height: 1.45; color: black; }
  .lp-body h2 { font-size: 15pt; break-after: avoid; margin-top: 28pt; }
  .lp-body h3 { font-size: 12pt; break-after: avoid; }

  .lp-body a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: var(--ink-3);
  }

  .lp-body a[href^="#"]::after { content: none; }

  @page { margin: 22mm 18mm 22mm 18mm; }
}
