/*
  My Calendar: the two public pages and the not-found page.
  One stylesheet, no script, nothing from another host.

  Paper, ink and hairline are the app's own colours, light and dark
  (apps/calendar-ios/PatricksCalendar/Theme.swift, Palette.light and
  Palette.dark: bg, fg, line), and a test holds the six to the app's. The
  dark hairline is #32353c because the app's is: its version 1.23 made it a
  step lighter than #26282e, which at 1.3 to 1 against the page all but
  went, and this page had kept the older one. Words are always ink on paper.

  The type is the app's own two faces, sent from this site and from nowhere
  else: Schibsted Grotesk for the words, and IBM Plex Mono for the small
  capitals over a help topic, which is how the app draws a label ("WHERE",
  "WHO"). Three small files in /fonts, each beside the licence it is given
  under. Until a file arrives, and where one never does, the words stand in
  the reader's system face: nothing waits for a font.
*/

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/SchibstedGrotesk-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/SchibstedGrotesk-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  --paper: #ffffff;
  --ink: #15171c;
  --line: #e6e6e2;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e0f12;
    --ink: #eeeef0;
    --line: #32353c;
  }
}

/* A reader who asks for more contrast gets rules as dark as the words. */
@media (prefers-contrast: more) {
  :root {
    --line: var(--ink);
  }
}

/*
  The face and the size are set here. The line height is not: it is the
  body's (1.5, below), which every paragraph, list line and the address
  take from it, as they did when this rule also named one. A test holds
  the body to it.
*/
html {
  font-family: var(--sans);
  font-size: 106.25%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/*
  On a wide screen the words are a size larger, and the column with them: a
  line is about seventy letters long, which is as long as reads easily.
*/
@media (min-width: 48rem) {
  html {
    font-size: 118.75%;
  }
}

/*
  On an iPhone the page follows the reader's own text size (Settings, Display
  and Brightness, Text Size), as the app does. The second test keeps this to
  iPhone and iPad: on a Mac the same keyword means a 13-pixel face. It comes
  after the wide-screen size, so an iPad keeps the reader's own size too.
*/
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html {
    font: -apple-system-body;
    font-family: var(--sans);
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  overflow-wrap: break-word;
}

/* One column, words flush left. */
main {
  box-sizing: border-box;
  max-inline-size: 36rem;
  margin-inline: auto;
  padding: 3rem 1.25rem 4rem;
}

@media (min-width: 48rem) {
  main {
    padding-block: 5rem 6rem;
  }
}

/*
  The page's name, as the app sets the name of a screen: heavy, tight, and
  the largest thing on the page. It grows with the window up to a point. At
  the largest text sizes an iPhone offers it stops growing before a word of
  it would be wider than the screen, and is never smaller than the words
  under it.
*/
h1 {
  margin: 0 0 1.5rem;
  font-size: min(clamp(1.75rem, 1.3rem + 2.2vw, 2.5rem), max(1rem, 11.5vw));
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/*
  The sentence under the name says what the page is about: a size up, its
  lines of about one length. At the large text sizes an iPhone offers it is
  the size of the words under it: they are large enough already.
*/
h1 + p {
  font-size: min(1.125rem, max(1rem, 5.6vw));
  line-height: 1.45;
  text-wrap: balance;
}

/*
  The name of a help topic, as the app draws a label: small capitals in the
  second face, spaced a little, in ink. The words themselves are written as
  a sentence; only their drawing is capitals. It is what a reader runs an
  eye down to find an answer, and at 0.75rem it was the smallest text on the
  page: under 13 pixels on a phone, where the words are 17. It is 14 there
  now, and still a size under the words it stands over.
*/
h2 {
  margin: 0 0 0.45rem;
  font-family: var(--mono);
  font-size: 0.825rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  text-wrap: balance;
}

p {
  margin: 0 0 1rem;
  text-wrap: pretty;
}

/*
  The two ways on from the not-found page, one under the other with no
  mark before them, under a hairline as a help topic is. The rule names
  every list, and the not-found page has the site's only one: a test fails
  if another page gets a list.
*/
ul {
  margin: 1.5rem 0 0;
  padding: 0.5rem 0 0;
  border-block-start: 1px solid var(--line);
  list-style: none;
}

/* A hairline before each help topic and before the address to write to. */
section,
address {
  margin-block-start: 1.5rem;
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--line);
}

section > :last-child {
  margin-block-end: 0;
}

address {
  font-style: normal;
}

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

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

/*
  A link that stands alone (the address to write to, the two links on the
  not-found page) is something to tap, so it gets a thumb's height. The
  address keeps its place in the line: the room is taken back in the margin.
*/
address a,
li a {
  display: inline-block;
  padding-block: 0.75rem;
}

address a {
  margin-block: -0.75rem;
}

/*
  At the largest text sizes an iPhone offers, the address is wider than the
  screen. It then breaks where it must, and the page never moves sideways.
*/
address a {
  max-inline-size: 100%;
  overflow-wrap: anywhere;
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

/* On paper: black on white whatever the screen was set to. */
@media print {
  :root {
    --paper: #ffffff;
    --ink: #000000;
    --line: #999999;
  }

  main {
    max-inline-size: none;
    padding: 0;
  }
}
