/* Mental Math support & privacy pages.
   Colours follow MentalMath/UI/Theme/Theme.swift: squared notebook paper,
   a red margin line, yellow highlighter and the green teacher's pen. */

@font-face {
  font-family: "Caveat";
  src: url("/mental-math/assets/caveat.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --paper: #fbf8f1;
  --grid: #dce5ef;
  --margin: #eba7a7;
  --rule: #b9c6d8;
  --ink: #1e2f5c;
  --ink-secondary: #5b6474;
  --pen: #2e7d4f;
  --pen-edge: #1f5e3a;
  --highlight: #ffe66d;
  --on-highlight: #1e2f5c;
  --focus: #23407a;
  /* Where the highlighter stroke starts and ends, as a share of line height.
     In dark mode the text on the stroke is dark, so the stroke must cover the
     whole line or the letters' tops vanish into the paper. */
  --marker-from: 48%;
  --marker-to: 92%;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1f2b28;
    --grid: rgb(237 235 227 / 0.07);
    --margin: rgb(184 96 90 / 0.7);
    --rule: rgb(237 235 227 / 0.22);
    --ink: #f6f4ec;
    --ink-secondary: #a9b3ae;
    --pen: #7fd6a0;
    --pen-edge: #b5ebc8;
    --highlight: #f4d35e;
    --on-highlight: #1f2b28;
    --focus: #f4d35e;
    --marker-from: 0%;
    --marker-to: 100%;
  }
}

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

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.page {
  max-width: 44rem;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 1rem 0 2.25rem;
  border-left: 2px solid var(--margin);
  display: flex;
  flex-direction: column;
}

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  padding: 1.25rem 0 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.app-name {
  font-family: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.1;
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
}

.site-nav ul {
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 0.25rem 0.125rem;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  border-bottom-color: var(--rule);
}

/* Active page: a highlighter stroke plus a weight change, not colour alone. */
.site-nav a[aria-current="page"] {
  font-weight: 600;
  color: var(--on-highlight);
  background: linear-gradient(transparent var(--marker-from), var(--highlight) var(--marker-from), var(--highlight) var(--marker-to), transparent var(--marker-to));
}

.lang-switch {
  display: flex;
  gap: 0.375rem;
  padding-left: 1rem;
  border-left: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.lang-switch [aria-current="true"] {
  font-weight: 700;
}

.lang-switch a {
  color: var(--pen);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Content */

main {
  flex: 1;
  padding: 2rem 0 3rem;
}

h1,
h2 {
  font-family: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  font-weight: 600;
  line-height: 1.15;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 2.75rem;
}

h1 .marker {
  color: var(--on-highlight);
  background: linear-gradient(transparent var(--marker-from), var(--highlight) var(--marker-from), var(--highlight) var(--marker-to), transparent var(--marker-to));
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 0.15em;
}

.subtitle {
  margin: 0 0 2rem;
  color: var(--ink-secondary);
}

h2 {
  margin: 2.25rem 0 0.5rem;
  font-size: 1.875rem;
}

h3 {
  margin: 1.5rem 0 0.25rem;
  font-size: 1.0625rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--pen);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--pen-edge);
}

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

.email {
  font-size: 1.1875rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.faq h3 {
  color: var(--ink);
}

.faq p {
  color: var(--ink-secondary);
}

.effective-date {
  margin-top: 2.5rem;
  color: var(--ink-secondary);
  font-size: 0.9375rem;
}

/* Footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 1rem 0 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-secondary);
  font-size: 0.9375rem;
}

.site-footer ul {
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 30rem) {
  .page {
    padding-left: 1.5rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  .lang-switch {
    padding-left: 0.75rem;
  }
}
