/* Hiker AI design system: dusk at the refugio. Shared tokens, base elements and components.
   Page CSS files load after this one. Ground is the dusk slate of the hero photo; one orange for answers and the primary action. */

/* ---------- fonts (self-hosted, SIL OFL: see /fonts/OFL-*.txt) ---------- */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/barlow-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/barlow-semi-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/barlow-semi-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face {
  font-family: "Overpass Mono"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(/fonts/overpass-mono-latin-wght-normal.woff2) format("woff2");
}

/* ---------- tokens ---------- */
:root {
  /* palette, taken from the dusk photo */
  --night: #0e141c;      /* ground: the valley after sunset */
  --slate: #17202b;      /* raised surfaces */
  --slate-2: #212c39;    /* inputs, code, second surface */
  --dusk: #f25c1f;       /* the answer, the primary action: nothing else */
  --snow: #f4f1ea;       /* text */
  --mist: #a9b4c0;       /* secondary text */
  --lake: #8fb8de;       /* links, focus */
  --sos: #ff5a47;        /* safety and destructive only */

  /* device screen (a physical LCD, fixed colours) */
  --lcd: #cfd8c2; --lcd-ink: #1b2416; --lcd-dim: #b6c2a6; --bezel: #05080c;

  /* roles: pages use these */
  --bg: var(--night);
  --surface: var(--slate);
  --surface-2: var(--slate-2);
  --ink: var(--snow);
  --muted: var(--mist);
  --line: #2a3644;
  --line-strong: #4a5a6c;
  --accent: var(--dusk);
  --accent-hover: #ff7337;
  --accent-ink: #14100d;
  --accent-soft: #3a1f12;
  --link: var(--lake);
  --focus: var(--lake);
  --ok: #73d29a;   --ok-soft: #13291d;
  --warn: #f2c14e; --warn-soft: #2d2412;
  --bad: var(--sos); --bad-soft: #351714;
  /* legacy names still used by some pages */
  --signpost: var(--dusk); --spruce: var(--night);

  /* type */
  --font: "Barlow", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Barlow Semi Condensed", "Barlow", ui-sans-serif, system-ui, sans-serif;
  --mono: "Overpass Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --t-xs: .8125rem;
  --t-sm: .9375rem;
  --t-base: 1.0625rem;
  --t-lg: 1.25rem;
  --t-xl: clamp(1.75rem, 1.4rem + 1.4vw, 2.375rem);
  --t-2xl: clamp(2.25rem, 1.6rem + 2.8vw, 3.5rem);
  --t-3xl: clamp(2.75rem, 1.7rem + 4.4vw, 5rem);

  /* space (4px base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 72px; --s-9: 112px;

  /* shape */
  --r-1: 8px;     /* buttons, inputs */
  --r-2: 14px;    /* panels, message bubbles */
  --r-3: 18px;    /* device bezel */
  --r-pill: 999px;
  --b-1: 1px solid var(--line);
  --b-2: 2px solid var(--ink);
  --shadow: 0 10px 30px rgb(0 0 0 / .35);

  --wrap: 1180px;
  --measure: 66ch;
  --head-h: 64px;

  color-scheme: dark;
  accent-color: var(--dusk);
  caret-color: var(--dusk);
  scrollbar-color: var(--line-strong) var(--night);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 8px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--t-base); line-height: 1.55;
  font-feature-settings: "kern"; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
#content { flex: 1 0 auto; outline: none; }
::selection { background: var(--dusk); color: var(--accent-ink); }
img, svg { max-width: 100%; height: auto; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.08; color: var(--ink); text-wrap: balance; font-family: var(--display); }
h1 { font-size: var(--t-2xl); font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: var(--t-xl); font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: var(--t-lg); font-weight: 700; letter-spacing: -.005em; line-height: 1.25; }
h4 { font-size: var(--t-base); font-weight: 700; }
p { margin: 0 0 1em; max-width: var(--measure); }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin-bottom: .35em; max-width: var(--measure); }
b, strong { font-weight: 700; }
small, .small { font-size: var(--t-sm); }
hr { border: 0; border-top: var(--b-1); margin: var(--s-6) 0; }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }

