/*
  Shared stylesheet for the static HTML demo (docs/demo).

  One file, hand-written, mirroring the tokens in apps/web/app/globals.css
  and the handful of Tailwind shapes the app actually uses. The pages are
  meant to be read as HTML as much as rendered, so the class names are
  semantic (.card, .pill, .nav) rather than utility soup.
*/

:root {
  --background: #ffffff;
  --foreground: #171717;
  --muted-foreground: #5c5c5c;
  --muted: #f4f4f5;
  --border: #e4e4e7;
  --accent: #1d4ed8;
  --accent-hover: #1e3a8a;
  --accent-foreground: #ffffff;
  --destructive: #dc2626;
  --success: #15803d;
  --warning: #b45309;
  --brand-ink: #3f4a3a;
  --brand-paper: #f4efe6;
  --brand-accent: #b5652f;
  --brand-surface: color-mix(in srgb, var(--brand-paper) 55%, var(--background));
  --brand-surface-border: color-mix(in srgb, var(--brand-ink) 20%, var(--border));
  --pulse-hole: var(--brand-paper);
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --foreground: #ededed;
    --muted-foreground: #a1a1aa;
    --muted: #18181b;
    --border: #2a2a2e;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-foreground: #0a0a0a;
    --success: #4ade80;
    --warning: #fbbf24;
    --brand-surface: color-mix(in srgb, var(--brand-ink) 25%, var(--background));
    --brand-surface-border: color-mix(in srgb, var(--brand-paper) 15%, var(--border));
    --pulse-hole: #0a0a0a;
  }
}

* { box-sizing: border-box; }
html { font-family: var(--font-sans); font-size: 16px; -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--background); color: var(--foreground); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
a.accent { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.125rem; font-weight: 500; }
h3 { font-size: 0.875rem; font-weight: 500; }
code { font-family: var(--font-mono); font-size: 0.85em; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.875rem; }
.xs { font-size: 0.75rem; }
.tabular { font-variant-numeric: tabular-nums; }
.success { color: var(--success); }
.warning { color: var(--warning); }
.destructive { color: var(--destructive); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Chrome: the two-row header (#313) ---------- */
.demo-banner {
  background: var(--brand-ink); color: var(--brand-paper);
  font-size: 0.75rem; padding: 0.35rem 1.5rem; text-align: center;
  /* Sticky, so the next step is in view on every scroll of every page. */
  position: sticky; top: 0; z-index: 50;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.35rem 1rem;
}
.demo-banner .demo-cta {
  background: var(--brand-accent); color: #fff; text-decoration: none; font-weight: 600;
  border-radius: 0.375rem; padding: 0.2rem 0.65rem; white-space: nowrap;
}
.demo-banner .demo-cta:hover { opacity: 0.9; }
/* A phone gets the short form, so the sticky bar stays one line; the disclaimer itself never goes. */
@media (max-width: 40rem) {
  .demo-banner { flex-wrap: nowrap; justify-content: space-between; padding: 0.35rem 1rem; }
  .demo-banner > span { display: none; }
  .demo-banner::before { content: "Demo · names invented"; text-align: left; }
}
.demo-footer {
  max-width: 48rem; margin: 0 auto 3rem; padding: 1.25rem 1.5rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--brand-surface); border: 1px solid var(--brand-surface-border); border-radius: 0.5rem;
}
@media (max-width: 52rem) { .demo-footer { margin: 0 1rem 3rem; } }
.demo-banner a { text-decoration: underline; }
header.app {
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-surface-border);
}
.app-row {
  max-width: 72rem; margin: 0 auto; padding: 0.75rem 1.5rem 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; letter-spacing: -0.01em; }
