/* Agent Workshop — Ledger + Shopmark design system v2.
   Dark-only, mobile-first. Flat ink on paper. No gradients, no glow,
   no glass, no color-fade text. Ember marks earned things only:
   the seal's arc, MERGED stamps, and live/verified indicators. */

:root {
  --ground: #0e0e10;
  --raised: #141416;
  --card: #17171a;
  --hair: #26262b;
  --bone: #ece5d8;
  --muted: #97907f;
  --ember: #e04a1f;
  --radius: 10px;
  --maxw: 720px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--bone);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

::selection { background: var(--hair); color: var(--bone); }

/* ---------- accessibility ---------- */
.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--bone); color: var(--ground);
  padding: 10px 16px; border-radius: 0 0 10px 0;
  font-weight: 700; z-index: 100; text-decoration: none;
}
.skip:focus { left: 0; }
:focus-visible { outline: 2px solid var(--bone); outline-offset: 3px; border-radius: 6px; }

/* ---------- header / nav ---------- */
header.site {
  border-bottom: 1px solid var(--hair);
  background: var(--ground);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav { display: flex; align-items: center; gap: 4px; padding: 10px 0; flex-wrap: wrap; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--bone);
  font-weight: 750; font-size: 17px; letter-spacing: -0.01em;
  margin-right: auto; padding: 6px 8px 6px 0;
  min-height: 44px;
}
.brand .mark {
  width: 32px; height: 32px;
  display: block;
  flex-shrink: 0;
}
.nav a.nlink {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 550;
  padding: 10px 12px; border-radius: 8px;
  min-height: 44px; display: inline-flex; align-items: center;
  transition: color 160ms ease, background-color 160ms ease;
}
.nav a.nlink:hover { color: var(--bone); background: var(--raised); text-decoration: none; }
.nav a.nlink.active { color: var(--bone); background: var(--raised); }

/* ---------- hero / type ---------- */
.hero { padding: 56px 0 32px; }
.hero-kicker {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 14px;
}
h1 {
  font-size: clamp(34px, 8.5vw, 52px);
  line-height: 1.06; letter-spacing: -0.025em; font-weight: 800;
  margin: 0 0 18px; max-width: 16ch;
}
h2 {
  font-size: 25px; line-height: 1.28; letter-spacing: -0.015em; font-weight: 750;
  margin: 44px 0 12px;
}
h3 { font-size: 19px; line-height: 1.35; letter-spacing: -0.01em; font-weight: 700; margin: 26px 0 8px; }
.lede { font-size: 20px; line-height: 1.6; color: var(--muted); margin: 0 0 18px; max-width: 34em; }
.lede strong { color: var(--bone); }
p { margin: 0 0 16px; }
a { color: var(--bone); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }

/* ---------- cards ---------- */
.card-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 8px 0; }
.card {
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 24px;
  margin: 0 0 14px;
  transition: transform 180ms ease, border-color 180ms ease;
}
.card-grid .card { margin: 0; }
.card:hover { transform: translateY(-2px); border-color: var(--muted); }
.card h3 { margin: 0 0 8px; font-size: 20px; }
.card p { color: var(--muted); font-size: 16px; }
.card p:last-child { margin-bottom: 0; }
.card .tag {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.card .cta-row { margin-top: 16px; }
.rule-card { border-left: 3px solid var(--bone); }
.rule-card:hover { border-left-color: var(--bone); }

/* ---------- stamps (load-bearing semantics — do not restyle) ---------- */
.stamp {
  display: inline-block;
  font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--bone);
  border: 2px solid var(--bone);
  outline: 1px solid var(--bone);
  outline-offset: 3px;
  border-radius: 3px;
  padding: 5px 12px;
  margin: 4px 10px 4px 0;
  transform: rotate(-2deg);
  white-space: nowrap;
}
.stamp.merged {
  color: var(--ember);
  border-color: var(--ember);
  outline-color: var(--ember);
}
.stamp.rejected {
  color: var(--muted);
  border-color: var(--muted);
  outline-color: var(--muted);
  text-decoration: line-through;
}
.stamp-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 18px 0;
}
.stamp-row .arrow { color: var(--muted); font-weight: 700; }

/* ---------- status strip ---------- */
.status { display: flex; flex-direction: column; gap: 8px; margin: 18px 0; }
.status-row {
  display: flex; gap: 10px; align-items: baseline;
  background: var(--raised); border: 1px solid var(--hair);
  border-radius: var(--radius); padding: 12px 16px; font-size: 15px;
}
.dot { font-size: 12px; flex-shrink: 0; }
.dot.live { color: var(--ember); }
.dot.planned { color: var(--muted); }
.status-row .lbl { font-weight: 700; }
.status-row .note { color: var(--muted); }

/* ---------- forms ---------- */
form.plain { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
select, input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%;
  background: var(--raised); border: 1px solid var(--hair); color: var(--bone);
  border-radius: var(--radius); padding: 12px 13px; font-size: 16px; font-family: var(--font);
  min-height: 48px;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--muted); }
