/* From packages/ui/src/styles.css */
:root {
  color-scheme: light dark;
  --superego-font-fallback: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  --superego-mono-fallback: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --superego-font: var(--superego-font-fallback);
  --superego-mono: var(--superego-mono-fallback);
  /* macOS's own: system grays, real controls; the accent is the app's (Settings → Appearance → Accent colour). */
  --superego-bg: light-dark(#ffffff, #1d1d1f);          /* the sheet: the thread, its panes, dialogs */
  --superego-sidebar-bg: light-dark(#f2f2f4, #262628);  /* headers and side lists inside dialogs */
  --superego-chrome: light-dark(#f2f2f4, #262628);      /* the window's side: its panel, the rail and the sidebar */
  --superego-ground: light-dark(#ebebef, #141416);      /* the window behind the thread's columns, a step under the side */
  /* Hairlines between columns and parts: the window's every structural line, 1px. Opaque, so a line is one colour
     whatever it runs over (the rail, the side, the sheet). */
  --superego-line: light-dark(#e3e3e6, #333336);
  --superego-fill: light-dark(rgb(0 0 0 / .05), rgb(255 255 255 / .06));   /* quiet fills: file heads, small buttons */
  --superego-card-edge: 0 0 0 .5px var(--superego-border), 0 1px 3px light-dark(rgb(0 0 0 / .06), rgb(0 0 0 / .3));
  --superego-surface: light-dark(#f3f3f6, #262629);     /* wells: code, tool output */
  --superego-pane-tab: light-dark(#f9f9fb, #232325);   /* a pane's tab and its bars, a step off the sheet */
  --superego-bubble: light-dark(color-mix(in oklab, var(--superego-link) 9%, #fff), color-mix(in oklab, var(--superego-link) 14%, #2a2a2e));      /* your messages */
  --superego-code-chip: light-dark(rgb(0 0 0 / .055), rgb(255 255 255 / .08));
  --superego-raised: light-dark(#ffffff, #2c2c2e);      /* what stands off its ground: notices, small lists, a chosen segment */
  --superego-border: light-dark(#d1d1d6, #444446);      /* frames: fields, menus */
  --superego-text: light-dark(rgb(0 0 0 / .85), rgb(255 255 255 / .88));
  --superego-muted: light-dark(rgb(0 0 0 / .55), rgb(255 255 255 / .56));
  --superego-faint: light-dark(rgb(0 0 0 / .36), rgb(255 255 255 / .36));
  /* The accent: as chosen, or this blue. In the dark, lifted a little toward white so it carries on dark grounds. */
  --superego-accent-base: #007aff;
  --superego-accent: light-dark(var(--superego-accent-base), color-mix(in oklab, var(--superego-accent-base) 92%, white));
  /* Focus rings: around the control that has the keyboard. */
  --superego-ring: var(--superego-accent);
  /* The region holding it: a line in the ring's colour, and a soft band of it outside, following the region's corners. */
  --superego-region-ring: 0 0 0 1px color-mix(in srgb, var(--superego-ring) 80%, transparent), 0 0 0 4px color-mix(in srgb, var(--superego-ring) 22%, transparent);
  --superego-accent-text: #ffffff;
  --superego-link: var(--superego-accent);              /* links, and what opens a file or a thread */
  --superego-selected: light-dark(rgb(0 0 0 / .07), rgb(255 255 255 / .08));
  --superego-hover: light-dark(rgb(0 0 0 / .04), rgb(255 255 255 / .05));
  /* Controls: push buttons, pop-ups, fields. */
  --superego-control: light-dark(#ffffff, #5a5a5e);
  --superego-control-active: light-dark(#e3e3e8, #6e6e73);
  --superego-control-edge: 0 0 0 .5px light-dark(rgb(0 0 0 / .22), rgb(0 0 0 / .5)), 0 1px 1.5px light-dark(rgb(0 0 0 / .14), rgb(0 0 0 / .35));
  --superego-field-bg: light-dark(#ffffff, #2a2a2c);
  --superego-field-edge: light-dark(#bdbdc2, #545458);
  --superego-track: light-dark(#d9d9de, #48484a);       /* a switch that's off, a slider's track */
  --superego-focus: 0 0 0 3px color-mix(in srgb, var(--superego-accent) 45%, transparent);
  --superego-status-working: var(--superego-accent);
  --superego-status-done: var(--superego-accent);
  --superego-status-blocked: light-dark(#ff8d28, #ff9230);
  --superego-status-error: light-dark(#ff383c, #ff4245);
  --superego-status-idle: light-dark(rgb(0 0 0 / .2), rgb(255 255 255 / .22));
  /* Words beside a status (Question, Failed): darker than the mark, to read as text. */
  --superego-status-blocked-text: light-dark(#c26a00, #ff9f0a);
  --superego-status-error-text: light-dark(#d70015, #ff6961);
  --superego-status-success: light-dark(#248a3d, #30d158);

  /* Code (code-highlight.ts): the editor, a message's and a rendered file's fenced blocks. */
  --superego-syntax-keyword: light-dark(#a626a4, #c792ea);
  --superego-syntax-string: light-dark(#50a14f, #a5d68a);
  --superego-syntax-number: light-dark(#b76b01, #f2b46d);       /* numbers, booleans, null, atoms */
  --superego-syntax-comment: var(--superego-faint);
  --superego-syntax-function: light-dark(#2f6fdb, #82aaff);     /* a function's name, called or defined */
  --superego-syntax-type: light-dark(#c18401, #ffcb6b);         /* types, classes, namespaces */
  --superego-syntax-tag: light-dark(#e45649, #f07178);          /* markup's tags */
  --superego-syntax-attribute: light-dark(#986801, #e0c08a);    /* attributes, properties, labels */
  --superego-syntax-definition: light-dark(#0f6e8a, #89ddff);   /* a variable or property where it's defined */
  --superego-syntax-meta: var(--superego-muted);                /* annotations, processing instructions */
  --superego-syntax-inserted: light-dark(#2f7d32, #a5d68a);     /* a diff's added lines */
  --superego-syntax-deleted: light-dark(#c0392b, #f07178);      /* a diff's removed lines */
  --superego-syntax-invalid: var(--superego-status-error);

  /* The terminal (extensions/terminal): read as drawn when one opens, and again when light/dark or the root's style
     changes. */
  --superego-terminal-fg: var(--superego-text);
  --superego-terminal-bg: var(--superego-bg);
  --superego-terminal-cursor: var(--superego-accent);
  --superego-terminal-selection: light-dark(color-mix(in srgb, var(--superego-accent) 25%, var(--superego-bg)), color-mix(in srgb, var(--superego-accent) 45%, var(--superego-bg)));
  --superego-terminal-black: light-dark(#1d1d1f, #48484a);
  --superego-terminal-red: light-dark(#c9241b, #ff6961);
  --superego-terminal-green: light-dark(#1a7f37, #4cd964);
  --superego-terminal-yellow: light-dark(#946200, #ffd60a);
  --superego-terminal-blue: light-dark(#0a5fd6, #64a8ff);
  --superego-terminal-magenta: light-dark(#a23ec4, #da8fff);
  --superego-terminal-cyan: light-dark(#0a7c8c, #5ac8fa);
  --superego-terminal-white: light-dark(#8e8e93, #d1d1d6);
  --superego-terminal-bright-black: light-dark(#636366, #8e8e93);
  --superego-terminal-bright-red: light-dark(#e0382d, #ff8f88);
  --superego-terminal-bright-green: light-dark(#24963f, #7ee08f);
  --superego-terminal-bright-yellow: light-dark(#b07800, #ffe066);
  --superego-terminal-bright-blue: light-dark(#2f7cf6, #8cc0ff);
  --superego-terminal-bright-magenta: light-dark(#bf5af2, #e5b0ff);
  --superego-terminal-bright-cyan: light-dark(#1695a8, #8ad8fb);
  --superego-terminal-bright-white: light-dark(#c7c7cc, #ffffff);

  /* Diffs: what a change added and removed. */
  --superego-diff-added: light-dark(#248a3d, rgb(48 209 88 / .85));          /* counts: +12 */
  --superego-diff-removed: light-dark(#d70015, rgb(255 105 97 / .85));       /* counts: −3 */
  --superego-diff-added-bg: light-dark(rgb(52 199 89 / .12), rgb(48 209 88 / .11));     /* the Diff pane's lines */
  --superego-diff-removed-bg: light-dark(rgb(255 59 48 / .09), rgb(255 69 58 / .12));
  --superego-diff-added-text: light-dark(#1d6e32, #a6f0b8);
  --superego-diff-removed-text: light-dark(#b3261e, #ffb3ad);
  --superego-diff-edit-added-bg: light-dark(rgb(52 199 89 / .14), rgb(48 209 88 / .15));  /* an edit's, in a thread */
  --superego-diff-edit-removed-bg: light-dark(rgb(255 59 48 / .11), rgb(255 69 58 / .15));
  --superego-diff-fence-added-bg: light-dark(rgb(46 160 67 / .12), rgb(46 160 67 / .18));  /* a diff fence's, in a message */
  --superego-diff-fence-removed-bg: light-dark(rgb(207 34 46 / .1), rgb(248 81 73 / .16));
  --superego-radius: 8px;
  --superego-radius-lg: 16px;
  --superego-space: 8px;

  /* Type: UI text at 13, reading text at 15.5, one title size; mono for meta. */
  /* Every size of text times this: the Text size setting's factor (Settings → Appearance; the app sets
     --superego-text-size) times the device's (--superego-text-device: the app's phone layout reads bigger). */
  --superego-text-size: 1;
  --superego-text-device: 1;
  --superego-text-scale: calc(var(--superego-text-size) * var(--superego-text-device));
  --superego-text-xs: calc(11px * var(--superego-text-scale));
  --superego-text-sm: calc(12px * var(--superego-text-scale));
  --superego-text-ui: calc(13px * var(--superego-text-scale));
  --superego-text-body: calc(13.5px * var(--superego-text-scale));
  --superego-text-mono: calc(12px * var(--superego-text-scale));
  --superego-text-title: calc(26px * var(--superego-text-scale));
  /* A field's under a finger (see below). */
  --superego-text-field: max(16px, calc(16px * var(--superego-text-size)), var(--superego-text-body));
  --superego-leading-ui: 1.45;
  --superego-leading-body: 1.55;
  /* Space on a 4px grid. */
  --superego-space-1: 4px;
  --superego-space-2: 8px;
  --superego-space-3: 12px;
  --superego-space-4: 16px;
  --superego-space-5: 24px;
  --superego-space-6: 32px;
  --superego-space-7: 52px;
  /* The reading column, the sidebar, and what floats over content. */
  --superego-column: 640px;
  --superego-sidebar: 232px;
  --superego-rail: 48px;
  --superego-titlebar: 48px;
  /* The desktop window's own corners (macOS draws them; no API says how round): measured from a screenshot of the
     app's window on macOS 26, a 16pt circle. What sits inset against a corner takes this less its inset, concentric. */
  --superego-window-radius: 16px;
  --superego-shadow-float: 0 0 0 .5px light-dark(rgb(0 0 0 / .1), rgb(0 0 0 / .6)), 0 16px 40px -10px light-dark(rgb(0 0 0 / .22), rgb(0 0 0 / .5)), 0 2px 8px light-dark(rgb(0 0 0 / .06), rgb(0 0 0 / .2));
  /* Glass (macOS's Liquid Glass, as a page can draw it): what floats over the content and works it (menus, popovers,
     the composer) is a translucent sheet that blurs what's under it, lit along its top edge. Its tint is what's raised
     (a theme's, with the window matching it). */
  --superego-glass: light-dark(color-mix(in srgb, var(--superego-raised) 86%, transparent), color-mix(in srgb, var(--superego-raised) 84%, transparent));
  --superego-glass-edge: inset 0 .5px 0 light-dark(rgb(255 255 255 / .95), rgb(255 255 255 / .16)), 0 0 0 .5px light-dark(rgb(0 0 0 / .1), rgb(255 255 255 / .1));
  --superego-glass-blur: blur(24px) saturate(1.8);
}

/* Colours, fonts and the radius are the app's own: the build puts @superego/ui's :root tokens
   (packages/ui/src/styles.css) ahead of this file. */
:root { --marker: light-dark(#e8590c, #ff8a4c); }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--superego-bg);
  color: var(--superego-text);
  font: 16px/1.6 var(--superego-font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--superego-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* The bar on every page */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 24px;
}
.top.wide { max-width: 1200px; }
.top .name { display: flex; align-items: center; gap: 8px; color: var(--superego-text); font-weight: 600; }
.top .name svg { width: 18px; height: 20px; }
.top nav { display: flex; gap: 20px; }
.top nav a { color: var(--superego-muted); }
.top nav a:hover, .top nav a[aria-current] { color: var(--superego-text); text-decoration: none; }

/* Home */

.home {
  max-width: 960px;
  margin: 0 auto;
  padding: 64px 24px 96px;
  text-align: center;
}
.home h1 { margin: 0; font-size: 44px; font-weight: 600; letter-spacing: -.02em; }
.home p { max-width: 560px; margin: 16px auto 0; color: var(--superego-muted); font-size: 17px; text-wrap: balance; }
.home .tagline { margin-top: 6px; color: var(--superego-text); font-size: 22px; font-weight: 500; letter-spacing: -.01em; }
.home .links { display: flex; justify-content: center; align-items: center; gap: 24px; margin-top: 32px; }
.home .byline { margin-top: 28px; font-size: 14px; }
.byline a { color: var(--superego-text); white-space: nowrap; }
.byline img { width: 20px; height: 20px; margin: 0 5px 0 3px; border-radius: 50%; vertical-align: -5px; }
.home code { padding: 1px 5px; border-radius: 4px; background: var(--superego-code-chip); font: .85em var(--superego-mono); overflow-wrap: anywhere; }

.shot { position: relative; margin: 56px 0 0; }
.shot img { display: block; width: 100%; height: auto; border-radius: 10px; box-shadow: 0 0 0 1px var(--superego-line), 0 12px 40px light-dark(rgb(0 0 0 / .08), rgb(0 0 0 / .4)); }
.shot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.shot path { fill: var(--marker); }
.shot .mark { position: absolute; transform: translate(-50%, -50%); padding: 0 4px; border-radius: 50%; background: var(--superego-bg); color: var(--marker); font-weight: 600; font-size: 15px; line-height: 1.3; }

.home .asked-intro { margin-top: 32px; }
.asked { max-width: 760px; margin: 16px auto 0; padding: 0; list-style: none; counter-reset: asked; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 32px; text-align: left; font-size: 16px; }
.asked li { counter-increment: asked; position: relative; padding-left: 22px; }
.asked li::before { content: counter(asked); position: absolute; left: 0; color: var(--marker); font-weight: 600; }
.home .take { margin-top: 24px; font-size: 15px; }
.home .where-intro { margin: 56px auto 24px; color: var(--superego-text); font-size: 17px; }

.home section { margin-top: 96px; }
.home h2 { margin: 0 0 28px; font-size: 22px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px 32px; margin: 0; text-align: left; }
.grid dt { font-weight: 600; }
.grid dd { margin: 2px 0 0; color: var(--superego-muted); font-size: 15px; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 48px; text-align: left; }
.columns h3 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
.home .columns p { margin: 16px 0 0; max-width: none; font-size: 15px; text-wrap: pretty; }
.adds { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.adds li { position: relative; padding-left: 18px; }
.adds li::before { content: "+"; position: absolute; left: 0; color: var(--marker); font-weight: 600; }

@media (max-width: 760px) {
  .home { padding-top: 40px; }
  .asked, .columns { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
}

.button {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--superego-accent);
  color: #fff;
  font-weight: 500;
}
.button:hover { text-decoration: none; filter: brightness(1.08); }

/* Docs */

.docs {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 80px;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 8px 0 24px;
  font-size: 14px;
}
.sidebar h2 { margin: 20px 0 6px; padding: 0 10px; color: var(--superego-muted); font-size: 14px; font-weight: 500; }
.sidebar h2:first-child { margin-top: 0; }
.sidebar ul { margin: 0; padding: 0; list-style: none; }
.sidebar a { display: block; padding: 3px 10px; border-radius: var(--superego-radius); color: var(--superego-text); }
.sidebar a:hover { text-decoration: none; background: var(--superego-selected); }
.sidebar a[aria-current] { background: var(--superego-selected); font-weight: 500; }
.sidebar ul ul { margin: 2px 0 6px 10px; }
.sidebar ul ul a { color: var(--superego-muted); font-size: 13px; }
.sidebar ul ul a:hover { color: var(--superego-text); }

@media (max-width: 760px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .sidebar { position: static; max-height: none; padding-bottom: 8px; }
  .sidebar ul ul { display: none; }
  .sidebar ul { display: flex; flex-wrap: wrap; gap: 2px; }
  .top { padding: 16px; }
  .top nav { gap: 14px; }
  .docs { padding-inline: 16px; }
}

/* Reading */

.prose { max-width: 760px; min-width: 0; }
.prose.single { margin: 0 auto; padding: 16px 24px 80px; }
.prose h1 { margin: 0 0 24px; font-size: 32px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.prose h2, .prose h3, .prose h4 { font-weight: 600; line-height: 1.3; scroll-margin-top: 16px; }
.prose h2 { margin: 48px 0 12px; font-size: 22px; }
.prose h3 { margin: 32px 0 8px; font-size: 17px; }
.prose h4 { margin: 24px 0 8px; font-size: 16px; }
.prose p, .prose ul, .prose ol, .prose pre, .prose .table, .prose picture, .prose blockquote { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 4px; }
.prose li > ul, .prose li > ol { margin: 4px 0 0; }
.prose blockquote { padding: 0 16px; color: var(--superego-muted); }
.prose img { max-width: 100%; height: auto; }
.prose hr { border: 0; border-top: 1px solid var(--superego-line); margin: 32px 0; }

.prose code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--superego-code-chip);
  font: .875em/1.5 var(--superego-mono);
  overflow-wrap: anywhere;
}
.prose pre {
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--superego-surface);
}
.prose pre code { overflow-wrap: normal; padding: 0; background: none; font-size: 13px; line-height: 1.55; }

.prose .table { overflow-x: auto; }
.prose table { border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.prose th, .prose td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--superego-line); text-align: left; vertical-align: top; }
.prose th { font-weight: 600; }
.prose td code { white-space: nowrap; }

.prose .source { margin-top: 48px; font-size: 13px; }
.prose .source a { color: var(--superego-faint); }

/* Code colours: the app's syntax tokens, by role */
.syntax-keyword { color: var(--superego-syntax-keyword); }
.syntax-string { color: var(--superego-syntax-string); }
.syntax-number { color: var(--superego-syntax-number); }
.syntax-function { color: var(--superego-syntax-function); }
.syntax-type { color: var(--superego-syntax-type); }
.syntax-tag { color: var(--superego-syntax-tag); }
.syntax-attribute { color: var(--superego-syntax-attribute); }
.syntax-definition { color: var(--superego-syntax-definition); }
.syntax-comment { color: var(--superego-syntax-comment); font-style: italic; }

/* Diagrams (docs/interface): wireframes in a row, a caption under them. */
.prose figure { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 16px; margin: 20px 0 28px; }
.prose figure img { flex: none; width: 100%; max-width: 560px; height: auto; }
.prose figure.steps img { width: calc((100% - 32px) / 3); }
.prose figure.phones img { width: 112px; }
.prose figcaption { flex-basis: 100%; color: var(--superego-muted); font-size: 14px; font-style: italic; }
