/* Nunito (SIL Open Font License), self-hosted, for headings: it echoes
   the rounded "little universe" wordmark. */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/nunito-latin-700-normal-8e827f51.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/nunito-latin-800-normal-9ff6e70e.woff2") format("woff2");
}

:root {
  /* Little Universe palette: Deep Navy #0C2649, Warm Cream #FCF7E8, Burnt Orange #DD7035 */
  --bg: #fcf7e8;
  --surface: #fffdf7;
  --text: #0c2649;
  --muted: #4e5d74;
  --border: #e8dfc4;
  --accent: #0c2649;
  --accent-hover: #1b3a66;
  --on-accent: #fcf7e8;
  --accent-soft: #efe8d3;
  --highlight: #dd7035;
  --link: #0c2649;
  --danger-bg: #fdecea;
  --danger: #a12a1f;
  --code-bg: #faf4e2;
  --warn-bg: #fbeadb;
  --warn-border: #e9b48e;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #081a33;
    --surface: #0c2649;
    --text: #fcf7e8;
    --muted: #aeb8c8;
    --border: #1e3a63;
    --accent: #fcf7e8;
    --accent-hover: #ffffff;
    --on-accent: #0c2649;
    --accent-soft: #16345e;
    --highlight: #f0a070;
    --link: #f0a070;
    --danger-bg: #3a1714;
    --danger: #f5b2a8;
    --code-bg: #0a2042;
    --warn-bg: #3a2414;
    --warn-border: #8a4a22;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--highlight); outline-offset: 2px; }

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; min-height: 60px; padding: 10px 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { display: block; height: 26px; width: auto; }
.nav { display: flex; gap: 4px; }
.nav-link { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav-link:hover { color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }

.hero { padding: 32px 0 16px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -0.02em; }
.lede { margin: 0; color: var(--muted); }
.filename { color: var(--highlight); word-break: break-all; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }

.form { display: grid; gap: 16px; }
.form-row { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; }
.field-inline { min-width: 220px; }
.label { font-size: 0.875rem; font-weight: 600; }
.muted { color: var(--muted); font-size: 0.9rem; }

.select, .code {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; resize: vertical; word-break: break-all; }

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 4px;
  text-align: center;
  padding: 36px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-text { display: grid; gap: 2px; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-name { font-weight: 600; color: var(--text); word-break: break-all; }

.button {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button-secondary { background: transparent; color: var(--accent); }
.button-secondary:hover { background: var(--accent-soft); }

.alert { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-weight: 500; }

.form-options { display: flex; align-items: end; gap: 16px; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 8px; padding-bottom: 9px; font-weight: 500; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.issue { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--warn-bg); border-color: var(--warn-border); }
.issue h2 { margin: 0 0 4px; font-size: 1.05rem; }
.issue p { margin: 0; color: var(--text); }
.issue form { margin: 0; }

.map { height: 420px; border-radius: 8px; border: 1px solid var(--border); z-index: 0; }
.stats { margin: 0 0 12px; }

.result h2 { margin: 0; font-size: 1.1rem; }
.result p { margin: 2px 0 0; }
.result-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }

.site-footer { color: var(--muted); font-size: 0.85rem; padding: 24px 16px 40px; }

@media (max-width: 600px) {
  /* On phones the menu gets its own row as a segmented control,
     with space around it so it doesn't sit on the header's edge. */
  .header-inner { padding: 12px 16px 14px; }
  .nav { width: 100%; padding: 3px; gap: 3px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; }
  .nav-link { flex: 1; text-align: center; padding: 8px 6px; border-radius: 7px; }
  .nav-link.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgb(12 38 73 / 0.08), 0 0 0 1px var(--border); }

  .map { height: 320px; }
  .form-row .button { width: 100%; }
}

.prose { padding: 8px 4px 16px; max-width: 70ch; }
.prose h2 { font-size: 1.25rem; margin: 28px 0 8px; letter-spacing: -0.01em; }
.prose h3 { font-size: 1rem; margin: 20px 0 4px; }
.prose p, .prose li { color: var(--text); }
.prose ol { padding-left: 1.25rem; }
.prose li { margin-bottom: 6px; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px; }

.site-footer p { margin: 0 0 6px; }
.tip { font-weight: 500; color: var(--text); }

.tip-prompt { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 20px; padding: 14px 16px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); text-align: center; }
.tip-button { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; padding: 7px 14px; }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--swatch); margin-right: 8px; vertical-align: 2px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--swatch); }
textarea.autosize { resize: none; overflow-y: auto; min-height: 42px; }
.button.busy { opacity: 0.75; cursor: progress; }
.result-anchor { scroll-margin-top: 12px; }

