/* share — the chrome around a shared file.
 *
 * Deliberately small and boring. The interesting typography belongs to the file
 * being shared, which is rendered in its own frame with github-markdown-css;
 * everything here exists to stay out of its way.
 *
 * No web fonts, no JavaScript: these pages run under `default-src 'none'` with
 * no script source at all, which is why deleting is a two-page flow rather than
 * a confirm() dialog. */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --line: #d1d9e0;
  --accent: #0969da;
  --danger: #cf222e;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-soft: #151b23;
    --fg: #e6edf3;
    --fg-muted: #9198a1;
    --line: #3d444d;
    --accent: #4493f8;
    --danger: #f85149;
  }
}

* { box-sizing: border-box; }

/* The UA gives [hidden] `display: none`, which ANY class rule setting a display
 * silently beats — .pitch is display:flex, so hiding it did nothing at all
 * until this line. Anything toggled by the `hidden` property needs it. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

code, pre { font-family: var(--mono); font-size: 0.9em; }

pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 16px;
  overflow-x: auto;
}

pre code { background: none; padding: 0; }

code {
  background: var(--bg-soft);
  border-radius: 4px;
  padding: 0.15em 0.35em;
}

/* ------------------------------------------------------------- prose pages */

.prose {
  max-width: 46rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.prose.narrow { max-width: 34rem; }

.prose h1 { font-size: 2rem; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
.prose h2 { font-size: 1.15rem; margin: 2.5rem 0 0.75rem; }
.prose .lede { font-size: 1.15rem; color: var(--fg-muted); margin-top: 0; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin: 0.4rem 0; }

/* ------------------------------------------------------------- the viewer */

body.viewing { display: flex; flex-direction: column; overflow: hidden; }

.filebar {
  flex: 0 0 auto;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}

.filebar h1 {
  font-size: 1.05rem;
  margin: 0;
  word-break: break-word;
}

.filebar .sub, .filebar .note {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.filebar .note { max-width: 60ch; }

.filebar dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
}

.filebar dl div { display: flex; gap: 0.4rem; align-items: baseline; }
.filebar dt { color: var(--fg-muted); }
.filebar dt::after { content: ":"; }
.filebar dd { margin: 0; }
.filebar .expiry { font-variant-numeric: tabular-nums; }

.actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { border-color: var(--fg-muted); }
.btn.primary { border-color: var(--accent); color: var(--accent); }
.btn.danger { border-color: var(--danger); color: var(--danger); }

form { display: flex; gap: 0.5rem; align-items: center; margin-top: 1.5rem; }

/* ------------------------------------------------------------------ topbar */

/* One header on every page, viewer included. Sticky and translucent so it stays
 * reachable without taking a slice of the fold with it. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar,
.topbar > nav { display: flex; align-items: center; }

.topbar {
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.5rem;
}

/* The wordmark. A logo, not a link — same treatment on every page, and it does
 * not turn blue or sprout an underline just because it happens to be clickable. */
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  text-decoration: none;
}

.brand svg { width: 21px; height: 21px; flex: 0 0 auto; }
.brand:hover { color: var(--fg); }

.topbar > nav { gap: 1.4rem; font-size: 0.9rem; }
.topbar > nav a { color: var(--fg-muted); text-decoration: none; }
.topbar > nav a:hover { color: var(--fg); }

.topbar .gh {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.topbar .gh:hover { border-color: var(--fg-muted); }
.topbar .gh svg { width: 15px; height: 15px; fill: currentColor; }

/* The burger is a checkbox and a label. No script, because the pages carrying a
 * secret run with no script source at all and a menu is not worth loosening
 * that for. Hidden on wide screens; the checkbox itself is never visible. */
.nav-toggle { position: absolute; opacity: 0; width: 0; height: 0; }

.nav-burger {
  display: none;
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

/* Three bars from one element: the middle is the span, the outer two are its
 * pseudo-elements. */
.nav-burger span,
.nav-burger span::before,
.nav-burger span::after {
  position: absolute;
  left: 50%;
  width: 1.05rem;
  height: 2px;
  margin-left: -0.525rem;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.nav-burger span { top: 50%; margin-top: -1px; }
.nav-burger span::before { content: ""; left: 0; margin-left: 0; top: -6px; }
.nav-burger span::after  { content: ""; left: 0; margin-left: 0; top: 6px; }

.nav-toggle:focus-visible + .nav-burger { outline: 2px solid var(--accent); }

/* Open: the bars become a cross. */
.nav-toggle:checked + .nav-burger span { background: transparent; }
.nav-toggle:checked + .nav-burger span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle:checked + .nav-burger span::after  { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 40rem) {
  .topbar { flex-wrap: wrap; padding: 0.6rem 1rem; }
  .nav-burger { display: block; }

  .topbar > nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-top: 0.6rem;
    border-top: 1px solid var(--line);
  }

  .nav-toggle:checked ~ nav { display: flex; }
  .topbar > nav a { width: 100%; padding: 0.7rem 0; }
  .topbar .gh { border: 0; padding: 0.7rem 0; border-radius: 0; }
}

/* ---------------------------------------------------------------- uploader */

/* Always open: on the home page this IS the page, so there is nothing to
 * expand. Still a plain multipart form, so it works with scripting off. */
.uploader { margin: 1.5rem 0 2.5rem; }
.uploader form { display: block; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 2.5rem 1.5rem;
  text-align: center;
  transition: border-color 0.12s, background 0.12s;
}

/* Set while a drag is over the zone. */
.dropzone.is-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-soft));
}

