/*
  Wren's site: the privacy, terms and support pages (landing.css has the rest).

  The colours are the app's own inks (app/Packages/WrenDesign/Sources/
  WrenDesign/Ink.swift), light and dark columns. The type is the app's: Iowan
  Old Style for what Wren says, Avenir Next for the body. Both ship on Apple
  devices; everything else falls back to a close system face.
*/

:root {
  --paper: #efe6cb;
  --card: #fffdf6;
  --text: #2e2a26;
  --quiet: #6a6258;
  --terra: #c66242;
  --terra-text: #853f28; /* terracotta that reads as text on paper */
  --rule: #ded8cb;
  --grain-blend: multiply;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191611;
    --card: #292620;
    --text: #e9e3d1;
    --quiet: #988d7c;
    --terra: #b35132;
    --terra-text: #d17f65;
    --rule: #403d35;
    --grain-blend: screen;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  position: relative;
  min-height: 100vh;
}

/* The paper's grain, as the design pages draw it. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .24 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  body::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .92 0 0 0 0 .88 0 0 0 0 .8 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  }
}

main, header, footer {
  position: relative;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--terra-text);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

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

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

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.2;
  margin: 0;
}

p, ul, ol { margin: 0 0 1em; }

/* ---------- the top of every page ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.home-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.25rem;
}

.home-link img {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .55rem;
  box-shadow: 0 0 0 1px var(--rule);
}

/* ---------- the policy and terms ---------- */

.legal h1 {
  font-size: clamp(1.9rem, 6vw, 2.4rem);
  margin-bottom: .5rem;
}

.legal .dates {
  color: var(--quiet);
  font-size: .95rem;
  margin-bottom: 2rem;
}

.legal h2 {
  font-size: 1.45rem;
  margin: 2.5rem 0 .75rem;
}

.legal h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 .5rem;
}

.legal ul { padding-left: 1.25rem; }

.legal li { margin-bottom: .4rem; }

.legal table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  font-size: .95rem;
}

.legal th, .legal td {
  text-align: left;
  vertical-align: top;
  padding: .6rem .5rem .6rem 0;
  border-bottom: 1px solid var(--rule);
}

.legal th {
  font-weight: 600;
  color: var(--quiet);
}

/* A table too wide for a phone scrolls inside itself, not the page. */
.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.25rem;
}

.table-scroll table { margin: 0; min-width: 32rem; }

/* ---------- the foot of every page ---------- */

.colophon {
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
  padding-bottom: 2.5rem;
  margin-top: 3rem;
  color: var(--quiet);
  font-size: .95rem;
}

.colophon nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  margin-bottom: .75rem;
}
