/* Undebtify — one stylesheet for every page. Colours follow iOS system
   colours so the site reads like the app, in light and dark. */

:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --ink: #1c1c1e;
  --muted: #6c6c70;
  --faint: #aeaeb2;
  --line: rgba(60, 60, 67, 0.14);
  --accent: #2e45a8;
  --accent-soft: rgba(46, 69, 168, 0.1);
  --on-accent: #ffffff;
  --green: #248a3d;
  --orange: #c93400;
  --red: #d70015;
  --blue: #007aff;
  --indigo: #5856d6;
  --teal: #30b0c7;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --ink: #f2f2f7;
    --muted: #98989f;
    --faint: #636366;
    --line: rgba(84, 84, 88, 0.5);
    --accent: #8a9df5;
    --accent-soft: rgba(138, 157, 245, 0.16);
    --on-accent: #0b1033;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --blue: #0a84ff;
    --indigo: #5e5ce6;
    --teal: #40c8e0;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
  /* Full-height column so the footer sits at the bottom on short pages */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.wrap > main { flex: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; margin-bottom: 8px; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.rounded { font-family: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif; }

/* Header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 650;
  font-size: 15px;
}
.brand:hover { text-decoration: none; }
.brand picture { display: block; }
.brand img { width: 26px; height: 26px; display: block; }

.nav { display: flex; gap: 2px; font-size: 14px; }
.nav a {
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 7px;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--line); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--card); font-weight: 550; }
@media (max-width: 400px) {
  .brand { font-size: 0; gap: 0; }
  .nav a { padding: 3px 7px; }
}

/* Buttons — kept tight */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  border: 0;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-solid { background: var(--accent); color: var(--on-accent); }
.btn-solid:hover { filter: brightness(1.06); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-plain { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-static { cursor: default; }

/* Sections */

section { padding: 22px 0; }
section + section { border-top: 1px solid var(--line); }

.hero { padding-top: 18px; }
.hero h1 { font-size: 28px; max-width: 16em; }
.hero .lede { font-size: 16px; color: var(--muted); margin: 8px 0 14px; max-width: 34em; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Home gets more air between sections; components stay tight */
.home section { padding: 34px 0; }
.home .hero { padding-top: 28px; }
.home .hero h1 { font-size: 32px; }
.home .hero .lede { font-size: 17px; margin: 10px 0 16px; }
.home h2 { margin-bottom: 12px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
}

/* Hero pile: physical and digital "things", positioned around the middle of the stage.
   Paper keeps fixed colours in dark mode, like the real thing would. */

.thing {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150px;
  font-size: 11px;
  line-height: 1.3;
  color: #1c1c1e;
  border-radius: 4px;
  transform: translate(-50%, -50%) translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14), 0 6px 16px rgba(0, 0, 0, 0.1);
}
.thing b { font-weight: 650; }

.letter { height: 86px; background: #d8b888; overflow: hidden; }
.letter-white { background: #f6f5f0; }
.letter::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 48%;
  background: rgba(0, 0, 0, 0.07);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.letter .addr { position: absolute; left: 14px; bottom: 14px; display: grid; gap: 4px; }
.letter .addr i { display: block; width: 58px; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, 0.28); }
.letter .addr i:last-child { width: 40px; }
.letter .stamp {
  position: absolute;
  right: 9px;
  bottom: 12px;
  padding: 1px 4px;
  border: 2px solid #d70015;
  border-radius: 3px;
  color: #d70015;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transform: rotate(-8deg);
}

.paper { width: 122px; padding: 10px; background: #fff; border-radius: 2px; display: grid; gap: 5px; }
.paper i { display: block; height: 4px; border-radius: 2px; background: #e3e3e8; }
.paper i.short { width: 60%; }
.paper span { font-size: 9.5px; color: #6c6c70; }
.paper span b { color: #d70015; }

.sticky {
  width: 96px;
  height: 88px;
  padding: 10px;
  background: #ffe36e;
  border-radius: 1px;
  font: 13px/1.25 "Marker Felt", "Chalkboard SE", "Bradley Hand", "Comic Sans MS", cursive;
}

.email, .sms, .nt { background: var(--card); color: var(--ink); }
.email { width: 168px; padding: 8px 10px 8px 22px; border-radius: 10px; display: grid; }
.email::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}
.email span, .sms span { color: var(--muted); }
.sms { width: 158px; padding: 8px 11px; border-radius: 14px; display: grid; }

.sheet {
  width: 132px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border-radius: 3px;
  overflow: hidden;
  font-size: 10px;
}
.sheet span { padding: 3px 6px; border: 0 solid #d1d1d6; border-width: 0 1px 1px 0; }
.sheet span:nth-child(-n + 2) { background: #e3f3e6; font-weight: 650; }
.sheet .err { color: #d70015; font-weight: 650; }

.nt { width: 180px; padding: 8px 10px; border-radius: 12px; display: flex; align-items: center; gap: 8px; }
.nt .app {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--tint);
  color: #fff;
}
.nt .app svg { width: 14px; height: 14px; }

/* The calm "after": a cut-down copy of the app's Debts screen */
.screen {
  width: 272px;
  padding-bottom: 10px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
  box-shadow: 0 0 0 1px var(--line), 0 14px 36px rgba(0, 0, 0, 0.16);
}
.screen p { margin: 0; }
.screen-top {
  padding: 10px 16px 12px;
  background: linear-gradient(165deg,
    color-mix(in srgb, var(--green) 20%, var(--bg)),
    color-mix(in srgb, var(--teal) 14%, var(--bg)) 55%,
    var(--bg));
}
.screen-title { text-align: center; font-size: 13px; font-weight: 650; margin-bottom: 10px; }
.screen-label { color: var(--muted); }
.screen-total {
  font: 700 34px/1.1 ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.screen-total small { font-size: 17px; letter-spacing: 0; }
.screen-sub { margin-top: 3px; font-size: 11px; color: var(--muted); }
.screen-down { color: var(--green); }
.screen-head {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.screen-rows { list-style: none; margin: 0 10px; padding: 0; border-radius: 14px; background: var(--card); overflow: hidden; }
.screen-rows li {
  display: flex;
  align-items: center;
  gap: 6px;
  max-height: 40px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.screen-rows li:last-child { border-bottom: 0; }
.screen-rows b { font-weight: 600; }
.dot { flex: none; width: 6px; height: 6px; border-radius: 50%; }
.dot-red { background: var(--red); }
.dot-orange { background: var(--orange); }
.late { font-size: 11px; color: var(--red); }
.late-orange { color: var(--orange); }
.amt { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  transition: transform 0.15s, background 0.2s, color 0.2s;
}
.late-orange + .pill { margin-left: auto; }
.pill-pay { color: var(--green); background: color-mix(in srgb, var(--green) 16%, transparent); }
.pill-add { color: var(--orange); background: color-mix(in srgb, var(--orange) 16%, transparent); }
.pill.pressed { transform: scale(0.88); }
.pill.paid { color: #fff; background: var(--green); }
/* A paid row folds away */
.screen-rows li { transition: max-height 0.4s, padding 0.4s, opacity 0.3s, border-color 0.3s; }
.screen-rows li.gone { max-height: 0; padding-block: 0; opacity: 0; border-color: transparent; }

/* Things drop onto the pile (JS adds .in), then the calm card covers them (.calm) */
.pileup { position: relative; height: 330px; margin-top: 18px; }
.pileup .thing {
  opacity: 0;
  transform: translate(-50%, -50%) translate(var(--x), calc(var(--y) - 40px)) rotate(calc(var(--r) * 2)) scale(1.06);
  transition: opacity 0.3s, transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.25), filter 0.5s;
}
.pileup .thing.in { opacity: 1; transform: translate(-50%, -50%) translate(var(--x), var(--y)) rotate(var(--r)); }
.pileup.calm .thing.in { opacity: 0.4; filter: blur(2px) grayscale(0.7); }
.pileup .screen {
  position: absolute;
  left: 50%;
  top: 32px; /* anchored to the top so it doesn't jump when a paid row folds away */
  z-index: 20;
  opacity: 0;
  transform: translate(-50%, 50px);
  transition: opacity 0.4s, transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.pileup.calm .screen { opacity: 1; transform: translate(-50%, 0); }
/* Rows settle in one by one once the screen arrives */
.pileup .screen-rows li { opacity: 0; transform: translateY(6px); }
.pileup.calm .screen-rows li {
  opacity: 1;
  transform: none;
  transition: max-height 0.4s, padding 0.4s, opacity 0.35s, transform 0.35s, border-color 0.3s;
  transition-delay: calc(0.35s + var(--n) * 0.15s);
}
.pileup.calm .screen-rows li.gone { opacity: 0; transition-delay: 0s; }

/* Privacy strip on home */

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 520px) { .trio { grid-template-columns: 1fr; } }
.trio h3 { margin-bottom: 2px; }
.trio p { margin: 0; font-size: 13px; color: var(--muted); }
.trio-note { margin: 10px 0 0; }

/* Maker's note */

.quote { margin: 0; padding: 14px 16px; }
.quote blockquote { margin: 0; }
.quote blockquote p { margin: 0; font-size: 15px; line-height: 1.55; }
.quote blockquote p::before { content: "\201C"; }
.quote blockquote p::after { content: "\201D"; }
.quote figcaption {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.quote figcaption b { color: var(--ink); font-weight: 600; }
.quote figcaption a { margin-left: auto; }
.quote picture { display: block; }
.quote img { width: 22px; height: 22px; display: block; }

/* Feature grid */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }

.feature h3 { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.feature p { margin: 0; font-size: 13px; color: var(--muted); }

.glyph {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  --tint: var(--accent);
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 14%, transparent);
}
.glyph svg { width: 13px; height: 13px; }

/* Plain lists of points */

.points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.points li { padding-left: 14px; position: relative; }
.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.points strong { font-weight: 600; }

/* Help page */

.alert {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.alert h2 { font-size: 15px; margin-bottom: 4px; }
.alert p { margin: 0; font-size: 14px; }

.services { display: grid; gap: 8px; }
.service h3 { font-size: 15px; margin-bottom: 2px; }
.service p { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.service .actions { gap: 5px; }

.nations { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.nations li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.nations li:first-child { border-top: 0; padding-top: 0; }
.nations .who { color: var(--muted); }

.note {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 12px;
  margin: 14px 0 0;
}

/* Footer */

.foot {
  padding: 18px 0 max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
}

/* Support FAQ */

.faq { display: grid; gap: 8px; }
.faq details { padding: 0; }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--faint); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }
.faq details p { margin: 0; padding: 0 14px 12px; font-size: 13px; color: var(--muted); }
