/* shapley.si
   One page: a title and a short list, centred over a starfield.
   Two inks on black. One typeface, roman and italic. One line rhythm. */

@font-face {
  font-family: "Old Standard";
  src: url("/fonts/old-standard-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Old Standard";
  src: url("/fonts/old-standard-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --ink: #f4f4f4;    /* title and links */
  --quiet: #909090;  /* headings and what is not live yet; 6.5:1 on black */

  /* Type scales gently from a 360 px phone to a 2,560 px monitor. */
  --size: clamp(1.0625rem, 0.94rem + 0.42vw, 1.5rem);
  /* Every vertical measure on the page is a whole number of these lines. */
  --line: calc(var(--size) * 1.6);

  color-scheme: dark;
}

/* A short screen, such as a phone on its side: take the type size from the
   height instead, so the whole list still fits without scrolling. The block
   is 16 lines tall with 3 lines of padding, and 19 lines of 1.6 come to 30.4
   times the type size, so 3.25 per cent of the height is the most that fits.
   The floor of 12.8 px lets a 390 px phone on its side (19 x 1.6 x 12.8 = 389)
   keep the whole list on screen. */
@supports (height: 1svh) {
  :root {
    --size: clamp(0.8rem, min(max(1.0625rem, 0.94rem + 0.42vw), 3.25svh), 1.5rem);
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  /* The title is the heaviest thing in the block and sits at its top, so the
     block is held half a line above the true centre to look centred: one line
     more padding below than above. */
  padding: var(--line) 1.25rem calc(var(--line) * 2);
  background: #000;
  color: var(--ink);
  font-family: "Old Standard", "Century Schoolbook", Century, Georgia, "Times New Roman", serif;
  font-size: var(--size);
  line-height: var(--line);
  font-kerning: normal;
  font-synthesis: none;
  /* Exact glyph positions. Without this, Chromium on Linux rounds every
     letter's advance to a whole pixel and the words come out loose and uneven
     (measured: the longest line 291 px wide instead of 272). */
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

main {
  position: relative; /* above the sky */
  max-width: 100%;
  text-align: center;
}

h1,
h2,
ul {
  margin: 0;
  padding: 0;
}

h1 {
  font-size: 2.2em;
  font-weight: 400;
  line-height: calc(var(--line) * 2);
  margin-bottom: var(--line);
}

h2 {
  font-size: 1em;
  font-weight: 400;
  font-style: italic;
  line-height: var(--line);
  color: var(--quiet);
  /* The italic's word space is cut wide; bring "Coming soon" together. */
  word-spacing: -0.08em;
  margin-top: var(--line);
}

ul {
  list-style: none;
}

li {
  overflow-wrap: break-word;
}

.soon {
  color: var(--quiet);
}

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

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

a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 0.3em;
}

::selection {
  background: var(--ink);
  color: #000;
}

/* Arrival. sky.js puts .warp on <html> for the length of the warp and takes
   it off once the list is fully there. The list comes up on a timer here
   rather than from the script, so it still appears if the script stops half
   way. Without JavaScript, with reduced motion, or on a second visit in the
   same session the class is never set and the list is simply there. Keep the
   numbers in step with LIST_DELAY, LIST_FADE and SKIP_FADE in sky.js. */
.warp main {
  opacity: 0;
  animation: arrive 1100ms cubic-bezier(0.3, 0, 0.3, 1) 1500ms forwards;
}

/* The visitor skipped before the list had begun to appear: bring it up now.
   A second set of keyframes, because changing the timing of a running
   animation would not restart it. */
.warp.skip main {
  animation: arrive-now 260ms ease-out forwards;
}

@keyframes arrive {
  to {
    opacity: 1;
  }
}

@keyframes arrive-now {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .warp main,
  .warp.skip main {
    opacity: 1;
    animation: none;
  }
}
