/* ==========================================================================
   EVAL components (brand kit). The app's primitives, drawn the way the app draws them, for the
   website. Needs css/eval-tokens.css first. Every class is .ev-*; the app's own class is named in
   each section so the two can be compared (app/css/components.css, engine.css, dark.css, signin.css,
   settings.css). Light and dark come from the tokens; the only theme rules here are the dark
   glass layers, written once for [data-theme="dark"] and once for a dark device in auto.
   Demo: components.html.
   ========================================================================== */

/* ---------- page ------------------------------------------------------- */
.ev-page {
  margin: 0; min-height: 100vh;
  font-family: var(--ev-font-body); font-size: var(--ev-fs-body); color: var(--ev-ink);
  background: var(--ev-canvas);   /* add class ev-bg (backgrounds/backgrounds.css) for the full light / Velvet background */
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
/* the star canvas from backgrounds/stars.js sits behind everything; content needs its own layer above it */
.ev-page > * { position: relative; z-index: 1; }
.ev-page > canvas#stars { z-index: 0; }

/* ---------- type ------------------------------------------------------- */
.ev-h1 { font-family: var(--ev-font-head); font-size: var(--ev-fs-h1); font-weight: 800; letter-spacing: var(--ev-ls-head); color: var(--ev-ink); margin: 0; }
.ev-h2 { font-family: var(--ev-font-head); font-size: var(--ev-fs-h2); font-weight: 800; letter-spacing: var(--ev-ls-head); color: var(--ev-ink); margin: 0; }
.ev-figure { font-family: var(--ev-font-head); font-weight: 800; letter-spacing: -1px; line-height: var(--ev-lh-tight); color: var(--ev-figure-ink); }
.ev-num { font-family: var(--ev-font-head); font-weight: 800; letter-spacing: -.1px; color: var(--ev-purple-ink); }   /* a figure inside prose (.num) */
.ev-prose { font-size: var(--ev-fs-body); line-height: var(--ev-lh-body); color: var(--ev-ink-2); }

/* ---------- buttons (app: .btn .btn-primary / .pill.lav.pill44 / .btn-ghost) ---------- */
.ev-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--ev-hit); padding: 0 20px; border-radius: var(--ev-r-pill); border: 0; cursor: pointer;
  font-family: var(--ev-font-head); font-size: var(--ev-fs-h3); font-weight: 700; letter-spacing: -.2px;
  white-space: nowrap; text-decoration: none;
  transition: transform var(--ev-dur-tap-up) var(--ev-ease);
}
.ev-btn:active { transform: translateY(2px); transition-duration: var(--ev-dur-tap-down); }
.ev-btn:focus-visible { outline: 2px solid var(--ev-purple); outline-offset: 2px; }
.ev-btn-primary { background: var(--ev-grad); color: var(--ev-on-grad); box-shadow: var(--ev-glow); }
/* secondary: the lavender action pill ("Store a sign-in ›") */
.ev-btn-secondary { background: var(--ev-lavender); color: var(--ev-purple-ink); font-family: var(--ev-font-body); font-size: 15px; padding: 0 14px 0 18px; gap: 6px; }
.ev-btn-ghost { background: var(--ev-surface-2); border: 1px solid var(--ev-line); color: var(--ev-ink-2); }
.ev-btn-round { width: var(--ev-hit); padding: 0; }
.ev-btn .ev-cv { display: flex; opacity: .85; }

/* ---------- pills (app: .pill) status is always a pill, never coloured text ---------- */
.ev-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--ev-font-body); font-size: var(--ev-fs-pill); font-weight: 700; line-height: 1;
  padding: 5px 11px; border-radius: var(--ev-r-pill); white-space: nowrap;
  background: var(--ev-plain-bg); color: var(--ev-plain-ink);
}
.ev-pill.good { background: var(--ev-good-bg); color: var(--ev-good-ink); }
.ev-pill.warn { background: var(--ev-warn-bg); color: var(--ev-warn-ink); }
.ev-pill.bad { background: var(--ev-bad-bg); color: var(--ev-bad-ink); }
.ev-pill.lav { background: var(--ev-lavender); color: var(--ev-purple-ink); }
.ev-pill.peach { background: var(--ev-peach-bg); color: var(--ev-peach-ink); }
.ev-pill.solid { background: var(--ev-grad); color: var(--ev-on-grad); }
.ev-pill.lg { font-size: var(--ev-fs-label); padding: 7px 14px; }
.ev-pill > svg { margin: -1px 0; }

