/*
 * Paperleaf Studio site. One stylesheet for every page.
 * Colours are Bookwren's tokens (app/src/theme/colors.ts): paper and ink in
 * light, night paper in dark. Headings use Newsreader (self-hosted, OFL);
 * body text uses the phone's or computer's own sans-serif.
 * No external requests: the CSP in _headers allows only this origin.
 */

@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/Newsreader-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/Newsreader-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --bg: #FBF8F3;
  --surface: #F4EFE7;
  --surface-high: #ECE5DA;
  --ink: #1F1B16;
  --ink-2: #5C5348;
  --line: #E4DDD2;
  --outline: #857B6D;
  --accent: #4F6F52;
  --accent-text: #476749;
  --accent-container: #DCE6D6;
  --on-accent-container: #213423;
  --shelf: rgba(31, 27, 22, 0.16);

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --measure: 40rem;
  --gutter: 1.25rem;
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171512;
    --surface: #201D19;
    --surface-high: #2B2722;
    --ink: #EEE8DE;
    --ink-2: #BDB3A5;
    --line: #332F29;
    --outline: #8B8274;
    --accent: #8FB592;
    --accent-text: #8FB592;
    --accent-container: #2D402F;
    --on-accent-container: #CFE5CE;
    --shelf: rgba(238, 232, 222, 0.22);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Layout */

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main {
  display: block;
  padding: 2rem 0 3.5rem;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip:focus {
  left: var(--gutter);
  top: 0.75rem;
  z-index: 10;
  background: var(--bg);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

/* Header and footer */

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 1.5rem;
  row-gap: 0.25rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.studio {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3125rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

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

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.625rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: 8px;
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.9375rem;
  padding: 1.5rem 0 2.5rem;
}

.site-footer ul {
  list-style: none;
  margin: 0 0 0.75rem -0.5rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}

.site-footer li a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.5rem;
}

.site-footer p {
  margin: 0;
}

/* Type */

h1,
h2,
h3 {
  font-family: var(--serif);
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-weight: 600;
  font-size: 2.25rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.75rem;
}

h2 {
  font-weight: 500;
  font-size: 1.625rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 0.75rem;
  scroll-margin-top: 1rem;
}

h3 {
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 2rem 0 0.5rem;
  scroll-margin-top: 1rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

p,
li,
dd {
  text-wrap: pretty;
}

ul,
ol {
  padding-left: 1.375rem;
}

li {
  margin: 0 0 0.375rem;
}

li::marker {
  color: var(--ink-2);
}

strong {
  font-weight: 600;
}

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

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

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

.lead {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--ink);
}

.muted {
  color: var(--ink-2);
}

.small {
  font-size: 0.9375rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-weight: 500;
}

.eyebrow a {
  color: inherit;
}

/* The wren mark (Bookwren's colophon), drawn inline so it needs no request. */

.wren {
  fill: currentColor;
  color: var(--accent);
  flex: none;
}

.eyebrow .wren {
  width: 1.5rem;
  height: 1.3rem;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-title .wren {
  width: 2.75rem;
  height: 2.375rem;
}

/* Bookwren page */

.promise {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.875rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.shelf {
  display: block;
  width: 100%;
  max-width: 26rem;
  height: auto;
  margin: 1.75rem 0 1.5rem;
}

.shelf-board {
  fill: var(--shelf);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  background: var(--accent-container);
  color: var(--on-accent-container);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 1.25rem 0 0;
}

.status .muted {
  margin: 0;
  font-size: 0.9375rem;
}

.features {
  list-style: none;
  padding: 0;
}

.features li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: 0.625rem;
}

.features li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.62em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  background: var(--accent);
}

/* Cards */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 0.5rem;
  margin: 0 0 1rem;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.app-card .app-title {
  margin-bottom: 0.75rem;
}

.app-card .app-title h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.app-card .app-title .wren {
  width: 2.25rem;
  height: 1.95rem;
}

.link-row {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

.link-row li {
  margin: 0;
}

.link-row a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.claims p {
  margin-bottom: 0.75rem;
}

/* Long documents: privacy policy and support */

.doc-meta {
  color: var(--ink-2);
  font-size: 0.9375rem;
  margin: 0 0 1.5rem;
}

.toc {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 0.75rem;
  margin: 1.75rem 0 0.5rem;
}

.toc h2 {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 0.5rem;
}

.toc ol {
  margin: 0;
  padding-left: 1.5rem;
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 0.3rem 0;
}

.party {
  border-top: 1px solid var(--line);
  padding-top: 0.25rem;
  margin-top: 2rem;
}

.party h3 {
  margin-top: 1rem;
}

.facts {
  margin: 0 0 1rem;
}

.facts dt {
  font-weight: 600;
  margin: 0.875rem 0 0.25rem;
}

.facts dd {
  margin: 0;
}

.facts dd > ul {
  margin-bottom: 0.25rem;
}

.note {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 0.875rem 1rem;
  margin: 1rem 0 1.25rem;
}

.note p:last-child {
  margin-bottom: 0;
}

.steps li {
  margin-bottom: 0.5rem;
}

.qa dt {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.1875rem;
  line-height: 1.35;
  margin: 1.5rem 0 0.375rem;
}

.qa dd {
  margin: 0;
}

.email {
  font-weight: 600;
}

/* Wider screens: a little more air, same reading measure. */

@media (min-width: 48rem) {
  :root {
    --gutter: 2rem;
  }

  main {
    padding-top: 3rem;
  }

  h1 {
    font-size: 2.75rem;
  }

  .promise {
    font-size: 2.25rem;
  }
}

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