/* Trailmark public site: the "Topo map" look.
   Survey-map paper, blue contour lines, condensed map type, cairns for markers, a red dashed trail.
   Tokens first; components are tm-* classes used by MainLayout and the public pages. */
:root {
  --tm-bg: #fbfcfc;
  --tm-card: #ffffff;
  --tm-ink: #0f1d2a;
  --tm-muted: #546575;
  --tm-line: #dbe4ea;
  --tm-contour: #a8c1d6;
  --tm-index: #6f93b3;
  --tm-water: #dcebf5;
  --tm-path: #c0392b;
  --tm-accent: #1c6aa3;
  --tm-on-accent: #ffffff;
  --tm-soft: #f1f6f9;
  --tm-ok: #1f7a4d;
  --tm-f-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --tm-f-body: "Barlow", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tm-bg: #0b141c; --tm-card: #101c27; --tm-ink: #e3ecf3; --tm-muted: #95a8b8; --tm-line: #1e2d3a;
    --tm-contour: #22384b; --tm-index: #3b5d7a; --tm-water: #102233; --tm-path: #ef6b5b;
    --tm-accent: #6fb3e6; --tm-on-accent: #0b141c; --tm-soft: #13212d; --tm-ok: #6fcf97;
  }
}
:root[data-theme="dark"] {
  --tm-bg: #0b141c; --tm-card: #101c27; --tm-ink: #e3ecf3; --tm-muted: #95a8b8; --tm-line: #1e2d3a;
  --tm-contour: #22384b; --tm-index: #3b5d7a; --tm-water: #102233; --tm-path: #ef6b5b;
  --tm-accent: #6fb3e6; --tm-on-accent: #0b141c; --tm-soft: #13212d; --tm-ok: #6fcf97;
}

html { font-family: var(--tm-f-body); }
body { background: rgb(var(--c-gray-50)); color: rgb(var(--c-gray-900)); }
/* The starter strips focus rings; keyboard users still need to see where they are. */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--tm-accent) !important; outline-offset: 2px;
}

/* ---------- shell ---------- */
.tm-site { background: var(--tm-bg); color: var(--tm-ink); font-family: var(--tm-f-body); min-height: 100vh; display: flex; flex-direction: column; }
.tm-in { width: 100%; max-width: 1140px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.tm-bar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--tm-bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--tm-line); }
.tm-bar .tm-in { display: flex; align-items: center; gap: 18px; min-height: 60px; }
.tm-logo { display: flex; align-items: center; gap: 8px; font-family: var(--tm-f-display); font-weight: 700; font-size: 1.45rem; letter-spacing: .14em; text-transform: uppercase; color: var(--tm-ink); }
.tm-logo svg { width: 30px; height: 30px; flex: none; }
.tm-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.tm-nav a { font-family: var(--tm-f-display); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tm-muted); padding: 8px 10px; }
.tm-nav a:hover, .tm-nav a.active { color: var(--tm-ink); }
.tm-nav a.active { box-shadow: inset 0 -2px 0 var(--tm-path); }
.tm-nav a.tm-btn, .tm-nav a.tm-btn:hover { color: var(--tm-on-accent); padding: 8px 14px; box-shadow: none; }
.tm-actions { display: flex; align-items: center; gap: 10px; }
.tm-theme { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--tm-line); border-radius: 4px; color: var(--tm-ink); background: transparent; cursor: pointer; }
.tm-theme svg { width: 17px; height: 17px; }
.tm-theme .tm-sun { display: none; }
:root[data-theme="dark"] .tm-theme .tm-sun { display: block; }
:root[data-theme="dark"] .tm-theme .tm-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tm-theme .tm-sun { display: block; }
  :root:not([data-theme="light"]) .tm-theme .tm-moon { display: none; }
}
.tm-menu { display: none; border: 1px solid var(--tm-line); background: transparent; color: var(--tm-ink); border-radius: 4px; padding: 6px 12px; font-family: var(--tm-f-display); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
@media (max-width: 860px) {
  .tm-menu { display: block; margin-left: auto; }
  .tm-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--tm-bg); border-bottom: 1px solid var(--tm-line); padding: 8px max(20px, env(safe-area-inset-right, 0px)) 16px max(20px, env(safe-area-inset-left, 0px)); }
  .tm-nav.open { display: flex; }
  .tm-nav a.active { box-shadow: inset 3px 0 0 var(--tm-path); }
  .tm-actions { padding-top: 8px; }
}