code, kbd, .mono { font-family: var(--mono); font-size: .9em; font-variant-ligatures: none; }
code { background: var(--surface-2); border-radius: var(--r-1); padding: .08em .35em; white-space: nowrap; }
pre { font-family: var(--mono); font-size: var(--t-sm); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s-5); }
@media (max-width: 480px) { .wrap { padding: 0 var(--s-4); } }
.muted { color: var(--muted); }
.center { text-align: center; }
.center p, .center .lede { margin-inline: auto; }
.lede { font-size: var(--t-lg); line-height: 1.45; color: var(--ink); max-width: 36em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- shell: header ---------- */
.skip { position: absolute; left: var(--s-4); top: -100px; z-index: 100; background: var(--dusk); color: var(--accent-ink);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-1); font-weight: 700; }
.skip:focus { top: var(--s-2); }

.site-head { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: var(--b-1); }
@supports (backdrop-filter: blur(1px)) {
  .site-head { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
}
.site-head .wrap { display: flex; align-items: center; gap: var(--s-5); height: var(--head-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 1.1875rem;
  letter-spacing: -.01em; text-decoration: none; line-height: 1; }
.brand img { display: block; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: var(--s-5); }
.site-nav a { color: var(--ink); font-weight: 600; font-size: var(--t-sm); text-decoration: none; padding: var(--s-2) 0; }
.site-nav a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.site-nav a.nav-account { border: 1px solid color-mix(in srgb, var(--ink) 45%, transparent); border-radius: var(--r-1); padding: 6px 14px; }
.site-nav a.nav-account:hover { background: var(--ink); color: var(--bg); text-decoration: none; }
@media (max-width: 560px) { .site-nav a.hide-sm { display: none; } }

/* header laid over a full-bleed photo (landing) */
.site-head.over { position: absolute; left: 0; right: 0; background: transparent; border-bottom: 0; backdrop-filter: none; }
.site-head.over .wrap, .site-head.over ~ .site-foot .wrap { max-width: 1380px; padding-inline: clamp(16px, 5vw, 90px); }
.site-head.over .brand, .site-head.over .site-nav a { color: #fff; text-shadow: 0 1px 8px rgb(0 0 0 / .45); }

/* ---------- shell: footer ---------- */
.site-foot { border-top: var(--b-1); background: var(--night); color: var(--muted); font-size: var(--t-sm); }
.site-foot .wrap { display: grid; grid-template-columns: 1fr auto; gap: var(--s-4) var(--s-6); padding-top: var(--s-6); padding-bottom: var(--s-7); }
.site-foot .foot-brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 750; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); align-items: center; }
.site-foot nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
.site-foot nav a:hover { text-decoration: underline; }
.site-foot .legal { grid-column: 1 / -1; margin: 0; max-width: 80ch; font-size: var(--t-xs); }
.site-foot .legal a { color: var(--muted); }
@media (max-width: 640px) { .site-foot .wrap { grid-template-columns: 1fr; } }

/* ---------- sections ---------- */
section.block { padding: var(--s-8) 0; }
section.block.alt { background: var(--surface); border-block: var(--b-1); }
section[id] { scroll-margin-top: calc(var(--head-h) + 8px); }
@media (max-width: 640px) { section.block { padding: var(--s-7) 0; } }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: end; }
.row > .field { flex: 1 1 160px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .55em 1.3em;
  font: inherit; font-weight: 700; font-size: var(--t-base); line-height: 1.2; letter-spacing: .01em;
  color: var(--accent-ink); background: var(--accent); border: 2px solid var(--accent); border-radius: var(--r-1);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--bg); }
.btn.secondary { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn.danger { background: var(--sos); border-color: var(--sos); color: #1a0806; }
.btn.danger:hover { background: #ff7a6b; border-color: #ff7a6b; }
.btn.small { min-height: 36px; padding: .35em .9em; font-size: var(--t-sm); }
.btn.wide { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] {
  background: transparent; color: var(--muted); border: 2px dashed var(--line-strong); cursor: not-allowed; transform: none;
}
.btn:focus-visible { outline-offset: 3px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 650; font-size: var(--t-sm); margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  display: block; width: 100%; min-height: 46px; font: inherit; font-size: var(--t-base); color: var(--ink);
  padding: 10px 14px; background: var(--slate-2); border: 1px solid var(--line-strong); border-radius: var(--r-1);
}
textarea { min-height: 120px; line-height: 1.45; resize: vertical; }
select { padding-right: 32px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--lake); }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--bad); }
.field { margin-bottom: var(--s-4); }
.field .hint { display: block; color: var(--muted); font-size: var(--t-sm); font-weight: 400; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: var(--t-sm); line-height: 1.45; }
.check input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--dusk); }
input.key-input { font-family: var(--mono); text-transform: uppercase; letter-spacing: .12em; }

