/* A plate from a celestial atlas, not a dark-mode dashboard.

   Two faces, each with one job: an engraved serif for the thing being observed (the repo,
   its one-line character), and a monospace for the instruments reading it (the dial, the
   key, the span, the status line). Nothing is set in a neutral UI sans, because the whole
   point is that this is a chart of something, not a control panel.

   Built for a projector in a lit seminar hall: near-black ground, high-contrast text,
   nothing under 15px, no thin greys that vanish on a washed-out screen. */

:root {
  --void: #07080c;      /* blue-black, not neutral black: it reads as night, not as off */
  --paper: #ece6d9;     /* warm chart-paper white against the cold ground */
  --muted: #8c8878;
  --rule: #1d2230;
  --ember: #e8c489;     /* the dial's peak-hour amber -- the only accent, and it is data */

  --serif: "Hoefler Text", "Iowan Old Style", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  /* Expo-out. Things arrive quickly and settle, the way a telescope stops moving. */
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#sky {
  position: fixed;
  inset: 0;
  display: block;
}

/* ---------------------------------------------------------------- the instrument panel */

#chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 22px 26px;
  z-index: 2;
  /* Fades the canvas out behind the input rather than covering it with a bar. */
  background: linear-gradient(to bottom, rgba(7,8,12,.94), rgba(7,8,12,0));
  pointer-events: none;
}

#form {
  display: flex;
  gap: 10px;
  max-width: 600px;
  pointer-events: auto;
}

#src {
  flex: 1;
  font: 15px/1.4 var(--mono);
  letter-spacing: .01em;
  padding: 12px 14px;
  color: var(--paper);
  background: rgba(14, 16, 24, .72);
  border: 1px solid var(--rule);
  border-radius: 3px;              /* nearly square: an instrument, not an app */
  transition: border-color .35s var(--ease), box-shadow .35s var(--ease);
}
#src::placeholder { color: var(--muted); }   /* #6c6a60 measured 3.7:1 -- under AA */
#src:focus {
  outline: none;
  border-color: #3b4560;
  box-shadow: 0 0 0 1px rgba(232, 196, 137, .18);
}

#form button {
  font: 600 12px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 0 22px;
  color: var(--void);
  background: var(--paper);
  border: 1px solid var(--paper);
  border-radius: 3px;
  cursor: pointer;
  transition: transform .3s var(--ease), background-color .3s var(--ease);
}
#form button:hover:not(:disabled) { transform: translateY(-1px); background: #fff; }
#form button:active:not(:disabled) { transform: translateY(0); }
#form button:disabled { opacity: .4; cursor: default; }

#src:focus-visible, #form button:focus-visible {
  outline: 1px solid var(--ember);
  outline-offset: 2px;
}

#status {
  margin: 12px 1px 0;
  min-height: 1.3em;
  font: 12px/1.3 var(--mono);
  letter-spacing: .13em;
  color: var(--muted);
  pointer-events: none;
}
#status.error { color: #e89a86; letter-spacing: .04em; font-size: 13px; }

#recent {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 1px 0;
  pointer-events: auto;   /* #chrome is pointer-events:none so the sky stays hoverable */
}

#recent button {
  font: 11px/1 var(--mono);
  letter-spacing: .1em;
  padding: 6px 10px;
  color: #b9b3a6;
  background: rgba(14, 16, 24, .72);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
#recent button:hover { color: var(--paper); border-color: #3b4560; }
#recent button[aria-current="true"] { color: var(--ember); border-color: #4a4334; }
#recent button:focus-visible { outline: 1px solid var(--ember); outline-offset: 2px; }

#zoom {
  position: fixed;
  right: 26px; bottom: 30px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

#zoom button {
  font: 13px/1 var(--mono);
  min-width: 34px;
  padding: 9px 0;
  color: #b9b3a6;
  background: rgba(14, 16, 24, .82);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
#zoom button:hover:not(:disabled) { color: var(--paper); border-color: #3b4560; }
#zoom button:disabled { opacity: .35; cursor: default; }
#zoom button:focus-visible { outline: 1px solid var(--ember); outline-offset: 2px; }
#zoomReset { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; padding: 8px 6px; }

/* Announced, never shown. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Invisible until focused, then a chip that says what the keys do. Tabbing into a star
   field with no idea that arrows work is the same as it not working. */
#skyFocus {
  position: fixed;
  top: 132px; left: 26px;
  z-index: 4;
  width: 1px; height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  font: 12px/1.4 var(--mono);
  letter-spacing: .06em;
}

/* `.is-on` is set from JS, and it is the one that is load-bearing. WebKit does not match
   :focus while the window is not the key window, so a rule hanging off :focus alone can
   silently not apply -- the same way the entrance animation silently did not run. The
   pseudo-class is kept as a belt to that braces. */
#skyFocus.is-on,
#skyFocus:focus {
  width: auto; height: auto;
  padding: 9px 13px;
  clip: auto;
  overflow: visible;
  color: var(--paper);
  background: rgba(11, 13, 20, .97);
  border: 1px solid var(--ember);
  border-radius: 3px;
  outline: none;
}

/* ---------------------------------------------------------------- the key */

#key {
  position: fixed;
  top: 272px; right: 26px;
  z-index: 2;
  text-align: right;
  pointer-events: none;
}

