/* The base sheet: the tokens, the fonts, the reset, and the classes the
   server's own pages use (D12). The frontend's own vocabulary is in
   frontend/src/app.css, and a class one component uses is in that
   component's scoped style. Separation is by plane, never by a border: the
   only rings are focus and a danger ring on an input that can't be used.
   Colour literals live in :root and nowhere else. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  /* The background (frontend/src/lib/Ground.svelte): the ground it paints
     on, the five colour fields that drift over it on the sign-in page, and
     how strongly they paint. Contrast over the brightest field decides the
     opacity. */
  --ground: #0a110f;
  --field-1: #7a9a5a;
  --field-2: #e8c27a;
  --field-3: #a8633f;
  --field-4: #5e8f7a;
  --field-5: #d9a07a;
  --field-opacity: 0.6;

  /* Light glass carries the person's own things: bubbles, the composer,
     inputs. It takes a top highlight and an inner ring. */
  --glass: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.12);
  --glass-on: rgba(255, 255, 255, 0.16);
  --glass-blur: blur(24px) saturate(1.5);
  --glass-hi: rgba(255, 255, 255, 0.18);
  --glass-on-hi: rgba(255, 255, 255, 0.25);
  --glass-ring: rgba(255, 255, 255, 0.08);
  --glass-edge: inset 0 1px 0 var(--glass-hi), inset 0 0 0 1px var(--glass-ring);
  /* Dark glass carries what Agave shows: cards, rows, tiles, menus, the
     sign-in panel and the dialog. It is matte: nearly opaque, and its blur
     drains the colour of the ground, so what stands on it holds focus. */
  --glass-dark: oklch(0.165 0.01 175 / 0.84);
  --glass-dark-blur: blur(24px) saturate(0.5);
  --glass-dark-edge: inset 0 0 0 1px oklch(1 0 0 / 0.07);
  --glass-dark-edge-hover: inset 0 0 0 1px oklch(1 0 0 / 0.16);
  /* Deeper glass, quieter edges: what a person said, and the composer they
     said it in (AG7). */
  --glass-deep: rgba(8, 14, 12, 0.55);
  --glass-deep-edge: inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  /* Under the glass: a code block, the slot a dragged row leaves behind. */
  --sunk: rgba(0, 0, 0, 0.28);

  --ink: #f3f1ea;
  --mu: rgba(255, 255, 255, 0.72);
  /* Ink for the mark on an empty screen: present, and quieter than text. */
  --dim: rgba(255, 255, 255, 0.3);
  --rule: rgba(255, 255, 255, 0.18);
  /* Agave's reply has no bubble, so its ink carries its own ground (AG7). */
  --reply-shadow: 0 1px 12px rgba(8, 14, 12, 0.6);

  /* The primary is white, and what a person said carries the same white
     held back. Focus is a white outline, never a colour. */
  --on: #ffffff;
  --on-ink: #13201b;
  --you: rgba(255, 255, 255, 0.86);
  --you-ink: #13201b;
  --focus: rgba(255, 255, 255, 0.6);
  /* A computer tile: the glow its picture stands in while online, one
     square per block and the two meters, amber at 85%, and the outline of
     a square for no block. */
  --tile-floor: oklch(0.87 0.13 150 / 0.07);
  --meter: oklch(0.8 0.1 150);
  --meter-high: oklch(0.83 0.13 78);
  --meter-empty: oklch(0.55 0.02 150);
  /* The tile that adds a computer: a dashed place, a shade darker. */
  --tile-add: oklch(0.16 0.01 175 / 0.35);
  --tile-add-hover: oklch(0.18 0.01 175 / 0.55);
  --tile-add-ring: oklch(1 0 0 / 0.16);
  --tile-add-ring-hover: oklch(1 0 0 / 0.3);
  --tile-add-ink: oklch(0.86 0.012 140);

  --radius: 6px;
  --radius-card: 8px;
  --radius-panel: 10px;

  /* Rows inside one dark-glass card are split by this, never a border. */
  --hairline: rgba(255, 255, 255, 0.06);
  --glass-well-ring: rgba(255, 255, 255, 0.14);
  /* What the dialog dims. */
  --backdrop: rgba(6, 10, 9, 0.45);
  --backdrop-blur: blur(6px);
  /* What a lifted card casts, and the only drop shadow in Agave. */
  --lift-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  /* Where a press took hold of a drag handle, until the card lifts. */
  --press: rgba(255, 255, 255, 0.28);

  /* The status inks Agave writes text in. */
  --ok: #c3e3be;
  --warn: #f0d9a6;
  --danger: #f3b195;
  /* A pill is an opaque fill and its own ink, so a pill looks the same on
     every glass. The four pairs are soft: the fill sits just above the
     glass, and the ink keeps little colour. */
  --ok-fill: oklch(0.3 0.035 150);
  --ok-fill-ink: oklch(0.9 0.06 150);
  --warn-fill: oklch(0.3 0.03 80);
  --warn-fill-ink: oklch(0.88 0.08 80);
  --danger-fill: oklch(0.29 0.05 25);
  --danger-fill-ink: oklch(0.8 0.12 25);
  --neutral-fill: oklch(0.3 0.01 170);
  --neutral-fill-ink: oklch(0.9 0.01 170);
  /* The fill of a destructive button. --danger stays the text ink. */
  --danger-on: #e08a6a;
  --danger-on-ink: #1e0d07;
  --fail-ring: rgba(224, 138, 106, 0.45);

  /* A person's own tile, so a face is never read as one more surface. */
  --person: oklch(0.27 0.04 160);
  /* The tints a house picture is drawn in: body, inset, line, roof,
     foliage, glass and the light. */
  --pic-body: oklch(0.34 0.022 160);
  --pic-inset: oklch(0.26 0.018 160);
  --pic-line: oklch(0.52 0.03 160);
  --pic-roof: oklch(0.42 0.06 30);
  --pic-leaf: oklch(0.42 0.07 150);
  --pic-glass: oklch(0.46 0.06 230);
  --pic-led: #9cc5a8;
  --mono: "Geist Mono", ui-monospace, monospace;
  color-scheme: dark;
}