/* ---------- buttons ---------- */
.tm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 3px; padding: 11px 18px; font-family: var(--tm-f-display); font-weight: 700; font-size: 1.02rem; letter-spacing: .1em; text-transform: uppercase; background: var(--tm-accent); color: var(--tm-on-accent); cursor: pointer; }
.tm-btn:hover { filter: brightness(1.07); }
.tm-btn-ghost { background: var(--tm-bg); color: var(--tm-ink); box-shadow: inset 0 0 0 1.5px var(--tm-ink); }
.tm-btn-sm { padding: 8px 14px; font-size: .95rem; }
.tm-link { color: var(--tm-accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- type ---------- */
.tm-h1 { font-family: var(--tm-f-display); font-weight: 700; font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: .98; text-transform: uppercase; letter-spacing: .01em; text-wrap: balance; }
.tm-h2 { font-family: var(--tm-f-display); font-weight: 700; font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1; text-transform: uppercase; text-wrap: balance; }
.tm-h3 { font-family: var(--tm-f-display); font-weight: 700; font-size: 1.35rem; letter-spacing: .04em; text-transform: uppercase; }
.tm-k { font-family: var(--tm-f-display); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--tm-accent); font-size: .9rem; }
.tm-lead { color: var(--tm-muted); font-size: 1.12rem; line-height: 1.55; max-width: 40em; }

/* ---------- map hero ---------- */
.tm-map { position: relative; border-bottom: 1px solid var(--tm-line); overflow: hidden; }
.tm-map canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tm-map > .tm-in { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding-block: 56px 64px; min-height: 540px; }
.tm-map .tm-lead { margin-top: 18px; background: color-mix(in srgb, var(--tm-bg) 82%, transparent); }
.tm-ctas { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.tm-pins { position: relative; min-height: 400px; }
.tm-pin { position: absolute; display: flex; gap: 6px; align-items: center; transform: translate(-11px, -50%); }
.tm-pin svg { width: 22px; height: 22px; flex: none; }
.tm-pin span { background: var(--tm-card); border: 1px solid var(--tm-line); padding: 3px 8px; border-radius: 3px; font-size: 13px; white-space: nowrap; box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.tm-pin b { font-family: var(--tm-f-display); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 14px; margin-right: 6px; }
.tm-legend { position: absolute; right: 0; bottom: 0; background: var(--tm-card); border: 1px solid var(--tm-ink); padding: 10px 14px; font-size: 12px; display: grid; gap: 4px; min-width: 210px; }
.tm-legend b { font-family: var(--tm-f-display); letter-spacing: .1em; text-transform: uppercase; font-size: 13px; }
.tm-legend div { display: flex; gap: 8px; align-items: center; }
.tm-legend i { display: inline-block; width: 22px; height: 0; border-top: 2px dashed var(--tm-path); }
.tm-legend i.c { border-top: 1px solid var(--tm-index); }
.tm-legend svg { width: 16px; height: 16px; margin-inline: 3px; }

/* ---------- sections ---------- */
.tm-band { padding-block: 64px; }
.tm-band.alt { background: var(--tm-soft); border-block: 1px solid var(--tm-line); }
.tm-head { display: grid; gap: 12px; margin-bottom: 32px; }
.tm-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--tm-line); background: var(--tm-card); }
.tm-grid3 > div { padding: 22px; border-left: 1px solid var(--tm-line); display: grid; gap: 8px; align-content: start; min-width: 0; }
.tm-grid3 > div:first-child { border-left: 0; }
.tm-grid3 b { font-size: 1.15rem; font-weight: 600; }
.tm-grid3 p { color: var(--tm-muted); font-size: 15px; }
.tm-cycle { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--tm-line); background: var(--tm-card); }
.tm-cycle > div { padding: 20px; border-left: 1px solid var(--tm-line); display: grid; gap: 6px; align-content: start; }
.tm-cycle > div:first-child { border-left: 0; }
.tm-cycle .when { font-family: var(--tm-f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--tm-muted); font-size: 14px; }
.tm-cycle p { color: var(--tm-muted); font-size: 15px; }
.tm-state { justify-self: start; font-family: var(--tm-f-display); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 13px; padding: 2px 8px; border: 1.5px solid currentColor; border-radius: 3px; }
.tm-state.coming { color: var(--tm-muted); }
.tm-state.started { color: var(--tm-path); }
.tm-state.done { color: var(--tm-ok); }
.tm-voice { margin-top: 28px; font-size: clamp(1.15rem, 2.2vw, 1.5rem); line-height: 1.4; max-width: 34em; display: flex; gap: 14px; }
.tm-voice svg { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.tm-elev svg { width: 100%; height: 120px; display: block; }
.tm-elev p { font-size: 14px; color: var(--tm-muted); margin-top: 8px; }
.tm-list { list-style: none; margin: 0; padding: 0; }
.tm-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--tm-line); }
.tm-list li span:last-child { color: var(--tm-muted); font-family: var(--tm-f-display); letter-spacing: .06em; text-transform: uppercase; font-size: 14px; text-align: right; }
.tm-two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.tm-two > div { min-width: 0; }
.tm-devices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tm-devices span { border: 1px solid var(--tm-line); background: var(--tm-card); padding: 6px 12px; border-radius: 3px; font-family: var(--tm-f-display); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 14px; }
.tm-cipher { background: var(--tm-card); border: 1px solid var(--tm-ink); padding: 20px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.7; display: grid; gap: 14px; min-width: 0; }
.tm-cipher .lbl { font-family: var(--tm-f-display); letter-spacing: .1em; text-transform: uppercase; font-size: 13px; color: var(--tm-muted); }
.tm-cipher .enc { color: var(--tm-path); word-break: break-all; }

