/* aplite.dev. one stylesheet for every page. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-latin-600-normal.woff2") format("woff2");
}

:root {
  /* brand kit colours */
  --bg: #0a0a0a;
  --ink: #f2f3f0;
  --dot: #6c7fd8;
  --muted: #8b8d91;
  --faint: #3a3b3f;
  --rule: #1d1e21;

  /* the wordmark's width. everything else is sized from it. */
  --wordmark: clamp(180px, 22vw, 310px);

  /* motion: quick, normal, slow */
  --quick: 150ms;
  --normal: 300ms;
  --slow: 600ms;

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--dot);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- centred pages: the homepage, 404 and the one-liners ---------- */

.stage {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 16px;
}

/* sits a little above true centre, so it looks centred */
.mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-5vh);
}

.wordmark {
  display: block;
  width: var(--wordmark);
  height: auto;
  overflow: visible;
}

a.home {
  display: block;
  border-radius: 4px;
}

/* the dot and the i-dot on their own, at the same size they are in the wordmark */
.solo-dot {
  display: block;
  width: calc(var(--wordmark) * 60 / 601.08);
  height: auto;
}

.solo-idot {
  display: block;
  width: calc(var(--wordmark) * 29.59 / 601.08);
  height: auto;
}

.line {
  margin: 2rem 0 0;
  max-width: 32ch;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}

/* a second line that belongs with the one above it */
.line-tight {
  margin-top: 0.5rem;
}

/* the letters' demands, under their line */
.dots.demands {
  margin-top: 1.5rem;
  color: var(--muted);
}

/* only shown when JavaScript is off (see noscript.css) */
.when-nojs {
  display: none;
}

/* ---------- /nothing ---------- */

.told-you {
  margin: 0;
  transform: translateY(-5vh);
  color: var(--muted);
  opacity: 0;
  animation: appear var(--slow) ease-out 10s forwards;
}

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

/* ---------- the comma, on the 404 ---------- */

/* hidden everywhere until someone needs it */
.wordmark .comma {
  opacity: 0;
}

/* on the 404 it waits off to the side, slides into the empty spot, notices
   you, and leaves. one visit every 20 seconds. */
.lost .comma {
  animation: comma 20s ease-in-out 4s infinite;
}

@keyframes comma {
  0%,
  78% {
    opacity: 0;
    transform: translateX(48px);
  }
  82% {
    opacity: 1;
    transform: translateX(0);
  }
  88% {
    opacity: 1;
    transform: translateX(0);
  }
  89% {
    transform: translateX(-3px);
  }
  90% {
    opacity: 1;
    transform: translateX(0);
  }
  94%,
  100% {
    opacity: 0;
    transform: translateX(72px);
  }
}

/* ---------- text pages: status, diaries, letters ---------- */

.page {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 48px 16px 96px;
}

.page-head {
  margin-bottom: 56px;
}

.page-head .wordmark {
  width: 96px;
}

.page h1 {
  margin: 0 0 32px;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

.page h2 {
  margin: 48px 0 16px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.page p {
  margin: 0 0 16px;
}

.muted {
  color: var(--muted);
}

/* lists use the dot as their bullet */
.dots {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dots li {
  position: relative;
  margin: 0 0 12px;
  padding-left: 22px;
}

.dots li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
}

/* name on the left, state on the right */
.states li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.states .state {
  color: var(--muted);
  text-align: right;
}

.date {
  display: block;
  margin: 32px 0 12px;
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.page .wordmark.letters-only {
  width: var(--wordmark);
  margin: 0 auto;
}

/* ---------- moving between pages ---------- */

/* the old page shrinks into the dot grid and the new one grows out of it.
   browsers without cross-document view transitions just load the page. */
@view-transition {
  navigation: auto;
}

@property --grain {
  syntax: "<length>";
  inherits: false;
  initial-value: 13px;
}

::view-transition-old(root),
::view-transition-new(root) {
  mix-blend-mode: normal;
  /* 18px cells, the same as the homepage's hidden grid. 13px covers a cell. */
  mask-image: radial-gradient(circle, #000 var(--grain), transparent calc(var(--grain) + 0.5px));
  mask-size: 18px 18px;
  mask-position: center;
}

::view-transition-old(root) {
  animation: grain-out 360ms ease-in both;
}

::view-transition-new(root) {
  animation: grain-in 420ms ease-out 180ms both;
}

@keyframes grain-out {
  from {
    --grain: 13px;
  }
  to {
    --grain: 0px;
  }
}

@keyframes grain-in {
  from {
    --grain: 0px;
  }
  to {
    --grain: 13px;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .told-you {
    animation-duration: 1ms;
  }

  .lost .comma {
    display: none;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ---------- print ---------- */

@media print {
  html,
  body {
    background: #fff;
    color: #000;
  }

  .stage {
    min-height: auto;
    padding-top: 2in;
  }

  .mark {
    transform: none;
  }

  .wordmark .letters,
  .wordmark .idot {
    fill: #000;
  }

  /* image wordmarks are drawn for a dark page. this keeps the letters dark and
     the dot close to its colour on paper. */
  img.wordmark,
  img.solo-dot,
  img.solo-idot {
    filter: invert(1) hue-rotate(180deg);
  }

  .line,
  .when-nojs {
    display: none !important;
  }

  .mark::after {
    content: "Why are you printing this.";
    margin-top: 2rem;
    color: #000;
  }
}