/* ---------- card (app: .card; dark: dark.css glass) ---------- */
.ev-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: var(--ev-space-4) var(--ev-space-5); border-radius: var(--ev-r);
  background-color: var(--ev-card-fill); background-image: var(--ev-card-image);
  border: 1px solid var(--ev-card-border); box-shadow: var(--ev-card-shadow);
  -webkit-backdrop-filter: var(--ev-card-blur); backdrop-filter: var(--ev-card-blur);
}
.ev-card-head { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.ev-card-head .ev-sp { flex: 1; }
/* a card inside a card, or a soft card: no glass, a quiet lift */
.ev-card .ev-card, .ev-card.soft { background: var(--ev-nested-fill); border-color: var(--ev-line-2); box-shadow: var(--ev-nested-shadow); -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ---------- assistant panel (app: .card.panel / .ask.panel) ---------- */
.ev-panel {
  display: flex; flex-direction: column; gap: 12px; padding: var(--ev-space-6); border-radius: var(--ev-r-lg);
  background-color: var(--ev-panel-fill); background-image: var(--ev-panel-image);
  border: 1px solid var(--ev-panel-border); box-shadow: var(--ev-panel-shadow);
  -webkit-backdrop-filter: var(--ev-panel-blur); backdrop-filter: var(--ev-panel-blur);
}
.ev-panel .ev-bubble { background: var(--ev-panel-bubble); border: 1px solid var(--ev-line); border-radius: var(--ev-r-md); padding: 14px 16px; font-size: var(--ev-fs-body); line-height: var(--ev-lh-body); color: var(--ev-ink-2); }
.ev-mark { width: 38px; height: 38px; border-radius: var(--ev-r-mark); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: var(--ev-grad); color: var(--ev-on-grad); box-shadow: var(--ev-glow); }

/* ---------- stat tile (app: .tile) and summary card (app: .sum) ---------- */
.ev-tile {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 12px 13px;
  border-radius: var(--ev-r-md); background-color: var(--ev-tile-fill); background-image: var(--ev-tile-image);
  border: 1px solid var(--ev-tile-border); box-shadow: var(--ev-tile-shadow);
  -webkit-backdrop-filter: var(--ev-tile-blur); backdrop-filter: var(--ev-tile-blur);
}
.ev-card .ev-tile { background: var(--ev-nested-fill); background-image: none; border-color: var(--ev-line-2); box-shadow: var(--ev-nested-shadow); -webkit-backdrop-filter: none; backdrop-filter: none; }
.ev-tile b { font-family: var(--ev-font-head); font-size: var(--ev-fs-d2); font-weight: 800; letter-spacing: -1px; line-height: var(--ev-lh-tight); color: var(--ev-figure-ink); }
.ev-tile span { font-size: var(--ev-fs-sub); font-weight: 500; color: var(--ev-muted); line-height: 1.3; }
.ev-tile > .ev-pill { align-self: flex-start; margin-top: 8px; }

/* ---------- nav pill bar (app: .navpills) ---------- */
.ev-nav {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--ev-r-pill);
  background: var(--ev-nav-track); border: 1px solid var(--ev-nav-track-border); box-shadow: var(--ev-nav-track-shadow);
  -webkit-backdrop-filter: var(--ev-glass-blur); backdrop-filter: var(--ev-glass-blur);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.ev-nav::-webkit-scrollbar { display: none; }
.ev-nav a, .ev-nav button {
  display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border: 0; border-radius: var(--ev-r-pill);
  background: transparent; cursor: pointer; text-decoration: none; white-space: nowrap; flex: 0 0 auto;
  font-family: var(--ev-font-body); font-size: 15px; font-weight: 700; color: var(--ev-muted);
  transition: color var(--ev-dur-page) var(--ev-ease), background-color var(--ev-dur-page) var(--ev-ease);
}
.ev-nav .on, .ev-nav [aria-current="page"] { background-color: var(--ev-nav-on-fill); color: var(--ev-ink); box-shadow: var(--ev-nav-on-shadow); }

/* ---------- inputs (app: .inputpill, the ask bar; .fi, a settings field) ---------- */
.ev-askbar {
  display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 8px 0 18px;
  border-radius: var(--ev-r-pill); background: var(--ev-card); border: 1.5px solid var(--ev-line-3); box-shadow: var(--ev-shadow-up);
}
.ev-askbar input { flex: 1; min-width: 0; height: 46px; border: 0; outline: none; background: none; font-family: var(--ev-font-body); font-size: var(--ev-fs-h3); font-weight: 500; color: var(--ev-ink); }
.ev-askbar input::placeholder { color: var(--ev-muted-2); }
.ev-askbar .ev-mic, .ev-askbar .ev-send { width: 44px; height: 44px; border-radius: var(--ev-r-pill); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; border: 0; cursor: pointer; }
.ev-askbar .ev-mic { color: var(--ev-muted); background: var(--ev-surface-2); border: 1px solid var(--ev-line-2); }
.ev-askbar .ev-send { background: var(--ev-grad); color: var(--ev-on-grad); box-shadow: var(--ev-glow); }
.ev-field { display: flex; flex-direction: column; gap: 6px; }
.ev-field label { font-size: var(--ev-fs-pill); font-weight: 700; color: var(--ev-muted); letter-spacing: .2px; }
.ev-input {
  width: 100%; height: 44px; padding: 0 12px; border-radius: var(--ev-r-sm); box-sizing: border-box;
  background: var(--ev-surface); border: 1px solid var(--ev-line); outline: none;
  font-family: var(--ev-font-head); font-size: var(--ev-fs-h3); font-weight: 700; letter-spacing: -.2px; color: var(--ev-ink);
  transition: border-color 160ms var(--ev-ease), background-color 160ms var(--ev-ease);
}
.ev-input:focus { border-color: var(--ev-purple); background: var(--ev-card); }
.ev-input::placeholder { color: var(--ev-muted-2); font-weight: 600; }

/* ---------- question chip (app: .chip) ---------- */
.ev-chip { display: flex; align-items: center; gap: 11px; height: 50px; padding: 0 13px; border-radius: var(--ev-r-chip); background: var(--ev-card); border: 1px solid var(--ev-line); box-shadow: var(--ev-shadow); font-size: var(--ev-fs-row); font-weight: 600; color: var(--ev-ink-2); }
.ev-chip .ev-ic { width: 28px; height: 28px; border-radius: 9px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: var(--ev-purple); background: var(--ev-lavender); }

/* ---------- avatar (app: .avatar) ---------- */
.ev-avatar { width: 26px; height: 26px; border-radius: var(--ev-r-pill); flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-family: var(--ev-font-head); font-size: var(--ev-fs-pill); font-weight: 800; letter-spacing: -.2px; color: var(--ev-on-grad); background: var(--ev-grad); }
.ev-avatar.lg { width: 38px; height: 38px; font-size: var(--ev-fs-row); }

/* ---------- bar + done box (app: .bar, .donebox) ---------- */
.ev-bar { position: relative; height: 8px; border-radius: var(--ev-r-pill); background: var(--ev-line); overflow: hidden; width: 100%; }
.ev-bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--ev-r-pill); background: var(--ev-grad-h); }
.ev-bar > i.good { background: var(--ev-green); } .ev-bar > i.warn { background: var(--ev-amber); } .ev-bar > i.bad { background: var(--ev-red); }
.ev-done { width: 40px; height: 40px; border-radius: var(--ev-r-pill); flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--ev-well-line); background: var(--ev-surface-2); color: var(--ev-on-grad); box-sizing: border-box; }
.ev-done.on { background: var(--ev-green); border-color: var(--ev-green); }

