/* Kirby-plain, like the app (gui/lib/theme.dart, dev/design-principles.md §4):
   black on white, greys for structure, no brand colour. Hue appears only
   where it means something — a status mark, what an action does, a link. */

:root {
  --bg: #ffffff;
  --surface: #f6f6f6;
  --fg: #1c1c1c;
  --dim: #666666;       /* 5.3:1 on --surface */
  --line: #e0e0e0;
  --ink: #1c1c1c;
  --on-ink: #ffffff;
  --link: #266eb5;      /* 4.9:1 on --surface */

  --running: #5c7a1f;
  --busy: #b86114;
  --failed: #dc1818;
  --idle: #858585;
  --restart: var(--link);

  --wrap: 68rem;
  --measure: 38rem;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1c;
    --surface: #242424;
    --fg: #f2f2f2;
    --dim: #b2b2b2;
    --line: #3d3d3d;
    --ink: #f2f2f2;
    --on-ink: #1c1c1c;
    --link: #8dbae7;

    --running: #a3d147;
    --busy: #ec9951;
    --failed: #ee6363;
    --idle: #999999;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.narrow { max-width: calc(var(--measure) + 10rem); }

a { color: var(--link); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 3px; }

code,
pre { font-family: var(--mono); }

code {
  font-size: 0.88em;
  background: var(--surface);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

p { margin: 0; }
p + p { margin-top: 0.9rem; }

.dim { color: var(--dim); }
.soft { color: var(--dim); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 6px;
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* INFO: the early-development notice borrows the busy mark — "in progress" is
   what it means in the app too — so the warning is a shape and words, not a
   colour alone (dev/design-principles.md §4). */

.notice {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--busy);
  font-size: 0.9375rem;
}
.notice p {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding-block: 0.6rem;
}
.notice .status { flex: none; }

/* Header and footer */

header.site {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.pier { width: 1.4rem; height: 1.4rem; fill: currentColor; flex: none; }

nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
nav a { color: var(--dim); text-decoration: none; font-size: 0.95rem; }
nav a:hover { color: var(--fg); }

footer.site {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding-block: 3rem;
  color: var(--dim);
  font-size: 0.9rem;
}
footer .pier { width: 1.75rem; height: 1.75rem; color: var(--fg); }

/* Section rhythm */

main > section { padding-block: 5.5rem; }
.band { background: var(--surface); }

.eyebrow {
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
}

h1,
h2 { letter-spacing: -0.025em; line-height: 1.12; }

h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2.4rem, 7vw, 4.25rem);
  font-weight: 750;
}

h2 {
  margin: 0 0 2.25rem;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 700;
}

h3 { margin: 0 0 0.4rem; font-size: 1.05rem; line-height: 1.35; }

.intro { max-width: var(--measure); margin: -1.25rem 0 2.25rem; color: var(--dim); }
.prose { max-width: var(--measure); }
.prose h2 { margin-bottom: 1.25rem; }
.prose p:not(.eyebrow) { color: var(--dim); }

/* Hero */

.hero { padding-block: 4.5rem 5.5rem; }
.lede { max-width: 36rem; font-size: 1.25rem; line-height: 1.6; }

.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

.button {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
}
.button:hover { opacity: 0.88; }
.button.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.button.ghost:hover { border-color: var(--fg); opacity: 1; }

.note {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.5rem;
  color: var(--dim);
  font-size: 0.93rem;
}

/* Status marks — the app's shapes, so colour never carries meaning alone:
   filled dot, ring, half ring, square. */

.status {
  display: inline-block;
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  vertical-align: -0.05em;
}
.status.is-running { background: var(--running); }
.status.is-idle { border: 2px solid var(--idle); }
.status.is-busy {
  border: 2px solid var(--busy);
  border-right-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(-45deg);
}
.status.is-failed { background: var(--failed); border-radius: 2px; }

/* The window mock */

.shot {
  position: relative;
  margin: 4rem 0 0;
  padding-bottom: 2.5rem;
}

.window {
  max-width: 50rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 24px 48px -24px rgb(0 0 0 / 0.18);
  overflow: hidden;
  font-size: 0.92rem;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--dim);
  font-size: 0.82rem;
  font-weight: 600;
}
.lights { display: flex; gap: 0.4rem; }
.lights i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--line); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.5rem;
}
.toolbar .appname { font-size: 1.05rem; font-weight: 700; }
.tools { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip,
.act {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.chip .ico,
.act .ico { font-weight: 400; color: var(--dim); }

/* Actions: tinted with their own hue, and told by icon and label as well
   (tray-actions.feature, "Project actions keep their places in the list"). */
.is-start { background: var(--surface); background: color-mix(in srgb, var(--running) 12%, var(--bg)); border-color: transparent; }
.is-stop { background: var(--surface); background: color-mix(in srgb, var(--failed) 12%, var(--bg)); border-color: transparent; }
.is-restart { background: var(--surface); background: color-mix(in srgb, var(--restart) 12%, var(--bg)); border-color: transparent; }
.is-start .ico { color: var(--running); }
.is-stop .ico { color: var(--failed); }
.is-restart .ico { color: var(--restart); }
.is-empty { visibility: hidden; }

.rows { list-style: none; margin: 0; padding: 0.25rem 0 0.5rem; }

.rows li {
  display: grid;
  grid-template-columns: 1rem 1fr auto;
  gap: 0.25rem 0.85rem;
  align-items: center;
  padding: 0.85rem 1.25rem;
}
.rows li + li { border-top: 1px solid var(--line); }
.rows .status { justify-self: center; }

.who { display: grid; min-width: 0; line-height: 1.4; }
.who .name { font-weight: 600; }
.url { color: var(--link); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { color: var(--dim); font-size: 0.82rem; }

/* Fixed places: Open, Restart, Settings, Start/Stop. */
.acts { display: grid; grid-template-columns: repeat(4, auto); gap: 0.35rem; }

@media (max-width: 44rem) {
  .rows li { grid-template-columns: 1rem 1fr; align-items: start; }
  .rows .status { margin-top: 0.35rem; }
  .acts { grid-column: 2; grid-template-columns: repeat(2, max-content); }
  .is-empty { display: none; }
}

.tray {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 15rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 24px 48px -16px rgb(0 0 0 / 0.25);
  font-size: 0.85rem;
}
.tray ul { list-style: none; margin: 0; padding: 0; }
.tray li { display: flex; align-items: center; gap: 0.55rem; padding: 0.3rem 0.6rem; border-radius: 5px; }
.tray li:first-child { background: var(--surface); }
.tray .chev { margin-left: auto; color: var(--dim); }
.tray .sep { height: 1px; margin: 0.3rem 0.4rem; padding: 0; background: var(--line); }

@media (max-width: 60rem) {
  .tray { display: none; }
  .shot { padding-bottom: 0; }
}

.shot figcaption {
  max-width: 34rem;
  margin-top: 1.25rem;
  color: var(--dim);
  font-size: 0.9rem;
}

/* How it works */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 2.5rem;
}

.steps li { counter-increment: step; }

.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 0.75rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--dim);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.steps p { color: var(--dim); }

.address {
  display: inline-block;
  margin-top: 0.9rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg) !important;
  font-family: var(--mono);
  font-size: 0.86rem;
}

