/* shell.css: the shared look of every page. Tokens copied from the life site's DESIGN.md (warm paper,
   manganese accent, Palatino for titles, the system sans for everything else), light and dark.
   Phone first: a bottom bar. From 900px wide: the same six sections in a rail on the left.
   Contract: site/README.md. */

:root {
  color-scheme: light dark;
  --font-display: Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --bg: #eae7e1;
  --bg-elevated: #fffefb;
  --surface: rgba(255, 254, 250, 0.90);
  --surface-solid: #fffefb;
  --surface-sunken: rgba(60, 45, 30, 0.055);
  --border: rgba(60, 42, 25, 0.13);
  --border-strong: rgba(60, 42, 25, 0.22);
  --text-primary: #201d19;
  --text-secondary: rgba(52, 46, 39, 0.80);
  --text-tertiary: rgba(52, 46, 39, 0.56);

  --accent: #7d3ba3;
  --accent-strong: #5e2b7e;
  --accent-tint: rgba(125, 59, 163, 0.12);
  --accent-tint-strong: rgba(125, 59, 163, 0.20);

  --good: #248a3d;
  --good-tint: rgba(36, 138, 61, 0.13);
  --warn: #b26b00;
  --warn-tint: rgba(178, 107, 0, 0.14);
  --bad: #d70015;
  --bad-tint: rgba(215, 0, 21, 0.13);
  /* what a post is: one colour each, for the kind pills (Video, Carousel, Post) on Review and Pipeline */
  --kind-video: #0b5fc4;
  --kind-video-tint: rgba(11, 95, 196, 0.12);
  --kind-carousel: #0a756f;
  --kind-carousel-tint: rgba(10, 117, 111, 0.13);
  --kind-post: #a8296a;
  --kind-post-tint: rgba(168, 41, 106, 0.12);

  --shadow-card: 0 1px 2px rgba(40, 25, 10, 0.05), 0 14px 32px rgba(40, 25, 10, 0.09);
  --blur: blur(20px);
  --radius-card: 20px;
  --radius-control: 10px;

  --rail-width: 220px;
  --bar-height: 62px;
}

:root[data-theme="dark"] {
  --bg: #171411;
  --bg-elevated: #363028;
  --surface: rgba(54, 48, 40, 0.85);
  --surface-solid: #363028;
  --surface-sunken: rgba(255, 244, 230, 0.05);
  --border: rgba(255, 240, 222, 0.16);
  --border-strong: rgba(255, 240, 222, 0.30);
  --text-primary: #f7f4ef;
  --text-secondary: rgba(245, 238, 228, 0.78);
  --text-tertiary: rgba(245, 238, 228, 0.56);
  --accent: #c68ae4;
  --accent-strong: #dcb2f0;
  --accent-tint: rgba(198, 138, 228, 0.20);
  --accent-tint-strong: rgba(198, 138, 228, 0.30);
  --good: #30d158;
  --good-tint: rgba(48, 209, 88, 0.20);
  --warn: #ffb340;
  --warn-tint: rgba(255, 179, 64, 0.20);
  --bad: #ff453a;
  --bad-tint: rgba(255, 69, 58, 0.20);
  --kind-video: #78b8ff;
  --kind-video-tint: rgba(120, 184, 255, 0.20);
  --kind-carousel: #4fd6c8;
  --kind-carousel-tint: rgba(79, 214, 200, 0.18);
  --kind-post: #ff94c2;
  --kind-post-tint: rgba(255, 148, 194, 0.18);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171411;
    --bg-elevated: #363028;
    --surface: rgba(54, 48, 40, 0.85);
    --surface-solid: #363028;
    --surface-sunken: rgba(255, 244, 230, 0.05);
    --border: rgba(255, 240, 222, 0.16);
    --border-strong: rgba(255, 240, 222, 0.30);
    --text-primary: #f7f4ef;
    --text-secondary: rgba(245, 238, 228, 0.78);
    --text-tertiary: rgba(245, 238, 228, 0.56);
    --accent: #c68ae4;
    --accent-strong: #dcb2f0;
    --accent-tint: rgba(198, 138, 228, 0.20);
    --accent-tint-strong: rgba(198, 138, 228, 0.30);
    --good: #30d158;
    --good-tint: rgba(48, 209, 88, 0.20);
    --warn: #ffb340;
    --warn-tint: rgba(255, 179, 64, 0.20);
    --bad: #ff453a;
    --bad-tint: rgba(255, 69, 58, 0.20);
    --kind-video: #78b8ff;
    --kind-video-tint: rgba(120, 184, 255, 0.20);
    --kind-carousel: #4fd6c8;
    --kind-carousel-tint: rgba(79, 214, 200, 0.18);
    --kind-post: #ff94c2;
    --kind-post-tint: rgba(255, 148, 194, 0.18);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font: 14.5px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-strong); text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- the frame ---------- */

