/* MarAI Keyboard legal pages. Self-contained: no web fonts, scripts,
   trackers or third-party requests, matching what the privacy policy says. */

:root {
  --foam: #f3f7f9;
  --surface: #e6f0f5;
  --key: #ffffff;
  --key-edge: #b9c9d4;
  --deep: #0b3a55;
  --ink: #1d2a33;
  --muted: #53636e;
  --line: #d3e0e7;
  --tide: #11669a;
  --spray: #56c3e6;
  --rounded: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", Charter, "Charter BT", Georgia, "Times New Roman", serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --foam: #06202e;
    --surface: #0d2d3f;
    --key: #163a4f;
    --key-edge: #03131c;
    --deep: #e4f2f8;
    --ink: #d5e4eb;
    --muted: #9bb2bf;
    --line: #1c4257;
    --tide: #7fd3f1;
    --spray: #2aa4d2;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--foam);
  color: var(--ink);
  font: 400 1.0625rem/1.72 var(--serif);
  text-rendering: optimizeLegibility;
}

a { color: var(--tide); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--tide); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--key); color: var(--deep); padding: 0.6rem 1rem;
  border-radius: 10px; font: 600 0.9375rem var(--rounded);
}
.skip:focus { top: 1rem; }

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

.wrap { max-width: 72rem; margin: 0 auto; padding-inline: 1.25rem; }

/* Header */
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding-block: 1.1rem;
}
.brand {
  font: 650 1.0625rem/1 var(--rounded); color: var(--deep);
  text-decoration: none; letter-spacing: -0.01em;
}
.site-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.site-nav a {
  font: 500 0.9375rem/1 var(--rounded); color: var(--muted);
  text-decoration: none; padding: 0.5rem 0.75rem; border-radius: 999px;
}
.site-nav a:hover { color: var(--deep); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--deep); background: var(--key); box-shadow: 0 1px 0 var(--key-edge); }

/* Hero: the page name typed on keycaps, resting on the wave from the app icon */
.hero { padding-block: 2.5rem 2.75rem; }
.keys { display: flex; gap: clamp(0.3rem, 1vw, 0.5rem); flex-wrap: wrap; margin: 0; }
.key {
  display: grid; place-items: center;
  width: clamp(2.35rem, 9vw, 3.9rem); height: clamp(2.6rem, 10vw, 4.3rem);
  background: var(--key); color: var(--deep);
  border-radius: clamp(8px, 1.6vw, 13px);
  box-shadow: 0 3px 0 var(--key-edge), 0 10px 24px -14px rgba(11, 58, 85, 0.45);
  font: 600 clamp(1.45rem, 5.2vw, 2.55rem)/1 var(--rounded);
  animation: press 520ms cubic-bezier(.3,.7,.3,1) both;
  animation-delay: calc(var(--i, 0) * 70ms + 120ms);
}
@keyframes press {
  0% { transform: translateY(0); box-shadow: 0 3px 0 var(--key-edge), 0 10px 24px -14px rgba(11,58,85,.45); }
  35% { transform: translateY(3px); box-shadow: 0 0 0 var(--key-edge), 0 4px 10px -8px rgba(11,58,85,.35); }
  100% { transform: translateY(0); box-shadow: 0 3px 0 var(--key-edge), 0 10px 24px -14px rgba(11,58,85,.45); }
}
@media (prefers-reduced-motion: reduce) { .key { animation: none; } }

.wave { display: block; width: min(100%, 34rem); height: 1.6rem; margin-top: 0.6rem; color: var(--spray); }

.lede {
  max-width: 40rem; margin: 1.5rem 0 0;
  font: 450 clamp(1.15rem, 2.6vw, 1.4rem)/1.5 var(--rounded);
  color: var(--deep); letter-spacing: -0.005em;
}
.meta { margin: 0.9rem 0 0; font: 400 0.9375rem/1.5 var(--rounded); color: var(--muted); }

.changes { max-width: 40rem; margin-top: 1.25rem; font-family: var(--rounded); font-size: 0.9375rem; }
.changes summary { cursor: pointer; color: var(--tide); font-weight: 550; width: fit-content; }
.changes ul { margin: 0.6rem 0 0; padding-left: 1.2rem; color: var(--ink); }
.changes li { margin: 0.25rem 0; }

/* Document layout */
.doc {
  display: grid; grid-template-columns: 14.5rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem); align-items: start;
  padding-bottom: 4rem;
}
.toc {
  position: sticky; top: 1.25rem; max-height: calc(100vh - 2.5rem); overflow-y: auto;
  font: 400 0.875rem/1.35 var(--rounded); padding-right: 0.25rem;
}
.toc p { margin: 0 0 0.6rem; font-weight: 600; color: var(--deep); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a {
  display: block; padding: 0.32rem 0 0.32rem 0.85rem; margin-left: -1px;
  color: var(--muted); text-decoration: none; border-left: 2px solid transparent;
}
.toc li a:hover { color: var(--deep); border-left-color: var(--spray); }
.toc-mobile { display: none; }

article { max-width: 43rem; min-width: 0; }
article > section { scroll-margin-top: 1rem; }
article > section + section { margin-top: 3rem; }

h1, h2, h3 { font-family: var(--rounded); color: var(--deep); letter-spacing: -0.012em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.6rem); line-height: 1.25; font-weight: 650; margin: 0 0 0.8rem; }
h2 .n { color: var(--muted); font-weight: 500; margin-right: 0.35em; font-variant-numeric: tabular-nums; }
h3 { font-size: 1.1rem; line-height: 1.35; font-weight: 620; margin: 1.8rem 0 0.4rem; }
p { margin: 0.8rem 0; }
ul, ol { padding-left: 1.3rem; margin: 0.8rem 0; }
li { margin: 0.35rem 0; }
li::marker { color: var(--muted); }
strong { font-weight: 650; color: var(--deep); }
.path { font-family: var(--rounded); font-size: 0.95em; font-weight: 550; color: var(--deep); white-space: normal; }

