/*
  Vocafy-Zahlen: the owner's own measuring pages. A working tool for one person, in the app's colours.
  Every colour names where it comes from ("index.css" is the stylesheet of app.vocafy.ch, as on vocafy.ch).

  Rules of this stylesheet
  - The gradient marks only the number that leads the page, the visitors: their daily columns and the first funnel bar.
  - Alert red only where people are lost.
  - One corner radius (8px, the app's buttons; 4px on the data end of a bar). No cards, no glass, no glow.
  - Nothing moves. A refetch keeps the old numbers in place, dimmed, until the new ones arrive.
*/

@font-face {
  font-family: "Quicksand";
  src: url("quicksand-bold.ttf") format("truetype"); /* Vocafy's typeface (OFL), the file from vocafy-landing-page */
  font-weight: 700;
  font-display: swap;
}

:root {
  --ground: #0c0f15; /* index.css, body background of the app */
  --ink: #e7e7e7; /* index.css --color, the app's text colour */
  --ink-2: #aaabac; /* --ink at 72 % over --ground (vocafy.ch --ink-2), 8.3:1 */
  --ink-3: #85878b; /* --ink at 55 % over --ground, for axis text and hints: 5.2:1 */
  --line: #2b2e33; /* --ink at 14 % over --ground (vocafy.ch --line) */
  --track: #181b21; /* --ink at 6 % over --ground: the empty part of a bar */
  --cyan: #00ffc2; /* index.css --colorGreen2, start of --colorMain */
  --blue: #1b7eff; /* index.css, end of --colorMain: every bar that does not lead */
  --alert: #f75353; /* index.css --colorAlert: only losses */
  --lost: #6a2b30; /* --alert at 40 % over --ground: the lost part of a funnel bar */
  --violet: #352bc4; /* index.css --colorButton: the demo-data line, so it can never pass for a number */
  --radius: 8px; /* index.css .button */

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Quicksand", ui-rounded, var(--font);
  --gutter: 16px;
  --max: 1120px;
}
@media (min-width: 720px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font);
  caret-color: var(--cyan);
}
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 2px; }
a { color: var(--ink); text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.num, table, .fnum, .bars, .axis { font-variant-numeric: tabular-nums; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; margin: 0; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); margin-bottom: 0.75rem; }
h3 { font-size: 1.125rem; margin: 2.5rem 0 0.75rem; }
p { margin: 0 0 0.75rem; max-width: 46rem; }
.hint { color: var(--ink-2); font-size: 0.9375rem; }
.muted { color: var(--ink-3); }
.loss { color: var(--alert); }
.loading { color: var(--ink-2); }

