/* ==========================================================================
   Vectrieve: the field
   --------------------------------------------------------------------------
   The public site's look (frontend/app/globals.css, frontend/DESIGN.md)
   carried onto every Jinja page: the signed in app (vt_base.html) and the
   account, error and legal pages (vt_public.html). Loaded last, after
   os.css, vectrieve.css, the shell's CSS and vt-site.css, so it re-points
   their tokens at the field and sets the few shapes the OS draws
   differently (radius, focus, labels, selection) without touching the
   vendored files. Decisions: docs/redesign/DESIGN.md, "The app, November
   2026".

     1. Faces (self hosted)
     2. Tokens: the field palette, type, radius, for every token system
     3. Ground and grain
     4. Type
     5. Controls: buttons, fields, focus
     6. Surfaces: panels, modals, tables, notices, empty states
     7. Selection: the dashed annotation box
     8. The terrain, where it earns its place
     9. Reduced motion
   ========================================================================== */

/* ---------- 1. Faces ----------------------------------------------------- */

/* Hubot Sans, GitHub, SIL OFL 1.1 (static/fonts/HubotSans-OFL.txt) */
@font-face {
  font-family: 'Hubot Sans';
  src: url('../fonts/HubotSans-VF.woff2') format('woff2');
  font-weight: 200 900;
  font-stretch: 80% 120%;
  font-display: swap;
}
@font-face {
  font-family: 'VT Helvetica';
  src: url('../fonts/Helvetica.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'VT Helvetica';
  src: url('../fonts/Helvetica-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
/* Fragment Mono, Wei Huang, SIL OFL 1.1 (static/fonts/FragmentMono-OFL.txt) */
@font-face {
  font-family: 'Fragment Mono';
  src: url('../fonts/FragmentMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

/* ---------- 2. Tokens ---------------------------------------------------- */

:root,
:root[data-theme],
body.vt-site,
:root[data-theme] body.vt-site {
  color-scheme: dark;

  /* The field, from frontend/app/globals.css */
  --vt-field: #03070e;        /* the ground */
  --vt-deep: #07101f;         /* solid panels */
  --vt-deep-2: #0b172b;       /* a panel's raised strip: hover, head */
  --vt-well: #050b17;         /* inside a field: inputs, code */
  --vt-line: rgba(196, 214, 255, 0.16);
  --vt-line-2: rgba(214, 228, 255, 0.34);
  --vt-control: rgba(200, 215, 255, 0.28);
  --vt-ink: #f2f6fc;          /* 17.6:1 on a panel */
  --vt-ink-2: #b9c6da;        /* body, 11:1 */
  --vt-ink-3: #93a3bd;        /* meta, 7.4:1 */
  --vt-placeholder: #7f8ea8;  /* 5.7:1 */
  --vt-signal: #8fb0f5;       /* Vectrieve blue: you are here, matched, focus */
  --vt-error: #ffb3a8;
  --vt-ok: #b9e3c6;
  --vt-amber: #f1d38c;
  --vt-annot-line: rgba(242, 246, 252, 0.88);

  --vt-display: 'Hubot Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --vt-body: 'VT Helvetica', 'HelveticaCustom', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --vt-mono: 'Fragment Mono', ui-monospace, Menlo, monospace;
  --vt-ease: cubic-bezier(0.2, 0, 0, 1);

  /* Company OS tokens (os.css, vectrieve.css) */
  --os-bg: var(--vt-field);
  --os-surface: var(--vt-deep);
  --os-surface-2: var(--vt-deep-2);
  --os-rail: var(--vt-field);
  --os-fill: rgba(196, 214, 255, 0.05);
  --os-fill-strong: rgba(196, 214, 255, 0.10);
  --os-line: var(--vt-line);
  --os-line-strong: var(--vt-line-2);
  --os-ink: var(--vt-ink);
  --os-ink-muted: var(--vt-ink-2);
  --os-ink-dim: var(--vt-ink-3);
  --os-backdrop: rgba(1, 3, 8, 0.72);
  --os-inverse-bg: var(--vt-ink);
  --os-inverse-ink: var(--vt-field);
  --os-success: var(--vt-ok);
  --os-success-wash: rgba(185, 227, 198, 0.10);
  --os-warn: var(--vt-amber);
  --os-warn-wash: rgba(241, 211, 140, 0.10);
  --os-danger: var(--vt-error);
  --os-danger-wash: rgba(255, 179, 168, 0.10);
  --os-info: var(--vt-ink-2);
  --os-info-wash: rgba(185, 198, 218, 0.10);
  --os-focus: var(--vt-signal);
  /* Labels: the points view's six instrument colours, no purple */
  --os-label-green: #b7ad97;  --os-label-green-wash: rgba(183, 173, 151, 0.14);
  --os-label-teal: #7f93ba;   --os-label-teal-wash: rgba(127, 147, 186, 0.14);
  --os-label-blue: #8fb0f5;   --os-label-blue-wash: rgba(143, 176, 245, 0.14);
  --os-label-purple: #c4968a; --os-label-purple-wash: rgba(196, 150, 138, 0.14);
  --os-label-pink: #c4968a;   --os-label-pink-wash: rgba(196, 150, 138, 0.14);
  --os-label-red: #ffb3a8;    --os-label-red-wash: rgba(255, 179, 168, 0.14);
  --os-label-orange: #d9b27a; --os-label-orange-wash: rgba(217, 178, 122, 0.14);
  --os-label-grey: #93a3bd;   --os-label-grey-wash: rgba(147, 163, 189, 0.14);
  --os-font: var(--vt-body);
  --os-font-mono: var(--vt-mono);
  --os-text-2xs: 0.75rem;     /* 12 */
  --os-text-xs: 0.8125rem;    /* 13 meta */
  --os-text-sm: 0.875rem;     /* 14 dense UI */
  --os-text-base: 0.9375rem;  /* 15 body */
  --os-text-md: 1rem;         /* 16 */
  --os-text-lg: 1.25rem;      /* 20 section title */
  --os-text-xl: 2.125rem;     /* 34 page title */
  --os-text-2xl: 2.125rem;
  --os-text-display: 2.75rem;
  --os-tracking-wide: 0;
  --os-radius-sm: 2px;
  --os-radius-md: 2px;
  --os-radius-lg: 0;
  --os-radius-xl: 0;
  --os-shadow-sm: none;
  --os-shadow-md: none;
  --os-shadow-lg: none;
  --os-ease: var(--vt-ease);

  /* Vectrieve's own (vectrieve.css) */
  --vt-accent: var(--vt-signal);
  --vt-accent-strong: #b3caf8;
  --vt-accent-wash: rgba(143, 176, 245, 0.12);
  --vt-accent-line: rgba(143, 176, 245, 0.42);
  --vt-code-bg: var(--vt-well);
  --vt-glass-bg: var(--vt-field);

  /* The shared shell (bsl_web glass.css, shell.css) */
  --bsl-bg: var(--vt-field);
  --bsl-surface: var(--vt-deep);
  --bsl-surface-2: var(--vt-deep-2);
  --bsl-fill: rgba(196, 214, 255, 0.05);
  --bsl-fill-strong: rgba(196, 214, 255, 0.10);
  --bsl-line: var(--vt-line);
  --bsl-line-strong: var(--vt-line-2);
  --bsl-scrim: rgba(1, 3, 8, 0.72);
  --bsl-ink: var(--vt-ink);
  --bsl-ink-muted: var(--vt-ink-2);
  --bsl-ink-dim: var(--vt-ink-3);
  --bsl-success: var(--vt-ok);
  --bsl-warn: var(--vt-amber);
  --bsl-danger: var(--vt-error);
  --bsl-info: var(--vt-ink-2);
  --bsl-accent: var(--vt-signal);
  --bsl-accent-ink: var(--vt-signal);
  --bsl-on-accent: var(--vt-field);
  --bsl-accent-wash: rgba(143, 176, 245, 0.12);
  --bsl-glass-solid: var(--vt-deep);
  --bsl-glass-edge: var(--vt-line-2);
  --bsl-font: var(--vt-body);
  --bsl-font-mono: var(--vt-mono);
  --bsl-radius-sm: 2px;
  --bsl-radius-md: 0;
  --bsl-radius-lg: 0;
  --bsl-ease: var(--vt-ease);

  /* The public pages' own (vt-site.css) */
  --s-ground: var(--vt-field);
  --s-surface: var(--vt-deep);
  --s-ink: var(--vt-ink);
  --s-muted: var(--vt-ink-2);
  --s-rule: var(--vt-line);
  --s-control: var(--vt-control);
  --s-fill: rgba(196, 214, 255, 0.05);
  --s-accent: var(--vt-signal);
  --s-on-accent: var(--vt-field);
  --s-accent-wash: rgba(143, 176, 245, 0.12);
  --s-font: var(--vt-body);
  --s-mono: var(--vt-mono);
  --s-radius: 2px;
}

/* ---------- 3. Ground and grain ------------------------------------------ */

html:has(body.vt-field) { background: var(--vt-field); }
body.vt-field {
  background: var(--vt-field);
  color: var(--vt-ink);
  font-family: var(--vt-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Film grain over everything, very light, as on the public site. */
body.vt-field::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  background: url('../img/grain.png');
  opacity: 0.045;
  mix-blend-mode: overlay;
}
body.vt-field ::selection { background: rgba(143, 176, 245, 0.4); }
body.vt-field a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }

/* ---------- 4. Type ------------------------------------------------------ */

/* Hubot Sans for titles, set wide like the site; Helvetica for words;
   Fragment Mono only for real data (paths, ids, keys, counts, code). */
body.vt-field h1,
body.vt-field .os-page-head h1,
body.vt-field .bsl-page-title {
  font-family: var(--vt-display);
  font-weight: 520;
  font-stretch: 108%;
  font-size: var(--os-text-xl);
  line-height: 1.05;
  letter-spacing: -0.022em;
  color: var(--vt-ink);
}
body.vt-field h2,
body.vt-field h3,
body.vt-field .os-section-label,
body.vt-field .os-modal-title,
body.vt-field .bsl-sheet-title,
body.vt-field .bsl-section-title,
body.vt-field .os-panel-title,
body.vt-field .os-empty-title {
  font-family: var(--vt-display);
  font-stretch: 104%;
  font-weight: 540;
  letter-spacing: -0.01em;
  color: var(--vt-ink);
}
body.vt-field .os-section-label { font-size: var(--os-text-lg); line-height: 1.2; padding-top: 0; }
body.vt-field .os-modal-title { font-size: 1.375rem; line-height: 1.2; }
body.vt-field .os-page-sub,
body.vt-field .os-section-hint { color: var(--vt-ink-2); }

body.vt-field code,
body.vt-field pre,
body.vt-field kbd,
body.vt-field .os-mono,
body.vt-field .vt-ns,
body.vt-field .vt-branch,
body.vt-field .vt-mono { font-family: var(--vt-mono); letter-spacing: 0; font-stretch: 100%; }

/* Sentence case everywhere: the OS's small caps labels are set back. */
body.vt-field .os-table th,
body.vt-field .os-dl dt,
body.vt-field .os-overline,
body.vt-field .os-stat-label,
body.vt-field .os-score-label,
body.vt-field .os-palette-group,
body.vt-field .os-badge-upper,
body.vt-field .vt-ws-pane-title {
  text-transform: none;
  letter-spacing: 0;
}
body.vt-field .os-table th { font-size: var(--os-text-xs); font-weight: 400; color: var(--vt-ink-3); background: transparent; }
body.vt-field .os-dl dt,
body.vt-field .vt-ws-pane-title { font-size: var(--os-text-xs); font-weight: 400; color: var(--vt-ink-3); }

/* ---------- 5. Controls -------------------------------------------------- */

body.vt-field :focus-visible {
  outline: 2px dashed var(--vt-signal);
  outline-offset: 3px;
  border-radius: 0;
}

/* Buttons: the site's. Outline by default; one primary a view, filled ink. */
body.vt-field .os-btn,
body.vt-field .bsl-btn {
  border-radius: 2px;
  border: 1px solid var(--vt-line-2);
  background: transparent;
  color: var(--vt-ink);
  font-family: var(--vt-body);
  font-weight: 400;
  min-height: 2.5rem;
  padding-inline: 1rem;
  transition: background-color 160ms var(--vt-ease), border-color 160ms var(--vt-ease), color 160ms var(--vt-ease);
}
body.vt-field .os-btn:hover,
body.vt-field .bsl-btn:hover { border-color: var(--vt-ink); background: transparent; }
body.vt-field .os-btn-sm { min-height: 2.125rem; padding-inline: 0.75rem; }
body.vt-field .os-btn-primary,
body.vt-field .bsl-btn-primary,
body.vt-field a.os-btn-primary {
  background: var(--vt-ink);
  border-color: var(--vt-ink);
  color: var(--vt-field) !important;
  font-weight: 700;
}
body.vt-field .os-btn-primary:hover,
body.vt-field .bsl-btn-primary:hover { background: #ffffff; border-color: #ffffff; filter: none; }
body.vt-field .os-btn-quiet,
body.vt-field .bsl-btn-quiet { border-color: transparent; color: var(--vt-ink-2); }
body.vt-field .os-btn-quiet:hover,
body.vt-field .bsl-btn-quiet:hover { border-color: transparent; color: var(--vt-ink); background: var(--os-fill); }
body.vt-field .os-btn-danger,
body.vt-field a.os-btn-danger { color: var(--vt-error); border-color: rgba(255, 179, 168, 0.5); }
body.vt-field .os-btn-danger:hover { border-color: var(--vt-error); background: var(--os-danger-wash); }
body.vt-field .os-btn:disabled,
body.vt-field .os-btn[aria-disabled='true'] { opacity: 0.55; cursor: default; }
body.vt-field .os-btn-icon { padding-inline: 0; min-width: 2.25rem; }

body.vt-field .os-input,
body.vt-field .os-select,
body.vt-field .os-textarea {
  background-color: var(--vt-well);
  border: 1px solid var(--vt-control);
  border-radius: 2px;
  color: var(--vt-ink);
  font-size: 1rem; /* 16px: no zoom on iOS */
  min-height: 2.75rem;
  padding-inline: 0.875rem;
}
body.vt-field .os-input::placeholder,
body.vt-field .os-textarea::placeholder { color: var(--vt-placeholder); }
body.vt-field .os-input:focus,
body.vt-field .os-select:focus,
body.vt-field .os-textarea:focus { border-color: var(--vt-signal); }
body.vt-field .os-input:focus-visible,
body.vt-field .os-select:focus-visible,
body.vt-field .os-textarea:focus-visible { outline: 1px solid var(--vt-signal); outline-offset: 0; }
body.vt-field .os-label { font-size: var(--os-text-sm); font-weight: 400; color: var(--vt-ink-2); }
body.vt-field input[type='checkbox'],
body.vt-field input[type='radio'] { accent-color: var(--vt-ink); }

/* Badges: square and quiet, data stays legible */
body.vt-field .os-badge,
body.vt-field .os-pill,
body.vt-field .bsl-badge { border-radius: 2px; }

/* ---------- 6. Surfaces -------------------------------------------------- */

/* Two levels, as on the site: the field and solid panels with a hairline.
   No radius on panels, no shadows, no glass. */
body.vt-field .os-card,
body.vt-field .os-panel,
body.vt-field .bsl-panel,
body.vt-field .os-table-wrap,
body.vt-field .os-notice {
  background: var(--vt-deep);
  border: 1px solid var(--vt-line);
  border-radius: 0;
  box-shadow: none;
}
body.vt-field .os-card-title { font-weight: 700; color: var(--vt-ink); }
body.vt-field .os-card-meta { color: var(--vt-ink-2); }
body.vt-field .os-table td { border-color: var(--vt-line); }
body.vt-field .os-table tbody tr:hover td { background: rgba(196, 214, 255, 0.03); }

body.vt-field .os-modal-backdrop,
body.vt-field .vt-modal-backdrop {
  background: rgba(1, 3, 8, 0.72);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body.vt-field .os-modal-panel {
  background: var(--vt-deep);
  border: 1px solid var(--vt-line-2);
  border-radius: 0;
  box-shadow: none;
  padding: 1.5rem;
}

body.vt-field .os-empty {
  border: 1px dashed var(--vt-line-2);
  border-radius: 0;
  color: var(--vt-ink-2);
  background: transparent;
}
body.vt-field .os-error {
  border-radius: 0;
  border: 1px solid rgba(255, 179, 168, 0.4);
  border-left: 2px solid var(--vt-error);
  background: var(--vt-deep);
}

/* The shell's floating parts, solid */
body.vt-field .bsl-palette,
body.vt-field .bsl-sheet,
body.vt-field .bsl-toast {
  background: var(--vt-deep);
  border: 1px solid var(--vt-line-2);
  border-radius: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body.vt-field .bsl-toast { border-left: 2px solid var(--vt-ink-3); }
body.vt-field .bsl-toast[data-variant='success'] { border-left-color: var(--vt-ok); }
body.vt-field .bsl-toast[data-variant='error'] { border-left-color: var(--vt-error); }
body.vt-field .bsl-toast[data-variant='warn'] { border-left-color: var(--vt-amber); }
body.vt-field .bsl-toast-mark { display: none; }
body.vt-field .bsl-palette-item,
body.vt-field .bsl-kbd { border-radius: 0; }
body.vt-field .bsl-kbd { font-family: var(--vt-mono); border-color: var(--vt-line-2); color: var(--vt-ink-3); }
body.vt-field .os-toast {
  background: var(--vt-deep);
  border: 1px solid var(--vt-line-2);
  border-radius: 0;
  box-shadow: none;
}

/* ---------- 7. Selection: the dashed annotation box ---------------------- */

/* The map's answer box, used for what is selected in a list: a dashed
   hairline with a small square on its corner, the signal square for the
   one that is current. The same language as the docs index on the site. */
body.vt-field .vt-annot,
body.vt-field .bsl-rail-link[aria-current='page'],
body.vt-field .os-tab[aria-selected='true'],
body.vt-field .vt-ws-ctx-tab[aria-selected='true'],
body.vt-field .vt-ws-tab.is-active,
body.vt-field .vt-ws-session.is-active,
body.vt-field .project-item.is-active > .vt-ws-project-row,
body.vt-field .vt-finder-item.is-selected,
body.vt-field .bsl-palette-item[aria-selected='true'],
body.vt-field .os-palette-item.is-active,
body.vt-field .vt-choice:has(input:checked),
body.vt-field .os-chip input:checked + .os-chip-face,
body.vt-field .os-segment-option input:checked + span {
  outline: 1px dashed var(--vt-annot-line);
  outline-offset: -1px;
  border-radius: 0;
  box-shadow: none;
  background-color: rgba(196, 214, 255, 0.04);
  background-image: linear-gradient(var(--vt-signal), var(--vt-signal));
  background-size: 6px 6px;
  background-position: 0 0;
  background-repeat: no-repeat;
  color: var(--vt-ink);
}
/* Keyboard focus on a selected item: the focus ring wins, offset outside. */
body.vt-field .bsl-rail-link[aria-current='page']:focus-visible,
body.vt-field .os-tab[aria-selected='true']:focus-visible,
body.vt-field .vt-ws-tab.is-active:focus-visible,
body.vt-field .vt-ws-session.is-active:focus-visible {
  outline: 2px dashed var(--vt-signal);
  outline-offset: 2px;
}
/* An annotation tag under a box: real data, set in mono */
.vt-annot-tag {
  display: inline-grid;
  gap: 2px;
  padding: 6px 10px 7px;
  background: rgba(3, 7, 14, 0.86);
  font: 12px/1.3 var(--vt-mono);
  color: var(--vt-ink);
}
.vt-annot-tag span + span { color: var(--vt-ink-2); }

/* ---------- 8. The terrain ------------------------------------------------ */

/* The rendered frame of the demo terrain (frontend/public/_vt/map-still.jpg,
   copied to static/img). Used faint, as ground under a page head or an
   empty state, never as decoration on a panel. */
.vt-terrain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--vt-field) url('../img/map-still.jpg') center 58% / cover no-repeat;
}
.vt-terrain::after {
  /* fade into the field on every side, so it reads as distance */
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--vt-field) 0%, rgba(3, 7, 14, 0.82) 38%, rgba(3, 7, 14, 0.25) 100%),
    linear-gradient(0deg, var(--vt-field) 0%, rgba(3, 7, 14, 0) 45%);
}
.vt-terrain-caption {
  position: absolute;
  right: 1.5rem;
  bottom: 1rem;
  font: 12px/1.4 var(--vt-mono);
  color: var(--vt-ink-3);
  text-align: right;
}

/* ---------- 9. Reduced motion ---------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  body.vt-field *,
  body.vt-field *::before,
  body.vt-field *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
@media (forced-colors: active) {
  body.vt-field::after { display: none; }
}

/* A heading inside a panel is a label for its row, not a title: the body
   face, like the panel's other row names. */
body.vt-field .os-card h3,
body.vt-field .os-card h4 {
  font-family: var(--vt-body);
  font-stretch: 100%;
  font-weight: 700;
  font-size: var(--os-text-md);
  letter-spacing: 0;
}
