/* micawber.app: one stylesheet for the whole site.
   Paper and ink with one ochre accent, taken from the app icon. The ochre is a
   line (rules, underlines, borders); text in the accent and focus rings use
   --ochre-text, which holds 4.8:1 on light paper where the ochre holds 2.5:1.
   Light and dark follow the system setting. */

/* Typefaces, served from this site (SIL Open Font License 1.1; licences in /fonts).
   Latin subsets. Lora for headings, figures and the brand; Source Sans 3 for everything else. */
@font-face {
  font-family: "Lora";
  src: url("/fonts/lora-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/fonts/lora-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/fonts/lora-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/fonts/lora-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Tokens. Every colour is a light and dark pair.
   ink-2 holds 5.2:1 on paper in light and 7.7:1 in dark; ochre-text 4.8:1 and 9.9:1. */
:root {
  --paper: #F7F3EB;
  --ink: #2B2927;
  --ink-2: #6B6560;
  --ochre: #C49444;
  --ochre-text: #8A6420;
  --rule: rgba(43, 41, 39, 0.18);
  --surface: #EFEAE0;

  --serif: "Lora", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1A1817;
    --ink: #F5F5F5;
    --ink-2: #B0AAA1;
    --ochre: #E8BA79;
    --ochre-text: #E8BA79;
    --rule: rgba(245, 245, 245, 0.18);
    --surface: #242120;
  }
}

/* Base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light dark;
  background: var(--paper);
}

body {
  margin: 0;
  container-type: inline-size;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* Side padding: 20px at a 390px phone, 64px at 1280px and wider. */
.site-header, main, .site-footer { --pad: clamp(20px, 5cqi, 64px); }

img { max-width: 100%; height: auto; }
picture { display: contents; }

h1, h2, h3 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }

a { color: var(--ink); }

/* A link in running text: ink, with a thin ochre underline. */
.text-link,
.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ochre);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.text-link:hover,
.prose a:hover { text-decoration-thickness: 2px; }

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.skip {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  font-weight: 600;
}
.skip:focus { left: 16px; }

/* Small capitals label */
.eyebrow {
  margin: 0 0 14px;
  font: 600 0.75rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* The double ochre rule from the app icon */
.double-rule {
  display: block;
  height: 7px;
  margin: 0;
  border: 0;
  border-top: 2px solid var(--ochre);
  border-bottom: 2px solid var(--ochre);
}

.rule {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--rule);
}

.path { font-weight: 600; }

code {
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 12px;
  padding: clamp(6px, 1.1cqi, 14px) var(--pad);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font: 600 1.25rem/1.2 var(--serif);
}
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.site-nav {
  display: flex;
  gap: clamp(18px, 2.5cqi, 32px);
  font-size: 0.9375rem;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}
.site-nav a:hover {
  text-decoration-line: underline;
  text-decoration-color: var(--rule);
}
.site-nav a[aria-current="page"] {
  text-decoration-line: underline;
  text-decoration-color: var(--ochre);
}

/* Footer */

.site-footer {
  padding: 0 var(--pad) clamp(28px, 3cqi, 40px);
}
.site-footer .inner {
  max-width: 1200px;
  margin: 0 auto;
}
.site-footer.narrow .inner { max-width: 42rem; }
.site-footer .double-rule { margin-bottom: 8px; }
.site-footer .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 24px;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.site-footer nav { display: flex; gap: 20px; }
.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ochre);
  text-underline-offset: 3px;
}
.site-footer nav a:hover { text-decoration-thickness: 2px; }
.site-footer p { margin: 10px 0; }

/* Overview */

.overview {
  max-width: calc(1200px + 2 * var(--pad));
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* An app screen in a phone-shaped frame: 660 × 1434 screenshots and clips. */
.screen {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 660 / 1434;
  border: 1px solid var(--rule);
  border-radius: 14% / 6.4%;
  background: var(--surface);
}

/* First screen. On a phone the copy comes first and the app follows, sized to
   fit the window; from 760px the app stands beside the copy. */
.hero {
  display: grid;
  gap: 36px;
  padding: clamp(32px, 6cqi, 88px) 0 clamp(36px, 4cqi, 56px);
}
.hero .app-icon {
  display: block;
  width: clamp(64px, 7cqi, 96px);
  height: auto;
  border-radius: 22%;
  box-shadow: 0 0 0 1px var(--rule);
  margin-bottom: clamp(20px, 3cqi, 40px);
}
.hero h1 {
  margin: 0 0 18px;
  max-width: 14ch;
  font: 500 clamp(2.375rem, 5.4cqi, 4.5rem)/1.04 var(--serif);
  letter-spacing: -0.02em;
}
.hero .lead {
  margin: 0 0 28px;
  max-width: 30em;
  font-size: clamp(1.1875rem, 1.7cqi, 1.375rem);
  line-height: 1.5;
}
.hero .buy {
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  max-width: 30em;
}
.app-store-badge {
  display: inline-block;
  margin-bottom: 12px;
  vertical-align: top;
}
.app-store-badge img {
  display: block;
  width: auto;
  height: 48px;
}
.buy .needs,
.buy .terms {
  margin: 4px 0 0;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.hero-shot {
  justify-self: center;
  width: min(100%, 300px, calc(72svh * 660 / 1434));
}

@container (min-width: 760px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) clamp(260px, 28cqi, 340px);
    gap: clamp(40px, 6cqi, 96px);
    align-items: center;
  }
  .hero-shot { width: 100%; }
}

