/* Document pages: legal documents, the legal centre, About and the 404 page.
   Calm and readable. No motion at all. Light and dark follow the system through tokens.css. */

/* No motion on these pages, including the dock and page transitions. */
body.doc,
body.doc * {
  transition: none !important;
  animation: none !important;
}

body.doc {
  font-size: 17px;
  line-height: 1.65;
}

/* ---- Frame ------------------------------------------------------------------ */

/* The side gutter is the shared page inset, so titles and body text line up with the footer and other pages. */
body.doc main {
  padding-inline: 0;
}

.doc-wrap {
  padding-inline: var(--page-inset);
}

/* Reading measure: text lines stay within about 68 characters. Wide tables scroll inside their own box. */
.doc-head,
.glance,
.doc-next,
.legal-app,
.doc-wrap .note {
  max-width: 68ch;
}

.doc-head {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.doc-app {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 600;
}

.doc-app .app-icon {
  display: block;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
}

.doc-app .app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doc-app .doc-mark {
  flex: none;
  width: 40px;
  height: 40px;
}

.doc-wrap h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin: 0;
}

.doc-date {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
}

.doc-lead {
  margin: 0;
  font-size: 19px;
  line-height: 1.5;
  color: var(--text);
}

/* Headings below the h1 use the system text face. Funnel Display is for the h1 only. */
.doc-wrap h2,
.doc-wrap h3 {
  font-family: var(--font-text);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  font-size: 22px;
}

/* ---- At a glance ------------------------------------------------------------ */

.glance {
  margin-top: 36px;
}

.glance h2 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--text-2);
}

.glance-list {
  list-style: none;
}

.glance-list li {
  padding: 16px 20px;
  line-height: 1.5;
}

.glance-list li + li {
  border-top: 1px solid var(--line);
}

/* ---- Body, table of contents and reading column ----------------------------- */

.doc-grid {
  display: grid;
  gap: 24px;
  margin-top: 40px;
}

.doc-grid > * {
  min-width: 0;
}

.prose {
  max-width: 68ch;
  overflow-wrap: break-word;
}

.prose section {
  scroll-margin-top: 24px;
}

.prose section + section {
  margin-top: 40px;
}

.prose h2 {
  margin: 0 0 12px;
}

.prose h2 .num {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  margin-right: 0.2em;
}

.prose p,
.prose ul,
.prose ol,
.prose dl,
.prose .table {
  margin: 0 0 16px;
}

.prose p:last-child,
.prose ul:last-child,
.prose ol:last-child {
  margin-bottom: 0;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: 6px;
}

.prose .note {
  color: var(--text-2);
  font-size: 15px;
}

.prose .steps li + li {
  margin-top: 10px;
}

.prose .qa dt {
  margin-top: 18px;
  font-weight: 600;
}

.prose .qa dt:first-child {
  margin-top: 0;
}

.prose .qa dd {
  margin: 4px 0 0;
}

