@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/IBMPlexSans.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/IBMPlexMono.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #17201c;
  --text: #2a332e;
  --soft: #3d4842;
  --muted: #5f6b65;
  --line: #dde2dd;
  --line-strong: #c9d0ca;
  --field: #f5f7f5;
  --accent: #1c6e52;
  --accent-strong: #155a42;
  --accent-soft: #e3f1ea;
  --danger: #a83a32;
  --focus: #2b6fbb;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 760px;
}

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:not([href]) {
  color: inherit;
  text-decoration: none;
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.94em;
}

code {
  white-space: nowrap;
  color: var(--ink);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.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;
}

[hidden] {
  display: none !important;
}

/* Page */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 32px 20px 96px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  margin-bottom: 112px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
}

.brand-tld {
  font-weight: 400;
  color: var(--muted);
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.brand-mark .bubble {
  fill: var(--accent);
}

.brand-mark .hash {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
}

.nav {
  display: flex;
  gap: 24px;
  font-size: 15px;
}

.nav a {
  color: var(--soft);
  text-decoration: none;
}

.nav a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* Intro: the promise and the field */

h1 {
  margin: 0 0 14px;
  font-size: 44px;
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.lede {
  margin: 0 0 32px;
  max-width: 31em;
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
}

.convert {
  display: flex;
  gap: 8px;
}

.convert input {
  flex: 1;
  min-width: 0;
  height: 60px;
  padding: 0 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 17px;
  color: var(--ink);
}

.convert input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.convert input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

button {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--field);
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

button[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

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

button.quiet {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border-color: var(--line);
  font-size: 14px;
}

.convert .primary {
  height: 60px;
  padding: 0 28px;
  border-radius: 10px;
  font-size: 17px;
}

.status {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.status:empty {
  display: none;
}

.status[data-tone="ok"] {
  color: var(--accent-strong);
}

.status[data-tone="error"] {
  color: var(--danger);
}

/* The sources: each item carries its own trailing dot, so a line never starts with one */

.sources {
  margin: 18px 0 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--soft);
}

.sources strong {
  margin-right: 4px;
  font-weight: 500;
  color: var(--ink);
}

.sources span {
  white-space: nowrap;
}

.sources span:not(:last-child)::after {
  content: " ·";
  color: var(--muted);
}

/* The direct route and the agent prompt */

.direct {
  margin-top: 64px;
}

.agents {
  margin-top: 40px;
  scroll-margin-top: 24px;
}

.lead {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--muted);
}

.well {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 18px;
  border-radius: 10px;
  background: var(--field);
}

.direct-url {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.direct-url[href]:hover .direct-tail {
  text-decoration: underline;
}

.direct-host {
  color: var(--accent);
  font-weight: 500;
}

.direct-tail {
  color: var(--muted);
}

.direct-url[href] .direct-tail {
  color: var(--ink);
}

.prompt {
  align-items: flex-start;
  padding: 16px 12px 16px 20px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
}

.prompt p {
  flex: 1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.notes {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

/* Once there is a result the page becomes a document view: only the field stays. */

.has-result .masthead {
  margin-bottom: 48px;
}

.has-result #promise,
.has-result .lede,
.has-result .sources,
.has-result .direct,
.has-result .agents {
  display: none;
}

.has-result .convert input,
.has-result .convert .primary {
  height: 48px;
  font-size: 15px;
}

.has-result .result {
  margin-top: 44px;
  padding-top: 0;
  border-top: 0;
}

/* Result */

.result {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

/* On a shared /md/ page the intro is gone, so the result starts at the top. */
.intro[hidden] + .result {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.result-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.result-titles {
  min-width: 0;
  flex: 1 1 320px;
}

h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.result-meta {
  margin: 4px 0 0;
  font-size: 15px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share-options {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
}

.option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.option-fields {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}

.share-options input[type="number"],
.share-options select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
}

.share-options input[type="number"] {
  width: 76px;
}

.share-options .primary {
  height: 36px;
  margin-left: auto;
}

.share-note {
  margin: 0 0 16px;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 15px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.share-note[data-tone="error"] {
  background: #f8e9e7;
  color: var(--danger);
}

textarea {
  display: block;
  width: 100%;
  min-height: 520px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  resize: vertical;
  tab-size: 2;
}

/* Small screens */

@media (max-width: 560px) {
  .page {
    padding: 20px 16px 64px;
  }

  .masthead {
    margin-bottom: 64px;
  }

  .nav a:not(.mono) {
    display: none;
  }

  h1 {
    font-size: 34px;
  }

  .lede {
    font-size: 17px;
  }

  .direct {
    margin-top: 40px;
  }

  .convert {
    flex-direction: column;
  }

  .convert input {
    flex: none;
    width: 100%;
    height: 56px;
    font-size: 16px;
  }

  .convert .primary {
    width: 100%;
    height: 56px;
  }

  .share-options .primary {
    margin-left: 0;
    width: 100%;
  }

  textarea {
    min-height: 360px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
