/*
 * Legal pages for Q-Learn, QF-Learn and M-Learn.
 *
 * One quiet layout for all three apps; each app only changes the accent,
 * taken from its icon. Every colour pair used for text meets WCAG AA in both
 * the light and the dark scheme.
 */

/* Inter, served from this site (SIL Open Font License, public/fonts/OFL.txt)
   so that reading these pages sends nothing to a font host. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --ink: #16181d;
  --ink-2: #3d4250;
  --ink-3: #5f6573;
  --line: #e6e7eb;
  --line-2: #d5d7dd;
  --warn-bg: #fff7e6;
  --warn-line: #f0a500;

  --accent: #5b21b6;
  --accent-strong: #4c1d95;
  --accent-soft: #f3eefe;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1160px;
  --prose: 44rem;
  --radius: 12px;
  --header-h: 0px; /* the header only sticks on wide screens */

  color-scheme: light;
}

body[data-app="qf-learn"] {
  --accent: #0b6e4f;
  --accent-strong: #08573e;
  --accent-soft: #e8f5ef;
}

body[data-app="m-learn"] {
  --accent: #b3360c;
  --accent-strong: #8f2a0a;
  --accent-soft: #fcede6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --bg-soft: #171a21;
    --ink: #ecedef;
    --ink-2: #c6c9d1;
    --ink-3: #9aa1ad;
    --line: #262a33;
    --line-2: #343945;
    --warn-bg: #2a2110;
    --warn-line: #d69200;

    --accent: #c4b5fd;
    --accent-strong: #ddd6fe;
    --accent-soft: #221a3a;

    color-scheme: dark;
  }

  body[data-app="qf-learn"] {
    --accent: #6ee7b7;
    --accent-strong: #a7f3d0;
    --accent-soft: #10291f;
  }

  body[data-app="m-learn"] {
    --accent: #ffa27f;
    --accent-strong: #ffc4ad;
    --accent-soft: #331a10;
  }
}

/* ------------------------------------------------------------------ base -- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-strong);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
  color: var(--bg);
}

.main {
  flex: 1;
}

/* ---------------------------------------------------------------- header -- */

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 100;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand:hover {
  color: var(--ink);
}

.brand img {
  width: 36px;
  height: 36px;
  flex: none;
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.brand-name {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--ink-3);
}

.app-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
}

.app-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.app-option img {
  width: 22px;
  height: 22px;
}

.app-option:hover {
  color: var(--ink);
  background: var(--bg);
  text-decoration: none;
}

.app-option[aria-current="true"] {
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px var(--line);
}

.doc-tabs {
  border-top: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 28px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs a {
  position: relative;
  flex: none;
  padding: 12px 0;
  color: var(--ink-3);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

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

.tabs a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.tabs a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

@media (max-width: 640px) {
  .app-option {
    padding: 5px;
  }

  .app-option-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .app-option[aria-current="true"] {
    box-shadow: 0 0 0 2px var(--accent);
  }

  .tabs {
    gap: 22px;
  }

  .tab-full {
    display: none;
  }

  .print-button {
    display: none;
  }
}

@media (min-width: 641px) {
  .tab-short {
    display: none;
  }
}

/* -------------------------------------------------------- document frame -- */

.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "head"
    "toc"
    "body";
  column-gap: 64px;
  padding-top: 40px;
  padding-bottom: 56px;
}

.doc-head {
  grid-area: head;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--ink-3);
  font-size: 0.875rem;
  font-weight: 500;
}

.eyebrow img {
  width: 20px;
  height: 20px;
}

.doc-head h1,
.not-found h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 1.4rem + 2.4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}


.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin-top: 18px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.meta-label {
  color: var(--ink-3);
}