.section { padding: clamp(36px, 4cqi, 56px) 0; }
.section > .eyebrow { margin-bottom: 24px; }

.section-title {
  margin: 0 0 clamp(20px, 2.4cqi, 32px);
  font: 500 clamp(1.75rem, 2.8cqi, 2.25rem)/1.15 var(--serif);
  letter-spacing: -0.01em;
}

/* What it does: rows of a small screen beside its text, which open the
   screenshot full size. Side by side in columns where they fit. */
.rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 0 clamp(32px, 4cqi, 56px);
}
.rows article {
  display: grid;
  grid-template-columns: clamp(88px, 28cqi, 116px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 22px 0 26px;
  border-top: 1px solid var(--rule);
}
.rows h3 {
  margin: 0 0 8px;
  font: 600 1.3125rem/1.25 var(--serif);
}
.rows p { margin: 0; }
.thumb { display: block; }
.thumb:hover .screen { border-color: var(--ochre); }

.also {
  margin: 8px 0 0;
  color: var(--ink-2);
}

/* A section whose title stands beside its content where there is room. */
.beside {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: clamp(16px, 2cqi, 24px) clamp(32px, 4cqi, 64px);
  padding-bottom: clamp(40px, 5cqi, 72px);
}
.beside .section-title { margin: 0; }
.beside > div > p { margin: 0 0 16px; max-width: 34em; }
.beside strong { font-weight: 600; }

.ruled {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  max-width: 34em;
}
.ruled li {
  padding: 10px 0;
  border-top: 1px solid var(--rule);
}
.ruled li:last-child { border-bottom: 1px solid var(--rule); }

/* Closing: the App Store link again, after the questions. */
.closing { padding: 0 0 clamp(36px, 4cqi, 56px); }
.closing .double-rule { margin-bottom: clamp(32px, 4cqi, 56px); }
.closing > p { margin: 0 0 24px; max-width: 34em; }

.quote {
  margin: 0;
  padding: clamp(28px, 3cqi, 40px) 0;
  border-top: 1px solid var(--rule);
  max-width: 40em;
}
.quote blockquote { margin: 0 0 8px; }
.quote blockquote p {
  margin: 0;
  font: italic 400 clamp(1.125rem, 1.6cqi, 1.25rem)/1.5 var(--serif);
}
.quote figcaption {
  font-size: 0.875rem;
  color: var(--ink-2);
}

/* Reading pages: support, privacy, not found */

.reading {
  max-width: calc(42rem + 2 * var(--pad));
  margin: 0 auto;
  padding: clamp(40px, 5cqi, 72px) var(--pad) clamp(48px, 6cqi, 88px);
}

.reading h1 {
  margin: 0 0 18px;
  font: 500 clamp(2.125rem, 4cqi, 2.875rem)/1.1 var(--serif);
  letter-spacing: -0.015em;
}
.reading > .double-rule { margin: 0 0 26px; }
.reading .lede {
  margin: 0 0 16px;
  font-size: clamp(1.1875rem, 1.6cqi, 1.25rem);
  line-height: 1.5;
}
.reading .meta {
  margin: -8px 0 26px;
  font-size: 0.9375rem;
  color: var(--ink-2);
  font-variant-numeric: lining-nums;
}

.prose h2 {
  margin: 44px 0 12px;
  font: 600 clamp(1.5rem, 2.2cqi, 1.75rem)/1.2 var(--serif);
}
.prose h3 {
  margin: 30px 0 8px;
  font: 600 1.25rem/1.3 var(--serif);
}
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 1.25em; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--ink-2); }
.prose ol li::marker { font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.prose strong { font-weight: 600; }

.prose dl { margin: 0 0 20px; border-bottom: 1px solid var(--rule); }
.prose dt {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font: 600 1.1875rem/1.3 var(--serif);
}
.prose dt:first-child { margin-top: 10px; }
.prose dd { margin: 6px 0 0; padding-bottom: 0; }
.prose dd:last-child { padding-bottom: 14px; }

/* A list set on rules, without bullets */
.prose .ruled-list { list-style: none; margin: 0 0 20px; padding: 0; }
.prose .ruled-list li {
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}
.prose .ruled-list li:last-child { border-bottom: 1px solid var(--rule); }

/* Numbered steps: a serif numeral in the accent beside each step */
.prose .steps { list-style: none; margin: 0 0 20px; padding: 0; counter-reset: step; }
.prose .steps li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0 12px;
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  counter-increment: step;
}
.prose .steps li::before {
  content: counter(step);
  font: 500 1.75rem/1.1 var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ochre-text);
}
.prose .steps li:last-child { border-bottom: 1px solid var(--rule); }
.prose .steps p { margin: 0; }