/* ---------- panels, cards ---------- */
.panel { background: var(--surface); border: var(--b-1); border-radius: var(--r-2); padding: var(--s-5); }
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
@media (min-width: 640px) { .panel { padding: var(--s-6); } }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
@media (max-width: 860px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: var(--b-1); border-radius: var(--r-2); padding: var(--s-5); }
.card > :last-child { margin-bottom: 0; }
section.alt .card, section.alt .panel { background: var(--bg); }

/* ---------- notices ---------- */
.notice {
  position: relative; margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4); font-size: var(--t-sm); line-height: 1.5;
  color: var(--ink); background: var(--surface); border: var(--b-1); border-radius: var(--r-1);
  max-width: var(--measure);
}
.notice.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.notice > :last-child { margin-bottom: 0; }
/* Safety notice: the red cap echoes the SOS button on the device. */
.notice.sos { background: var(--bad-soft); border: 1.5px solid var(--sos); border-radius: var(--r-2);
  padding: var(--s-3) var(--s-4) var(--s-3) calc(var(--s-4) + 52px); min-height: 66px; }
.notice.sos::before {
  content: "SOS"; content: "SOS" / "";
  position: absolute; left: var(--s-3); top: var(--s-3); width: 44px; height: 40px; display: grid; place-items: center;
  background: var(--sos); color: #1a0806; font-weight: 800; font-size: .8125rem; letter-spacing: .04em; border-radius: 6px;
  padding-top: 2px; box-shadow: inset 0 -2px 0 rgb(0 0 0 / .25);
}

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px 8px; border-bottom: var(--b-1); vertical-align: top; }
th { font-weight: 650; color: var(--muted); border-bottom: 1.5px solid var(--line-strong); white-space: nowrap; }
td.num, th.num { text-align: right; }
td code { white-space: nowrap; }
.table-wrap { overflow-x: auto; border: var(--b-1); border-radius: var(--r-2); background: var(--surface); }
.table-wrap table { min-width: 640px; }
.table-wrap tr:last-child td { border-bottom: 0; }
.q { max-width: 340px; overflow-wrap: break-word; }
.clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- pills (status) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .4em; vertical-align: middle;
  font-size: var(--t-xs); font-weight: 650; line-height: 1; padding: .38em .7em .3em; white-space: nowrap;
  color: var(--ink); background: var(--surface-2); border-radius: var(--r-pill);
}
.pill.ok, .pill.warn, .pill.bad { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.pill.ok::before, .pill.warn::before, .pill.bad::before {
  content: ""; width: .55em; height: .55em; border-radius: 50%; background: currentColor; flex: none; margin-top: -.1em;
}
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--ink); }

