/* vpl · shell — the part every app looks like.
 *
 * One palette, one type scale, one page foundation. An app adds its own
 * workspace on top; it does not invent colours. The variables below are the
 * shell's: apps read them, apps do not redefine them.
 *
 * Copied into apps/<name>/vendor/ by ./stage (which ./serve and ./deploy run),
 * so every app ships with a copy and never with a link back into this folder.
 * Runtime independence is the point of the suite.
 */

/* vpl — one stylesheet, CSS variables (§4.4).
 * Warm paper, not a dashboard. Light is the default; dark is a variable swap. */
:root {
  --paper:        #faf8f4;
  --paper-2:      #f2eee6;   /* list pane */
  --paper-3:      #e9e3d8;   /* hairlines, hover */
  --ink:          #1f1d1a;
  --ink-2:        #55504a;
  --ink-3:        #8a8378;
  --line:         #e0d9cd;
  --mark:         #b4531f;   /* the only accent, used sparingly */
  --danger:       #a3352b;

  /* one colour language for sharing, in the list and at the top of the note:
   * anyone with the link / someone may edit / someone may only read */
  --tone-public: #a4553c;   /* terracotta, next to the accent */
  --tone-shared: #4a6b52;   /* moss */
  --tone-read:   #4a5f76;   /* slate */

  --sans: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', ui-serif, Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --list-w: 15rem;
  --radius: 8px;
  --bar-h: 2.75rem;
  --line-strong: #cdc3b2;
}

[data-theme='dark'] {
  --paper:        #1a1816;
  --paper-2:      #232120;
  --paper-3:      #33302c;
  --ink:          #f7f3ec;
  --ink-2:        #ddd6cb;
  --ink-3:        #b5ada1;   /* 7.97:1 on --paper */
  /* Edges must be obvious, not merely present. #8a8177 is 4.63:1 on
   * --paper and 4.19:1 on the sidebar surface. */
  --line:         #8a8177;
  --line-strong:  #a39a8f;
  --mark:         #ffb06b;
  --danger:       #ff9084;
  --tone-public: #dda07a;
  --tone-shared: #9fc4a8;
  --tone-read:   #a8c4e0;
}

/* In dark mode a hairline on a near-black surface vanishes, so inputs and
 * pane dividers get an explicit, visible border. Structural dividers are
 * drawn in --line-strong and made 2px: at 1px even a strong colour reads
 * as "faint" on a large dark field. */
[data-theme='dark'] input,
[data-theme='dark'] textarea {
  border-color: var(--line);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 2px;
}

/* ── buttons ────────────────────────────────────────────────────── */
/* Base controls belong to the shell: an app that forgets them falls back to the
 * browser's beige buttons, which is what vi did until this was added. */
button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  color: var(--ink-2);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
button:hover { background: var(--paper-3); color: var(--ink); }
button.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
button.primary:hover { background: var(--ink-2); }
button.danger { color: var(--danger); }
button.ghost { border-color: transparent; }
button.ghost:hover { border-color: var(--line); }
button.icon {
  border: none; padding: 0.35rem 0.5rem; font-size: 1.05rem; line-height: 1;
  border-radius: var(--radius);
}

/* ── selects ─────────────────────────────────────────────────────── */
/* A <select> left alone renders as a small native control next to our wide
 * inputs, which reads as "unfinished". Same box, same radius, same height;
 * only the arrow stays native, because a custom one is a dropdown of its own. */
select {
  width: 100%;
  min-height: 2.15rem;
  padding: .45rem .5rem;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 8px;
  background: var(--paper, #fff);
  color: var(--ink, inherit);
  appearance: auto;
}
[data-theme='dark'] select { border-color: var(--line); }
