/*
 * saucer.sh design tokens and primitives.
 * Shared by the React app and the server-rendered file pages, so a link looks
 * the same whether it was rendered by Vite or by the Worker.
 *
 * The direction: a rendered markdown document. Hairline rules, small mono
 * labels, no shadows and no decoration.
 *
 * The palette is neutral on purpose — greys the whole way down, with the
 * emphasis carried by an ink-coloured fill rather than a hue. A primary button
 * is white on near-black, not blue on anything. Values are matched to
 * tripwire.sh, which is the reference the brief pointed at.
 *
 * That means --accent is a *neutral*, and the two accent tokens invert between
 * themes: --accent is the ink, --accent-ink is the paper. Anything reaching for
 * a colour should reach for --danger, which is the one chromatic token left.
 */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=Geist+Mono:wght@100..900&display=swap");

:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #0f0f10;
  --muted: #5b5b60;
  --line: #e5e5e5;
  /* Neutral, not a hue: the primary fill is ink on paper. */
  --accent: #0f0f10;
  --accent-ink: #ffffff;
  --accent-wash: color-mix(in srgb, var(--accent) 6%, transparent);
  --danger: #c2403f;
  --block: #f7f7f7;

  --font-sans: "Geist", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", "SFMono-Regular", Consolas, ui-monospace, monospace;

  --radius: 6px;
  --step: 0.25rem;
  --label-col: 8.75rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0e0e0e;
    --ink: #ffffff;
    --muted: #969696;
    --line: #232323;
    --accent: #ffffff;
    --accent-ink: #0e0e0e;
    --danger: #ff6568;
    --block: #191919;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e0e0e;
  --ink: #ffffff;
  --muted: #969696;
  --line: #232323;
  --accent: #ffffff;
  --accent-ink: #0e0e0e;
  --danger: #ff6568;
  --block: #191919;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.58;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 0.18em;
}
/* Wrapped in :where() so the whole selector carries zero specificity.
 *
 * As a bare `a:hover` this outranked every component that styles a link by
 * class — `.saas-strip` is 0,1,0 and `a:hover` is 0,1,1 — so hovering a link
 * whose background *is* `--accent` repainted its text to exactly its own
 * background and the content vanished: black on black in light mode, white on
 * white in dark. The announcement bar in the header did this on the live site.
 *
 * At zero specificity this stays the default for an unstyled link and loses to
 * anything that has an opinion, which is the behaviour it always meant to have.
 */
:where(a:hover) { color: var(--accent); text-decoration-color: currentColor; }

::selection {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

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

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.05rem; }

/* ---------- layout ---------- */

.shell {
  width: min(100% - 2.5rem, 860px);
  margin: 0 auto;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--step) * 2);
  font: 650 0.75rem/1 var(--font-mono);
  letter-spacing: -0.04em;
  text-decoration: none;
}

/* The mark: the dither-kit avatar for the brand seed, mirrored 8×8 pixels.
   The same file is the favicon — it was inlined as a data URI when the two
   differed in colour, and now that the glyph carries its own hue there is no
   reason to ship a second copy. Generated: see scripts/gen-brand-mark.mjs. */
.wordmark::before {
  content: "";
  width: 17px;
  height: 17px;
  background: url("/favicon.svg") center / contain no-repeat;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: calc(var(--step) * 4);
}

/* ---------- controls ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--step) * 2);
  height: 32px;
  padding: 0 calc(var(--step) * 3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 500 0.8rem/1 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }

.button--primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.button--primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.button--quiet { border-color: transparent; color: var(--muted); }
.button--quiet:hover:not(:disabled) { color: var(--accent); border-color: transparent; }

.button--danger { color: var(--danger); }
.button--danger:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }

.input {
  height: 32px;
  padding: 0 calc(var(--step) * 2.5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
}
.input:focus-visible { border-color: var(--accent); outline: none; }
.input::placeholder { color: var(--muted); }

.mono { font-family: var(--font-mono); }

.meta {
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Kicker: how a page or section announces itself. */
.kicker {
  margin: 0;
  color: var(--muted);
  font: 700 0.68rem/1.35 var(--font-mono);
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.chip {
  display: inline-flex;
  border: 1px solid var(--line);
  padding: 0.14rem 0.34rem;
  color: var(--muted);
  font: 0.65rem/1.4 var(--font-mono);
  white-space: nowrap;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

/* ---------- the link bar: the one thing this product is for ---------- */

.linkbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(var(--step) * 2);
  padding: calc(var(--step) * 1.5) calc(var(--step) * 1.5) calc(var(--step) * 1.5) calc(var(--step) * 3);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--block);
  overflow: hidden;
}

.linkbar__url {
  flex: 1;
  min-width: 0;
  font: 0.8rem/1.6 var(--font-mono);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  text-decoration: none;
}
.linkbar__url::-webkit-scrollbar { display: none; }

/* Copying flashes the bar once. It used to sweep a gradient beam across it;
   the confirmation is the same, without the light show. */
.linkbar--copied::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-wash);
  animation: flash 620ms ease-out;
  pointer-events: none;
}

@keyframes flash {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .linkbar--copied::after { animation: none; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