.studio { min-height: 100vh; }
.frame { min-width: 0; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px 12px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--surface);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}

/* the channel switch: a segmented control */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-sunken); border-radius: var(--radius-control); }
.seg button {
  min-height: 36px; padding: 6px 11px; border: 0; border-radius: 8px; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface-solid); color: var(--text-primary); box-shadow: var(--shadow-card); }

.search { flex: 1 1 100px; min-width: 0; display: flex; }
.search input {
  width: 100%; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-solid); font-size: 16px; /* 16px: no zoom on iPhone */
}
.search input::placeholder { color: var(--text-tertiary); }

.page { max-width: 1120px; margin: 0 auto; padding: 16px 16px calc(var(--bar-height) + 40px + env(safe-area-inset-bottom)); }

/* on a phone the header scrolls away with the page, so posts get the whole screen */
@media (max-width: 899px) { .top { position: static; } }

/* ---------- the bottom bar (phone) ---------- */

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
}
.bar a, .bar button {
  position: relative; min-height: var(--bar-height); padding: 8px 2px; border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 650; color: var(--text-tertiary); text-decoration: none; cursor: pointer;
}
.bar svg { width: 22px; height: 22px; }
.bar [aria-current="page"], .bar [aria-expanded="true"] { color: var(--accent-strong); }

.more-sheet {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--bar-height) + 10px + env(safe-area-inset-bottom)); z-index: 40;
  padding: 8px; display: grid; gap: 2px;
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow-card);
}
.more-sheet a {
  display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 8px 14px;
  border-radius: 10px; color: var(--text-primary); font-weight: 600; text-decoration: none;
}
.more-sheet a[aria-current="page"] { background: var(--accent-tint); color: var(--accent-strong); }

/* a count or a mark on a tab */
.badge-dot {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent-strong); color: var(--bg-elevated);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.badge-dot.mark { min-width: 10px; width: 10px; height: 10px; padding: 0; background: var(--warn); top: 10px; left: calc(50% + 8px); }

/* ---------- the rail (desktop) ---------- */

.rail { display: none; }

@media (min-width: 900px) {
  .bar, .more-sheet { display: none !important; }
  .rail {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; top: 0; bottom: 0; left: 0; width: var(--rail-width); z-index: 25;
    padding: 24px 12px; background: var(--surface); border-right: 1px solid var(--border);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  }
  .rail .brand { font: 700 22px/1 var(--font-display); letter-spacing: -0.012em; padding: 4px 12px 18px; }
  .rail a {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
    border-radius: var(--radius-control); color: var(--text-secondary); font-weight: 600; text-decoration: none;
  }
  .rail a:hover { background: var(--surface-sunken); }
  .rail a[aria-current="page"] { background: var(--accent-tint); color: var(--accent-strong); }
  .rail svg { width: 20px; height: 20px; flex: none; }
  .rail .badge-dot { position: static; margin-left: auto; }
  .frame { margin-left: var(--rail-width); }
  .top { padding: 14px 32px; }
  .page { padding: 32px 32px 80px; }

  /* the sidebar's button, and the thin strip it makes: icons only, more room for the page */
  .rail .brand-short { display: none; }
  .rail-toggle {
    margin-top: auto; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--radius-control);
    background: transparent; color: var(--text-tertiary); font-weight: 600; cursor: pointer; text-align: left;
  }
  .rail-toggle:hover { background: var(--surface-sunken); color: var(--text-primary); }
  .rail-toggle svg { width: 20px; height: 20px; flex: none; }
  .studio.rail-collapsed { --rail-width: 64px; }
  .studio.rail-collapsed .rail { padding: 24px 8px; align-items: stretch; }
  .studio.rail-collapsed .rail .brand { padding: 4px 0 18px; text-align: center; }
  .studio.rail-collapsed .rail .brand-full { display: none; }
  .studio.rail-collapsed .rail .brand-short { display: inline; }
  .studio.rail-collapsed .rail a, .studio.rail-collapsed .rail-toggle { justify-content: center; padding: 8px 0; }
  /* the words stay for screen readers; only their room is given up */
  .studio.rail-collapsed .rail .navlabel {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .studio.rail-collapsed .rail-toggle svg { transform: rotate(180deg); }
  .studio.rail-collapsed .rail .badge-dot { position: absolute; top: 4px; right: 4px; margin: 0; min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; }
  .studio.rail-collapsed .rail .badge-dot.mark { min-width: 10px; width: 10px; height: 10px; top: 8px; right: 10px; }
}