/* Feature grid — ruled, like a file listing */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.grid li { padding: 1.6rem 1.5rem 1.75rem; background: var(--bg); }
.grid p { color: var(--dim); font-size: 0.97rem; }

/* Code blocks */

.code {
  margin: 0;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 0.84rem;
  line-height: 1.7;
  overflow-x: auto;
}
.code mark { font-weight: 700; background: none; color: inherit; }
.band .code { background: var(--bg); }
#config .code { background: var(--surface); }

.pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1.5rem;
  align-items: start;
}
.pair > :first-child { grid-column: span 1; }
@media (min-width: 60rem) {
  .pair { grid-template-columns: 1.6fr 1fr; }
}
.pair figure { margin: 0; min-width: 0; }
.pair figcaption { margin-bottom: 0.6rem; color: var(--dim); font-size: 0.88rem; }
.pair figcaption code { background: none; padding: 0; }

/* Tables (privacy.html: where every download comes from) */

.table { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th,
td { padding: 0.8rem 1.1rem; text-align: left; vertical-align: top; }
thead th { color: var(--dim); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; }
tbody tr { border-top: 1px solid var(--line); }
tbody th { font-weight: 600; white-space: nowrap; }
tbody td:last-child { color: var(--dim); white-space: nowrap; }

/* Status */

.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: -1rem 0 1.5rem; color: var(--dim); font-size: 0.9rem; }
.legend > span { display: inline-flex; align-items: center; gap: 0.5rem; }

.state { margin: 0; max-width: 46rem; }
.state div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 0.85rem;
  border-top: 1px solid var(--line);
}
.state div:last-child { border-bottom: 1px solid var(--line); }
.state dt { display: inline-flex; align-items: center; gap: 0.7rem; font-weight: 600; }
.state dd { margin: 0; color: var(--dim); }

.roadmap-title { margin-top: 3.5rem; font-size: 1.3rem; }
.roadmap-title + .intro { margin: 0 0 1.25rem; }

.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags li {
  padding: 0.35rem 0.8rem;
  border: 1px dashed var(--idle);
  border-radius: 999px;
  color: var(--dim);
  font-size: 0.9rem;
}

/* FAQ — native <details>, no script */

.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }

/* WARNING: not flex — flex makes every text run and <code> in a question its
   own item, and space-between spreads them across the line. */
.faq summary {
  position: relative;
  display: block;
  padding-block: 1.1rem;
  padding-right: 2rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; top: 1.1rem; right: 0; color: var(--dim); font-weight: 400; font-size: 1.25rem; line-height: 1.2; }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--dim); padding-bottom: 1.1rem; }
.faq details p + p { margin-top: -0.3rem; }

/* Footer links to the imprint and privacy pages */

