/*
 * Self-hosted, not linked from Google Fonts. The page tells visitors it makes
 * no third-party requests and the CSP enforces that with default-src 'self';
 * loading fonts from Google would hand every visitor's IP to Google while
 * contradicting the page it is printed on.
 *
 * Both are variable, Latin-subset: 38KB and 76KB. OFL 1.1 — the notices in
 * assets/fonts/ are deployed alongside the files, as the licence requires.
 */
@font-face {
  font-family: 'Martian Mono';
  src: url('/assets/fonts/MartianMono-latin.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Sans';
  src: url('/assets/fonts/InstrumentSans-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

/*
 * pockept.com
 *
 * Brand tokens are duplicated here by hand from constants/Theme.ts — twelve
 * values, copied deliberately. Importing them would mean a build step, which
 * would mean a dependency tree, which is the thing being avoided. If a token
 * changes there, change it here in the same commit.
 */

:root {
  --paper: #e9e7e1;
  --paper-dim: #dedbd3;
  --ink: #191c18;
  --ink-mute: #6e7269;
  --rule: #c9c7c0;
  --kept: #2e5e43;
  --spent: #d8452b;

  --font-mono: 'Martian Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-sans: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --space: 24px;
  --radius: 4px;
}

/*
 * The site is light only, deliberately, and it is the one place in the product
 * that commits like this.
 *
 * The signature device is a receipt — ink on pale stock — and every artifact
 * this site produces is permanently on paper: og.png, the share card, the
 * favicon, the app icon. If the page inverted, a visitor with a dark OS would
 * see a pale link preview, click it, and land on something that looks like a
 * different product.
 *
 * The app is the opposite case and keeps its dark mode (SPEC §3.2, ADR 0002):
 * it gets opened at night, in bed, which a marketing page does not.
 *
 * color-scheme keeps form controls and scrollbars pale too — without it the
 * inputs render dark on a paper page.
 */
:root {
  color-scheme: light;
}

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

body {
  margin: 0;
  padding: calc(var(--space) * 2) var(--space);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: calc(var(--space) * 1.5);
}

h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
}

.lede {
  margin: 0;
  color: var(--ink-mute);
}

/* --- the receipt line, SPEC §3.1 --------------------------------------- */

.receipt {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: var(--radius);
}

.row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.row .label {
  flex: 0 1 auto;
}

/* A repeating gradient rather than typed dots: crisp at any width, and it
   survives being rasterised into a share card. */
.row .leader {
  flex: 1 1 auto;
  align-self: center;
  height: 2px;
  min-width: 16px;
  background-image: radial-gradient(circle, var(--rule) 1px, transparent 1.5px);
  background-size: 5px 2px;
  background-repeat: repeat-x;
}

.row .value {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.row.total .label,
.row.total .value {
  font-weight: 600;
}

.heading {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.rule {
  align-self: flex-end;
  width: 40%;
  height: 1px;
  background: var(--rule);
}

.edge {
  height: 2px;
  background: var(--ink);
}

.spacer {
  height: 8px;
}

.footer {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--ink-mute);
}

.value.kept { color: var(--kept); }
.value.spent { color: var(--spent); }
.value.muted { color: var(--ink-mute); }

/* --- the tool ---------------------------------------------------------- */

/*
 * The hero is set like assets/og.png — centred, generous, the wordmark given
 * room. Everything below it stays left-aligned: a form and a receipt are tools,
 * and centring either would hurt both. The poster treatment stops at the rule.
 */
header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space);
  padding: calc(var(--space) * 1.5) 0 var(--space);
  text-align: center;
}

.lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mantra {
  margin: 0;
  font-size: 17px;
  color: var(--ink-mute);
}

/*
 * The wordmark and the mantra are a locked pair: their rendered widths match.
 * 35.5px against the mantra's 17px is a MEASURED value, not a chosen one — if
 * either string, face or size changes, re-measure and retune both. There is no
 * CSS that equalises two runs of text, so this is the price of the lockup.
 */
.wordmark {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 35.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.wordmark span {
  color: var(--ink-mute);
}

header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  /* wide enough that the explicit <br> is the only break */
  max-width: 40ch;
}

.ruleline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.ruleline::before,
.ruleline::after {
  content: '';
  width: 56px;
  height: 3px;
  background: var(--ink);
}

.ruleline span {
  width: 132px;
  height: 2px;
  background-image: radial-gradient(circle, var(--rule) 1px, transparent 1.5px);
  background-size: 6px 2px;
  background-repeat: repeat-x;
}

header .lede {
  max-width: 46ch;
}

form {
  display: flex;
  flex-direction: column;
  gap: var(--space);
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label > span {
  font-weight: 500;
}

label em {
  color: var(--ink-mute);
  font-style: normal;
  font-weight: 400;
}

label small {
  color: var(--ink-mute);
  font-size: 13px;
}

input {
  font-family: var(--font-mono);
  font-size: 17px;
  padding: 12px;
  color: var(--ink);
  background: var(--paper-dim);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

button {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 500;
  padding: 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
}

button.primary {
  color: var(--paper);
  background: var(--ink);
}

#result {
  display: flex;
  flex-direction: column;
  gap: var(--space);
}

/*
 * An ID selector beats the UA stylesheet's [hidden] { display: none }, so the
 * rule above was showing the receipt, the share button and the email form from
 * page load. This puts the attribute back in charge.
 */
#result[hidden] {
  display: none;
}

#email-form {
  gap: 12px;
  padding-top: var(--space);
  border-top: 1px solid var(--rule);
}

/*
 * Validation is set in ink, never in --spent. That colour means money that
 * left; using it for an error would make it decorative, which docs/brand.md
 * rules out. A calm app does not turn red when you miss a field.
 */
input[aria-invalid='true'] {
  border-color: var(--ink);
  background: var(--paper);
}

.form-error {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}

.form-error:empty {
  display: none;
}

.note,
.fineprint {
  margin: 0;
  color: var(--ink-mute);
  font-size: 13px;
}

/* --- what the app does, shown rather than described ------------------- */

.explain {
  display: flex;
  flex-direction: column;
  gap: var(--space);
  padding-top: var(--space);
  border-top: 1px solid var(--rule);
}

.explain h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.explain p {
  margin: 0;
}

/*
 * The shield (SPEC §4.2). iOS renders the real one from a ShieldConfiguration
 * extension over a blur — one icon, a title, a subtitle, two buttons, and not
 * one thing more. This mock must never grow past what that API can actually
 * show, or the page is promising a screen the product cannot build.
 */
.shield {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space);
  padding: calc(var(--space) * 1.5) var(--space);
  text-align: center;
  color: var(--paper);
  background: var(--ink);
  border-radius: 14px;
}

.shield-title {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}

.shield-sub {
  color: var(--rule);
}

.shield-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
}

.shield-btn {
  flex: 1;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--paper);
  border-radius: var(--radius);
}

.shield-btn.primary {
  color: var(--ink);
  background: var(--paper);
}

.points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space);
}

.points strong {
  font-weight: 600;
}

/* --- links and the site footer ---------------------------------------- */

/*
 * The page had no links until the privacy notice arrived. Underlined rather
 * than coloured: `kept` and `spent` are never decorative and never mark
 * emphasis, so neither may be spent on a link (docs/brand.md).
 */
a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--rule);
}

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

.sitefoot {
  padding-top: var(--space);
  border-top: 1px solid var(--rule);
  color: var(--ink-mute);
  font-size: 13px;
  /* Centred to match .footer, the receipt's own last line. The page ends the
     way the receipt does. */
  text-align: center;
}