/* ---------- page parts ---------- */

h1 { margin: 0 0 6px; font: 700 30px/1.15 var(--font-display); letter-spacing: -0.015em; }
h2 { margin: 28px 0 10px; font: 700 22px/1.2 var(--font-display); letter-spacing: -0.012em; }
@media (min-width: 900px) { h1 { font-size: 38px; } }
.lede { margin: 0 0 20px; color: var(--text-secondary); max-width: 62ch; }
.label {
  margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary);
}

.card {
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 20px;
}
.stack { display: grid; gap: 16px; }
@media (min-width: 900px) { .stack.cols { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }
.card h3 { margin: 0 0 4px; font: 650 15px/1.3 var(--font-ui); }
.card p { margin: 0 0 8px; color: var(--text-secondary); }
.card p:last-child { margin-bottom: 0; }

/* a block that a later stage fills */
.placeholder { border-style: dashed; box-shadow: none; background: var(--surface-sunken); }
.placeholder .stage { display: inline-block; margin-bottom: 8px; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-tint); color: var(--accent-strong); font-size: 12px; font-weight: 650;
}
.pill.good { background: var(--good-tint); color: var(--good); }
.pill.warn { background: var(--warn-tint); color: var(--warn); }
.pill.bad { background: var(--bad-tint); color: var(--bad); }
/* the kind of a post: a pill of its own colour. `.kind` is the small one a board box or a story's line shows. */
.pill.kind-video { background: var(--kind-video-tint); color: var(--kind-video); }
.pill.kind-carousel { background: var(--kind-carousel-tint); color: var(--kind-carousel); }
.pill.kind-post { background: var(--kind-post-tint); color: var(--kind-post); }
.pill.kind { padding: 1px 8px; font-size: 11.5px; letter-spacing: 0.01em; }
.pill.quiet { background: var(--surface-sunken); color: var(--text-tertiary); }

.btn {
  min-height: 44px; padding: 8px 18px; border-radius: var(--radius-control);
  border: 1px solid var(--border-strong); background: var(--surface-solid); font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }

/* empty, loading and error states */
.note { padding: 20px; border-radius: var(--radius-card); background: var(--surface-sunken); color: var(--text-secondary); }
.note.error { background: var(--bad-tint); color: var(--text-primary); }
.note strong { display: block; margin-bottom: 2px; color: var(--text-primary); }
.note .btn { margin-top: 12px; }

/* a plain list of records (the run log) */
.records { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.record {
  display: grid; gap: 4px 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-solid);
}
.record .head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.record .who { font-weight: 650; }
.record .meta { color: var(--text-tertiary); font-size: 13px; font-variant-numeric: tabular-nums; }
.record .text { color: var(--text-secondary); overflow-wrap: anywhere; }
.record dl { display: contents; }

@media (prefers-reduced-motion: no-preference) {
  .seg button, .btn, .rail a { transition: background-color 0.12s, border-color 0.12s; }
}

/* ---------- where things stand, and what happens next (next-step.js; the Pipeline page and Review) ---------- */

