/*
 * Tipline styles.
 *
 * The design brief is one sentence: a frightened person on a five-year-old
 * phone should be able to find the box, type in it, and press the button.
 * Everything here serves that. System fonts (no webfont request, no flash of
 * invisible text, no third-party origin), one column, large touch targets, and
 * a submit button that is never below a fold on any screen this has been opened
 * on. Dark mode is honoured because the phone being held under a table at night
 * is a real case.
 */

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #14171c;
  --ink-soft: #545c68;
  --line: #d9dde3;
  --accent: #0b5cd5;
  --accent-ink: #ffffff;
  --danger: #a8200d;
  --danger-bg: #fdf0ed;
  --good: #0d6b3f;
  --good-bg: #eefaf3;
  --focus: #0b5cd5;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318;
    --surface: #181c23;
    --ink: #eef1f5;
    --ink-soft: #a5aeba;
    --line: #2c323c;
    --accent: #5c9dff;
    --accent-ink: #08101f;
    --danger: #ff9c8a;
    --danger-bg: #2b1512;
    --good: #7ee0ab;
    --good-bg: #10251b;
    --focus: #7fb4ff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main { max-width: 42rem; margin: 0 auto; }
main.wide { max-width: 68rem; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--surface);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
}

/* The emergency notice is first in the document and first on the screen. Someone
   in immediate danger must not have to read a tipline's marketing to find 911. */
.emergency {
  max-width: 42rem;
  margin: 0 auto 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid currentColor;
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: none;
  font-size: 0.95rem;
}

.head { padding: 2rem 0 1rem; }
.head--row { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 0.6rem; }
.lede { margin: 0; color: var(--ink-soft); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 0 0 1.5rem;
}
.card--good { border-color: var(--good); background: var(--good-bg); }

.field { display: block; margin: 0 0 1.1rem; }
.field__label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.field__hint { display: block; margin-top: 0.4rem; font-size: 0.875rem; color: var(--ink-soft); }

textarea, input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 0.7rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
textarea { resize: vertical; min-height: 8.5rem; }

/* A visible focus ring, not the browser default that some resets remove.
   Keyboard users on this site are not a rounding error. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.submit {
  width: 100%;
  padding: 0.95rem 1rem;
  font: inherit;
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.submit:hover { filter: brightness(1.08); }
.submit[disabled] { opacity: 0.6; cursor: progress; }

.button {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
}
.button--quiet { background: transparent; color: var(--accent); border-color: var(--line); }

/* Optional details are collapsed by default. Every field visible at rest is a
   field somebody feels they ought to fill in before they are allowed to send. */
.more { margin-top: 1.25rem; border-top: 1px solid var(--line); padding-top: 0.9rem; }
.more summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.more__inner { padding-top: 1rem; }

.results {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  max-height: 15rem;
  overflow-y: auto;
}
.results li { padding: 0.6rem 0.75rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.results li:last-child { border-bottom: none; }
.results li[aria-selected="true"], .results li:hover { background: var(--accent); color: var(--accent-ink); }
.results__state { color: var(--ink-soft); font-size: 0.85rem; display: block; }
.results li[aria-selected="true"] .results__state, .results li:hover .results__state { color: inherit; opacity: 0.85; }

.chosen { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; font-weight: 600; }
.chosen button { border: none; background: none; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

.error {
  padding: 0.8rem 1rem;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  margin: 0 0 1rem;
}

.code-label { margin: 1.5rem 0 0.25rem; font-weight: 600; }
.code {
  font: 700 clamp(1.8rem, 9vw, 2.8rem)/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
  margin: 0.25rem 0;
  /* Selectable and easy to hit: copying this is the single most important
     interaction on the page. */
  user-select: all;
  word-break: break-all;
}
.code-note { color: var(--ink-soft); font-size: 0.9rem; margin-top: 0.25rem; }
.code-inline { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.08em; }
.code-input { font: 600 1.3rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.16em; text-transform: uppercase; }

.promise ul { padding-left: 1.15rem; }
.promise li { margin-bottom: 0.5rem; }
.promise__caveat { color: var(--ink-soft); font-size: 0.9rem; border-left: 3px solid var(--line); padding-left: 0.9rem; }


.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.25rem; }

.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0 0 1rem; font-size: 0.95rem; }
.meta dt { color: var(--ink-soft); }
.meta dd { margin: 0; }
.tip-body { border-top: 1px solid var(--line); padding-top: 0.9rem; white-space: normal; }
.tip-body p { margin: 0 0 0.75rem; }

.updates { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.update { border-left: 3px solid var(--line); padding: 0.1rem 0 0.1rem 0.9rem; margin-bottom: 1rem; }
.update--operator { border-left-color: var(--accent); }
.update__who { display: block; font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }

.pill { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.8rem; border: 1px solid var(--line); text-transform: uppercase; letter-spacing: 0.04em; }
.pill--new { border-color: var(--accent); color: var(--accent); }
.pill--closed { color: var(--ink-soft); }
.warn { color: var(--danger); font-weight: 600; }

.tips { width: 100%; border-collapse: collapse; font-size: 0.92rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tips th, .tips td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); }
.tips th { background: var(--bg); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.tips tr:last-child td { border-bottom: none; }

.filters { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { padding: 0.3rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); font-size: 0.88rem; }
.filters__now { color: var(--ink-soft); font-size: 0.85rem; }

.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row select { width: auto; }

.lost { color: var(--ink-soft); font-size: 0.92rem; }

footer { max-width: 42rem; margin: 3rem auto 0; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.9rem; }
.footer__who { margin: 0.25rem 0 0; }

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

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