.toc {
  font-size: 15px;
  line-height: 1.35;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li a {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-height: 44px;
  padding: 10px 0;
  color: var(--text-2);
  text-decoration: none;
}

.toc li a:hover {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.toc .num {
  flex: none;
  min-width: 1.6em;
  font-variant-numeric: tabular-nums;
}

.toc-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

/* Wide screens: the contents sit beside the article and stay in view while reading. */
.toc-wide {
  display: none;
}

/* Phones: a closed details element, so the document starts with its text. */
.toc-narrow {
  border-radius: 16px;
  background: var(--page-2);
}

.toc-narrow summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

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

.toc-narrow summary::after {
  content: "";
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: rotate(45deg);
}

.toc-narrow[open] summary::after {
  transform: rotate(-135deg);
}

.toc-narrow nav {
  padding: 0 20px 12px;
}

@media (min-width: 960px) {
  .doc-grid.has-toc {
    grid-template-columns: 220px minmax(0, 68ch);
    column-gap: 72px;
    align-items: start;
  }

  .toc-wide {
    display: block;
    position: sticky;
    top: 32px;
    max-height: calc(100svh - 64px);
    overflow-y: auto;
  }

  .toc-narrow {
    display: none;
  }
}

/* ---- Links and buttons in the body ------------------------------------------ */

.doc-wrap a {
  color: var(--marigold-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.doc-wrap a:hover {
  text-decoration-thickness: 2px;
}

/* Components are not inline text links, so they keep their own colours and drop the underline. */
.doc-wrap .toc a,
.doc-wrap .group-row,
.doc-wrap .pill,
.doc-wrap .btn {
  text-decoration: none;
}

.doc-wrap a.pill {
  color: var(--page);
}

.doc-wrap a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--text);
  color: var(--page);
  font-weight: 600;
}

.doc-wrap .group-row {
  color: var(--text);
  min-height: 56px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.doc-wrap .group-row.has-icon {
  min-height: 64px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.doc-wrap .group-row-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.doc-wrap .group-row-title {
  font-weight: 600;
  font-size: 17px;
}

.doc-wrap .app-icon {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  overflow: hidden;
}

.doc-wrap .app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Tables: they scroll inside their own container, never across the page --- */

.doc-wrap .table {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
}

.doc-wrap .table table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.45;
}

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

.doc-wrap .table tr:last-child th,
.doc-wrap .table tr:last-child td {
  border-bottom: 0;
}

.doc-wrap .table thead th {
  background: var(--page-2);
  color: var(--text-2);
  font-weight: 600;
}

.doc-wrap .table tbody th[scope="row"] {
  font-weight: 600;
}

/* Phones: each row becomes a card, and each cell shows its column name above its value.
   thead stays in the markup, visually hidden, so screen readers still get the column names. */
@media (max-width: 640px) {
  .prose .table {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .prose .table table,
  .prose .table tbody,
  .prose .table tr,
  .prose .table th,
  .prose .table td {
    display: block;
  }

  .prose .table table {
    width: 100%;
    min-width: 0;
  }

  .prose .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .prose .table tr {
    padding: 16px 0;
    border-top: 1px solid var(--line);
  }

  .prose .table tr:last-child {
    border-bottom: 0;
  }

  .prose .table th,
  .prose .table td {
    padding: 0;
    border: 0;
  }

  .prose .table th[scope="row"] {
    width: 100%;
    font-weight: 600;
    padding-bottom: 4px;
  }

  .prose .table td::before {
    content: attr(data-label);
    display: block;
    margin-top: 10px;
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
  }
}

/* ---- Lists of pages: the legal centre, siblings and About -------------------- */

.legal-apps {
  display: grid;
  gap: 0;
}

.legal-app {
  margin-top: 48px;
}

.legal-app h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}

.legal-app h2 a {
  color: var(--text);
  text-decoration: none;
}

.legal-app h2 .app-icon {
  display: block;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
}

.legal-app h2 .app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doc-next {
  margin-top: 64px;
}

.doc-next h2 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--text-2);
}

.doc-404 .doc-head {
  margin-top: 24px;
}

.doc-404 .prose {
  margin-top: 24px;
}

.doc-404 .doc-next {
  margin-top: 40px;
}

.doc-404 .prose p + p {
  margin-top: 20px;
}

.doc-wrap .note {
  margin-top: 32px;
  color: var(--text-2);
  font-size: 15px;
}

/* ---- Print: the text alone, without the dock, footer or navigation ------------ */

@media print {
  .dock,
  .foot,
  .skip,
  .toc,
  .doc-next {
    display: none !important;
  }

  body.doc {
    background: #FFFFFF;
    color: #000000;
    font-size: 11pt;
    line-height: 1.5;
  }

  .doc-wrap a,
  .doc-wrap a:visited {
    color: #000000;
    text-decoration: underline;
  }

  .doc-wrap .table {
    overflow: visible;
  }

  .doc-grid.has-toc {
    display: block;
  }

  .doc-wrap h1,
  .doc-wrap h2 {
    break-after: avoid;
  }

  .prose section {
    break-inside: auto;
  }
}
