/* BUBU legal pages: privacy.html and terms.html.
   A light page on purpose. These are documents people read slowly, sometimes print,
   and need to trust; dark-on-light at high contrast is what reads best at length.
   The ground is a faint lavender off-white, never pure #fff, so it still belongs to
   the purple brand without tinting the text. Fonts are self-hosted from /fonts --
   a privacy policy that loads Google Fonts would itself be sending visitors' IP
   addresses to a third party. */

@font-face {
  font-family: 'Inter';
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Sora';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/sora-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Sora';
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/sora-latin-700-normal.woff2') format('woff2');
}

/* `only light`, not `light`: browsers with a forced dark mode (Samsung Internet,
   Chrome's auto-dark) repaint any page that merely prefers light, which turned this
   off-white page dark grey on a Galaxy Tab. `only` is the opt-out they honour. */
:root {
  color-scheme: only light;
  --bg: #f7f5fa;          /* off-white, lavender-tinted */
  --paper: #fdfcfe;       /* cards: a step lighter, still not pure white */
  --ink: #1c1823;         /* body text, ~16:1 on --bg */
  --ink-2: #463f52;       /* secondary text, ~9:1 */
  --ink-3: #6a6275;       /* captions, ~5.5:1 */
  --line: #e2dbea;
  --accent: #6b21a8;      /* purple, ~8.5:1 on --bg, safe for links */
  --accent-soft: #f1e8fa;
  --warn: #8a3b00;
  --warn-soft: #fdf1e6;
  --display: 'Sora', 'Segoe UI', Roboto, system-ui, sans-serif;
  --body: 'Inter', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.72 var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  max-width: 47rem;
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
}

