/* White page, black type, one typeface, one blue. */

/* Inter is served from this folder and preloaded in index.html, so it is ready before first paint. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}
/* Arial resized to Inter's proportions. If Inter is ever late, lines still break in the same places. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  size-adjust: 107.06%;
  ascent-override: 90.49%;
  descent-override: 22.56%;
  line-gap-override: 0%;
}

:root {
  color-scheme: light;
  --paper: #FFFFFF;
  --ink: #111214;
  --muted: #7A7D85;
  --tint: #EEF0F4;
  --signal: #2450FF;
  --sans: "Inter", "Inter Fallback", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }

.page {
  min-height: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding-block: clamp(72px, 24vh, 240px) 28px;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 56px;
}
main { display: flex; flex-direction: column; gap: 22px; }

h1 {
  margin: 0;
  font-weight: 600;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.45;
  letter-spacing: -0.025em;
}
.story {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.5;
  letter-spacing: -0.022em;
  text-wrap: pretty;
}

/* Sentences share a line until one is unfolded; then it becomes its own paragraph. */
.sentence.open { display: block; margin-bottom: 0.7em; }
.sentence:not(.open) + .sentence.open { margin-top: 0.7em; }
.sentence.open:last-child { margin-bottom: 0; }
.story p { margin: 0 0 0.7em; }
.story p:last-child { margin-bottom: 0; }

/* A phrase that can be unfolded */
.fold {
  background: var(--tint);
  border-radius: 6px;
  padding: 0.04em 0.22em;
  cursor: pointer;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.fold:hover { background: color-mix(in srgb, var(--signal) 12%, var(--paper)); color: var(--signal); }

/* Newly unfolded text arrives in blue and settles to black */
.fresh { animation: settle 1.6s ease-out; }
@keyframes settle { from { color: var(--signal); } }

.story a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--muted);
  transition: color 0.2s;
}
.story a:hover { color: var(--signal); text-decoration-color: var(--signal); }

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  min-height: 1.5em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.meta button {
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--tint);
  background: none;
  padding: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.meta button:hover { color: var(--signal); border-color: var(--signal); }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; color: var(--muted); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.icons { display: flex; gap: 6px; margin-right: -6px; }
.icons a { display: flex; padding: 6px; color: var(--muted); transition: color 0.2s; }
.icons a:hover { color: var(--ink); }
footer a { text-decoration: none; transition: color 0.2s; }
footer a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .fresh { animation: none; }
  .fold { transition: none; }
}
