/* HerdTag site: farm-supply catalog look. Light paper by default, dark supported. */
:root {
  --paper: #f5efe3;
  --paper-2: #ece3d2;
  --card: #fbf8f1;
  --ink: #1e1c19;
  --muted: #6a6257;
  --rule: #d6cab4;
  --accent: #9b2c24;      /* barn red, used sparingly */
  --denim: #3d5468;
  --tan: #b48b55;
  --field: #5b6b3a;
  --zone: #e6c98f;
  --head: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;
  --body: "Libre Franklin", "Franklin Gothic Book", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* legacy names used by docs pages and the battery widget */
  --bg: var(--paper);
  --green: var(--field);
  --green-2: var(--denim);
  --ochre: var(--tan);
  --red: var(--accent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171512;
    --paper-2: #1f1c18;
    --card: #221f1a;
    --ink: #ece4d4;
    --muted: #a59b8b;
    --rule: #3a342c;
    --accent: #d2675b;
    --denim: #93abc0;
    --tan: #cfa56d;
    --field: #a7b77f;
    --zone: #6b5a35;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.6 var(--body);
}
img, svg { max-width: 100%; }
a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--head); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h3 { font-size: 1.3rem; font-weight: 600; }
p { margin: 0 0 1em; }
strong { font-weight: 600; }
code { font-family: var(--mono); font-size: .88em; background: var(--paper-2); padding: .1em .35em; border-radius: 3px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 680px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--card); padding: 8px 12px; z-index: 10; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 34em; }

/* Header */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 700; font-size: 1.45rem; text-decoration: none; color: var(--ink); }
.brand svg { width: 26px; height: 26px; }
.nav { margin-left: auto; display: flex; gap: 28px; font-size: .95rem; font-weight: 500; }
.nav a { white-space: nowrap; text-decoration: none; color: var(--ink); padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--ink); }
.badge { display: none; }
@media (max-width: 560px) {
  .wrap { padding: 0 18px; }
  .site-head .wrap { gap: 10px; min-height: 60px; }
  .brand { font-size: 1.2rem; gap: 8px; }
  .brand svg { width: 22px; height: 22px; }
  .nav { gap: 14px; font-size: .86rem; }
  .hide-sm { display: none; }
}

/* Sections */
section { padding: 88px 0; border-top: 1px solid var(--rule); }
section:first-of-type { border-top: 0; }
section.alt { background: var(--paper-2); }
.label { font: 600 .78rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
@media (max-width: 560px) { section { padding: 60px 0; } body { font-size: 17px; } }

/* Hero */
.hero { padding: 88px 0 0; }
.hero h1 { max-width: 13em; }
.hero .lede { margin-top: 18px; }
.hero-art { display: block; width: 100%; height: auto; margin-top: 48px; color: var(--ink); }
@media (max-width: 560px) { .hero { padding-top: 52px; } .hero-art { margin-top: 32px; height: 170px; } }

/* Buttons */
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn { display: inline-block; padding: 13px 22px; border: 1.5px solid var(--ink); border-radius: 3px; font-weight: 600; font-size: .98rem; text-decoration: none; color: var(--ink); background: transparent; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Two-column text + art */
.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 64px; align-items: center; }
.split.top { align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 36px; } }

/* Steps */
.steps { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; counter-reset: s; }
.steps li { border-top: 2px solid var(--ink); padding-top: 18px; counter-increment: s; }
.steps li::before { content: counter(s); display: block; font: 700 2.4rem/1 var(--head); color: var(--accent); margin-bottom: 12px; }
.steps h3 { margin-bottom: .3em; }
.steps p { margin: 0; color: var(--muted); }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; gap: 28px; } }

/* Roadmap line */
.road { list-style: none; padding: 0; margin: 44px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); position: relative; }
.road::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; border-top: 2px dashed var(--rule); }
.road li { position: relative; padding-top: 34px; padding-right: 16px; }
.road li::before { content: ""; position: absolute; top: 0; left: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }
.road li.now::before { background: var(--accent); border-color: var(--accent); }
.road b { display: block; font: 600 1.15rem/1.2 var(--head); margin-bottom: 4px; }
.road span { color: var(--muted); font-size: .95rem; }
.road .now span { color: var(--accent); font-weight: 600; }
section.alt .road li::before { background: var(--paper-2); }
section.alt .road li.now::before { background: var(--accent); }
@media (max-width: 720px) {
  .road { grid-template-columns: 1fr; gap: 22px; }
  .road::before { left: 9px; right: auto; top: 0; bottom: 0; border-top: 0; border-left: 2px dashed var(--rule); }
  .road li { padding: 0 0 0 40px; }
}