/* --- end of the brand: fonts and tokens above, Agave's own pages below --- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* The ground is only the root's, so the background
   (frontend/src/lib/Ground.svelte) is not painted over by the body's own. */
html {
  background: var(--ground);
}
html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  font: 400 14px/1.5 "Geist", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* The window is the ground. frontend/src/routes/Shell.svelte lays the chat
   and the view on it; nothing here divides them. */
body {
  overflow: hidden;
}

/* The frontend renders into div.app (frontend/src/app.html). The shell is
   fixed to the window, so the div must not box it. */
.app { display: contents; }

::selection { background: var(--on); color: var(--on-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::placeholder { color: var(--mu); opacity: 1; }

/* The frontend's .spin (frontend/src/app.css) is the only user. */
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- the classes the server's pages use, and the frontend with them ---- */

.danger-ink { color: var(--danger); }

/* The two glass surfaces, and the only place the blur is spelled. Light
   glass carries the person's own things, dark glass what Agave shows. */
.glass {
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge);
}
.glass-dark {
  background: var(--glass-dark);
  backdrop-filter: var(--glass-dark-blur);
  -webkit-backdrop-filter: var(--glass-dark-blur);
  box-shadow: var(--glass-dark-edge);
}
.glass-deep {
  background: var(--glass-deep);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-deep-edge);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn-primary { background: var(--on); color: var(--on-ink); font-weight: 600; }

/* AG3, AG6: an input is a light-glass well, with a ring and no highlight. */
.field {
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 0 0 1px var(--glass-well-ring);
  color: var(--ink);
}
.field:focus { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.field.invalid { box-shadow: inset 0 0 0 2px var(--danger); }
.field-mono { font-family: var(--mono); }

.fold { display: flex; flex-direction: column; gap: 8px; align-self: stretch; align-items: flex-start; }
.fold-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--mu);
  cursor: pointer;
}
.fold-toggle:hover { color: var(--ink); }

.mono-block {
  align-self: stretch;
  max-height: 320px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--sunk);
  color: var(--mu);
  font-family: var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

body.notice { display: flex; align-items: center; justify-content: center; overflow: auto; }
.notice main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
  max-width: 320px;
  padding: 32px;
}
.brand { margin: 0; font-weight: 600; }
.notice main { gap: 8px; }
.notice h1 { margin: 0; font-size: 22px; font-weight: 600; }
.notice p { margin: 0; }
.notice .btn { margin-top: 16px; }
/* Choose your username: the field, its refusal 4px under it, the button. */
.ask { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; }
.ask-field { width: 100%; }