/* ---------- Top bar ---------- */

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(247, 245, 250, 0.92);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.topbar__inner {
  max-width: 47rem;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mark {
  font: 700 1.2rem/1 var(--display);
  letter-spacing: 0.14em;
  color: var(--accent);
  text-decoration: none;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem 1.25rem;
  font-size: 0.92rem;
}

.topbar nav a {
  color: var(--ink-2);
  text-decoration: none;
}

.topbar nav a[aria-current='page'] {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Title ---------- */

.title {
  padding: 3.25rem 0 1.5rem;
}

.kicker {
  margin: 0 0 0.75rem;
  font: 600 0.75rem/1 var(--body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 0.75rem;
  font: 600 clamp(2rem, 5vw, 2.75rem) / 1.12 var(--display);
  letter-spacing: -0.03em;
  color: var(--ink);
}

.meta {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.95rem;
}

/* ---------- Summary and callouts ---------- */

.summary {
  margin: 1.5rem 0 2.25rem;
  padding: 1.5rem 1.6rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.summary h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  border: 0;
  padding: 0;
}

.summary ul {
  margin: 0;
  padding-left: 1.2rem;
}

.summary li + li {
  margin-top: 0.4rem;
}

.callout {
  margin: 1.25rem 0;
  padding: 1rem 1.2rem;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 0.6rem 0.6rem 0;
  color: var(--ink);
}

.callout--warn {
  background: var(--warn-soft);
  border-left-color: var(--warn);
}

.callout p {
  margin: 0;
}

.callout p + p {
  margin-top: 0.6rem;
}

/* A value the operator still has to supply. Loud on purpose, so it cannot ship
   unnoticed. */
.todo {
  background: #fff3b0;
  color: #5c4400;
  padding: 0 0.3rem;
  border-radius: 0.25rem;
  font-weight: 600;
}

/* ---------- Contents ---------- */

.toc {
  margin: 0 0 2.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--paper);
}

.toc p {
  margin: 0 0 0.6rem;
  font: 600 0.75rem/1 var(--body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.toc ol {
  margin: 0;
  padding-left: 1.3rem;
  columns: 2 16rem;
  column-gap: 2rem;
  font-size: 0.95rem;
}

.toc li {
  break-inside: avoid;
  padding: 0.15rem 0;
}

/* ---------- Body ---------- */

section {
  scroll-margin-top: 4.5rem;
}

h2 {
  margin: 2.75rem 0 0.9rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  font: 600 1.4rem/1.3 var(--display);
  letter-spacing: -0.015em;
  color: var(--ink);
}

h3 {
  margin: 1.6rem 0 0.5rem;
  font: 600 1.05rem/1.4 var(--display);
  color: var(--ink);
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}

li + li {
  margin-top: 0.35rem;
}

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

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

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

strong {
  font-weight: 600;
}

/* ---------- Tables ---------- */

.table-wrap {
  margin: 1rem 0 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--paper);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.55;
}

th,
td {
  padding: 0.75rem 0.95rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

th {
  font-weight: 600;
  color: var(--ink);
  background: #f3eff8;
  white-space: nowrap;
}

td:first-child {
  font-weight: 500;
  min-width: 9rem;
}

/* ---------- Plain words, examples and glossary ---------- */

/* The explanation beside the legal wording. Green, so it reads as a third kind of
   box -- neither the purple "worth knowing" callout nor the orange warning. */
.plain {
  margin: 1rem 0 1.25rem;
  padding: 0.85rem 1.1rem 0.95rem;
  background: #edf6f2;
  border: 1px solid #cde5da;
  border-radius: 0.7rem;
  color: var(--ink);
}

.plain::before {
  content: 'In plain words';
  display: block;
  margin-bottom: 0.3rem;
  font: 600 0.7rem/1.4 var(--body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1d6a4f;
}

.plain.example::before {
  content: 'Example';
}

.plain p {
  margin: 0;
}

.plain p + p,
.plain ol,
.plain ul {
  margin-top: 0.5rem;
}

.plain ol,
.plain ul {
  margin-bottom: 0;
}

dl.glossary {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.75rem 1.5rem;
  margin: 1rem 0 0;
  padding: 1.25rem 1.4rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1rem;
}

dl.glossary dt {
  font-weight: 600;
  color: var(--ink);
  scroll-margin-top: 5rem;
}

dl.glossary dd {
  margin: 0;
  color: var(--ink-2);
}

a.term {
  color: inherit;
  text-decoration-style: dotted;
}

@media (max-width: 30rem) {
  dl.glossary {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  dl.glossary dd {
    margin-bottom: 0.7rem;
  }
}

/* ---------- Licence texts (licenses.html) ---------- */

details.license {
  margin: 0 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--paper);
}

details.license summary {
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-weight: 500;
}

details.license pre {
  margin: 0;
  padding: 0 1rem 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.8rem/1.55 ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color: var(--ink-2);
}

/* ---------- Footer ---------- */

.foot {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 0.9rem;
}

.foot p {
  margin: 0 0 0.5rem;
}

@media (max-width: 30rem) {
  body {
    font-size: 1rem;
  }

  /* Six links do not fit beside the logo on a phone. They move to their own row
     under it, left-aligned, instead of being squeezed or cut off. */
  .topbar__inner {
    flex-wrap: wrap;
    row-gap: 0.45rem;
    padding-block: 0.75rem;
  }

  .topbar nav {
    width: 100%;
    justify-content: flex-start;
    gap: 0.3rem 1rem;
    font-size: 0.88rem;
  }

  .summary,
  .toc {
    padding: 1.1rem 1.15rem;
  }

  /* Two columns still fit a phone if they are allowed to wrap. Without this the
     first column's minimum and the nowrap headers pushed one table a few pixels
     wider than the screen, and a legal table you have to swipe sideways reads badly. */
  th {
    white-space: normal;
  }

  th,
  td {
    padding: 0.65rem 0.75rem;
  }

  td:first-child {
    min-width: 6.5rem;
  }

  /* Three columns do not fit a phone without swiping, and a helpline table is the
     last place anyone should have to swipe. `.stack` turns each row into a block:
     the first cell as its heading, the rest beneath it. */
  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack td {
    display: block;
  }

  table.stack tr:first-child {
    display: none;
  }

  table.stack tr {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
  }

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

  table.stack td {
    border: 0;
    padding: 0.15rem 0.9rem;
    min-width: 0;
  }

  table.stack td:first-child {
    font-weight: 600;
    color: var(--ink);
  }
}

@media print {
  .topbar,
  .toc {
    display: none;
  }

  body {
    background: #fff;
    font-size: 11pt;
  }

  h2 {
    break-after: avoid;
  }

  a {
    color: inherit;
  }
}
