/*
 * The public face: the main page and the 404.
 *
 * These two are the only pages a stranger can reach, so they share one look
 * and one stylesheet — the same reason admin.css exists for the signed-in
 * pages. Nothing here names a deck, an author or a route: what is behind the
 * door is not the door's business.
 */

:root {
  color-scheme: dark;
  --bg: #07080a;
  --panel: #12151b;
  --fg: #e8eaed;
  --muted: #7c828c;
  --dim: #4a505a;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #4ade80;
  --danger: #f87171;
  --glow: rgba(74, 222, 128, 0.18);
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  /* Arrows and the return glyph, which not every monospace face carries. */
  --symbols: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols 2', var(--mono);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

/*
 * A column: the content, then the status line, then the footer. The content
 * takes the room that is left and centres in it, so the footer sits under it
 * on every screen instead of being pinned over it on a short one.
 */
body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 12px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
}

/* --- Backdrop ----------------------------------------------------------- */

/*
 * Two slow aurorae and a hairline grid. Fixed and behind everything, so the
 * page can be read over it and nothing here can intercept a click.
 */
.aura,
.grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.aura {
  background:
    radial-gradient(48vmax 48vmax at 28% 32%, var(--glow), transparent 62%),
    radial-gradient(38vmax 38vmax at 74% 68%, rgba(96, 165, 250, 0.13), transparent 60%);
  filter: blur(18px);
  animation: drift 38s ease-in-out infinite alternate;
}

.grid {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.35;
  /* Fade the grid out at the edges so it reads as texture, not as a table. */
  mask-image: radial-gradient(circle at 50% 50%, #000 20%, transparent 72%);
}

@keyframes drift {
  from {
    transform: translate3d(-3%, -2%, 0) scale(1);
  }
  to {
    transform: translate3d(4%, 3%, 0) scale(1.12);
  }
}

/* --- Content ------------------------------------------------------------ */

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  /* Auto margins on the column axis: centred in whatever is left. */
  margin: auto 0;
  text-align: center;
}

/* The mark: three stacked bars — a deck — with one lit relay dot. */
.mark {
  width: 60px;
  height: 60px;
  margin: 0 auto 30px;
  display: block;
  overflow: visible;
}

/* Widest bar brightest, so the mark reads as a beam narrowing to one point. */
.mark rect {
  fill: var(--fg);
  opacity: 0.72;
}

.mark rect + rect {
  opacity: 0.5;
}

.mark .beam {
  fill: var(--accent);
  filter: drop-shadow(0 0 5px rgba(74, 222, 128, 0.6));
  animation: relay 2.6s ease-in-out infinite;
}

@keyframes relay {
  0%,
  100% {
    opacity: 0.25;
  }
  35% {
    opacity: 1;
  }
}

.wordmark {
  margin: 0;
  font-size: clamp(22px, 7vw, 30px);
  font-weight: 500;
  letter-spacing: 0.42em;
  /* The tracking pushes the block right; pull it back so it reads centred. */
  text-indent: 0.42em;
  color: var(--fg);
}

.rule {
  width: 72px;
  height: 1px;
  margin: 22px auto;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

/* The one line of copy. Fixed height, so a changing phrase cannot reflow. */
.line {
  min-height: 1.4em;
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.line .cursor {
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 460px) {
  .line {
    font-size: 11px;
    letter-spacing: 0.08em;
  }
}

/* --- The way in --------------------------------------------------------- */

.enter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 38px;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.enter:hover,
.enter:focus-visible {
  color: var(--fg);
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.06);
}

.enter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.enter .key {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--dim);
  font-family: var(--symbols);
  font-size: 11px;
  letter-spacing: 0;
}

/* --- The link box --------------------------------------------------- */

/*
 * One field and one button, on one line. The field is the wider of the two
 * because what goes in it is a URL, and a URL cut off at the ends is a URL
 * nobody can check.
 */
.jump {
  margin: 34px auto 0;
  max-width: 400px;
  text-align: left;
}

.jump-label {
  display: block;
  margin: 0 0 10px 2px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}

.jump-row {
  display: flex;
  gap: 8px;
}

.jump input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(18, 21, 27, 0.7);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.jump input::placeholder {
  color: var(--dim);
}

.jump input:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.jump input:focus {
  outline: none;
  border-color: rgba(74, 222, 128, 0.55);
  background: rgba(74, 222, 128, 0.05);
}