.print-button {
  margin-left: auto;
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.print-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.print-button[hidden] {
  display: none;
}

/* ----------------------------------------------------------------- toc -- */

.toc-wrap {
  grid-area: toc;
  min-width: 0;
}

.toc {
  margin-bottom: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.toc summary {
  padding: 12px 16px;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  list-style-position: inside;
}

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

.toc a {
  display: flex;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 0.875rem;
  line-height: 1.4;
  text-decoration: none;
}

.toc a:hover {
  background: var(--bg);
  color: var(--ink);
}

.toc a[aria-current="location"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.toc-num {
  flex: none;
  min-width: 1.75em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.toc a[aria-current="location"] .toc-num {
  color: inherit;
}

@media (min-width: 960px) {
  :root {
    --header-h: 112px;
  }

  .site-header {
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--bg) 97%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
  }

  .doc {
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "toc body";
    padding-top: 56px;
  }

  .doc--short {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "body";
  }

  .toc-wrap {
    position: relative;
  }

  .toc {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    margin: 0;
    border: 0;
    background: none;
  }

  .toc summary {
    padding: 0 8px 10px;
    color: var(--ink-3);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: default;
    list-style: none;
    pointer-events: none;
  }

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

  .toc ol {
    padding: 0;
  }
}

/* ---------------------------------------------------------------- prose -- */

.prose {
  grid-area: body;
  min-width: 0;
  max-width: var(--prose);
  font-size: 1.0625rem;
  line-height: 1.7;
}

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

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.1em;
}

.prose a {
  overflow-wrap: anywhere;
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.prose h2 {
  position: relative;
  margin: 2.4em 0 0.8em;
  padding-top: 1.4em;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.375rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.015em;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.prose h2:first-child {
  padding-top: 0;
  border-top: 0;
}

.prose .anchor {
  margin-left: 0.4em;
  color: var(--ink-3);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.prose h2:hover .anchor,
.prose h2:focus-within .anchor {
  opacity: 1;
}

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

.prose li {
  margin: 0.45em 0;
  padding-left: 0.2em;
}

.prose li::marker {
  color: var(--ink-3);
}

.prose ol > li::marker {
  font-variant-numeric: tabular-nums;
}

/* Disclaimers written in capitals, set as a quieter block. */
.prose .caps {
  padding: 16px 18px;
  border-left: 3px solid var(--line-2);
  border-radius: 0 8px 8px 0;
  background: var(--bg-soft);
  color: var(--ink-2);
  font-size: 0.875rem;
  line-height: 1.65;
  letter-spacing: 0.01em;
}

.prose .caps + .caps {
  margin-top: -0.6em;
}

.prose .callout {
  margin: 0 0 1.4em;
  padding: 14px 18px;
  border-left: 4px solid var(--warn-line);
  border-radius: 0 8px 8px 0;
  background: var(--warn-bg);
}

.prose .callout p {
  margin: 0;
}

.back-to-top {
  margin-top: 3em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
}

/* -------------------------------------------------------------- related -- */

.related {
  padding: 48px 0 56px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.related h2 {
  margin: 0 0 20px;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 650;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.06);
  color: var(--ink-2);
  text-decoration: none;
}

.card-title {
  color: var(--ink);
  font-weight: 600;
}

.card:hover .card-title {
  color: var(--accent);
}

.card-text {
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- 404 -- */

.not-found {
  max-width: 760px;
  padding-top: 72px;
  padding-bottom: 72px;
}

.not-found > p {
  margin: 16px 0 28px;
  font-size: 1.0625rem;
}

/* --------------------------------------------------------------- footer -- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-3);
  font-size: 0.9375rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 32px 48px;
  padding-top: 44px;
  padding-bottom: 32px;
}

.footer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--ink);
  font-weight: 650;
}

.footer-title img {
  width: 24px;
  height: 24px;
}

.footer-about p:not(.footer-title) {
  max-width: 34rem;
  margin: 0;
  line-height: 1.6;
}

.footer-col h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-col h2:not(:first-child) {
  margin-top: 22px;
}

.footer-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-col li {
  margin: 6px 0;
}

.footer-col a,
.footer-about a {
  color: var(--ink-2);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.footer-col a:hover,
.footer-about a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-bottom {
  padding-top: 18px;
  padding-bottom: 28px;
  border-top: 1px solid var(--line);
}

.footer-bottom p {
  margin: 0;
  font-size: 0.875rem;
}

@media (max-width: 760px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------- print -- */

@media print {
  :root {
    --ink: #000;
    --ink-2: #111;
    --ink-3: #444;
    --line: #ccc;
    --bg: #fff;
    --bg-soft: #fff;
    --accent: #000;
    --accent-strong: #000;
  }

  @page {
    margin: 18mm 16mm;
  }

  body {
    font-size: 10.5pt;
  }

  .skip-link,
  .site-header,
  .toc-wrap,
  .related,
  .site-footer,
  .back-to-top,
  .print-button,
  .prose .anchor {
    display: none !important;
  }

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

  .doc-head,
  .prose {
    max-width: none;
  }

  .prose {
    font-size: 10.5pt;
  }

  .prose h2 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .prose a {
    color: #000;
    text-decoration: underline;
  }

  .prose .caps,
  .prose .callout {
    background: none;
    border-left-color: #999;
  }
}
