/*
  Manifesto's pages: a sheet of the app's yellow legal pad.

  One ruled line (--u, 28 px) is the rhythm of every page. Each line box and each gap is a
  whole number of lines, so the writing stands on the rules: the rule runs --r down each
  line, 5.5 px under the baseline of the body text, just clear of its descenders (the app
  lifts its writing the same way). Both faces put their capitals in the middle of their line
  box, so text in a pill needs no nudge. Bricolage sits lower in its line: see h2.

  The faces are the app's (OFL, licences in /fonts). No scripts, no cookies.
*/

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/AtkinsonHyperlegibleNext-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/AtkinsonHyperlegibleNext-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

:root {
  /* The colours of the app by day (Design/Tokens.swift). */
  --ground: #fdf49b;
  --tray: #fffbd5;
  --ink: #1a2c94;
  --second: #435793;
  --rule: #94c7db;
  --margin: rgb(214 29 34 / 0.55);

  --u: 1.75rem;
  --r: 1.5625rem;
  --side: 1rem;
  --measure: 36rem;

  --text: "Atkinson Hyperlegible Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", "Atkinson Hyperlegible Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  color-scheme: light;
}

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

html {
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--text);
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: var(--u);
  overflow-wrap: break-word;
  /* The rules of the pad: one a line, the whole width of the page. */
  background-image: linear-gradient(var(--rule), var(--rule) 1px, transparent 1px);
  background-size: 100% var(--u);
  background-position: 0 var(--r);
}

/* The red double rule of the margin, where there is room for it left of the writing. */
@media (min-width: 42rem) {
  body::before {
    content: "";
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(50% - var(--measure) / 2 - 1rem - 4px);
    width: 4px;
    border-left: 1px solid var(--margin);
    border-right: 1px solid var(--margin);
    pointer-events: none;
  }
}

.col {
  max-width: calc(var(--measure) + 2 * var(--side));
  margin-inline: auto;
  padding-inline: var(--side);
}

/* The head of the sheet has no rules, as in the app. */
.head {
  background: var(--ground);
  padding-top: var(--u);
}

@media (min-width: 42rem) {
  .head {
    padding-top: calc(var(--u) * 3);
  }
}

.mark {
  display: block;
  width: fit-content;
  font: 800 1.375rem/var(--u) var(--display);
  color: var(--ink);
  text-decoration: none;
}

h1 {
  margin: var(--u) 0 0;
  font: 800 2.125rem/calc(var(--u) * 2) var(--display);
  letter-spacing: -0.01em;
}

.updated {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--second);
}

/* The first rule closes the head, and the writing starts on the next one. */
main {
  display: block;
  padding-top: var(--u);
}

p,
ul,
ol {
  margin: 0 0 var(--u);
}

ul,
ol {
  padding-left: 1.5rem;
}

li::marker {
  color: var(--second);
}

/* A sentence that leads into the list under it keeps to it. */
.intro {
  margin-bottom: 0;
}

/* In a 28 px line Bricolage's baseline is 1.5 px lower than Atkinson's: 2 px up, and its
   descenders clear the rule as the body text does. */
h2 {
  position: relative;
  top: -2px;
  margin: calc(var(--u) * 2) 0 0;
  font: 800 1.375rem/var(--u) var(--display);
}

h3 {
  margin: var(--u) 0 0;
  font: 700 1.0625rem/var(--u) var(--text);
}

main > :first-child {
  margin-top: 0;
}

strong {
  font-weight: 700;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

/* The short version lies on the sheet like a slip of paper, its edges on two rules. It is
   lifted onto the rule above it; the shadow is the one pixel that covers the rule under it. */
.short {
  position: relative;
  top: calc(var(--r) - var(--u));
  margin: var(--u) 0;
  padding: var(--u) 1.25rem 0;
  background: var(--tray);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--tray);
}

main > .short:first-child {
  margin-top: var(--u);
}

.short h2 {
  margin-top: 0;
}

.short > :last-child {
  margin-bottom: var(--u);
}

.company {
  color: var(--ink);
}

/* Home: the name in the head, one line on the rules, the way to the App Store. */
.home .head {
  padding-top: calc(var(--u) * 3);
}

@media (min-width: 42rem) {
  .home .head {
    padding-top: calc(var(--u) * 5);
  }
}

.hero {
  margin: 0;
  font: 800 3.5rem/calc(var(--u) * 2) var(--display);
  letter-spacing: -0.02em;
}

@media (min-width: 42rem) {
  .hero {
    font-size: 4.5rem;
    line-height: calc(var(--u) * 3);
  }
}

.line {
  position: relative;
  top: -2px;
  font: 700 1.375rem/var(--u) var(--display);
}

/* The app's pill: two lines high, standing on the rule under it. */
.get {
  position: relative;
  top: calc(var(--r) - var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 20rem;
  height: calc(var(--u) * 2);
  border-radius: 999px;
  background: var(--ink);
  color: var(--ground);
  font-weight: 700;
  text-decoration: none;
}

.get:hover {
  background: #14227a;
}

.get:active {
  transform: scale(0.98);
}

.note {
  color: var(--second);
  font-size: 0.9375rem;
}

.foot {
  padding-top: var(--u);
  padding-bottom: calc(var(--u) * 2);
  font-size: 0.9375rem;
  color: var(--second);
}

.foot p {
  margin: 0;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.5rem;
}

/* A taller touch target without a taller line. */
.foot nav a {
  padding-block: 0.5rem;
  margin-block: -0.5rem;
}

.foot a {
  color: var(--ink);
}

.foot a[aria-current="page"] {
  color: var(--second);
  text-decoration: none;
}

@media print {
  body {
    background: none;
  }

  body::before {
    display: none;
  }
}
