/**
 * Spendo - the pages beside the app: /install, /privacy, /terms
 *
 * Plain documents, read once, often on a phone that came from a shared link. They
 * use the app's tokens and nothing else, so they look like the app's own pages rather
 * than a website about it: ink on the warm ground, Geist, the three radii, rows as
 * lines inside one surface. No motion beyond a press, for the reason the app gives
 * (tokens.css, "motion"): it acknowledges a tap and does not decorate.
 *
 * The CSP refuses <style> blocks and inline scripts, so everything is here.
 */

*,
*::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(--font);
  font-size: var(--text-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding: calc(var(--space-8) + var(--safe-top)) var(--space-4) calc(var(--space-8) + var(--safe-bottom));
  /* viewport-fit=cover hands the notch to the page in landscape too. */
  padding-left: max(var(--space-4), env(safe-area-inset-left, 0px));
  padding-right: max(var(--space-4), env(safe-area-inset-right, 0px));
}

/* No double-tap-to-zoom wait on a tap, and no grey flash: every control here draws its
   own pressed state instead. */
a,
.btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ------------------------------------------------------------------ the top */

.page-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap-min);
  color: var(--ink);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

.page-brand img {
  width: 40px;
  height: 40px;
  border-radius: var(--r-field);
}

.page-title {
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--text-display);
  line-height: 1.1;
  letter-spacing: var(--track-tight);
  font-weight: var(--weight-bold);
  text-wrap: balance;
}

.page-lead {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--text-row);
  text-wrap: pretty;
}

.page-updated {
  margin: var(--space-2) 0 0;
  color: var(--ink-3);
  font-size: var(--text-caption);
}

/* ------------------------------------------------------------- sections */

.section {
  margin-top: var(--space-8);
}

.section-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--text-section);
  line-height: 1.3;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.glyph {
  width: 22px;
  height: 22px;
  flex: none;
  fill: currentColor;
}

.section-head .glyph {
  color: var(--brand);
}

.prose p,
.prose ul {
  margin: 0 0 var(--space-3);
  color: var(--ink-2);
}

.prose ul {
  padding-left: var(--space-5);
}

.prose li + li {
  margin-top: var(--space-1);
}

.prose strong {
  color: var(--ink);
  font-weight: var(--weight-semibold);
}

/* A plain link reads as text with a quiet underline; ink, never a hue - the only
   colours in Spendo are which way the money went. */
a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover,
a:active {
  text-decoration-color: var(--ink);
}

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

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
}

/* Dark mode draws the edge on the surface, as the app does, because a shadow on a
   near-black ground is invisible. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .card,
  :root:not([data-theme='light']) .rows {
    box-shadow: 0 0 0 1px var(--line);
  }
}

:root[data-theme='dark'] .card,
:root[data-theme='dark'] .rows {
  box-shadow: 0 0 0 1px var(--line);
}

.label {
  margin: 0 0 var(--space-1);
  color: var(--ink-3);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

/* ----------------------------------------------------------------- button */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 52px;
  padding: 0 var(--space-6);
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--on-brand);
  font: inherit;
  font-size: var(--text-row);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transition: transform var(--dur-instant) var(--ease), background-color var(--dur-state) var(--ease);
}

.btn:hover {
  background: var(--brand-pressed);
}

.btn:active {
  transform: scale(var(--press-scale));
}

.btn .glyph {
  width: 20px;
  height: 20px;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* ------------------------------------------------------------ download */

.download-facts {
  margin: var(--space-4) 0 0;
  color: var(--ink-3);
  font-size: var(--text-caption);
  text-align: center;
}

/* Each fact wraps whole, never "64-bit" on one line and its noun on the next. */
.download-facts span {
  white-space: nowrap;
}

.download-facts span + span::before {
  content: '·';
  margin: 0 var(--space-2);
}

/* --------------------------------------------------------- rows (steps) */

/* Lines inside one surface, like the ledger: never a stack of cards. */
.rows {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.rows > li {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}

.rows > li:not(:first-child) {
  border-top: 1px solid var(--line);
}

.step-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-tile);
  background: var(--brand-tint);
  color: var(--ink);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

/* A flex child: without min-width it cannot shrink below its longest word. */
.step-body {
  min-width: 0;
}

.step-body h3 {
  margin: 4px 0 var(--space-1);
  font-size: var(--text-row);
  font-weight: var(--weight-semibold);
  text-wrap: balance;
}

.step-body p {
  margin: 0;
  color: var(--ink-2);
}

/* ----------------------------------------------------------- fingerprints */

.fingerprint {
  margin: var(--space-1) 0 var(--space-4);
  color: var(--ink);
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.fingerprint:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------- the foot */

.page-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: var(--text-caption);
}

.page-foot a {
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
}

.page-foot a[aria-current='page'] {
  color: var(--ink);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

/* A sentence the owner still has to fill in, marked so nobody mistakes it for a
   finished answer. */
.pending {
  padding: 0 var(--space-1);
  border-radius: 4px;
  background: var(--warn-tint);
  color: var(--warn);
}