.standing { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-solid); }
.standing .label { margin-bottom: 6px; }
.slines { display: grid; gap: 4px; }
.sline { margin: 0; overflow-wrap: anywhere; }
.slabel { font-weight: 650; }
.scount { display: inline-block; min-height: 24px; }
.sagents { margin: 8px 0 0; color: var(--text-secondary); font-size: 13px; }
.sline-you .scount { font-weight: 650; }

.nextstep { display: grid; gap: 4px; margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--accent-tint); }
.nextstep .nline { margin: 0; color: var(--text-primary); }
.nextstep .nfirst { font-weight: 650; }
.nqueue { display: grid; gap: 2px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border-strong); font-size: 13px; color: var(--text-secondary); }
.nqueue .sline { margin: 0; }
.send { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; }
.btn.cta { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 700; }
.btn.cta:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sendbtn[disabled] { opacity: 0.55; cursor: default; }
.sendwhat { margin: 0; }
.send .sendsaid:not(:empty) + .sendwhat { display: none; }

/* Review: the one card after a save (next-step.js, afterSave) */
.aftersave { display: grid; gap: 6px; margin: 0 0 16px; padding: 14px 16px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--border); border-left: 4px solid var(--good); overflow-wrap: anywhere; }
.aftersave .ahead { margin: 0; font-weight: 650; color: var(--text-primary); }
.aftersave .acheck { color: var(--good); font-weight: 800; }
.aftersave .anext { margin: 0; color: var(--text-secondary); }
.aftersave .send { margin-top: 6px; }
.sendsaid { margin: 0; color: var(--text-secondary); font-size: 13px; }
.sendsaid:empty { display: none; }

/* ---------- design pass, 18 Nov 2026: fewer frames, three kinds of button ---------- */
/* No page intro under the title any more: the title alone, then the page. */
h1 { margin-bottom: 18px; }
@media (min-width: 900px) { h1 { font-size: 34px; } }
/* Buttons. Main action: .btn.cta (filled). Everything else: .btn (outline, no fill). A plain link-like action: .btn.quiet. */
.btn { background: transparent; color: var(--text-primary); }
.btn:hover { border-color: var(--accent); background: var(--surface-sunken); }
.btn[disabled]:hover { border-color: var(--border-strong); background: transparent; }
.btn.quiet { border-color: transparent; color: var(--text-secondary); padding-left: 10px; padding-right: 10px; }
.btn.quiet:hover { color: var(--text-primary); background: var(--surface-sunken); border-color: transparent; }
.btn.cta:hover { background: var(--accent-strong); }

/* the agents in one line (next-step.js, agentsView): Today and the Pipeline */
.agentsbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-width: 0; }
.abwords { display: grid; gap: 1px; flex: 1 1 260px; min-width: 0; }
.abtext { margin: 0; color: var(--text-secondary); overflow-wrap: anywhere; }
.abtext strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.ablast { margin: 0; font-size: 13px; color: var(--text-tertiary); }
.abmac { margin: 2px 0 0; font-size: 13px; color: var(--warn); }
.agentsbar .send { margin: 0; }
.agentsbar .sendwhat { display: none; }

/* ---- The founders' preview (<html data-mode="demo">, set by the Worker on dear-studio): read only, Lexi only. ----
   Every control that saves, sends or starts something is hidden; reading, filters and links stay. shell.js shows the tag
   in place of the channel switch, and StudioApi.write refuses. */
.demo-tag { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: var(--radius-control); background: var(--surface-sunken); color: var(--text-secondary); font-size: 13px; white-space: nowrap; }
.demo-tag strong { color: var(--text-primary); }
[data-mode="demo"] .actbar,
[data-mode="demo"] .decide,
[data-mode="demo"] .makepills,
[data-mode="demo"] .makeshint,
[data-mode="demo"] .stepbtn.step-skip,
[data-mode="demo"] .send,
[data-mode="demo"] .sendbtn,
[data-mode="demo"] .readybox,
[data-mode="demo"] .copybtn,
[data-mode="demo"] [data-ask],
[data-mode="demo"] .askslot,
[data-mode="demo"] .flagword { display: none !important; }
[data-mode="demo"] .flagbtn { pointer-events: none; cursor: default; }