/* Was #5f5d56, which measures 3.0:1 on this ground -- under AA at 11px, and the first
   thing to disappear on a washed-out projector. */
#key h2 {
  margin: 0 0 10px;
  font: 11px/1 var(--mono);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}

#key ul { margin: 0; padding: 0; list-style: none; }

#key li {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 7px;
  font: 12px/1.2 var(--mono);
  letter-spacing: .06em;
  color: #b9b3a6;
}

#key i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;   /* set per-item from the star colour */
  flex: none;
}

/* Caption for the dial, sitting directly under it. */
#dialLabel {
  position: fixed;
  top: 238px; right: 26px;
  z-index: 2;
  margin: 0;
  width: 184px;
  text-align: center;
  font: 10px/1 var(--mono);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the empty state */

#intro {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 30px 26px 32px;
  z-index: 2;
  background: linear-gradient(to top, rgba(7,8,12,.96) 55%, rgba(7,8,12,0));
}

#introRule {
  margin: 0 0 20px;
  border-top: 1px solid var(--rule);
}

#intro h1 {
  margin: 0 0 12px;
  overflow-wrap: anywhere;
  font-size: clamp(30px, 4.6vw, 62px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.012em;
}

#intro .lede {
  margin: 0 0 16px;
  max-width: 54ch;
  font-size: clamp(16px, 1.55vw, 21px);
  line-height: 1.45;
  color: #c9c2b4;
}

#intro .try {
  margin: 0;
  font: 12px/1.9 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Type-in-the-box is the slow path. These are the same action, one click away. */
#intro .try button {
  font: inherit;
  letter-spacing: inherit;
  padding: 0;
  color: var(--paper);
  background: none;
  border: 0;
  border-bottom: 1px solid #3a4152;
  cursor: pointer;
}
#intro .try button:hover { color: var(--ember); border-bottom-color: var(--ember); }
#intro .try button:focus-visible { outline: 1px solid var(--ember); outline-offset: 3px; }

#intro .by {
  margin: 10px 0 0;
  font: 11px/1.9 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
#intro .by a { color: inherit; text-decoration: none; border-bottom: 1px solid #3a4152; }
#intro .by a:hover { color: var(--ember); border-bottom-color: var(--ember); }
#intro .by a:focus-visible { outline: 1px solid var(--ember); outline-offset: 3px; }

/* ---------------------------------------------------------------- the plate caption */

#caption {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 30px 26px 32px;
  z-index: 2;
  background: linear-gradient(to top, rgba(7,8,12,.96) 55%, rgba(7,8,12,0));
  pointer-events: none;
}

/* The span line: an observation record, in the instrument face. */
/* The rule spans the whole plate, the way a chart's frame does. Stopping it at the text
   measure made it read as an underline that had run out. */
#observed {
  margin: 0 0 14px;
  padding-top: 15px;
  border-top: 1px solid var(--rule);
  font: 11px/1 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

#title {
  margin: 0 0 10px;
  /* org/repo slugs run long and there is no space in them to break at. */
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-size: clamp(30px, 4.6vw, 62px);
  font-weight: 400;              /* the serif carries it; bold would coarsen the engraving */
  line-height: 1;
  letter-spacing: -0.012em;
}

#read {
  margin: 0;
  max-width: 58ch;
  font-family: var(--serif);
  font-size: clamp(16px, 1.55vw, 21px);
  line-height: 1.45;
  color: #c9c2b4;
}

/* ---------------------------------------------------------------- tooltip */

#tooltip {
  position: fixed;
  z-index: 3;
  padding: 9px 12px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: rgba(11, 13, 20, .96);
  font: 12px/1.5 var(--mono);
  letter-spacing: .03em;
  pointer-events: none;
  white-space: nowrap;
}
#tooltip b { font-weight: 600; color: var(--paper); }
#tooltip span { color: var(--muted); }

/* ---------------------------------------------------------------- no arrival animation

   Do not add an entrance animation to the chrome. This was tried twice and it produced
   a blank page both times.

   Anything that animates from `opacity: 0` on load is a trap here, and removing the
   fill-mode does not save it: once Safari has *started* the animation it owns the
   property, and it throttles animations in a window that is not visible -- so the element
   freezes at opacity 0 and stays there. The result is a page with no input, no button, no
   caption and no error message, which looks exactly like a crash and is unusable. A user
   who mistypes a repo name sees nothing at all.

   The sky already runs its own reveal on the canvas. That is the arrival; the instruments
   around it just need to be there. */

@media (prefers-reduced-motion: reduce) {
  #src, #form button { transition: none; }
}

/* ---------------------------------------------------------------- narrow

   The instrument column has nowhere to go below this: the dial lands on the input and the
   key lands on the sky. The sketch stops drawing the dial at the same breakpoint. A dial
   you cannot read is worse than no dial. */

@media (max-width: 759px) {
  #key, #dialLabel { display: none; }
  #chrome { padding: 16px 18px; }
  #form { flex-wrap: wrap; }
  #src { min-width: 0; }
  #caption, #intro { padding: 22px 18px 24px; }
  #observed { font-size: 10px; letter-spacing: .16em; }
  #intro .try { line-height: 2.1; }

  /* Bottom-right belongs to the plate here -- the controls were sitting straight on top
     of the caption text. The dial and key are hidden at this width, so the top-right
     corner is free. */
  #zoom {
    top: 112px; right: 14px;
    bottom: auto;
  }
}