.glance { list-style: none; padding: 0; margin: 1rem 0; }
.glance li {
  font: 450 1.0625rem/1.5 var(--rounded); color: var(--ink);
  padding: 0.2rem 0 0.2rem 1rem; margin: 0.9rem 0; border-left: 3px solid var(--spray);
}

.note {
  background: var(--surface); border-radius: 14px; padding: 1rem 1.2rem; margin: 1.2rem 0;
}
.note > :first-child { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }
.legal-emphasis { font-weight: 600; color: var(--deep); }

.table-wrap { overflow-x: auto; margin: 1.2rem 0; border-radius: 14px; background: var(--key); box-shadow: 0 1px 0 var(--key-edge); }
table { width: 100%; min-width: 38rem; border-collapse: collapse; font-size: 0.95rem; line-height: 1.5; }
caption { text-align: left; padding: 0.9rem 1rem 0; font: 600 0.9375rem var(--rounded); color: var(--deep); }
th, td { text-align: left; vertical-align: top; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); }
th { font: 600 0.8125rem/1.3 var(--rounded); color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { font-family: var(--rounded); font-weight: 560; color: var(--deep); }

.qa { margin: 0; }
.qa details { border-bottom: 1px solid var(--line); }
.qa summary {
  cursor: pointer; list-style: none; padding: 1rem 2rem 1rem 0; position: relative;
  font: 560 1.075rem/1.4 var(--rounded); color: var(--deep);
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: ""; position: absolute; right: 0.3rem; top: 1.35rem; width: 0.55rem; height: 0.55rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 160ms ease;
}
.qa details[open] summary::after { transform: rotate(-135deg); top: 1.6rem; }
.qa .answer { padding-bottom: 1rem; }
.qa .answer > :first-child { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .qa summary::after { transition: none; } }

.doc-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 0; padding: 0; list-style: none; max-width: 40rem; }
.doc-links li { flex: 1 1 15rem; margin: 0; }
.doc-links a {
  display: block; height: 100%; text-decoration: none; background: var(--key); color: var(--deep);
  border-radius: 12px; padding: 0.85rem 1.1rem; box-shadow: 0 2px 0 var(--key-edge);
  font: 600 1rem/1.2 var(--rounded);
}
.doc-links a span { display: block; font-weight: 400; font-size: 0.875rem; color: var(--muted); margin-top: 0.2rem; }
.doc-links a:hover { transform: translateY(1px); box-shadow: 0 1px 0 var(--key-edge); }
.doc-links a:active { transform: translateY(2px); box-shadow: 0 0 0 var(--key-edge); }

.site-footer { border-top: 1px solid var(--line); }
.site-footer .wrap {
  padding-block: 1.75rem 2.5rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font: 400 0.875rem/1.5 var(--rounded); color: var(--muted);
}
.site-footer p { margin: 0; }
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 56rem) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .toc { display: none; }
  .toc-mobile {
    display: block; background: var(--key); border-radius: 14px; box-shadow: 0 1px 0 var(--key-edge);
    font: 400 0.9375rem/1.4 var(--rounded); margin-bottom: 2rem;
  }
  .toc-mobile summary { cursor: pointer; padding: 0.85rem 1rem; font-weight: 600; color: var(--deep); }
  .toc-mobile ol { margin: 0; padding: 0 1rem 0.9rem 2.2rem; }
  .toc-mobile li { margin: 0.3rem 0; }
  .toc-mobile a { color: var(--ink); text-decoration: none; }
  .toc-mobile a:hover { color: var(--tide); text-decoration: underline; }
}

@media (max-width: 40rem) {
  .table-wrap { overflow: visible; background: transparent; box-shadow: none; }
  .table-wrap table { min-width: 0; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; }
  .table-wrap tr { background: var(--key); border-radius: 14px; box-shadow: 0 1px 0 var(--key-edge); padding: 0.4rem 0; margin-bottom: 0.75rem; }
  .table-wrap td { border: 0; padding: 0.35rem 1rem; }
  .table-wrap td:first-child { font-size: 1.02rem; padding-top: 0.6rem; }
  .table-wrap td:not(:first-child)::before {
    content: attr(data-label); display: block; font: 600 0.8125rem/1.3 var(--rounded); color: var(--muted);
  }
}

@media print {
  :root { --foam: #fff; --surface: #fff; --key: #fff; --ink: #000; --deep: #000; --muted: #333; --tide: #000; --line: #999; }
  body { font-size: 11pt; }
  .skip, .site-nav, .toc, .toc-mobile, .wave, .changes summary { display: none !important; }
  .changes ul { display: block; }
  .key { box-shadow: none; border: 1px solid #999; animation: none; }
  .doc { display: block; }
  article { max-width: none; }
  .note, .table-wrap { border: 1px solid #999; box-shadow: none; }
  article a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  section { break-inside: auto; }
  h2, h3 { break-after: avoid; }
}