.brand svg { width: 1.5rem; height: 1.5rem; color: var(--brand-ink); }
@media (prefers-color-scheme: dark) { .brand svg { color: var(--brand-paper); } }
.app-tools { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; font-size: 0.875rem; }
.app-tools .who { color: var(--muted-foreground); max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-tools .search {
  display: inline-flex; align-items: center; gap: 0.5rem;
  border: 1px solid var(--border); border-radius: 0.375rem; padding: 0.2rem 0.6rem;
  color: var(--muted-foreground); background: var(--background);
}
.app-tools kbd { font-family: var(--font-mono); font-size: 0.7rem; border: 1px solid var(--border); border-radius: 0.25rem; padding: 0 0.3rem; }
nav.app { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem 0.25rem; overflow-x: auto; }
nav.app .strip { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; padding-bottom: 0.5rem; font-size: 0.875rem; }
@media (min-width: 640px) { nav.app .strip { flex-wrap: nowrap; width: max-content; } }
nav.app a { color: var(--muted-foreground); border-bottom: 2px solid transparent; padding-bottom: 0.125rem; white-space: nowrap; }
nav.app a:hover { color: var(--foreground); text-decoration: none; }
nav.app a[aria-current="page"] { color: var(--foreground); font-weight: 500; border-bottom-color: var(--brand-accent); }
nav.app a.secondary { font-size: 0.75rem; }
nav.app a.first-secondary { margin-left: 0.5rem; border-left: 1px solid var(--border); padding-left: 1rem; }

/* ---------- Page ---------- */
main.page { max-width: 72rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; display: flex; flex-direction: column; gap: 2rem; }
main.page.narrow { max-width: 48rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.page-head .lede { margin-top: 0.25rem; color: var(--muted-foreground); font-size: 0.875rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
section { display: flex; flex-direction: column; gap: 0.75rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.section-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted-foreground); font-weight: 500;
}
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.grid-4 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
.with-rail { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .with-rail { grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); } }
.rail { display: flex; flex-direction: column; gap: 1.5rem; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.between { justify-content: space-between; }

/* ---------- Surfaces ---------- */
.card { border: 1px solid var(--border); border-radius: 0.5rem; padding: 1rem; background: var(--background); }
.card.muted-surface { background: var(--muted); }
.card.brand-surface { background: var(--brand-surface); border-color: var(--brand-surface-border); }
.tile { border: 1px solid var(--border); border-radius: 0.5rem; padding: 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.tile .num { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .label { font-size: 0.875rem; color: var(--muted-foreground); }
.tile .sub { font-size: 0.75rem; color: var(--muted-foreground); }
.list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 0.5rem; overflow: hidden; }
.list > * { padding: 0.75rem 1rem; border-top: 1px solid var(--border); }
.list > *:first-child { border-top: 0; }
.list .item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.list a.item:hover { background: var(--muted); text-decoration: none; }
.empty { border: 1px dashed var(--border); border-radius: 0.5rem; padding: 1.5rem; color: var(--muted-foreground); font-size: 0.875rem; }
.notice { border-left: 3px solid var(--brand-accent); padding: 0.5rem 0.75rem; background: var(--brand-surface); font-size: 0.875rem; border-radius: 0 0.375rem 0.375rem 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; font-weight: 500; color: var(--muted-foreground); padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
tr:last-child td { border-bottom: 0; }
th a { color: inherit; }
th a[aria-sort] { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Bits ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  border: 1px solid var(--border); border-radius: 999px; padding: 0.05rem 0.55rem;
  font-size: 0.75rem; color: var(--muted-foreground); white-space: nowrap;
}
.pill.on { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
.pill.success { border-color: color-mix(in srgb, var(--success) 40%, transparent); color: var(--success); }
.pill.warning { border-color: color-mix(in srgb, var(--warning) 40%, transparent); color: var(--warning); }
.pill.destructive { border-color: color-mix(in srgb, var(--destructive) 40%, transparent); color: var(--destructive); }
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--border); border-radius: 0.375rem; padding: 0.35rem 0.75rem;
  font-size: 0.875rem; background: var(--background); color: var(--foreground); cursor: pointer;
}
.btn:hover { background: var(--muted); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-foreground); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.quiet { border-color: transparent; color: var(--muted-foreground); }
.btn.sm { font-size: 0.75rem; padding: 0.2rem 0.5rem; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2rem; height: 2rem; border-radius: 999px; background: var(--muted); color: var(--muted-foreground);
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.02em;
}
.avatar.sm { width: 1.5rem; height: 1.5rem; font-size: 0.6rem; }
.avatar.lg { width: 3rem; height: 3rem; font-size: 0.9rem; }
.faces { display: inline-flex; }
.faces .avatar { margin-left: -0.35rem; border: 2px solid var(--background); }
.faces .avatar:first-child { margin-left: 0; }
.person { display: flex; align-items: center; gap: 0.6rem; }
.person .name { font-weight: 500; }
.person .meta { font-size: 0.75rem; color: var(--muted-foreground); }
.lens { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.lens a { border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.875rem; color: var(--muted-foreground); }
.lens a:hover { text-decoration: none; color: var(--foreground); }
.lens a[aria-current] { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
.tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.tabs a { padding: 0.4rem 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted-foreground); }
.tabs a:hover { text-decoration: none; color: var(--foreground); }
.tabs a[aria-current] { color: var(--foreground); border-bottom-color: var(--foreground); font-weight: 500; }
.timeline { display: flex; flex-direction: column; }
.timeline .entry { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: 0.6rem 0; border-top: 1px solid var(--border); font-size: 0.875rem; }
.timeline .entry:first-child { border-top: 0; }
.timeline .when { color: var(--muted-foreground); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline .kind { font-size: 0.75rem; color: var(--muted-foreground); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; font-size: 0.875rem; }
.kv dt { color: var(--muted-foreground); margin: 0; }
.kv dd { margin: 0; }
.story { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.875rem; color: var(--muted-foreground); }
.story strong { color: var(--foreground); font-weight: 500; }
form.inline { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
input[type=text], input[type=search], select, textarea {
  font: inherit; font-size: 0.875rem; border: 1px solid var(--border); border-radius: 0.375rem;
  padding: 0.35rem 0.6rem; background: var(--background); color: var(--foreground);
}
textarea { width: 100%; min-height: 5rem; }
label.check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; }
details summary { cursor: pointer; font-size: 0.875rem; color: var(--muted-foreground); }

/* ---------- Member shell (/me) ---------- */
header.member { background: var(--brand-surface); border-bottom: 1px solid var(--brand-surface-border); }
header.member .app-row { padding-bottom: 0.75rem; }
nav.member { max-width: 48rem; margin: 0 auto; padding: 0 1.5rem; }
nav.member .strip { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; padding: 0.5rem 0; font-size: 0.875rem; }
nav.member a { color: var(--muted-foreground); border-bottom: 2px solid transparent; padding-bottom: 0.125rem; }
nav.member a[aria-current="page"] { color: var(--foreground); font-weight: 500; border-bottom-color: var(--brand-accent); }
.btn.brand { background: var(--brand-accent); border-color: var(--brand-accent); color: #fff; }

/* ---------- Reviewer's notes ---------- */
aside.note {
  border: 1px solid var(--brand-surface-border); background: var(--brand-surface);
  border-radius: 0.5rem; padding: 0.75rem 1rem; font-size: 0.8rem; color: var(--muted-foreground);
}
aside.note b { color: var(--foreground); font-weight: 500; }

/* ---------- settings-users.html: the settings rail (#253) and a seat row (#381) ---------- */
.settings-layout { display: flex; flex-direction: column; gap: 1.5rem; }
@media (min-width: 768px) { .settings-layout { flex-direction: row; gap: 2.5rem; } }
nav.settings { flex: none; width: 14rem; display: flex; flex-direction: column; gap: 1.5rem; font-size: 0.875rem; }
nav.settings ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
nav.settings a { display: block; border-radius: 0.375rem; padding: 0.35rem 0.5rem; color: var(--muted-foreground); }
nav.settings a:hover { background: var(--muted); color: var(--foreground); text-decoration: none; }
nav.settings a[aria-current="page"] { background: var(--muted); color: var(--foreground); font-weight: 500; }
nav.settings .leaves { font-size: 0.75rem; opacity: 0.6; margin-left: 0.25rem; }
.settings-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1.5rem; }
.grants th:nth-child(n+2), .grants td:nth-child(n+2) { width: 5rem; }
.grants td { border-bottom: 0; padding: 0.25rem 1rem 0.25rem 0; }
.grants th { border-bottom: 0; padding-bottom: 0.25rem; }

/* ---------- people.html / person.html / sunday.html ---------- */
/* A pressed choice in a segmented control (By family / By person, List / Graph). */
.seg { display: inline-flex; overflow: hidden; border: 1px solid var(--border); border-radius: 0.375rem; font-size: 0.875rem; }
.seg button { font: inherit; border: 0; background: var(--background); color: var(--muted-foreground); padding: 0.35rem 0.75rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--foreground); color: var(--background); font-weight: 500; }
/* One face, one tap (people/sunday/[id]/noticing.tsx). */
.list button.face { display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 2.75rem; font: inherit; font-size: 1rem; text-align: left; border: 0; background: transparent; color: inherit; padding: 0.5rem 1rem; cursor: pointer; }
.list button.face[aria-pressed="true"] { background: var(--muted); font-weight: 500; }
.list button.face .end { margin-left: auto; font-size: 0.75rem; color: var(--muted-foreground); }

/* ---------- groups.html: cards that are links ---------- */
ul.cards { list-style: none; margin: 0; padding: 0; }
a.card { display: block; }
a.card:hover { border-color: var(--foreground); text-decoration: none; }
.card .alias { font-weight: 400; color: var(--muted-foreground); }
.card .desc { margin-top: 0.5rem; }

/* ---------- today.html / season.html: the eye beside a count (names-behind.tsx) ---------- */
.eye { display: inline-flex; align-items: center; gap: 0.25rem; border: 0; background: none; padding: 0; margin-left: 0.5rem; color: var(--muted-foreground); cursor: pointer; vertical-align: middle; }
.eye svg { width: 0.85rem; height: 0.85rem; }
.eye:hover { color: var(--foreground); }

/* ---------- group.html: bare lists, the office's roll ---------- */
ul.bare, fieldset.bare { list-style: none; margin: 0; padding: 0; border: 0; }
form.roll { margin-top: 0.75rem; }
ul.gatherings { max-width: 28rem; }

/* ---------- opportunities.html: underlined inline links, the names behind a count ---------- */
a.u { text-decoration: underline; text-underline-offset: 4px; }
ul.names { margin-top: 0.25rem; gap: 0.15rem; }

/* ---------- serving.html: the two-line role row, a tight faces row ---------- */
.stack.tight { gap: 0.1rem; }
.row.tight { gap: 0.25rem; }

/* ---------- serving.html: the week view's one column ---------- */
.week-roles { max-width: 28rem; gap: 1.25rem; }
.week-role h3 { border-bottom: 1px solid var(--border); padding-bottom: 0.15rem; margin-bottom: 0.25rem; }
.week-role li { padding: 0.15rem 0; }

/* ---------- The walk-through (#426) ----------
   One story across five pages. On the two pages that are also ordinary
   screens the bar is there only when the link asked for it (:target), so the
   same file serves the walk and the all-screens index without a script. */
.walk {
  border: 1px solid var(--brand-surface-border); background: var(--brand-surface);
  border-radius: 0.5rem; padding: 0.75rem 1rem; font-size: 0.875rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
}
.walk .step { font-size: 0.75rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.walk.when-asked { display: none; }
.walk.when-asked:target { display: flex; }
.walk-mark { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The date under a queue row's sentence (#428), and a queue's kind heading (#425). */
.evidence { display: block; font-size: 0.75rem; color: var(--muted-foreground); }
.kind-head { font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); margin: 1rem 0 0.4rem; }
.item.worked { flex-direction: column; align-items: stretch; gap: 0.5rem; }
