/* Kehre. Road-sign type (Barlow, the DIN-style face), signal yellow used as a fill only. */

@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap; src: url("/assets/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-style: normal; font-display: swap; src: url("/assets/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-style: normal; font-display: swap; src: url("/assets/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-style: normal; font-display: swap; src: url("/assets/fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-style: normal; font-display: swap; src: url("/assets/fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url("/assets/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url("/assets/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f1f3f4;
  --ink: #12161a;
  --muted: #4a545d;
  --line: #c3cad0;
  --link: #0a4ea6;
  --signal: #ffcc00;
  --signal-ink: #12161a;
  --danger: #b3261e;
  --ok: #1b6e3c;
  --focus: #0a4ea6;
  --text: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Barlow Condensed", "Barlow", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #23272b;
    --surface: #2e3338;
    --ink: #eef1f3;
    --muted: #b6bfc6;
    --line: #4a5158;
    --link: #8ab8ff;
    --signal: #ffd633;
    --signal-ink: #14181c;
    --danger: #ff9188;
    --ok: #86d9a3;
    --focus: #ffd633;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-block: 28px 64px; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0 0 .5em; letter-spacing: .005em; }
h1 { font-size: clamp(2.5rem, 6.2vw, 4.4rem); }
h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
h3 { font-size: 1.45rem; }
p { margin: 0 0 1em; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 600; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.narrow { width: min(520px, 100% - 40px); }
.prose { max-width: 70ch; }
.prose.wrap { width: min(70ch, 100% - 40px); }
.lead { font-size: 1.25rem; line-height: 1.45; color: var(--muted); max-width: 52ch; }
.hint { color: var(--muted); font-size: .95rem; margin-top: .4em; }
.small { font-size: .9rem; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--signal); color: var(--signal-ink); padding: 8px 14px; border: 2px solid var(--ink); border-radius: 6px; z-index: 10; }
.skip:focus { top: 12px; }

/* Header and footer */
.site-header { border-bottom: 2px solid var(--ink); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.bar nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.bar nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 500; }
.bar nav a:not(.btn):hover { text-decoration: underline; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 1.9rem/1 var(--display); letter-spacing: .01em; }
.brand-mark { width: 30px; height: 30px; padding: 4px; background: var(--signal); color: var(--signal-ink); border: 2px solid var(--ink); border-radius: 7px; }
.site-footer { border-top: 2px solid var(--ink); color: var(--muted); font-size: .95rem; }
.site-footer p { margin: 0; }
.site-footer nav { display: flex; gap: 18px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: 10px 18px; min-height: 44px;
  font: 600 1rem/1.1 var(--text); text-decoration: none; cursor: pointer;
  color: var(--ink); background: transparent;
  border: 2px solid var(--ink); border-radius: 6px;
}
.btn:hover { background: var(--surface); }
.btn-primary { background: var(--signal); color: var(--signal-ink); border-color: var(--ink); }
.btn-primary:hover { background: var(--signal); filter: brightness(.95); }
.btn-quiet { border-color: var(--line); }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: .95rem; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn.is-on { background: var(--ink); color: var(--bg); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 1.2em 0 0; }

/* Forms */
.stack > * + * { margin-top: .5rem; }
.stack > .actions, .stack > .two { margin-top: 1rem; }
label { display: block; font-weight: 600; margin-top: 1rem; }
.stack > label:first-child { margin-top: 0; }
input[type="text"], input[type="email"], input[type="date"], input[type="time"], input[type="number"], textarea, select {
  width: 100%; padding: 10px 12px; min-height: 44px;
  font: inherit; color: var(--ink); background: var(--bg);
  border: 2px solid var(--line); border-radius: 6px;
}
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--ink); }
textarea { resize: vertical; line-height: 1.45; }
#code { font: 700 2rem/1 var(--display); letter-spacing: .4em; text-align: center; max-width: 12ch; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset { border: 0; padding: 0; margin: 1.2rem 0 0; }
legend { font-weight: 600; padding: 0; margin-bottom: .4rem; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-top: .5rem; }
.choice input { margin-top: .35em; width: 1.1rem; height: 1.1rem; accent-color: var(--ink); }
.msg { min-height: 1.5em; margin: 1rem 0 0; font-weight: 500; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }
.add-row { display: flex; gap: 10px; }
.add-row input { flex: 1; min-width: 0; }

/* Home */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; padding-block: 28px 56px; }
.hero h1 { max-width: 12ch; }
.hero-art { margin: 0; }
.hero-art svg { width: 100%; height: auto; display: block; overflow: visible; }
.road-base { fill: none; stroke: var(--ink); stroke-width: 28; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.4s cubic-bezier(.5, .1, .3, 1) .1s forwards; }
.road-line { fill: none; stroke: var(--signal); stroke-width: 3; stroke-dasharray: .014 .016; opacity: 0; animation: fade .6s ease 2.3s forwards; }
.pin { opacity: 0; transform-box: fill-box; transform-origin: center; animation: pop .45s ease var(--d, 0s) forwards; }
.pin circle, .pin rect { stroke: var(--ink); stroke-width: 5; fill: var(--bg); }
.pin-start circle { fill: var(--ink); stroke: var(--signal); }
.pin-via circle { fill: var(--signal); stroke-dasharray: 5 4; }
.pin-end rect { fill: var(--signal); }
.pin text { fill: var(--ink); font: 600 24px/1 var(--display); letter-spacing: .02em; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }

.band { padding-block: 32px 0; }
.rows { margin: 1rem 0 2rem; }
.row { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 12px 40px; padding: 20px 0; border-top: 2px solid var(--ink); }
.rows .row:last-child { border-bottom: 2px solid var(--ink); }
.row h2, .row h3 { margin: 0; font-size: 1.6rem; }
.row p { margin: 0; max-width: 60ch; }
.plain { padding-left: 1.2em; }
.plain li { margin-bottom: .5em; }

/* Lists: dashboard, profile */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.drive-list { list-style: none; padding: 0; margin: 1rem 0 2.5rem; border-top: 2px solid var(--ink); }
.drive-list > li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.drive-link { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.drive-link:hover .drive-name { text-decoration: underline; }
.drive-name { font: 700 1.5rem/1.1 var(--display); }
.drive-sub { color: var(--muted); font-size: .95rem; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.settings { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 2px solid var(--ink); max-width: 560px; }
.empty { padding: 28px 0; color: var(--muted); }

/* Drive page */
.drive-head h1 { margin-bottom: .2em; }
.by { color: var(--muted); margin-bottom: .8em; }
.pill { display: inline-block; margin-left: 6px; padding: 1px 10px; font-size: .85rem; border: 1px solid var(--muted); border-radius: 999px; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 8px 36px; margin: 0 0 1rem; }
.meta div { min-width: 0; }
.meta dt { color: var(--muted); font-size: .9rem; }
.meta dd { margin: 0; font-weight: 600; font-size: 1.1rem; }
.summary { margin-bottom: 1.5rem; }
.drive-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 48px; align-items: start; margin-top: 1.5rem; }
.side { position: sticky; top: 16px; }
.map { height: 380px; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--surface); z-index: 0; }
.map-frame { width: 100%; height: 100%; border: 0; display: block; }
.part-tabs { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tools { margin-top: 1.2rem; }
.tools h2 { font-size: 1.4rem; margin: .8rem 0 .2rem; }
.gmaps { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.part-note { color: var(--muted); font-size: .9rem; margin: -2px 0 6px; }

.timeline { list-style: none; margin: 0 0 1rem; padding: 0; }
.node { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 14px; padding-bottom: 22px; }
.node:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 28px; bottom: -4px; width: 4px; background: var(--ink); border-radius: 2px; }
.marker { width: 28px; height: 28px; margin-top: 2px; border: 4px solid var(--ink); border-radius: 50%; background: var(--bg); position: relative; z-index: 1; }
.node-start .marker { background: var(--ink); box-shadow: inset 0 0 0 3px var(--signal); }
.node-via .marker { background: var(--signal); border-style: dashed; }
.node-end .marker { background: var(--signal); border-radius: 5px; }
.node-title { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.node-type { margin-left: 6px; color: var(--muted); font-size: .9rem; }
.node-time { margin-left: 6px; font-weight: 600; }
.node-notes { margin: .25em 0 0; color: var(--muted); }
.node-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: .6em 0 0; }
.coords { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.briefing { margin-top: 3rem; padding-top: 1.5rem; border-top: 2px solid var(--ink); }

/* Editor */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; align-items: start; }
.editor-actions { grid-column: 1 / -1; display: flex; gap: 12px; padding-top: 1rem; border-top: 2px solid var(--ink); }
.editor-stops .map { height: 300px; margin: 12px 0 0; }
.stop-editor { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.stop-editor > li { padding: 14px 0 16px 14px; border-left: 6px solid var(--line); border-bottom: 1px solid var(--line); }
.stop-editor > li.t-start { border-left-color: var(--ink); }
.stop-editor > li.t-via { border-left-color: var(--signal); }
.stop-editor > li.t-end { border-left-color: var(--signal); border-left-style: double; }
.stop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.stop-kind { font-weight: 600; }
.stop-kind select { width: auto; min-height: 36px; padding: 4px 8px; }
.stop-tools { display: flex; gap: 6px; }
.stop-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stop-fields .wide { grid-column: 1 / -1; }
.stop-fields label { margin-top: 0; font-weight: 500; font-size: .9rem; color: var(--muted); }

/* Print card page */
.card-sheet { width: min(820px, 100% - 40px); margin: 24px auto; }
.card-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; border-bottom: 3px solid var(--ink); padding-bottom: 16px; margin-bottom: 16px; }
.card-head h1 { margin-bottom: .2em; }
.card-head p { margin: 0 0 .3em; }
.qr { margin: 0; text-align: center; }
.qr img { background: #fff; padding: 4px; border-radius: 4px; display: block; }
.stops-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.stops-table th, .stops-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.stops-table th { border-bottom: 2px solid var(--ink); }
.foot { margin-top: 24px; }

/* Leaflet tweaks */
.leaflet-container { font-family: var(--text); background: var(--surface); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-art { max-width: 420px; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .drive-grid, .editor-grid { grid-template-columns: 1fr; gap: 28px; }
  .side { position: static; order: -1; }
  .map { height: 300px; }
}
@media (max-width: 520px) {
  .two, .stop-fields { grid-template-columns: 1fr; }
  .stop-fields .wide { grid-column: auto; }
  .bar nav { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .road-base { animation: none; stroke-dashoffset: 0; }
  .road-line { animation: none; opacity: 1; }
  .pin { animation: none; opacity: 1; }
}