/* ---------- row (app: .row) ---------- */
.ev-row { display: flex; align-items: center; gap: 11px; min-height: 52px; padding: 8px 0; }
.ev-row + .ev-row { border-top: 1px solid var(--ev-line-2); }
.ev-row .ev-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ev-row .ev-tt { font-family: var(--ev-font-head); font-size: var(--ev-fs-h3); font-weight: 700; letter-spacing: -.25px; color: var(--ev-ink); }
.ev-row .ev-det { font-size: var(--ev-fs-sub); color: var(--ev-muted); }

/* ---------- sheet with band + pull tab (app: .curtain .band .pulltab) ----------
   No X button, ever: the pull tab, a drag, or a tap on the scrim closes it. */
.ev-sheet {
  display: flex; flex-direction: column; overflow: hidden; border-radius: var(--ev-r-xl) var(--ev-r-xl) 0 0;
  background-color: var(--ev-sheet-fill); background-image: var(--ev-sheet-image);
  border: 1px solid var(--ev-sheet-border); border-bottom: 0; box-shadow: var(--ev-shadow-sheet);
}
.ev-sheet.side { border-radius: var(--ev-r-xl); border-bottom: 1px solid var(--ev-sheet-border); }
.ev-band { position: relative; flex: 0 0 auto; height: var(--ev-band-h); padding: 0 16px; display: flex; align-items: center; gap: 10px; background: var(--ev-grad-h); }
.ev-band-title { font-family: var(--ev-font-head); font-size: 15px; font-weight: 800; letter-spacing: -.2px; color: var(--ev-on-grad); }
.ev-pulltab { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 72px; height: calc(var(--ev-band-h) + 16px); padding: 0 0 16px; border: 0; background: none; display: flex; align-items: center; justify-content: center; cursor: grab; box-sizing: border-box; }
.ev-pulltab > i { display: block; width: 48px; height: 5px; border-radius: var(--ev-r-pill); background: var(--ev-pull-tab); }
.ev-sheet-body { padding: var(--ev-space-6) var(--ev-space-7) var(--ev-space-8); display: flex; flex-direction: column; gap: 12px; }
.ev-scrim { background: var(--ev-scrim); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* ---------- chart (a bar chart in the app's series colours) ---------- */
.ev-chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; }
.ev-chart > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.ev-chart > div > i { display: block; width: 100%; border-radius: 6px 6px 3px 3px; }
.ev-chart b { font-family: var(--ev-font-head); font-size: var(--ev-fs-label); font-weight: 800; color: var(--ev-ink); }
.ev-chart span { font-size: var(--ev-fs-pill); font-weight: 600; color: var(--ev-muted); }
.ev-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }

/* ---------- dark: the figures in glass glow white ---------- */
:root[data-theme="dark"] .ev-tile b, :root[data-theme="dark"] .ev-figure { color: var(--ev-figure-ink); }
:root[data-theme="dark"] .ev-panel .ev-h1 { color: var(--ev-on-grad); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ev-panel .ev-h1 { color: var(--ev-on-grad); } }

@media (prefers-reduced-motion: reduce) { .ev-btn, .ev-nav a, .ev-nav button { transition-duration: 1ms !important; } }