::placeholder { color: var(--muted); opacity: 0.7; }
button.btn, a.btn {
  display: inline-block; cursor: pointer; border: 1px solid transparent; text-decoration: none;
  background: var(--bone);
  color: var(--ground); font-weight: 700; font-size: 16px; font-family: var(--font);
  padding: 12px 22px; border-radius: var(--radius); text-align: center;
  min-height: 48px; line-height: 1.4;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}
button.btn:hover, a.btn:hover { text-decoration: none; transform: translateY(-1px); background: var(--bone); }
a.btn.ghost, button.btn.ghost {
  background: transparent; color: var(--bone);
  border: 1px solid var(--hair);
}
a.btn.ghost:hover, button.btn.ghost:hover { border-color: var(--muted); background: var(--raised); transform: translateY(-1px); }
.form-note { font-size: 13px; color: var(--muted); opacity: 0.8; margin: 6px 0 0; }

/* ---------- lists / misc ---------- */
ul.tight { padding-left: 22px; margin: 0 0 16px; }
ul.tight li { margin-bottom: 8px; }
ul.tight li::marker { color: var(--muted); }
ol.pipeline { padding-left: 0; counter-reset: pipe; }
ol.pipeline > li {
  list-style: none; position: relative; padding-left: 40px; margin-bottom: 16px;
}
ol.pipeline > li::before {
  counter-increment: pipe; content: counter(pipe);
  position: absolute; left: 0; top: 2px;
  width: 28px; height: 28px; border-radius: 50%;
  color: var(--muted);
  border: 1px solid var(--hair);
  font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.divider { border: none; border-top: 1px solid var(--hair); margin: 40px 0; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--hair); background: var(--raised);
  border-radius: 999px; padding: 4px 12px; margin: 0 6px 6px 0;
  transition: border-color 160ms ease, color 160ms ease;
}
.pill.live { color: var(--ember); border-color: var(--ember); }
.pill.earned { color: var(--ember); border-color: var(--ember); }
.pill.planned { color: var(--muted); }
.meta { color: var(--muted); font-size: 14px; }
blockquote {
  border-left: 3px solid var(--hair); margin: 22px 0; padding: 6px 0 6px 18px;
  color: var(--muted); font-style: italic;
}
code {
  font-family: var(--mono);
  background: var(--raised); border: 1px solid var(--hair);
  border-radius: 6px; padding: 1px 7px; font-size: 0.87em; color: var(--muted);
  word-break: break-word;
}
pre {
  background: var(--raised); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 18px; overflow-x: auto; font-size: 14px; line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; color: var(--bone); word-break: normal; }
table.ref { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 12px 0 20px; }
table.ref th, table.ref td {
  text-align: left; padding: 10px; border-bottom: 1px solid var(--hair); vertical-align: top;
}
table.ref th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
table.ref tr { transition: background-color 160ms ease; }
table.ref tbody tr:hover { background: var(--raised); }

/* filter chips (work orders) */
.chip {
  cursor: pointer; font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--muted); background: var(--raised); border: 1px solid var(--hair);
  border-radius: 999px; padding: 8px 14px; margin: 0 8px 8px 0; min-height: 40px;
  transition: color 160ms ease, border-color 160ms ease;
}
.chip:hover { color: var(--bone); border-color: var(--muted); }
.chip[aria-pressed="true"] { color: var(--bone); border-color: var(--bone); }

/* ---------- earned seal placeholder (directory) ---------- */
.seal-slot {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 14px; padding: 12px 0;
  border-top: 1px solid var(--hair);
}
.seal-slot .ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px dashed var(--muted);
  opacity: 0.55; flex-shrink: 0;
}
.seal-slot p { margin: 0; }

/* ---------- reveal animation (JS-gated, motion-safe) ----------
   The hiding class `reveal-on` is added by app.js itself, so if the
   script fails to load, content is never hidden. Everything renders
   fully with JS disabled. */
.reveal-on .reveal {
  opacity: 0; translate: 0 16px;
  transition: opacity 620ms ease, translate 620ms ease;
  transition-delay: var(--d, 0ms);
}
.reveal-on .reveal.in { opacity: 1; translate: 0 0; }

/* ---------- footer ---------- */
footer.site {
  border-top: 1px solid var(--hair); margin-top: 72px; padding: 32px 0 52px;
  color: var(--muted); font-size: 14px;
}
footer.site .foot-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--bone); font-weight: 700; font-size: 15px; margin-bottom: 14px;
}
footer.site .foot-brand img { width: 26px; height: 26px; display: block; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 14px; }
footer.site nav a {
  color: var(--muted); text-decoration: none; padding: 8px 0; min-height: 44px;
  display: inline-flex; align-items: center;
}
footer.site nav a:hover { color: var(--bone); }
footer.site .colophon { line-height: 1.7; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  /* compact scrollable nav on phones: seal mark only, links swipe */
  .nav { flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding: 8px 0;
         scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .brand { margin-right: 6px; padding-right: 0; }
  .brand .wordmark { display: none; }
  .nav a.nlink { font-size: 14px; padding: 10px 11px; white-space: nowrap; }
}
@media (min-width: 620px) {
  .card-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .hero { padding: 76px 0 44px; }
}
@media (min-width: 900px) {
  :root { --maxw: 760px; }
}

/* ---------- reduced motion: everything still ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-on .reveal { opacity: 1 !important; translate: none !important; transition: none !important; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