/* Touch screens can't drag files, so drop the hint there. */
@media (hover: none) and (pointer: coarse) {
  .drag-hint { display: none; }
}

.byline { color: var(--muted); }
.byline a { color: inherit; }

.try-example { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.try-example form { margin: 0; }
.button-small { padding: 6px 12px; font-size: 0.9rem; }

.downloads { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-top: 14px; }

h1, h2, h3, .brand {
  font-family: "Nunito", ui-rounded, ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
}
h1 { font-weight: 800; }
h2, h3, .brand { font-weight: 800; }
.hero h1 { letter-spacing: -0.01em; }

/* Guides */
.guide .hero { padding-bottom: 20px; }
.eyebrow { margin: 0 0 6px; font-family: "Nunito", ui-rounded, sans-serif; font-weight: 800; font-size: 0.9rem; text-transform: lowercase; letter-spacing: 0.04em; color: var(--highlight); }
.guide .hero h1 { font-size: clamp(1.8rem, 5.5vw, 2.6rem); line-height: 1.15; }
.guide .lede { font-size: 1.1rem; max-width: 62ch; }
.quick-check h2 { margin: 0 0 8px; font-size: 1.15rem; }
.quick-check ul { margin: 0 0 10px; padding-left: 1.2rem; }
.quick-check li { margin-bottom: 6px; }
.quick-check p { margin: 0; }
.map-title { margin: 0 0 12px; font-size: 1.15rem; }
.map-short { height: 340px; }
.caption { margin: 10px 0 0; }
.map-pin { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #dd7035; color: #0c2649; border: 2px solid #fcf7e8; font: 800 13px/1 "Nunito", ui-rounded, sans-serif; box-shadow: 0 1px 3px rgb(12 38 73 / 0.3); }
.map-pin-good { background: #0c2649; color: #fcf7e8; }
.map-key { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.map-key li { display: flex; align-items: center; gap: 10px; color: var(--text); }
.map-key .map-pin { flex: none; box-shadow: none; }
.guide .prose { max-width: 72ch; }
.guide .prose h2 { scroll-margin-top: 16px; }
.prose pre { margin: 12px 0; padding: 12px 14px; overflow-x: auto; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; }
.prose pre code { display: block; padding: 0; border: 0; background: none; font-size: 0.85rem; line-height: 1.55; white-space: pre; }
.code-label { display: block; margin-bottom: 6px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.inline-try { margin: 4px 0 8px; }
.guide-footer { margin: 8px 4px 24px; }
@media (max-width: 600px) {
  .map-short { height: 260px; }
  .prose pre code { white-space: pre-wrap; word-break: break-word; }
}
.issue-link { white-space: nowrap; }

.guides h2 { margin: 0 0 10px; font-size: 1.15rem; }
.guides ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.guides li { display: grid; gap: 2px; }
.guides li a { font-weight: 700; font-size: 1.05rem; }
.footer-guides a { color: inherit; }

/* Little route-line signature above the footer, echoing the logo. */
.footer-motif { display: block; width: 96px; height: auto; margin: 8px 0 14px; }
.footer-motif path { fill: none; stroke: var(--muted); stroke-opacity: 0.5; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.footer-motif .start { fill: var(--text); }
.footer-motif .end { fill: var(--highlight); }
