/* keldra.xyz, Pairecon marketing site.
 *
 * Fonts (self-hosted, SIL Open Font License):
 *   Literata for headings, IBM Plex Sans for everything else.
 *   Plex Sans is the app's font, so the site and the product read as one family.
 * Weights: 400 body, 500 headings, labels and buttons. No others.
 * Type scale (px): 13 captions, small print, small buttons
 *   | 15 buttons, text in cards and tables | 16 body | 18 lede, h3
 *   | 24 ledger figures, legal h2, phone h2 | 28 h2 | 34 phone h1 | 46 h1
 * Palette: the app's ink blue for actions and links, one cool grey family tinted
 *   toward it, the app's green and red sparingly.
 * Radius: 4px inputs and buttons, 8px panels and screenshots.
 */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/assets/fonts/literata-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #ffffff;
  --band: #f3f5f7;
  --surface: #ffffff;
  --border: #dbe1e7;
  --border-strong: #b9c3cd; /* dividers on the grey band */
  --border-input: #7d8a97;  /* inputs and outline buttons, 3.4:1 on white */
  --text: #15202b;
  --text-2: #3e4c5b;
  --text-3: #556372;
  --accent: #1d4f73;
  --accent-hover: #163e5b;
  --accent-active: #112f45;
  --accent-weak: #e7eff5;
  --ok: #146138;
  --ok-bg: #e5f2ea;
  --ok-border: #b5d9c3;
  --bad: #a3231a;
  --bad-bg: #fbeae8;
  --bad-border: #efc1bc;
  --info-bg: #e7eff5;
  --info-border: #b6cadb;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 1px rgba(21, 32, 43, .04), 0 4px 10px -4px rgba(21, 32, 43, .12);
  --serif: "Literata", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --t-sm: 13px;
  --t-card: 15px;
  --t-body: 16px;
  --t-lede: 18px;
  --t-h3: 24px;
  --t-h2: 28px;
  --t-h1s: 34px;
  --t-h1: 46px;
  --gutter: 24px;
  --section: 112px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Keep the footer at the bottom on short pages */
  min-height: 100vh; display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { a:hover { color: var(--accent-hover); } }
a:active { color: var(--accent-active); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: var(--t-h2); line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 16px; }
h3 { font-size: var(--t-lede); line-height: 1.3; margin-bottom: 8px; }
p { margin: 0 0 16px; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

.wrap { width: 100%; max-width: 1168px; margin: 0 auto; padding: 0 var(--gutter); }
/* Narrow sections keep the page's left edge and limit only their content width */
.narrow > * { max-width: 720px; }
.prose { max-width: 620px; }
.prose p { color: var(--text-2); }

/* Read by screen readers, not shown */
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip { position: absolute; left: 16px; top: -48px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); z-index: 10; }
.skip:focus { top: 12px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--page); }
.header-row { display: flex; align-items: center; gap: 32px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-name { font-weight: 500; }
.brand-by { color: var(--text-3); }
.site-nav { display: flex; gap: 24px; margin-left: auto; }
.header-row > .btn { margin-left: auto; }
.site-nav + .btn { margin-left: 0; }
.site-nav a { color: var(--text-2); text-decoration: none; font-size: var(--t-card); }
@media (hover: hover) and (pointer: fine) { .site-nav a:hover { color: var(--accent); text-decoration: underline; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 20px;
  font: 500 var(--t-card)/1 var(--sans);
  border-radius: var(--radius-sm); border: 1px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.btn-sm { min-height: 38px; padding: 0 14px; font-size: var(--t-sm); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-active); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--accent); border-color: var(--border-input); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--accent-hover); color: #fff; }
  .btn-secondary:hover { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-weak); }
}
/* Busy: the label stays at full contrast; the form script ignores clicks and keeps the width */
.btn[aria-disabled="true"] { cursor: progress; }

/* Hero */
.hero { padding: 88px 0 0; }
.hero h1 { max-width: 880px; }
.lede { font-size: var(--t-lede); color: var(--text-2); max-width: 680px; margin: 24px 0 32px; line-height: 1.55; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.assure { color: var(--text-2); margin: 20px 0 0; max-width: 620px; }

/* Screenshots */
.shot { margin: 0; }
.shot img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--band);
}
.shot figcaption { font-size: var(--t-sm); color: var(--text-3); margin-top: 12px; max-width: 640px; }
.shot-hero { margin: 64px auto 0; }
.shot-wide { margin-top: 48px; }

/* Sections */
.section { padding: var(--section) 0 0; }
.section:last-of-type { padding-bottom: var(--section); }
.band { background: var(--band); padding: 88px 0; margin-top: var(--section); }
.band + .section { padding-top: var(--section); }
.band:last-of-type { padding-bottom: 96px; }
.section-lede { color: var(--text-2); max-width: 620px; margin-bottom: 40px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: start; }
/* How it works: three steps side by side, the journal entry under them at the app's own size.
   From 1180px the steps stack in a column beside the entry, so both share one top edge. */
.steps-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 48px; }
.steps.steps-row li + li { margin-top: 0; }
.shot-entry { margin-top: 48px; max-width: 798px; }
@media (min-width: 1180px) {
  .how-grid { display: grid; grid-template-columns: minmax(0, 1fr) 798px; gap: 48px; align-items: start; margin-top: 32px; }
  .how-grid .steps-row { grid-template-columns: 1fr; margin-top: 0; gap: 32px; }
  .how-grid .shot-entry { margin-top: 0; }
  /* Balanced wrapping splits "read-only" in this narrow column */
  .how-grid h3 { text-wrap: wrap; }
}