/* ---------- inner pages ---------- */
.tm-pagehead { position: relative; overflow: hidden; border-bottom: 1px solid var(--tm-line); }
.tm-pagehead canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tm-pagehead > .tm-in { position: relative; padding-block: 52px 44px; display: grid; gap: 12px; }
.tm-pagehead .tm-lead { background: color-mix(in srgb, var(--tm-bg) 82%, transparent); }
.tm-prose { max-width: 720px; display: grid; gap: 16px; }
.tm-prose h2 { font-family: var(--tm-f-display); font-weight: 700; font-size: 1.7rem; text-transform: uppercase; margin-top: 18px; }
.tm-prose p, .tm-prose li { color: var(--tm-muted); font-size: 1.05rem; line-height: 1.6; }
.tm-prose strong { color: var(--tm-ink); }
.tm-prose ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; list-style: disc; }
.tm-table { overflow-x: auto; border: 1px solid var(--tm-line); background: var(--tm-card); }
.tm-table table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 15px; }
.tm-table th, .tm-table td { text-align: left; padding: 12px 16px; border-top: 1px solid var(--tm-line); vertical-align: top; }
.tm-table thead th { border-top: 0; font-family: var(--tm-f-display); letter-spacing: .1em; text-transform: uppercase; font-size: 13px; color: var(--tm-muted); }
.tm-table td:first-child { font-weight: 600; }
.tm-table .y { color: var(--tm-ok); font-weight: 600; }
.tm-table .n { color: var(--tm-muted); }
.tm-free { display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; }
.tm-free-card { background: var(--tm-card); border: 2px solid var(--tm-ink); padding: 28px; display: grid; gap: 16px; }
.tm-free-card .amt { font-family: var(--tm-f-display); font-size: 3.4rem; font-weight: 700; line-height: 1; }
.tm-free-card .amt small { font-size: 1rem; font-weight: 500; color: var(--tm-muted); font-family: var(--tm-f-body); }
.tm-ticks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; }
.tm-ticks li { display: flex; gap: 8px; }
.tm-ticks li::before { content: "✓"; color: var(--tm-ok); font-weight: 700; }
.tm-extras { border: 1px dashed var(--tm-index); padding: 28px; display: grid; gap: 12px; align-content: start; }
.tm-extras p, .tm-extras li { color: var(--tm-muted); font-size: 15px; }
.tm-extras ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; list-style: disc; }
.tm-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tm-dl > div { background: var(--tm-card); border: 1px solid var(--tm-line); padding: 22px; display: grid; gap: 6px; align-content: start; }
.tm-dl b { font-family: var(--tm-f-display); font-size: 1.35rem; letter-spacing: .04em; text-transform: uppercase; }
.tm-dl small { color: var(--tm-muted); }
.tm-dl .status { font-family: var(--tm-f-display); letter-spacing: .08em; text-transform: uppercase; font-size: 13px; color: var(--tm-path); }
.tm-dl .status.live { color: var(--tm-ok); }