/* ---------- readouts (tiles) ---------- */
.tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0; margin-bottom: var(--s-6);
  background: var(--surface); border: var(--b-1); border-radius: var(--r-2); overflow: hidden;
}
.tile { padding: var(--s-3) var(--s-4) var(--s-4); box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); min-width: 0; }
.tile .k { color: var(--muted); font-size: var(--t-sm); line-height: 1.3; }
.tile .v { font-size: 1.75rem; font-weight: 800; line-height: 1.15; margin: .2em 0 .05em; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.tile .v.mono { font-weight: 700; letter-spacing: .06em; font-size: 1.5rem; }

/* ---------- the device screen: the one memorable element ---------- */
/* .lcd is a device screen in its bezel; .msg is one message on it; .gauge is the 160-character budget. */
.lcd {
  background: var(--lcd); color: var(--lcd-ink); font-family: var(--mono); font-size: .9375rem; line-height: 1.45;
  border: 10px solid var(--bezel); border-radius: var(--r-3); padding: var(--s-4);
  box-shadow: inset 0 2px 8px rgb(0 0 0 / .18);
}
.lcd a { color: inherit; }
.lcd code { background: none; padding: 0; }
.msg { padding: 10px 12px 8px; border-radius: 6px; margin: 0 0 var(--s-3); max-width: 94%; background: #e6ecdc; }
.msg.out { background: var(--lcd-dim); margin-left: auto; }
.msg.in { background: #e9eee1; box-shadow: inset 0 0 0 1px rgb(30 42 24 / .25); }
.msg:last-child { margin-bottom: 0; }
.msg .meta { display: block; margin-top: 6px; font-size: .75rem; opacity: .72; }
.gauge {
  --n: 0; display: block; position: relative; height: 8px; margin: 8px 0 2px;
  background-color: rgb(30 42 24 / .12);
  background-image: linear-gradient(to left, rgb(30 42 24 / .35) 1px, transparent 1px);
  background-size: 6.25% 100%; /* a tick every 10 characters */
}
.gauge::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(min(var(--n), 160) / 160 * 100%); background: var(--lcd-ink); }

/* the key, as shown on the device */
.keybox {
  display: inline-block; margin: 6px 0 var(--s-4); padding: .22em .55em .12em;
  font-family: var(--mono); font-weight: 700; font-size: clamp(2.25rem, 9vw, 3.5rem); letter-spacing: .16em; line-height: 1.2;
  background: var(--lcd); color: var(--lcd-ink); border: 8px solid var(--bezel); border-radius: var(--r-3);
  box-shadow: inset 0 2px 8px rgb(0 0 0 / .18); user-select: all;
}
/* text to type on the device */
.sample {
  font-family: var(--mono); font-size: .9375rem; line-height: 1.45; overflow-wrap: anywhere;
  background: var(--lcd); color: var(--lcd-ink); border-radius: var(--r-1); padding: 10px 14px 8px;
  box-shadow: inset 0 1px 4px rgb(0 0 0 / .16);
}

/* ---------- lists and disclosure ---------- */
ol.steps { list-style: none; padding: 0; counter-reset: step; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 44px; margin-bottom: var(--s-4); }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; display: grid; place-items: center;
  border: var(--b-2); border-radius: 50%; font-weight: 800; font-size: var(--t-sm); padding-top: 2px; font-variant-numeric: tabular-nums;
}
dl.defs { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-5); margin: 0 0 1em; }
dl.defs dt { font-family: var(--mono); font-size: .9375rem; font-weight: 600; }
dl.defs dd { margin: 0; color: var(--muted); }
@media (max-width: 420px) { dl.defs { grid-template-columns: 1fr; gap: 0; } dl.defs dd { margin-bottom: var(--s-3); } }

summary { cursor: pointer; }
details.faq { border-bottom: var(--b-1); }
details.faq:first-of-type { border-top: var(--b-1); }
details.faq summary { list-style: none; display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-4) 0 calc(var(--s-4) - 3px); font-weight: 700; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: ""; flex: none; width: 16px; height: 16px; margin-top: 3px; background: var(--muted);
  -webkit-mask: url(/img/icon-plus.svg) center / contain no-repeat; mask: url(/img/icon-plus.svg) center / contain no-repeat; }
details.faq[open] summary::after { -webkit-mask-image: url(/img/icon-minus.svg); mask-image: url(/img/icon-minus.svg); }
details.faq > :not(summary) { margin: 0 0 var(--s-4); color: var(--muted); }

pre.log { white-space: pre-wrap; word-break: break-word; font-size: var(--t-xs); line-height: 1.5; background: var(--bg);
  border: var(--b-1); border-radius: var(--r-1); padding: var(--s-3); max-height: 320px; overflow: auto; }

/* ---------- admin shell (admin.css may refine) ---------- */
.admin-nav { background: var(--surface); border-bottom: var(--b-1); }
.admin-nav .wrap { display: flex; align-items: center; gap: var(--s-1); overflow-x: auto; }
.admin-nav a { padding: 12px 10px 9px; color: var(--muted); font-weight: 650; font-size: var(--t-sm); white-space: nowrap;
  text-decoration: none; border-bottom: 3px solid transparent; }
.admin-nav a.on { color: var(--ink); border-bottom-color: var(--ink); }
.admin-nav a:hover { color: var(--ink); }
.admin main { padding: var(--s-6) 0 var(--s-7); }
.bar { height: 8px; background: var(--lake); min-width: 2px; border-radius: 1px; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .btn:active { transform: none; }
}

/* ---------- browser surfaces ---------- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--night); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 3px solid var(--night); }
