/* Margin's site. The palette is the app's own (Margin/Design/Design.swift):
   greyscale, no accent colour, the current thing on a grey wash. Text greys
   are a step deeper than the app's `muted` so small text passes WCAG AA. */

:root {
  color-scheme: light dark;
  --ground: #ffffff;
  --ink: #171717;
  --text-2: #555555;
  --muted: #6e6e6e;
  --hairline: #e8e8e8;
  --wash: #efefef;

  /* Space tints, used only as small marks. */
  --slate: #738090;
  --blue: #407ad9;
  --green: #3d9e66;
  --orange: #e68533;
  --red: #db4d4d;
  --violet: #8c66d9;

  --radius: 14px;
  --note: 15rem;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1c1c1c;
    --ink: #ededed;
    --text-2: #b3b3b3;
    --muted: #949494;
    --hairline: #333333;
    --wash: #2d2d2d;
  }
}

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

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

/* The footer sits at the foot of the window even when a page is short. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

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

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li,
figcaption {
  text-wrap: pretty;
}

/* Links read as links without a colour: a soft underline that firms up. */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--muted);
}

a:hover {
  text-decoration-color: currentColor;
}

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 0.875rem;
  background: var(--ink);
  color: var(--ground);
  border-radius: 10px;
  text-decoration: none;
  z-index: 1;
}

.skip:focus {
  top: 1rem;
}

.wrap {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px);
}

/* Header and footer */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 600;
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 22.5%;
  box-shadow: 0 0 0 1px var(--hairline);
}

.links {
  display: flex;
  gap: 1.25rem;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.links a {
  text-decoration-color: transparent;
}

.links a:hover,
.links a[aria-current="page"] {
  text-decoration-color: currentColor;
}

.foot {
  margin-top: 4rem;
  border-top: 1px solid var(--hairline);
}

.foot .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  font-size: 15px;
  color: var(--text-2);
}

/* The page and its margin. Each row is a main column and a note beside it;
   the notes share one hairline that runs down the page, like the rule in
   the app icon. On a phone the note follows its row. */

.row + .row {
  margin-top: 2.25rem;
}

.note {
  margin-top: 0.75rem;
  padding-left: 0.875rem;
  border-left: 1px solid var(--hairline);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-2);
}

.note p + p {
  margin-top: 0.5rem;
}

/* A page's contents come first on a phone and sit in the margin beside the
   text on a wider screen. */
.row.contents-first > .note {
  margin: 0 0 2.5rem;
}

@media (max-width: 879px) {
  .note:empty {
    display: none;
  }
}

@media (min-width: 880px) {
  .row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--note);
  }

  .row + .row {
    margin-top: 0;
  }

  .row > .main {
    padding: 0 3rem 2.75rem 0;
  }

  .row > .note {
    margin-top: 0;
    padding: 0.2rem 0 2.75rem 1.5rem;
  }

  .row.contents-first > .main {
    grid-column: 1;
    grid-row: 1;
  }

  .row.contents-first > .note {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }
}

/* Type */

h1 {
  font-size: clamp(34px, 5.2vw, 50px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.024em;
  max-width: 15em;
}

.lede {
  margin-top: 1rem;
  max-width: 34em;
  font-size: clamp(19px, 2.2vw, 22px);
  line-height: 1.45;
  color: var(--text-2);
}

h2 {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.012em;
}

h3 {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 600;
}

.main p,
.main ul {
  max-width: 38em;
}

.main h2 + p,
.main h2 + ul,
.main h3 + p,
.main p + p,
.main p + ul,
.main ul + p {
  margin-top: 0.625rem;
}

.main h2 + h3 {
  margin-top: 1rem;
}

.main p + h3,
.main ul + h3 {
  margin-top: 1.5rem;
}

.main ul {
  padding-left: 1.2em;
}

.main li + li {
  margin-top: 0.375rem;
}

.text-2 {
  color: var(--text-2);
}

.meta {
  margin-top: 0.75rem;
  font-size: 15px;
  color: var(--text-2);
}

/* Home */

.hero {
  padding-top: clamp(2rem, 7vw, 5rem);
}

/* The one thing to do here: ink on the page, as the app draws its own
   primary action, with no colour of its own. */
.main .cta {
  margin-top: 1.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 1.5rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ground);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  opacity: 0.86;
}

.button:focus-visible {
  border-radius: 999px;
}

.main .cta-note {
  margin-top: 0.75rem;
  font-size: 15px;
  color: var(--text-2);
}

.closing {
  margin-top: 1.5rem;
}

.closing h2 + p {
  margin-top: 0.625rem;
}

/* Where Margin is now: on the grey wash the app uses for the current thing. */
.status {
  padding: 0.875rem 1rem;
  background: var(--wash);
  border-radius: var(--radius);
  color: var(--ink);
}

.status p + p {
  margin-top: 0.375rem;
  color: var(--text-2);
}

.note.status-note {
  border-left: 0;
  padding-left: 0;
}

@media (min-width: 880px) {
  .note.status-note {
    border-left: 1px solid var(--hairline);
    padding-left: 1.5rem;
  }
}

.shots {
  display: flex;
  gap: 1rem;
  margin: 2.5rem calc(-1 * clamp(20px, 5vw, 48px)) 3rem;
  padding: 0.25rem clamp(20px, 5vw, 48px) 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 clamp(20px, 5vw, 48px);
  list-style: none;
}

.shots li {
  flex: 0 0 min(66vw, 250px);
  scroll-snap-align: start;
}

.shots img {
  width: 100%;
  /* The phone's own rounded screen corners. */
  border-radius: 13.7% / 6.3%;
  box-shadow: 0 0 0 1px var(--hairline);
  background: var(--wash);
}

.shots figcaption {
  margin-top: 0.875rem;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-2);
}

@media (min-width: 880px) {
  .shots {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1.5rem, 4vw, 3.5rem);
    margin: 3.5rem 0 4rem;
    padding: 0;
    overflow: visible;
  }

  .shots li {
    max-width: 290px;
  }
}

.section-head {
  margin-bottom: 1.75rem;
}

.tints {
  display: flex;
  gap: 6px;
  margin-bottom: 0.625rem;
}

.tints span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.t-slate { background: var(--slate); }
.t-blue { background: var(--blue); }
.t-green { background: var(--green); }
.t-orange { background: var(--orange); }
.t-red { background: var(--red); }
.t-violet { background: var(--violet); }

/* Privacy and support */

/* Space below the head comes from the row's own cells, so the margin rule
   runs on unbroken into the text. */
.page-head {
  padding-top: clamp(2rem, 6vw, 4rem);
}

.contents {
  font-size: 15px;
}

.contents p {
  color: var(--text-2);
  margin-bottom: 0.375rem;
}

.contents ul {
  padding: 0;
  list-style: none;
}

.contents li + li {
  margin-top: 0.25rem;
}

.contents a {
  text-decoration-color: transparent;
}

.contents a:hover {
  text-decoration-color: currentColor;
}

@media (min-width: 880px) {
  .sticky {
    position: sticky;
    top: 1.5rem;
  }
}

.doc section + section {
  margin-top: 2.5rem;
}

.doc section {
  scroll-margin-top: 1.5rem;
}

.mail {
  overflow-wrap: anywhere;
}

/* 404 */

.lost {
  padding-top: clamp(3rem, 12vw, 8rem);
}

.lost p {
  margin-top: 1rem;
  color: var(--text-2);
}