/* A box drawn in the rule colour */
.panel {
  margin: 0 0 20px;
  padding: 20px 24px;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.panel p:last-child { margin-bottom: 0; }
.panel-title {
  display: block;
  margin-bottom: 6px;
  font: 600 1.25rem/1.3 var(--serif);
}

/* Questions */
.faq { border-bottom: 1px solid var(--rule); }
.faq details { border-top: 1px solid var(--rule); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
  list-style: none;
  font: 600 1.1875rem/1.3 var(--serif);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  width: 1em;
  text-align: center;
  font: 400 1.5rem/1 var(--sans);
  color: var(--ochre-text);
}
.faq details[open] summary::after { content: "\2212"; }
.faq details > div { padding: 0 0 8px; }
.faq details > div > p { margin: 0 0 16px; }

/* Not found: the page fills the window, the footer at its foot */
body:has(.lost) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.lost { flex: 1; width: 100%; }
.lost { padding-top: clamp(56px, 9cqi, 120px); }
.lost h1 { font-size: clamp(2.25rem, 4.6cqi, 3.25rem); line-height: 1.08; margin-bottom: 20px; }
.lost > .double-rule { margin-bottom: 28px; }
.lost .lede { margin-bottom: 28px; font-size: 1.1875rem; max-width: 34em; }
.tally {
  display: flex;
  flex-direction: column;
  max-width: 26em;
  margin: 0 0 36px;
  border-bottom: 1px solid var(--rule);
  font: 400 1.125rem/1.6 var(--serif);
}
.tally div {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
}
.prose .tally dt { margin: 0; padding: 0; border: 0; font: inherit; }
.prose .tally dd { margin: 0; padding: 0; font-variant-numeric: lining-nums tabular-nums; }
.tally .result dt { font-weight: 600; }
.tally .result dd { font-style: italic; }
.prose .button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--ochre);
  border-radius: 4px;
  font: 600 0.9375rem/1.2 var(--serif);
  color: var(--ink);
  text-decoration: none;
}
.prose .button:hover { background: color-mix(in srgb, var(--ochre) 14%, transparent); }

/* How a month works: numbered steps, each a screen tall on a phone, text then
   clip; from 760px the clip stands beside the text. */
.section-lead {
  margin: 0 0 clamp(24px, 3cqi, 40px);
  max-width: 34em;
  font-size: clamp(1.125rem, 1.5cqi, 1.25rem);
  line-height: 1.5;
}
.month {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.month > li {
  display: grid;
  gap: 24px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--rule);
  counter-increment: step;
}
.month h3 {
  margin: 0 0 10px;
  font: 600 clamp(1.5rem, 2.2cqi, 1.75rem)/1.2 var(--serif);
}
.month h3::before {
  content: counter(step);
  display: block;
  margin-bottom: 6px;
  font: 500 2rem/1 var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ochre-text);
}
.month p { margin: 0; max-width: 32em; }
.month .clip {
  justify-self: center;
  width: min(100%, 300px, calc(70svh * 660 / 1434));
}

@container (min-width: 760px) {
  .month > li {
    grid-template-columns: minmax(0, 1fr) clamp(240px, 24cqi, 300px);
    gap: clamp(40px, 6cqi, 96px);
    align-items: center;
    padding: 40px 0;
  }
  .month .clip { width: 100%; }
}

/* Clips: a muted loop of the app in a phone frame. site.js adds the button
   beneath it that pauses and resumes it, outside the frame so it can't be
   mistaken for a control in the app; without the script the poster stands alone. */
.clip { margin: 0; }
.clip video { cursor: pointer; }
.clip-toggle {
  display: block;
  margin: 12px auto 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: 22px;
  background: transparent;
  color: var(--ink);
  font: 600 0.8125rem/1 var(--sans);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.clip-toggle:hover { border-color: var(--ochre); }
