/* Schibsted Grotesk, SIL Open Font License 1.1 (fonts/OFL.txt). Served from
   here rather than from Google: a page for an app whose point is keeping your
   data at home should not hand its visitors' addresses to anyone. */
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --paper: #f4f7fa;
  --surface: #ffffff;
  --ink: #13233a;
  --muted: #56667b;
  --rule: #d5dde7;
  --blue: #1e90ff;
  --blue-ink: #0b62c4;
  --rose: #ffffff;
  --rose-minor: #b9d8fb;
  /* The four pillars, in the colours the app draws them in. */
  --cash: #42a5f5;
  --emergency: #66bb6a;
  --planned: #ffa726;
  --longterm: #ef5350;
  --code-bg: #13233a;
  --measure: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1a29;
    --surface: #152438;
    --ink: #e4ecf5;
    --muted: #9aabbf;
    --rule: #26384f;
    --blue-ink: #6cb6ff;
    --rose-minor: #3c6fa8;
    --code-bg: #08111c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 "Schibsted Grotesk", system-ui, sans-serif;
}

a { color: var(--blue-ink); text-underline-offset: 0.18em; }
a:focus-visible, .button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

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

h1, h2 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-size: 1.6rem; }
p { margin: 0; }

kbd, code, pre {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  font-size: 0.88em;
}
kbd {
  padding: 0.05em 0.4em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ header */

.top, main, footer {
  width: min(var(--measure), 100% - 32px);
  margin-inline: auto;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}
.top nav { display: flex; gap: 24px; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.top nav a:hover { color: var(--ink); }

/* -------------------------------------------------------------------- hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding-block: 56px 72px;
}

h1 {
  font-size: clamp(2.3rem, 1.4rem + 3.4vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
  max-width: 14ch;
  text-wrap: balance;
}

.lede {
  margin-top: 28px;
  max-width: 34em;
  font-size: 1.2rem;
  color: var(--muted);
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.button {
  display: inline-block;
  padding: 13px 22px;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.button:hover { border-color: var(--ink); }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover { background: #0b7ae6; border-color: #0b7ae6; }

.note { margin-top: 16px; font-size: 0.93rem; color: var(--muted); max-width: 34em; }

/* The compass rose: the logo, large, with the four pillars of the portfolio
   on its four points. The labels are HTML laid over the SVG so they wrap and
   scale like text. */
.rose {
  position: relative;
  margin: 0;
  width: min(100%, 400px);
  justify-self: center;
  aspect-ratio: 1;
}
.rose svg { width: 100%; height: 100%; overflow: visible; }
.rose .ring { fill: none; stroke: var(--rule); stroke-width: 1.5; stroke-dasharray: 2 6; }
.rose .disc { fill: var(--blue); }
.rose .major { fill: var(--rose); }
.rose .minor { fill: var(--rose-minor); }
.rose .pin { fill: var(--blue); }
.rose .ticks circle { stroke: var(--paper); stroke-width: 4; }
.t-cash { fill: var(--cash); }
.t-emergency { fill: var(--emergency); }
.t-planned { fill: var(--planned); }
.t-longterm { fill: var(--longterm); }

/* Each label sits by its dot. The dots are at 118 of the 160 units from the
   centre to the edge: 13.1% and 86.9% of the figure. */
.rose .p {
  position: absolute;
  width: 8em;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}
.rose .n { left: 50%; top: 13.1%; transform: translate(-50%, calc(-100% - 16px)); }
.rose .s { left: 50%; top: 86.9%; transform: translate(-50%, 16px); }
.rose .e { left: 81%; top: 50%; transform: translateY(16px); text-align: left; }
.rose .w { right: 81%; top: 50%; transform: translateY(16px); text-align: right; }

/* The one moment of motion on the page: the needle swings and settles, the
   way a compass does when you pick it up. */
.needle {
  transform-origin: 0 0;
  animation: settle 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes settle {
  0%   { transform: rotate(-70deg); }
  45%  { transform: rotate(14deg); }
  70%  { transform: rotate(-5deg); }
  88%  { transform: rotate(1.5deg); }
  100% { transform: rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .needle { animation: none; }
}

/* ------------------------------------------------------------- screenshots */

.shot { margin: 0; }
.shot img {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
}
.shot figcaption { margin-top: 14px; color: var(--muted); font-size: 0.95rem; }
.shot.wide img { box-shadow: 0 30px 60px -30px rgb(19 35 58 / 0.35); }

.halves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  padding-block: 112px 24px;
}
.halves article { display: flex; flex-direction: column; gap: 18px; }
.halves p { max-width: 36em; }
.halves .shot { margin-top: auto; padding-top: 12px; }

/* ------------------------------------------------------------------ phones */

.phones { padding-block: 104px 0; }
.phone-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 32px;
}
.phone-row img {
  border: 1px solid var(--rule);
  border-radius: 22px;
  background: var(--surface);
}

/* ----------------------------------------------------------------- details */

.details { padding-block: 112px 0; }
.details dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px 40px;
  margin: 36px 0 0;
}
.details dl > div { border-top: 2px solid var(--ink); padding-top: 14px; }
.details dt { font-weight: 700; font-size: 1.08rem; }
.details dd { margin: 6px 0 0; color: var(--muted); }

/* --------------------------------------------------------------------- run */

.run {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 56px;
  margin-top: 120px;
  padding: 48px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
}
.run p { margin-top: 14px; }
.run aside p { color: var(--muted); }
.run pre {
  margin: 20px 0 0;
  padding: 18px 20px;
  border-radius: 10px;
  background: var(--code-bg);
  color: #e4ecf5;
  overflow-x: auto;
  line-height: 1.7;
}
.run aside { border-left: 1px solid var(--rule); padding-left: 40px; }
.run aside h2 { font-size: 1.25rem; }

/* ------------------------------------------------------------------ footer */

footer {
  padding-block: 64px 48px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ------------------------------------------------------------------ narrow */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-block: 32px 56px; }
  .rose { width: min(100%, 340px); margin-top: 16px; }
  .halves { grid-template-columns: 1fr; gap: 72px; padding-block: 80px 0; }
  .phone-row { grid-template-columns: repeat(2, 1fr); }
  .details dl { grid-template-columns: 1fr 1fr; }
  .run { grid-template-columns: minmax(0, 1fr); gap: 40px; padding: 32px 24px; }
  .run aside { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 32px; }
}

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .lede { font-size: 1.08rem; }
  .details dl { grid-template-columns: 1fr; }
  .rose .p { font-size: 0.82rem; width: 6.5em; }
  .run { padding: 24px 18px; }
}