.dropzone-headline { margin: 0 0 0.35rem; font-size: 1.15rem; font-weight: 600; }
.dropzone-or   { margin: 0 0 0.9rem; color: var(--fg-muted); font-size: 0.9rem; }
.dropzone-hint { margin: 1rem 0 0; color: var(--fg-muted); font-size: 0.8rem; }

/* The real input stays reachable for keyboard and for the no-JS path; the
 * <label> next to it is what gets styled as a button. */
.dropzone input[type=file] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.dropzone label.btn { cursor: pointer; }
.dropzone input[type=file]:focus-visible + label.btn { outline: 2px solid var(--accent); }

.dropzone-go { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.dropzone-note { color: var(--fg-muted); font-size: 0.85rem; }

/* ------------------------------------------------------------------ recent */

.recent { margin: 2.5rem 0 0; }

.recent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.recent-head h2 { font-size: 1rem; margin: 0; }
.recent-clear { font-size: 0.75rem; padding: 0.25rem 0.6rem; }
.recent-note { margin: 0.75rem 0 0; color: var(--fg-muted); font-size: 0.75rem; }

/* ----------------------------------------------------------------- results */

.results {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}

.results li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.result-name { font-weight: 600; word-break: break-all; }
.result-meta { color: var(--fg-muted); font-size: 0.8rem; text-align: right; }

.result-url {
  grid-column: 1;
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
}

.result-copy, .result-delete { grid-column: 2; white-space: nowrap; }
.result-delete { border-color: var(--danger); color: var(--danger); }

/* The delete password, shown once on the /upload result page and nowhere else. */
.result-secret { grid-column: 1 / -1; font-size: 0.78rem; color: var(--fg-muted); }
.result-secret code { user-select: all; }

/* The delete form on the confirm page: a password field, then the buttons. */
.delete-form { display: block; margin-top: 1.5rem; }
.delete-form label { display: block; font-size: 0.85rem; margin-bottom: 0.35rem; }
.delete-form input {
  width: 100%; padding: 0.5rem 0.7rem; font: inherit; font-size: 0.9rem;
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px;
}
.delete-form input:focus-visible { outline: 2px solid var(--accent); border-color: var(--accent); }
.delete-actions { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.hint { color: var(--fg-muted); font-size: 0.8rem; }
.result-copy.is-done { border-color: var(--accent); color: var(--accent); }

/* The progress bar spans both columns and disappears when the upload lands. */
.result-bar {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: 0.4rem;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.result-progress {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.15s linear;
}

/* A rejected file is the one row whose text is LONG — "trick.png claims to be
 * .png but its contents look like arbitrary binary data" does not belong in an
 * auto-width column that is right-aligned under a Copy button. Give the whole
 * row to the message, left-aligned, and mark it. */
.results li.failed {
  grid-template-columns: 1fr;
  border-left: 3px solid var(--danger);
  padding-left: 0.75rem;
}

.results li.failed .result-meta {
  grid-column: 1;
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.45;
}

.results li.failed .result-name { color: var(--danger); }

p.failed {
  color: var(--danger);
  border-left: 3px solid var(--danger);
  padding-left: 0.75rem;
}

/* The file itself. Its own document, in its own frame, so nothing it contains
 * can reach this page. */
.preview {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: var(--bg);
}

@media (max-width: 40rem) {
  .filebar { flex-direction: column; gap: 0.75rem; }
  .actions { width: 100%; }
  .btn { flex: 1; text-align: center; }
}

/* ---------------------------------------------------------------- api page */

.api-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 1rem 0 0; }
.api-table th, .api-table td {
  text-align: left; padding: 0.5rem 0.6rem 0.5rem 0; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.api-table th { color: var(--fg-muted); font-weight: 600; }
.api-table td:first-child { white-space: nowrap; }

/* ------------------------------------------------------------------- pitch */

/* The one piece of colour on the page, and it earns it: most people arriving
 * here have no idea this is an MCP server. Dismissed for 90 days at a time. */
.pitch {
  position: relative;
  display: flex;
  gap: 1rem;
  margin: 1.75rem 0 0;
  padding: 1.25rem 1.4rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 12px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--accent) 11%, var(--bg)),
      color-mix(in srgb, var(--accent) 4%, var(--bg)));
}

.pitch-body { flex: 1 1 auto; min-width: 0; }
.pitch-body > * { margin: 0 0 0.6rem; }
.pitch-body > *:last-child { margin-bottom: 0; }

.pitch-headline { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; }
.pitch-body p { font-size: 0.92rem; }

.pitch pre {
  background: color-mix(in srgb, var(--fg) 6%, transparent);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
  font-size: 0.8rem;
}

.pitch-more { font-size: 0.85rem; color: var(--fg-muted); }

.pitch-dismiss {
  flex: 0 0 auto;
  align-self: flex-start;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.pitch-dismiss:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); color: var(--fg); }

@media (max-width: 40rem) {
  .pitch { padding: 1rem; }
  .pitch pre { overflow-x: auto; }
}
