/* Heddle design tokens: Heddle linen (Daniel, 2026-10-18).
   Source of truth for the Heddle Online browser app and the plugin's library page (CONTRACTS.md I-8).
   Change here first; online owns this file, dev consumes it.
   Fonts: Literata for titles and reading text, IBM Plex Sans for controls, IBM Plex Mono for labels.
   Shipped code self-hosts the fonts (no third-party requests); prototypes may load Google Fonts.
   Mark: docs/workstreams/dev/brand/heddle_mark.svg (stroke currentColor; colour it with --ink). */

:root {
  /* Ground and text */
  --bg: #f6f3ec;          /* linen */
  --surface: #fffdf8;     /* cards, bars, sheets */
  --ink: #1f2328;
  --muted: #5d6168;
  --rule: #ddd6c8;

  /* Actions and states. Ochre is only for things waiting on the person. */
  --acc: #2f4b7c;         /* indigo: actions, links, selection */
  --acc-soft: #e4e9f2;
  --on-acc: #fffdf8;
  --warm: #9a6a2c;        /* ochre: needs you */
  --warm-soft: #f2e8d8;
  --good: #3d6b4f;        /* done, delivered, merged */
  --good-soft: #e3eee6;
  --stop: #5d6168;        /* stopped, parked, quiet */
  --stop-soft: #ebe7de;
  --shade: rgba(31, 35, 40, .38);

  /* Type */
  --display: "Literata", Georgia, serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --display-weight: 600;

  /* Shape */
  --r: 6px;               /* controls */
  --r-card: 8px;
  --r-sheet: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --surface: #1c1f23; --ink: #ece8e0; --muted: #a7abb1; --rule: #363a40;
    --acc: #9fb4dc; --acc-soft: #1e2737; --on-acc: #15171a;
    --warm: #d6a865; --warm-soft: #2e261a; --good: #8cc3a0; --good-soft: #1c2a21;
    --stop: #a7abb1; --stop-soft: #26292d; --shade: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --surface: #1c1f23; --ink: #ece8e0; --muted: #a7abb1; --rule: #363a40;
  --acc: #9fb4dc; --acc-soft: #1e2737; --on-acc: #15171a;
  --warm: #d6a865; --warm-soft: #2e261a; --good: #8cc3a0; --good-soft: #1c2a21;
  --stop: #a7abb1; --stop-soft: #26292d; --shade: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* State chips, shared vocabulary:
   .chip.go   = in progress, handed off, working   (acc)
   .chip.need = needs your decision, handed back    (warm)
   .chip.done = delivered, merged                   (good)
   .chip.stop = stopped, parked, no recent activity (stop, dashed border) */

/* Braidry web app styles. The tokens come first (design/online/tokens.css, copied in by build.mjs).
   Fonts: Literata, IBM Plex Sans and IBM Plex Mono are self-hosted below (Latin subset, SIL OFL 1.1, from the
   fontsource packages 5.3.0; licence texts in fonts/). Nothing is loaded from a third-party host. */

@font-face { font-family: "Literata"; font-style: normal; font-weight: 400; font-display: swap; src: url("/app/fonts/literata-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 600; font-display: swap; src: url("/app/fonts/literata-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/app/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("/app/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/app/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/app/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/app/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--display); font-weight: var(--display-weight); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; margin-top: 2rem; }
p { margin: 0 0 .75rem; }
a { color: var(--acc); }
code { font-family: var(--mono); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lbl { font: 500 .75rem/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: .35rem; }
.loading { padding: 2rem; color: var(--muted); }

/* Layout */
.app { display: flex; min-height: 100vh; }
.side { width: 17rem; flex: none; background: var(--surface); border-right: 1px solid var(--rule); display: flex; flex-direction: column; padding: 1rem .75rem; gap: 1rem; position: sticky; top: 0; height: 100vh; }
.main { flex: 1; min-width: 0; max-width: 52rem; padding: 2rem 1.5rem 4rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); }
.mark { display: inline-flex; width: 2rem; height: 2rem; }
.mark svg { width: 100%; height: 100%; }
.wordmark { font: var(--display-weight) 1.3rem var(--display); }
.nav-list { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item { display: flex; justify-content: space-between; align-items: center; text-align: left; padding: .5rem .7rem; border-radius: var(--r); border: 0; background: none; color: var(--ink); font: 500 .95rem var(--body); text-decoration: none; cursor: pointer; }
.nav-item:hover { background: var(--stop-soft); }
.nav-item.current { background: var(--acc-soft); color: var(--acc); }
.soon-item { color: var(--muted); cursor: default; }
.soon-item:hover { background: none; }
.soon { font: 500 .7rem var(--mono); color: var(--muted); margin-left: .5rem; }
.account-chip { display: flex; align-items: center; gap: .6rem; padding: .6rem; border-top: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.avatar { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--acc); color: var(--on-acc); display: grid; place-items: center; font: 600 .85rem var(--body); flex: none; }
.who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who strong, .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.narrow { width: 100%; max-width: 26rem; display: grid; gap: .75rem; }
.narrow .brand { margin-bottom: 1rem; }

/* Controls */
.field { display: grid; gap: .25rem; margin-bottom: .9rem; }
.field .lbl { margin: 0; }
.hint { font-size: .8rem; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%; font: 400 1rem var(--body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r); padding: .6rem .7rem;
}
textarea { resize: vertical; }
.btn { font: 500 .95rem var(--body); border-radius: var(--r); padding: .6rem 1rem; border: 1px solid transparent; cursor: pointer; display: inline-flex; gap: .6rem; align-items: center; justify-content: center; }
.btn.primary { background: var(--acc); color: var(--on-acc); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn.danger { background: var(--ink); color: var(--bg); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--acc); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; text-align: left; }
.row-btns { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .75rem 0; }
.check { display: flex; gap: .5rem; align-items: flex-start; margin: .75rem 0; }
.error { color: var(--ink); background: var(--stop-soft); border-left: 3px solid var(--ink); padding: .5rem .75rem; border-radius: var(--r); margin: 0 0 .75rem; }
.ok { color: var(--good); background: var(--good-soft); padding: .5rem .75rem; border-radius: var(--r); }

/* Cards and lists */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-card); padding: 1rem 1.1rem; margin: .75rem 0; display: grid; gap: .35rem; }
.card.empty p { margin: 0; }
.card.stop { border-color: var(--ink); }
.card.ok-card { border-color: var(--good); background: var(--good-soft); }
/* Ochre: waiting on the person to decide (the link route's network warning). */
.card.need { border-color: var(--warm); background: var(--warm-soft); }
.card.need p { margin: 0; }
.form { gap: .25rem; }
.list { display: grid; gap: .5rem; }
.item { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-card); padding: .75rem 1rem; }
.item-main { flex: 1; min-width: 12rem; display: grid; }
.item .row-btns { margin: 0; }
.chip { font: 500 .75rem var(--mono); border-radius: 999px; padding: .15rem .6rem; border: 1px solid var(--rule); }
iframe.page { width: 100%; min-height: 80vh; border: 0; background: #fff; }
.chip.go { background: var(--acc-soft); color: var(--acc); border-color: transparent; }
.chip.stop { background: var(--stop-soft); color: var(--stop); border-style: dashed; }
.chip.done { background: var(--good-soft); color: var(--good); border-color: transparent; }

/* Recovery code and code blocks. Ochre: this is waiting on the person to save it. */
.recovery { font: 500 1.05rem var(--mono); letter-spacing: .05em; background: var(--surface); border: 1px dashed var(--warm); color: var(--warm); border-radius: var(--r-card); padding: .9rem; text-align: center; word-break: break-all; user-select: all; }
.mono-block { display: block; font: 400 .85rem var(--mono); background: var(--bg); border: 1px solid var(--rule); border-radius: var(--r); padding: .5rem .7rem; word-break: break-all; user-select: all; }
.notice { background: var(--stop-soft); border-left: 3px solid var(--ink); padding: .6rem .8rem; border-radius: var(--r); }

/* Share: audience options */
.aud { display: grid; gap: .5rem; margin-bottom: 1rem; }
.aud-opt { display: grid; text-align: left; gap: .15rem; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-card); padding: .7rem .9rem; cursor: pointer; font: inherit; }
.aud-opt.sel { border-color: var(--acc); background: var(--acc-soft); }

/* Connect an AI app: the consent window (/connect/ai) */
.narrow.consent { max-width: 30rem; }
.narrow.consent .brand { margin-bottom: .25rem; }
a.btn { text-decoration: none; }
.consent-body { display: grid; gap: .5rem; min-width: 0; overflow-wrap: anywhere; }
.consent-body h1 { font-size: 1.5rem; }
.consent-card { gap: .5rem; padding: 1.1rem 1.2rem; margin: 0; }
.consent-card h1 { margin: 0; }
.consent-card p { margin: 0; }
.consent-card .lbl { margin: .35rem 0 0; }
.chip.verified { justify-self: start; background: var(--good-soft); color: var(--good); border-color: transparent; }
.scope-lines { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.stack-btns { display: grid; gap: .6rem; margin: .5rem 0; }
.consent-btns { margin: .25rem 0; }
.consent-btns .btn { flex: 1 1 8rem; padding: .75rem 1rem; }

/* Your decision (/runs/<handle>/decide). Ochre marks what waits on the person. */
.chip.waiting { justify-self: start; background: var(--warm-soft); color: var(--warm); border-color: transparent; }
.decide-opts { margin: .25rem 0 0; }
.decide-opt { padding: .8rem 1rem; }
.decide-opt:hover:not(:disabled), .decide-opt:focus-visible { border-color: var(--acc); }
.decide-opt:disabled { opacity: .55; cursor: not-allowed; }
.waiver-note { font-style: italic; }

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--rule); }
  .nav-list { flex-direction: row; flex-wrap: wrap; flex: none; }
  .main { padding: 1.25rem 1rem 3rem; }
}