/* The payout math: the one loud element on the page */
.ledger { margin: 8px 0 0; }
.ledger table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
.ledger caption { text-align: left; caption-side: bottom; font-size: var(--t-sm); color: var(--text-3); padding-top: 12px; }
.ledger th, .ledger td { padding: 12px 0; border-bottom: 1px solid var(--border); font-family: var(--serif); font-size: var(--t-h3); line-height: 1.3; }
.ledger th { text-align: left; font-weight: 400; color: var(--text-2); padding-right: 16px; }
.ledger td { text-align: right; white-space: nowrap; color: var(--text); }
/* Accounting alignment: positive amounts leave room for the closing bracket of negatives */
.ledger td:not(.neg)::after { content: ")"; visibility: hidden; }
.ledger tr.total th, .ledger tr.total td { color: var(--text); font-weight: 500; border-top: 1px solid var(--text); border-bottom: 1px solid var(--text); }
/* The difference is the point of the table: same weight as the total, in the error red, with a word beside it */
/* The double rule marks the final line, so it sits under Difference */
.ledger tr.diff th, .ledger tr.diff td { color: var(--bad); font-weight: 500; border-top: 1px solid var(--text); border-bottom: 3px double var(--text); }

/* Steps: a real sequence, so the numbers stay */
.steps { list-style: none; margin: 32px 0 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-left: 48px; }
.steps li + li { margin-top: 32px; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border-input);
  font: 500 var(--t-sm)/28px var(--sans); text-align: center; color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 12px 0; border-top: 1px solid var(--border); color: var(--text-2); }
.plain-list li:last-child { border-bottom: 1px solid var(--border); }
.band .plain-list li { border-color: var(--border-strong); }

/* FAQ */
.faq details { border-top: 1px solid var(--border); }
.faq details:last-child { border-bottom: 1px solid var(--border); }
.faq summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px 0; font-weight: 500;
}
.faq summary:focus-visible { outline-offset: 4px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 10px; height: 10px;
  border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
  transform: translateY(-3px) rotate(45deg);
}
.faq details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
@media (hover: hover) and (pointer: fine) { .faq summary:hover { color: var(--accent); } }
.faq details p { color: var(--text-2); padding-bottom: 20px; max-width: 660px; }


/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0 40px; font-size: var(--t-card); color: var(--text-2); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; }
.footer-row p { margin: 0; }
.footer-row .tm { flex-basis: 100%; font-size: var(--t-sm); color: var(--text-3); max-width: 720px; }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* Legal pages */
.doc { padding: 72px 0 112px; }
.doc h1 { font-size: var(--t-h1); margin-bottom: 12px; }
.doc .updated { color: var(--text-3); font-size: var(--t-card); margin-bottom: 40px; }
.doc .summary { background: var(--band); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 48px; }
.doc .summary p { color: var(--text); }
.doc h2 { font-size: var(--t-h3); margin: 48px 0 12px; }
.doc p, .doc li { color: var(--text-2); }
.doc ul { padding-left: 20px; margin: 0 0 16px; }
.doc li + li { margin-top: 6px; }
.doc table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: var(--t-card); }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 16px 10px 0; border-bottom: 1px solid var(--border); }
.doc th { font-weight: 500; color: var(--text); }
.doc tbody th { font-weight: 400; }

/* 404 */
.notfound { padding: 120px 0 160px; }
.notfound h1 { font-size: var(--t-h1); margin-bottom: 16px; }
.notfound p { color: var(--text-2); max-width: 520px; }
.notfound .cta-row { margin-top: 32px; }

@media (max-width: 1000px) {
  /* Phone crops (hero and close, up to 1000px) are single app cards that carry their own border */
  .shot-hero img, .shot-wide img { border: 0; background: none; border-radius: var(--radius); }
}

@media (max-width: 960px) {
  .split { grid-template-columns: 1fr; gap: 40px; }
  .steps-row { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .header-row { justify-content: space-between; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; --section: 80px; --t-h1: var(--t-h1s); --t-h2: var(--t-h3); }
  .hero { padding-top: 48px; }
  .lede { font-size: var(--t-body); margin: 20px 0 28px; }
  .header-cta { display: none; }
  .cta-row .btn { width: 100%; }
  .shot-hero { margin-top: 48px; }
  .assure { font-size: var(--t-card); color: var(--text-3); }
  .shot-entry img { border: 0; background: none; border-radius: var(--radius); }
  .brand-by { display: none; }
  .btn-sm { padding: 0 12px; }
  .band { padding: 64px 0; }
  .ledger th, .ledger td { font-size: var(--t-lede); }
  .doc { padding: 48px 0 80px; }
  /* Legal tables: one block per row, the first cell as its heading, the second labelled */
  .doc thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .doc tbody tr:first-child { border-top: 1px solid var(--border); }
  .doc th, .doc td { display: block; padding: 0; border: 0; }
  .doc td[data-label] { margin-top: 4px; }
  .doc td[data-label]::before { content: attr(data-label) ": "; font-weight: 500; color: var(--text-3); }
  .doc tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .notfound { padding: 72px 0 112px; }
}