/* Plain checklist */
.ticks { list-style: none; padding: 0; margin: 28px 0 0; }
.ticks li { padding: 14px 0 14px 36px; border-bottom: 1px solid var(--rule); position: relative; }
.ticks li:first-child { border-top: 1px solid var(--rule); }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 22px; width: 12px; height: 7px; border-left: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(-45deg); }

/* Contact */
.contact { text-align: left; }
.contact h2 { max-width: 14em; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); padding: 28px 0 40px; font-size: .9rem; color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.site-foot a { color: var(--muted); }

/* How-it-works */
.prose { max-width: 680px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .5em; }
.figure { margin: 0; }
.figure figcaption { font-size: .9rem; color: var(--muted); margin-top: 10px; }
.svg-ink { fill: var(--ink); }
.svg-muted { fill: var(--muted); }
.svg-line { stroke: var(--ink); }
.table-scroll { overflow-x: auto; margin: 24px 0; }
table { border-collapse: collapse; width: 100%; font-size: .96rem; }
th, td { text-align: left; padding: 11px 14px 11px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--ink); }

.bytes { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; margin: 26px 0 12px; font: 600 .78rem/1 var(--mono); }
.bytes span { padding: 16px 0; text-align: center; color: #fff; border-radius: 2px; }
.bytes .lat { background: var(--field); } .bytes .lon { background: var(--denim); }
.bytes .bat { background: var(--tan); } .bytes .st { background: var(--accent); } .bytes .fid { background: var(--muted); }
@media (prefers-color-scheme: dark) { .bytes span { color: #171512; } }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; color: var(--muted); }
.legend-row i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 1px; vertical-align: 0; }

.widget { background: var(--card); border: 1px solid var(--rule); border-radius: 4px; padding: 24px; }
.widget label { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; font-weight: 500; margin-top: 16px; }
.widget label:first-child { margin-top: 0; }
.widget output { font-weight: 600; color: var(--accent); white-space: nowrap; }
.widget input[type=range] { width: 100%; accent-color: var(--accent); margin: 8px 0 0; }
.note { font-size: .86rem; color: var(--muted); margin-top: 16px; }
.result { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 4px; padding: 20px; }
.card .k { font: 700 2.6rem/1 var(--head); margin-bottom: 6px; }
.bar { display: flex; height: 14px; margin: 12px 0 10px; border-radius: 2px; overflow: hidden; background: var(--paper-2); }
.bar span { display: block; height: 100%; }

/* Docs */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; padding-top: 48px; padding-bottom: 72px; }
.docs > nav h2 { font: 600 .75rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; }
.docs > nav h2:first-child { margin-top: 0; }
.docs > nav ul { list-style: none; padding: 0; margin: 0; }
.docs > nav a { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--rule); text-decoration: none; color: var(--ink); font-size: .94rem; }
.docs > nav a:hover { border-left-color: var(--ink); color: var(--ink); }
.docs > nav a[aria-current="page"] { border-left-color: var(--accent); font-weight: 600; }
.doc { min-width: 0; max-width: 760px; font-size: 17px; }
.doc h1 { font-size: clamp(2.2rem, 5vw, 3rem); }
.doc h2 { font-size: 1.7rem; margin-top: 1.8em; padding-top: .8em; border-top: 1px solid var(--rule); }
.doc h3 { margin-top: 1.4em; }
.doc pre { background: var(--card); border: 1px solid var(--rule); border-radius: 4px; padding: 14px 16px; overflow-x: auto; font-size: .86rem; line-height: 1.5; }
.doc pre code { background: none; padding: 0; }
.doc table { display: block; overflow-x: auto; }
.doc img { max-width: 100%; }
.doc blockquote { margin: 1em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--tan); color: var(--muted); }
.doc-src { font-size: .82rem; color: var(--muted); margin-bottom: 18px; }
.grid { display: grid; gap: 14px; margin: 14px 0 34px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid .card h3 { font-size: 1.15rem; margin-bottom: .25em; }
.grid .card p { margin: 0; }
a.card:hover { border-color: var(--ink); }
@media (max-width: 820px) {
  .docs { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; }
  .docs > nav { border-bottom: 1px solid var(--rule); padding-bottom: 20px; }
  .docs > nav ul { display: flex; flex-wrap: wrap; gap: 4px 16px; }
  .docs > nav a { border-left: 0; padding: 3px 0; }
  .docs > nav a[aria-current="page"] { color: var(--accent); }
  .grid.c2 { grid-template-columns: 1fr; }
}