.jump input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* The same pill as the sign-in link, so the two ways in read as one family. */
.jump button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.08);
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.jump button:hover,
.jump button:focus-visible {
  border-color: rgba(74, 222, 128, 0.7);
  background: rgba(74, 222, 128, 0.14);
}

.jump button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.jump button .key {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--dim);
  font-family: var(--symbols);
  font-size: 11px;
  letter-spacing: 0;
}

/* While the server is being asked, the button waits; the field does not. */
.jump[data-busy] button {
  opacity: 0.55;
  pointer-events: none;
}

/*
 * The sentence under the box. Fixed height, like the cycling line above, so
 * an answer arriving does not shove the sign-in link down the page.
 */
.jump-status {
  min-height: 1.6em;
  margin: 10px 2px 0;
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.jump-status[data-tone='problem'] {
  color: var(--danger);
}

.jump-status a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(74, 222, 128, 0.4);
}

.jump-status a:hover,
.jump-status a:focus-visible {
  border-bottom-color: var(--accent);
}

.jump-status a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Below this the field and the button do not fit side by side. */
@media (max-width: 400px) {
  .jump-row {
    flex-direction: column;
  }

  .jump button {
    justify-content: center;
  }
}

/* With the box above it, the sign-in link is the second way in, not the first. */
main .enter {
  margin-top: 26px;
}

.foot {
  position: relative;
  z-index: 1;
  margin: 28px 0 14px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--dim);
}

/* --- Credit ------------------------------------------------------------ */

/*
 * Built by /site-footer.js, on every page here and on the signed-in pages too
 * — admin.css carries its own version of this block. Last in the column, so
 * it is under the content on every screen and never over it.
 */
.sitefoot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 8px;
  row-gap: 6px;
  margin-top: 12px;
  padding: 0 20px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--dim);
}

/*
 * The longer footer on the front door and sign-in: the sites, the channels,
 * then the credit line. Each row takes the full width and wraps on its own,
 * so on a phone a row folds without pulling the next one up into it.
 */
.sitefoot-links,
.sitefoot-social {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  column-gap: 14px;
  row-gap: 4px;
}

.sitefoot-link {
  letter-spacing: 0.08em;
}

.sitefoot-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sitefoot-group-label {
  margin-right: 2px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

/* A glyph, sized to the line: the name is on the link, not in the picture. */
.sitefoot-icon {
  display: inline-flex;
  width: 13px;
  height: 13px;
  border-bottom: none;
  color: var(--muted);
  transition: color 160ms ease;
}

.sitefoot-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.sitefoot-icon:hover,
.sitefoot-icon:focus-visible {
  color: var(--accent);
  border-bottom: none;
}

/* The credit line sits a touch apart from the rows above it. */
.sitefoot-with-links .sitefoot-copy {
  margin-top: 2px;
}

.sitefoot a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.sitefoot a:hover,
.sitefoot a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent-line, rgba(74, 222, 128, 0.4));
}

.sitefoot a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sitefoot-version {
  /* Tabular digits so a version changing under a refresh does not shuffle. */
  font-variant-numeric: tabular-nums;
}

/* --- 404 ---------------------------------------------------------------- */

.code {
  position: relative;
  margin: 0;
  font-size: clamp(64px, 22vw, 108px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--fg);
}

/*
 * Two offset copies of the same digits, drifting apart and back. A signal that
 * did not arrive cleanly, which is what a 404 is.
 */
.code::before,
.code::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.code::before {
  color: var(--accent);
  animation: split 5.5s ease-in-out infinite;
}

.code::after {
  color: #60a5fa;
  animation: split 5.5s ease-in-out infinite reverse;
}

@keyframes split {
  0%,
  86%,
  100% {
    transform: translate(0, 0);
    opacity: 0;
  }
  90% {
    transform: translate(-3px, 1px);
    opacity: 0.5;
  }
  96% {
    transform: translate(2px, -1px);
    opacity: 0.35;
  }
}

.reason {
  margin: 18px 0 0;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.countdown {
  margin: 10px 0 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

.countdown b {
  color: var(--accent);
  font-weight: 500;
  /* Tabular digits, so 3 → 2 → 1 does not shuffle the line. */
  font-variant-numeric: tabular-nums;
}

/* --- Motion ------------------------------------------------------------- */

/*
 * Everything above is decoration. Someone who has asked for less movement
 * gets the same page, still.
 */
@media (prefers-reduced-motion: reduce) {
  .aura,
  .mark .beam,
  .line .cursor {
    animation: none;
  }

  /* Nothing but movement to contribute, so they step aside entirely. */
  .code::before,
  .code::after {
    display: none;
  }
}