footer.site { flex-wrap: wrap; }
.legal-links { display: flex; gap: 1.25rem; margin-left: auto; }
.legal-links a { color: var(--dim); }
.legal-links a:hover,
.legal-links a[aria-current] { color: var(--fg); }

/* Imprint and privacy: a smaller head than the landing page's hero */

.page-head { padding-block: 3.5rem 3rem; }
.page-head h1 { font-size: clamp(2rem, 5.5vw, 3.25rem); }

.facts { margin: 0 0 2rem; }
.facts div {
  display: grid;
  grid-template-columns: minmax(0, 12rem) 1fr;
  gap: 0.25rem 1.5rem;
  padding-block: 1rem;
  border-top: 1px solid var(--line);
}
.facts div:last-child { border-bottom: 1px solid var(--line); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; color: var(--dim); }
@media (max-width: 36rem) {
  .facts div { grid-template-columns: 1fr; }
}

/* Privacy, laid out like the app's Settings window: a side navigation, one
   page beside it (features/settings.feature, "Settings pages are chosen from
   a side navigation"). The selected entry is marked by a bar, bold text and
   its background — never by colour alone. */

.settings.window { max-width: none; margin-bottom: 5rem; overflow: visible; }
.settings .titlebar { border-radius: 12px 12px 0 0; }

.settings-body { display: grid; grid-template-columns: 13rem minmax(0, 1fr); }

.side {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.5rem;
  border-right: 1px solid var(--line);
  min-height: 100%;
}
.side a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  border-left: 3px solid transparent;
  border-radius: 4px;
  color: var(--fg);
  font-size: 0.95rem;
  text-decoration: none;
}
.side a span { width: 1.1rem; text-align: center; color: var(--dim); }
.side a:hover { background: var(--surface); }

.settings:not(:has(.pane :target)) .side a:first-child,
.settings:has(#computer:target) .side a[href="#computer"],
.settings:has(#downloads:target) .side a[href="#downloads"],
.settings:has(#website:target) .side a[href="#website"],
.settings:has(#rights:target) .side a[href="#rights"] {
  background: var(--surface);
  border-left-color: var(--fg);
  font-weight: 600;
}

.pane { padding: 0.5rem 2rem 2.5rem; }
.pane > section { padding-block: 1.5rem; scroll-margin-top: 1rem; }
.pane > section + section { border-top: 1px solid var(--line); }
.pane h2 { margin: 0 0 0.6rem; font-size: 1.15rem; letter-spacing: -0.01em; }
.pane p { color: var(--dim); }
.pane-intro { max-width: var(--measure); margin-bottom: 1.25rem !important; }
.pane-note { margin-top: 1rem !important; font-size: 0.9rem; }
.pane .legend { margin: 0 0 0.5rem; }

/* What Wharf changes: one row per place, a mark and its words */

.places { list-style: none; margin: 0; padding: 0; }
.places li {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  gap: 0.9rem;
  padding-block: 1.1rem;
}
.places li + li { border-top: 1px solid var(--line); }
.places h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.7rem; margin-bottom: 0.3rem; }
.places p { font-size: 0.97rem; max-width: var(--measure); }
.places p + p { margin-top: 0.5rem; }
.places .mark { margin-top: 0.35rem; }

.mark { display: inline-block; flex: none; width: 0.7rem; height: 0.7rem; border-radius: 50%; }
.mark.is-writes { background: var(--fg); }
.mark.is-never { border: 2px solid var(--idle); }

.when {
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.undo { font-size: 0.9rem !important; }
.undo::before { content: "↺ "; }

@media (max-width: 44rem) {
  .settings-body { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side a { flex: none; border-left: 0; border-bottom: 3px solid transparent; border-radius: 4px 4px 0 0; }
  .settings:not(:has(.pane :target)) .side a:first-child,
  .settings:has(#computer:target) .side a[href="#computer"],
  .settings:has(#downloads:target) .side a[href="#downloads"],
  .settings:has(#website:target) .side a[href="#website"],
  .settings:has(#rights:target) .side a[href="#rights"] { border-bottom-color: var(--fg); }
  .pane { padding-inline: 1.1rem; }
}

/* The window mock, as the app draws it today: the name and mark in the bar,
   "Cast off" and "Add project…" in opposite corners below the list
   (single-application.feature, "Casting off from the main window"). */

:root { --castoff: #0f7c80; }
@media (prefers-color-scheme: dark) { :root { --castoff: #5fc4c8; } }

.appname { display: inline-flex; align-items: center; gap: 0.5rem; }
.appname .pier { width: 1.1rem; height: 1.1rem; }
.chip.is-stop-line { color: var(--failed); border-color: var(--failed); }
.chip.is-stop-line .ico { color: var(--failed); }
.chip.is-plain { border-color: transparent; color: var(--dim); }

.fabs {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem 1.1rem;
}
.fab {
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.fab.is-castoff { background: var(--castoff); color: var(--bg); }

/* Open source and privacy, side by side */

.pair-even {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 3rem 4rem;
}
.pair-even h2 { margin-bottom: 1.25rem; }
.pair-even .cta { margin-top: 1.5rem; }