/* forms on public pages */
.tm-field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.tm-field input, .tm-field textarea { border: 1px solid var(--tm-line); background: var(--tm-card); color: var(--tm-ink); border-radius: 3px; padding: 11px 12px; font: inherit; font-weight: 400; width: 100%; }
.tm-field .validation-message, .tm-err { color: var(--tm-path); font-weight: 400; font-size: 13px; }
.tm-ok-box { border: 1.5px solid var(--tm-ok); background: var(--tm-card); padding: 22px; display: grid; gap: 8px; }

/* ---------- starter pages (sign-in, account) ----------
   The starter's app.css hard-codes light colours on these classes while their text follows the dark tokens,
   so dark mode showed white cards with white headings. Re-point them at the Topo tokens here, not in app.css. */
.card { background-color: var(--tm-card); border: 1px solid var(--tm-line); box-shadow: none; }
.card-header { border-bottom-color: var(--tm-line); }
.form-input { color: var(--tm-ink); background-color: var(--tm-bg); border-color: var(--tm-line); }
.form-label { color: var(--tm-ink); }
.btn-primary { background-color: var(--tm-accent); color: var(--tm-on-accent); }
.btn-primary:hover { background-color: color-mix(in srgb, var(--tm-accent) 85%, var(--tm-ink)); }
.btn-secondary { background-color: var(--tm-card); color: var(--tm-ink); border-color: var(--tm-line); }
.btn-secondary:hover { background-color: var(--tm-soft); }
/* Admin sidebar: built from gray-900/white utilities, which the dark tokens flip, so it turned light with dark
   text in dark mode. Keep it dark in both themes. */
aside.from-gray-900 { background: #0f1d2a; }
aside.from-gray-900 .text-white, aside.from-gray-900 [class~="!text-white"] { color: #ffffff !important; }
aside.from-gray-900 .text-gray-400 { color: #9ca3af; }
aside.from-gray-900 .text-gray-500 { color: #6b7280; }
aside.from-gray-900 .bg-gray-800 { background-color: #1f2937; }
/* On a phone the fixed 256px sidebar left tables a sliver: put it on top as one scrolling row instead. */
@media (max-width: 767px) {
  aside.from-gray-900 { position: static; width: auto; }
  aside.from-gray-900 > div { height: auto; }
  aside.from-gray-900 nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
  aside.from-gray-900 nav > * { display: flex; gap: 4px; margin: 0 !important; }
  aside.from-gray-900 nav p { display: none; }
  aside.from-gray-900 nav a { white-space: nowrap; margin: 0 !important; }
  aside.from-gray-900 ~ .ml-64 { margin-left: 0; } /* beats the Tailwind CDN rule injected after this file */
}
/* Auth pages centre their form in a full screen, under our header: on a phone the form started halfway down. */
.tm-site main .min-h-screen { min-height: 70vh; }
@media (max-width: 560px) { .tm-site main .min-h-screen { min-height: 0; } }

/* ---------- footer ---------- */
.tm-footer { margin-top: auto; border-top: 1px solid var(--tm-line); color: var(--tm-muted); font-size: 14px; }
.tm-footer .tm-in { padding-block: 28px; display: flex; gap: 16px 32px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.tm-footer nav { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.tm-footer a, .tm-footer button { font-family: var(--tm-f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--tm-muted); background: none; border: 0; padding: 0; cursor: pointer; font-size: 14px; }
.tm-footer a:hover, .tm-footer button:hover { color: var(--tm-ink); }

@media (max-width: 860px) {
  .tm-map > .tm-in, .tm-two, .tm-free { grid-template-columns: 1fr; }
  .tm-grid3 { grid-template-columns: 1fr; }
  .tm-grid3 > div { border-left: 0; border-top: 1px solid var(--tm-line); }
  .tm-grid3 > div:first-child { border-top: 0; }
  .tm-cycle { grid-template-columns: 1fr 1fr; }
  .tm-cycle > div:nth-child(3) { border-left: 0; }
  .tm-cycle > div:nth-child(n+3) { border-top: 1px solid var(--tm-line); }
  .tm-pins { min-height: 340px; }
}
@media (max-width: 560px) {
  .tm-band { padding-block: 48px; }
  .tm-cycle { grid-template-columns: 1fr; }
  .tm-cycle > div { border-left: 0; border-top: 1px solid var(--tm-line); }
  .tm-cycle > div:first-child { border-top: 0; }
  .tm-ticks { grid-template-columns: 1fr; }
  /* The pins are placed by % of this box, so the legend hangs below it instead of sitting on them. */
  .tm-legend { top: calc(100% + 16px); bottom: auto; left: 0; }
  .tm-pins { min-height: 300px; margin-bottom: 130px; }
}
