:root {
  --ground: #FBFAF7; --raise: #FFFFFF; --ink: #1A1D21; --muted: #6B7076;
  --faint: #9A9E9C; --accent: #2E6E68; --accent-soft: #E6EFEC; --rule: #E4E1D9;
  --shadow: 0 1px 2px rgba(26,29,33,.04), 0 8px 24px rgba(26,29,33,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #131519; --raise: #191C21; --ink: #E8E6E1; --muted: #9AA0A6;
    --faint: #6C7178; --accent: #5FB3A9; --accent-soft: #17302C; --rule: #2A2E34;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 68ch; margin: 0 auto; padding: clamp(28px,6vw,72px) 22px 96px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.eyebrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 18px;
}
h1 { font-size: clamp(30px,5.5vw,44px); line-height: 1.08; font-weight: 800;
     letter-spacing: -.02em; margin: 0 0 14px; text-wrap: balance; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 8px; max-width: 58ch; }
section { margin-top: 44px; }
h2 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
     font-family: ui-monospace, Menlo, monospace; color: var(--ink); font-weight: 600;
     margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--rule);
     display: flex; align-items: baseline; gap: 10px; }
h2::before { content: ""; width: 7px; height: 7px; background: var(--accent);
             border-radius: 2px; transform: translateY(-1px); }
p { margin: 0 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em;
       background: var(--accent-soft); padding: 1px 6px; border-radius: 5px; }
.card { background: var(--raise); border: 1px solid var(--rule); border-radius: 12px;
        box-shadow: var(--shadow); padding: 22px; }

/* the HTMX demo */
.demo-btn {
  font: 600 15px/1 system-ui, sans-serif; color: #fff; background: var(--accent);
  border: 0; border-radius: 9px; padding: 12px 18px; cursor: pointer;
  transition: filter .15s ease;
}
.demo-btn:hover { filter: brightness(1.08); }
.demo-btn:disabled { opacity: .6; cursor: default; }
#run-panel { margin-top: 18px; min-height: 24px; }
.hint { font-size: 14px; color: var(--faint); margin-top: 10px; }

/* htmx request-in-flight indicator */
.indicator { display: none; color: var(--muted); font-size: 14px; margin-left: 12px; }
.htmx-request .indicator { display: inline; }
.htmx-request .demo-btn { opacity: .6; }

/* the returned fragment */
ol.stages { counter-reset: s; list-style: none; padding: 0; margin: 4px 0 0; }
ol.stages > li {
  counter-increment: s; position: relative; padding: 10px 0 10px 42px;
  border-bottom: 1px solid var(--rule);
  animation: rise .28s ease both; animation-delay: calc(var(--i) * .09s);
}
ol.stages > li:last-child { border-bottom: 0; }
ol.stages > li::before {
  content: counter(s); position: absolute; left: 0; top: 8px;
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft);
  color: var(--accent); font-family: ui-monospace, monospace; font-size: 13px;
  font-weight: 700; display: grid; place-items: center;
}
ol.stages b { font-weight: 650; }
ol.stages span { color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { ol.stages > li { animation: none; } }

footer { margin-top: 60px; padding-top: 18px; border-top: 1px solid var(--rule);
         color: var(--faint); font-size: 13px; }

form.sign-in label {
  display: block; margin: 0 0 14px; font-size: 14px; color: var(--muted);
}
form.sign-in input[type="email"],
form.sign-in input[type="password"],
form.sign-in select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--ground);
  color: var(--ink); font: 400 16px/1.4 system-ui, sans-serif;
}
.account-list { list-style: none; padding: 0; margin: 0; }
.account {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--rule);
}
.account-id { flex: 1; min-width: 16ch; display: flex; align-items: center; gap: 10px; }
.account-email { font-weight: 550; }
.account-role, .account-deactivate { display: flex; align-items: center; gap: 8px; margin: 0; }
.account-role select, .account-role button, .account-deactivate button {
  font: inherit; font-size: 14px; padding: 6px 10px;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--raise);
  color: var(--ink); cursor: pointer;
}
form.sign-in button { margin-top: 8px; }
.form-error { color: #b42318; font-weight: 600; }
form.sign-out { display: inline; margin-left: 12px; }
form.sign-out button {
  background: none; border: 0; padding: 0; color: var(--muted);
  cursor: pointer; font: inherit;
}

/* ---- top nav ---- */
.topnav {
  max-width: 68ch; margin: 0 auto; padding: 20px 22px 0;
  display: flex; align-items: baseline; justify-content: space-between;
}
.topnav .brand { font-weight: 700; font-size: 15px; color: var(--ink);
                 text-decoration: none; letter-spacing: .02em; }
.topnav .navlinks a { color: var(--muted); text-decoration: none; font-size: 14px;
                      margin-left: 18px; }
.topnav .navlinks a:hover { color: var(--accent); }

/* ---- ADR list ---- */
.adr-list { list-style: none; padding: 0; margin: 16px 0 0; }
.adr-list li { border-bottom: 1px solid var(--rule); }
.adr-list li:first-child { border-top: 1px solid var(--rule); }
.adr-list a {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px;
  text-decoration: none; color: var(--ink);
}
.adr-list a:hover { color: var(--accent); }
.adr-num { color: var(--faint); font-size: 13px; flex: none; }
.adr-title { flex: 1; font-weight: 550; }

/* ---- status badges ---- */
.badge {
  flex: none; font-family: ui-monospace, Menlo, monospace; font-size: 11px;
  letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px;
  border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.badge-accepted   { color: var(--accent); background: var(--accent-soft); }
.badge-proposed   { color: #8a6d1a; background: #f7efd6; }
.badge-deprecated,
.badge-superseded { color: var(--muted); background: var(--rule); }
@media (prefers-color-scheme: dark) {
  .badge-proposed { color: #d9b34d; background: #2c2510; }
}

/* ---- rendered ADR ---- */
.crumb { font-size: 14px; margin: 4px 0 22px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.adr-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
article.adr h1 { font-size: clamp(26px,4.5vw,36px); line-height: 1.12; margin: 6px 0 20px; }
article.adr h2 {
  font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  font-family: ui-monospace, Menlo, monospace; color: var(--ink); font-weight: 600;
  margin: 34px 0 14px; padding-bottom: 9px; border-bottom: 1px solid var(--rule);
}
article.adr p { margin: 0 0 15px; }
article.adr ul { padding-left: 20px; }
article.adr li { margin-bottom: 8px; }
article.adr code {
  font-family: ui-monospace, Menlo, monospace; font-size: .9em;
  background: var(--accent-soft); padding: 1px 6px; border-radius: 5px;
}
article.adr pre {
  background: var(--raise); border: 1px solid var(--rule); border-radius: 10px;
  padding: 16px; overflow-x: auto;
}
article.adr pre code { background: none; padding: 0; }
article.adr strong { font-weight: 650; }
