/* Contact Form Echo — one page, one form, one answer under it.
 *
 * System fonts and a single accent. The only thing worth styling carefully is
 * the echoed value: it has to read as "this is the exact string", which means a
 * monospace block with visible edges, so a trailing space or an empty line is
 * something you can see rather than something you have to trust us about.
 */

:root {
  --ink: #1c1f24;
  --ink-soft: #5b6470;
  --line: #dde2e8;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #2f5fd0;
  --ok: #1f7a4d;
  --ok-bg: #eef8f2;
  --bad: #b3261e;
  --bad-bg: #fdf0ef;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2.5rem 1rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 46rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

h1 { font-size: 1.6rem; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .9rem; }
h3 { font-size: .8rem; margin: 0 0 .35rem; text-transform: uppercase;
     letter-spacing: .06em; color: var(--ink-soft); }

.lede { margin: 0; color: var(--ink-soft); max-width: 38rem; }

/* -- form ---------------------------------------------------------------- */

form, .result, .notes {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}

form { display: flex; flex-direction: column; gap: 1.25rem; }

.field { display: flex; flex-direction: column; gap: .4rem; }

label { font-weight: 600; font-size: .92rem; }

input[type="text"], textarea {
  font: inherit;
  color: inherit;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}

textarea { resize: vertical; min-height: 8rem; font-family: inherit; }

input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.has-error input, .has-error textarea { border-color: var(--bad); }

.field-error {
  margin: 0;
  color: var(--bad);
  font-size: .88rem;
}

.counter { margin: 0; font-size: .8rem; color: var(--ink-soft); min-height: 1.1em; }
.counter.over { color: var(--bad); font-weight: 600; }

.actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }

button {
  font: inherit;
  font-weight: 600;
  padding: .6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button.secondary { background: #fff; color: var(--accent); }
button:hover { filter: brightness(1.06); }

/* -- the answer ---------------------------------------------------------- */

.result { border-left: 4px solid var(--ok); }
.result-invalid { border-left-color: var(--bad); }

.echo + .echo { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }

/* The exact string. Monospace, wrapping preserved, whitespace preserved — and
 * min-height so a value that is one short word still looks like a block you are
 * being shown, not a stray line of text. */
.echo-value {
  margin: 0 0 .4rem;
  padding: .6rem .7rem;
  background: #f4f6fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: .93rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 2.6rem;
}

.field-note {
  margin: 0;
  font-size: .86rem;
  color: var(--ok);
  background: var(--ok-bg);
  border-radius: 6px;
  padding: .3rem .5rem;
  display: inline-block;
}

.field-note.unchanged { color: var(--ink-soft); background: transparent; padding-left: 0; }

.summary { margin: 1.1rem 0 0; color: var(--ink-soft); font-size: .9rem; }

.page-error {
  margin: 0;
  padding: .8rem 1rem;
  border-radius: var(--radius);
  background: var(--bad-bg);
  border: 1px solid var(--bad);
  color: var(--bad);
}

/* -- reference ----------------------------------------------------------- */

.notes ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .5rem; }
.notes li { font-size: .92rem; color: var(--ink-soft); }
.notes strong { color: var(--ink); }

code {
  font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #eef1f5;
  padding: .1em .35em;
  border-radius: 4px;
}

.fine { margin: 1rem 0 0; font-size: .85rem; color: var(--ink-soft); }

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7eaee; --ink-soft: #9aa4b1; --line: #333a44;
    --bg: #14171b; --card: #1b1f25; --accent: #6f9bff;
    --ok: #6ede9f; --ok-bg: #16291f; --bad: #ff8b80; --bad-bg: #2a1917;
  }
  input[type="text"], textarea { background: #12151a; }
  .echo-value { background: #12151a; }
  code { background: #262c34; }
  button.secondary { background: transparent; }
}