button, input, select { font: inherit; color: inherit; }
button {
  background: var(--track);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  min-height: 40px;
}
button:hover { border-color: var(--ink-3); }
button[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.link-btn { background: none; border: 0; padding: 0.4rem 0; text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
input, select {
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  min-height: 40px;
  max-width: 100%;
}
input[type="date"] { color-scheme: dark; }
select { color-scheme: dark; }

/* Demo line: on every view, never scrolls away together with the jump bar */
.demo-line {
  margin: 0;
  max-width: none;
  background: var(--violet);
  color: #fff;
  padding: 0.5rem var(--gutter);
  font-size: 0.9375rem;
  text-align: center;
}

/* Login and service-down views */
.gate { max-width: 28rem; margin: 0 auto; padding: 18vh var(--gutter) 4rem; }
.gate-title { font-size: 2rem; margin-bottom: 0.5rem; }
.gate-lead { color: var(--ink-2); margin-bottom: 1.5rem; }
.gate-form { display: grid; gap: 0.5rem; }
.gate-form input { width: 100%; font-size: 1.125rem; }
.gate-form button { justify-self: start; margin-top: 0.5rem; background: var(--ink); color: var(--ground); border-color: var(--ink); padding: 0.5rem 1.25rem; }
.gate-msg { min-height: 1.5em; color: var(--alert); margin-top: 0.5rem; }
.gate-msg.ok { color: var(--ink-2); }

/* Header, jump bar, filters */
.top-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; padding-top: 1rem; padding-bottom: 0.5rem; }
.brand { font-size: 1.25rem; }
.top-range { margin: 0; color: var(--ink-2); flex: 1 1 12rem; }
.jump { position: sticky; top: 0; z-index: 5; background: var(--ground); border-bottom: 1px solid var(--line); }
.jump-row { display: flex; gap: 1.25rem; overflow-x: auto; scrollbar-width: none; white-space: nowrap; align-items: center; min-height: 44px; }
.jump-row::-webkit-scrollbar { display: none; }
.jump a { text-decoration: none; color: var(--ink-2); font-size: 0.9375rem; padding: 0.5rem 0; }
.jump a:hover { color: var(--ink); }
.jump-demo { background: var(--violet); color: #fff; font-size: 0.8125rem; padding: 0.15rem 0.5rem; border-radius: 4px; }

.filters { padding-top: 1rem; padding-bottom: 0.5rem; display: grid; gap: 0.75rem; }
.presets { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.own, .selects { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: end; }
.own label, .selects label { display: grid; gap: 0.2rem; font-size: 0.875rem; color: var(--ink-2); }
.selects select { min-width: 9rem; }
.filter-msg { color: var(--alert); margin: 0; min-height: 0; }
.filter-msg:empty { display: none; }

/* Sections: space and one rule line, no boxes */
.board { padding-bottom: 3rem; }
.board.is-loading > section { opacity: 0.45; }
.board > section { padding: 2.5rem 0 1rem; border-top: 1px solid var(--line); }
.board > section:first-child { border-top: 0; padding-top: 1rem; }
.empty { color: var(--ink-2); font-size: 1.0625rem; padding: 0.5rem 0 1rem; }

/* The answer */
.answer { display: grid; gap: 1.5rem; }
.lead { display: grid; gap: 0.25rem; }
.lead-num { font-size: clamp(3.5rem, 2.4rem + 5vw, 6rem); font-weight: 650; line-height: 1; letter-spacing: -0.02em; }
.lead-label { font-size: 1.25rem; }
.lead-sentence { font-size: 1.0625rem; color: var(--ink-2); max-width: 44rem; }
.figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; margin: 0; }
@media (min-width: 720px) { .figs { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.figs div { border-top: 1px solid var(--line); padding-top: 0.5rem; }
.figs dt { color: var(--ink-2); font-size: 0.9375rem; }
.figs dd { margin: 0; font-size: 1.75rem; font-weight: 600; line-height: 1.2; }
.answer + .hint { margin-top: 1.25rem; }
.figs .sub { display: block; font-size: 0.875rem; font-weight: 400; color: var(--ink-3); }

/* Charts */
.chart { position: relative; margin-top: 1rem; touch-action: pan-y; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart-title { font-size: 0.9375rem; color: var(--ink-2); margin: 0.75rem 0 0.15rem; }
.chart-title b { color: var(--ink); font-weight: 600; }
.axis { fill: var(--ink-3); font-size: 12px; }
.grid { stroke: var(--line); stroke-width: 1; }
.hl { fill: var(--ink); opacity: 0.08; }
.tip {
  position: fixed; z-index: 20; pointer-events: none;
  background: #1d2027; /* --ink at 9 % over --ground, one step above the surface */
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.5rem 0.7rem; font-size: 0.875rem; line-height: 1.45; max-width: 16rem;
  font-variant-numeric: tabular-nums;
}
.tip b { font-weight: 600; }
details.as-table { margin-top: 0.75rem; }
details.as-table summary { cursor: pointer; color: var(--ink-2); padding: 0.4rem 0; }

/* Funnel drawn to scale */
.modes { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.mode-line { color: var(--ink-2); font-size: 0.9375rem; }
.funnel { list-style: none; margin: 1rem 0 0; padding: 0; }
.fhead, .fstep { display: grid; grid-template-columns: 1fr; gap: 0.25rem; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.fhead { display: none; color: var(--ink-3); font-size: 0.8125rem; border-top: 0; padding-bottom: 0.2rem; }
.fname { font-size: 0.9375rem; }
.fbar { display: flex; height: 14px; background: var(--track); border-radius: 0 4px 4px 0; }
.fbar .b { background: var(--blue); border-radius: 0 4px 4px 0; min-width: 0; }
.fbar .b.lead { background: linear-gradient(166deg, var(--cyan), var(--blue)); }
.fbar .l { background: var(--lost); margin-left: 2px; border-radius: 0 4px 4px 0; }
.fnum { display: flex; flex-wrap: wrap; gap: 0.1rem 1rem; font-size: 0.875rem; color: var(--ink-2); }
.fnum b { color: var(--ink); font-size: 1rem; font-weight: 600; }
.fnum .k { color: var(--ink-3); }
.fstep.not-measured .fname { color: var(--ink-2); }
.fstep.not-measured .fbar { background: none; border: 1px dashed var(--line); height: 14px; } /* slop-ok: dashed outline marks a step that is not measured yet, not a gridline */
@media (min-width: 900px) {
  .fhead, .fstep { grid-template-columns: 15rem minmax(0, 1fr) 5rem 7rem 6rem 6rem; align-items: center; gap: 1rem; }
  .fhead { display: grid; }
  .fstep .fnum { display: contents; }
  .fstep .fnum > span { text-align: right; }
  .fstep .fnum .k { display: none; }
}
.losses { margin: 1.5rem 0 0; padding-left: 1.4rem; max-width: 46rem; }
.losses li { margin-bottom: 0.75rem; }
.losses li::marker { color: var(--ink-3); }

/* Tables: figures right, few lines */
.tbl-wrap { overflow-x: auto; margin: 0.5rem 0; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-weight: 500; color: var(--ink-2); font-size: 0.8125rem; vertical-align: bottom; }
td.n, th.n { text-align: right; white-space: nowrap; }
td .s { display: block; color: var(--ink-3); font-size: 0.8125rem; }
td.few { color: var(--ink-2); }
th button { background: none; border: 0; padding: 0; min-height: 0; color: inherit; font: inherit; text-align: inherit; cursor: pointer; }
th button:hover { color: var(--ink); }
th[aria-sort] button { color: var(--ink); }
th[aria-sort="descending"] button::after { content: " ▾"; }
th[aria-sort="ascending"] button::after { content: " ▴"; }
.narrow { max-width: 46rem; }
/* The source table is the widest thing here: on a wide screen it leaves the text column. */
@media (min-width: 1260px) { .tbl-wrap.breakout { margin-left: -64px; margin-right: -64px; } }
@media (min-width: 1400px) { .tbl-wrap.breakout { margin-left: -120px; margin-right: -120px; } }
.tbl-tools label.grow { flex: 1 1 16rem; }
.tbl-tools label.grow input { width: 100%; }
.sticky-col { position: sticky; left: 0; background: var(--ground); z-index: 1; }
tr.pin td:first-child { font-weight: 600; }
.tbl-tools { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: end; margin: 0.5rem 0; }
.tbl-tools label { display: grid; gap: 0.2rem; font-size: 0.875rem; color: var(--ink-2); }
.tbl-tools input[type="search"] { min-width: min(18rem, 100%); }
.tbl-count { color: var(--ink-2); font-size: 0.875rem; margin: 0; }

/* Ranked bars (splits, choices, reasons) */
.bars { list-style: none; margin: 0.25rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 0.75rem; align-items: baseline; }
.bars .bt { grid-column: 1 / -1; height: 8px; background: var(--track); border-radius: 0 4px 4px 0; display: flex; }
.bars .bt span { background: var(--blue); border-radius: 0 4px 4px 0; }
.bars .v { color: var(--ink-2); font-size: 0.875rem; white-space: nowrap; }
.splits { display: grid; gap: 1.5rem 2.5rem; grid-template-columns: 1fr; }
/* slop-ok: three-cards - three ranked bar lists (device, in-app browser, OS) side by side so the shares compare at a glance; no icons, no boxes */
@media (min-width: 900px) { .splits { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.splits h4 { margin: 0 0 0.25rem; font-size: 1rem; font-weight: 600; }

/* Onboarding */
.ob-steps { list-style: none; padding: 0; margin: 1rem 0 0; }
.ob-step { padding: 1rem 0; border-top: 1px solid var(--line); display: grid; gap: 0.5rem; }
@media (min-width: 900px) {
  .ob-step { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 2.5rem; row-gap: 0.5rem; align-items: start; }
  .ob-step > * { grid-column: 1; }
  .ob-step > .bars, .ob-step > .bars-pair, .ob-step > .hint { grid-column: 2; grid-row: 1 / span 3; }
}
.ob-step h4 { margin: 0; font-size: 1rem; font-weight: 600; }
.bars-pair .hint { margin: 0.5rem 0 0; }
.bars-pair .hint:first-child { margin-top: 0; }

/* Segmented switch for sources and funnel */
.switch { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.25rem 0 0.5rem; }

/* Export */
.dl { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.5rem 0 1rem; }
.dl a { display: inline-block; background: var(--track); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.9rem; text-decoration: none; }
.dl a:hover { border-color: var(--ink-3); }
pre { background: var(--track); border-radius: var(--radius); padding: 0.75rem; overflow-x: auto; font-size: 0.8125rem; line-height: 1.5; max-width: 100%; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

.foot { color: var(--ink-3); font-size: 0.875rem; padding-top: 1rem; padding-bottom: 2rem; border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media (forced-colors: active) { .fbar .b, .bars .bt span { background: CanvasText; } .fbar .l { background: GrayText; } }
