/*
 * The origin log is the one page that is allowed to be loud. It borrows the
 * landing's pixel register -- hard borders, stepped motion, no easing anywhere
 * -- and self-hosts the two fonts, because the site's CSP is `font-src 'self'`
 * and this page is a static file with no bundler to hash them in.
 */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/pixelify-sans-700.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-400.woff2') format('woff2');
}

:root {
  --canvas: #ffffff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --ember: #b45309;
  --ember-core: #fbbf24;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: 'Pixelify Sans', 'IBM Plex Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0f172a;
    --ink: #f1f5f9;
    --ink-soft: #cbd5e1;
    --muted: #94a3b8;
    --ember: #f97316;
    --ember-core: #fde68a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.8;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

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

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 4px solid var(--ink);
  background: var(--canvas);
  padding: 12px 20px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.bar a { color: var(--ink); text-decoration: none; }
.bar a:hover { text-decoration: underline; }
.bar .spacer { margin-left: auto; }

/*
 * The stop control. Infinite motion beside other content needs a way to stop
 * it (WCAG 2.2.2) -- this is that way, which is what buys the fire the right
 * to keep burning. It is a real button, not a checkbox pretending: pressed
 * state is exposed, and origin.js remembers the choice.
 */
.motion {
  border: 2px solid var(--ink);
  background: var(--canvas);
  color: var(--ink);
  padding: 4px 10px;
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.motion:hover { background: var(--ink); color: var(--canvas); }
.motion:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

.badge {
  display: inline-block;
  border: 3px solid var(--ink);
  padding: 6px 10px;
  margin: 0;
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.12em;
}

h1 {
  margin: 18px 0 32px;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.9rem, 7vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.log {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.log li {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

/* Fixed width, right aligned: I and III are different widths, and a ragged
   left edge is a poor look on a page about people who could not leave four
   pixels alone. */
.numeral {
  flex: 0 0 2rem;
  text-align: right;
  color: var(--ink);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.6;
}

.log p { margin: 0; }

.ember {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 16px 18px;
  margin: 36px 0;
  color: var(--ink);
}

.ember p { margin: 0; }

.fire {
  flex: 0 0 auto;
  color: var(--ember);
}

/* The hotter middle of the flame, so it reads as fire and not a blob. */
.fire .core { fill: var(--ember-core); }

/* Every frame hidden by default: the animation is what reveals one at a time,
   so a browser with motion off must be given a frame explicitly (below). */
.fire .frame { opacity: 0; }

.close { color: var(--ink); }

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.25em;
  background: var(--ink);
  vertical-align: text-bottom;
}

.out { margin-top: 32px; }
.out a { color: var(--ink); font-weight: 500; }

footer {
  border-top: 4px solid var(--ink);
  padding: 18px 20px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

footer a { color: var(--muted); }

@keyframes fire-frame {
  0%,
  33.32% { opacity: 1; }
  33.33%,
  100%   { opacity: 0; }
}

@keyframes caret-blink {
  0%,
  49.9%  { opacity: 1; }
  50%,
  100%   { opacity: 0; }
}

@keyframes numeral-boot {
  from { transform: translateX(-0.8em); }
  to   { transform: translateX(0); }
}

/*
 * Motion is opt-out, and the opt-out is honoured from two directions: the
 * button (data-motion) and the OS setting, which origin.js resolves into the
 * same attribute so there is exactly one switch to reason about here.
 */
[data-motion='on'] .fire .frame {
  animation: fire-frame 0.6s steps(1, end) infinite;
}

[data-motion='on'] .fire .frame-b { animation-delay: 0.2s; }
[data-motion='on'] .fire .frame-c { animation-delay: 0.4s; }

[data-motion='on'] .caret {
  animation: caret-blink 1.1s steps(1, end) infinite;
}

/* Never fades a glyph: animating text opacity walks it through every contrast
   ratio on the way up, and a scan caught these numerals mid-fade at 2.12:1.
   The carriage slides instead; the ink stays ink. */
[data-motion='on'] .numeral {
  animation: numeral-boot 500ms steps(4, end) 1 both;
}

[data-motion='on'] .log li:nth-child(2) .numeral { animation-delay: 90ms; }
[data-motion='on'] .log li:nth-child(3) .numeral { animation-delay: 180ms; }
[data-motion='on'] .log li:nth-child(4) .numeral { animation-delay: 270ms; }
[data-motion='on'] .log li:nth-child(5) .numeral { animation-delay: 360ms; }

/* Motion off: the page still has to look finished. One flame frame is shown
   and the caret rests solid. */
[data-motion='off'] .fire .frame-a { opacity: 1; }
