/* One Origin — styles for the three "What every human does" pages.

   Load order on these pages: scene.css, perspectives.css, commonality.css,
   theme.css, cards.css. Everything here is prefixed `cq-` so it cannot collide
   with the perspective pages, which share the rest of the shell.

   Two rules shaped this sheet. Controls are real buttons with real pressed
   states, because a diagram you cannot operate is a picture. And where a visual
   is qualitative rather than measured, its axes say so on the page. */

:root {
  --cq-line: var(--hair);
  --cq-accent: var(--clay);
  --cq-gold: var(--gold);
}

/* ------------------------------------------------------------- stat strip -- */

.cq-stats {
  list-style: none;
  margin: 1.6em 0 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--cq-line);
  border: 1px solid var(--cq-line);
}

.cq-stat {
  background: var(--void);
  padding: 1em 1.05em;
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

.cq-stat-value {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 500;
  color: var(--cq-gold);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.cq-stat-label {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--sand-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.45;
}

.cq-stat-note {
  font-size: 0.78rem;
  color: var(--sand);
  opacity: 0.8;
  margin-top: 0.4em;
  line-height: 1.5;
}

/* ------------------------------------------------------------- controls -- */

.cq-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin: 1.6em 0 0.9em 0;
  align-items: center;
}

.cq-controls-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--sand-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-right: 0.4em;
}

.cq-pill {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--sand);
  background: transparent;
  border: 1px solid var(--cq-line);
  border-radius: 2px;
  padding: 0.55em 1em;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.cq-pill:hover { border-color: var(--cq-accent); }
.cq-pill[aria-pressed="true"] {
  color: var(--void);
  background: var(--sand);
  border-color: var(--sand);
}

/* ------------------------------------------------------------ findings -- */

.cq-findings {
  list-style: none;
  margin: 1.4em 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.cq-finding {
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr);
  gap: 0.9em;
  padding: 0.95em 0;
  border-top: 1px solid var(--cq-line);
}

.cq-finding:last-child { border-bottom: 1px solid var(--cq-line); }

.cq-finding-n {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--cq-accent);
  padding-top: 0.25em;
}

.cq-finding p {
  font-size: 0.92rem;
  color: var(--sand);
  opacity: 0.88;
  max-width: 62ch;
}

/* ------------------------------------------------- contested / caveats -- */

.cq-contested-list {
  list-style: none;
  margin: 1.2em 0 0 0;
  padding: 0;
  display: grid;
  gap: 0.7em;
}

.cq-contested {
  border: 1px solid var(--cq-line);
  border-left: 2px solid var(--sand-dim);
  border-radius: 3px;
  padding: 0.9em 1.05em;
  background: var(--void-2);
}

.cq-contested-head {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  flex-wrap: wrap;
  margin-bottom: 0.4em;
}

.cq-contested-head strong { font-family: var(--serif); font-size: 0.98rem; font-weight: 500; }
.cq-contested p { font-size: 0.86rem; color: var(--sand); opacity: 0.85; max-width: 60ch; }

.cq-badge {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22em 0.5em;
  border: 1px solid currentColor;
  border-radius: 2px;
}

.cq-badge--for { color: var(--verdant); }
.cq-badge--against { color: var(--crimson); }
.cq-badge--both { color: var(--cq-gold); }
.cq-badge--revision { color: var(--cq-accent); }
.cq-badge--caution { color: var(--sand-dim); }

/* ------------------------------------------------------------ sources -- */

.cq-sources {
  margin: 1em 0 0 0;
  padding-left: 1.2em;
  font-size: 0.8rem;
  color: var(--sand-dim);
  line-height: 2;
}

.cq-sources a { color: var(--sand); }

/* ------------------------------------------------------- census (sings) -- */

.cq-census {
  border: 1px solid var(--cq-line);
  border-radius: 4px;
  padding: 1.2em;
  background: var(--void-2);
  margin-top: 1.6em;
}

.cq-census-head {
  display: flex;
  align-items: baseline;
  gap: 0.8em;
  flex-wrap: wrap;
  margin-bottom: 1em;
}

.cq-census-count {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  color: var(--verdant);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.cq-census-head span {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--sand-dim);
  letter-spacing: 0.03em;
}

.cq-census-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11px, 1fr));
  gap: 5px;
}

.cq-census-dot {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--cq-line);
  background: transparent;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity .3s ease, transform .35s ease, background .3s ease;
  transition-delay: calc(var(--i) * 5ms);
}

.cq-census.is-lit .cq-census-dot {
  opacity: 1;
  transform: scale(1);
  background: var(--verdant);
  border-color: var(--verdant);
}

.cq-census-note {
  margin-top: 1em;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--sand-dim);
  line-height: 1.6;
}

/* --------------------------------------------------------- dimensions -- */

.cq-dims { margin-top: 1.2em; display: flex; flex-direction: column; gap: 0.55em; }

.cq-dim {
  display: grid;
  grid-template-columns: minmax(90px, 130px) minmax(0, 1fr) 4.2em;
  gap: 0.8em;
  align-items: center;
}

.cq-dim-label { font-family: var(--mono); font-size: 0.72rem; color: var(--sand); }

.cq-dim-track {
  height: 9px;
  background: var(--void-2);
  border: 1px solid var(--cq-line);
  border-radius: 2px;
  overflow: hidden;
}

.cq-dim-fill {
  height: 100%;
  background: var(--cq-accent);
  transition: width .9s cubic-bezier(.2, .8, .3, 1);
}

.cq-dim-fill--rest {
  width: 100%;
  background: repeating-linear-gradient(90deg, var(--sand-dim) 0 2px, transparent 2px 6px);
  opacity: 0.5;
}

.cq-dim-value {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--cq-gold);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cq-dim--rest .cq-dim-value { color: var(--sand-dim); }

/* ------------------------------------------------------------ song types -- */

.cq-types {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
  margin-top: 1.4em;
}

@media (max-width: 720px) { .cq-types { grid-template-columns: 1fr; } }

.cq-types-stage svg { width: 100%; height: auto; display: block; }

.cq-axis { stroke: var(--sand-dim); stroke-width: 0.8; opacity: 0.6; }

.cq-axis-label {
  font-family: var(--mono);
  font-size: 6px;
  fill: var(--sand-dim);
  letter-spacing: 0.04em;
}

.cq-type-mark { cursor: pointer; opacity: 0.45; transition: opacity .25s ease; }
.cq-type-mark.is-active { opacity: 1; }
.cq-type-halo { fill: rgba(184, 94, 55, 0); transition: fill .25s ease; }
.cq-type-mark.is-active .cq-type-halo { fill: rgba(184, 94, 55, 0.16); }
.cq-type-dot { fill: var(--cq-accent); }
.cq-type-mark:not(.is-active) .cq-type-dot { fill: var(--sand-dim); }

.cq-type-label {
  font-family: var(--sans);
  font-size: 7.5px;
  fill: var(--sand);
  font-weight: 500;
}

.cq-types-buttons { display: flex; flex-wrap: wrap; gap: 0.5em; margin-bottom: 1em; }

.cq-type-btn {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--sand);
  background: transparent;
  border: 1px solid var(--cq-line);
  border-radius: 2px;
  padding: 0.55em 1em;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.cq-type-btn:hover { border-color: var(--cq-accent); }
.cq-type-btn[aria-pressed="true"] { color: var(--void); background: var(--sand); border-color: var(--sand); }

.cq-type-detail { border-left: 2px solid var(--cq-accent); padding-left: 1em; min-height: 5em; }
.cq-type-detail strong { font-family: var(--serif); font-size: 1.05rem; font-weight: 500; }
.cq-type-detail p { margin-top: 0.4em; font-size: 0.88rem; color: var(--sand); opacity: 0.86; max-width: 48ch; }

.cq-qualitative-note {
  margin-top: 0.8em;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--sand-dim);
  line-height: 1.6;
}

/* --------------------------------------------------- variance (sings) -- */

.cq-variance { margin-top: 1.6em; }
.cq-var-bar-row { display: grid; grid-template-columns: 11em minmax(0, 1fr); gap: 0.8em; align-items: center; margin-bottom: 0.5em; }
.cq-var-label { font-family: var(--mono); font-size: 0.72rem; color: var(--sand); }
.cq-var-track { height: 16px; background: var(--void-2); border: 1px solid var(--cq-line); border-radius: 2px; overflow: hidden; }

.cq-var-fill {
  height: 100%;
  background: var(--cq-accent);
  transition: width 1s cubic-bezier(.2, .8, .3, 1);
}

.cq-var-fill--between { background: var(--verdant); }

/* --------------------------------------------------------- face (face) -- */

.cq-face {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
  margin-top: 1.4em;
}

@media (max-width: 720px) { .cq-face { grid-template-columns: 1fr; } }

.cq-face-stage svg { width: 100%; height: auto; display: block; }
.cq-face-outline { fill: var(--void-2); stroke: var(--sand); stroke-width: 1.4; }
.cq-face-line { fill: none; stroke: var(--sand); stroke-width: 1.4; stroke-linecap: round; }
.cq-face-eye { fill: var(--sand); }
.cq-face-mouth { fill: none; stroke: var(--sand); stroke-width: 2.2; stroke-linecap: round; }
.cq-face-crow { fill: none; stroke: var(--cq-accent); stroke-width: 1.3; stroke-linecap: round; }
.cq-face-callout { stroke: var(--cq-accent); stroke-width: 0.8; stroke-dasharray: 3 2; }

.cq-face-callout-text {
  font-family: var(--mono);
  font-size: 6.4px;
  fill: var(--cq-accent);
  letter-spacing: 0.02em;
}

.cq-face-readout { border-left: 2px solid var(--cq-accent); padding-left: 1em; min-height: 6em; }
.cq-face-readout strong { font-family: var(--serif); font-size: 1.08rem; font-weight: 500; }
.cq-face-readout p { margin-top: 0.5em; font-size: 0.9rem; color: var(--sand); opacity: 0.86; max-width: 46ch; }

.cq-smiles {
  list-style: none;
  margin: 1.4em 0 0 0;
  padding: 0;
  display: grid;
  gap: 0.7em;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.cq-smile { border: 1px solid var(--cq-line); border-radius: 3px; padding: 0.9em 1.05em; background: var(--void-2); }
.cq-smile strong { font-family: var(--serif); font-size: 1rem; font-weight: 500; }
.cq-smile-muscle { display: block; margin-top: 0.35em; font-family: var(--mono); font-size: 0.66rem; color: var(--cq-accent); }
.cq-smile p { margin-top: 0.4em; font-size: 0.84rem; color: var(--sand); opacity: 0.85; }

/* -------------------------------------------------------- turns (turns) -- */

.cq-turns { margin-top: 1.4em; }
.cq-turns-chart svg, .cq-turns-timeline svg { width: 100%; height: auto; display: block; }

.cq-band { fill: rgba(71, 116, 94, 0.1); stroke: rgba(71, 116, 94, 0.35); stroke-width: 0.8; stroke-dasharray: 3 2; }

.cq-band-label {
  font-family: var(--mono);
  font-size: 6.4px;
  fill: var(--verdant);
  letter-spacing: 0.03em;
}

.cq-bar { fill: var(--cq-accent); }
.cq-bar-label { font-family: var(--sans); font-size: 9px; fill: var(--sand); font-weight: 500; }
.cq-bar-value { font-family: var(--mono); font-size: 8px; fill: var(--cq-gold); font-variant-numeric: tabular-nums; }

.cq-turn-q { fill: var(--sand); opacity: 0.82; }
.cq-turn-a { fill: var(--verdant); }
.cq-turn-gap { fill: rgba(184, 94, 55, 0.3); }

.cq-turn-label { font-family: var(--mono); font-size: 7.5px; fill: var(--sand-dim); letter-spacing: 0.04em; }
.cq-turn-gap-label { font-family: var(--mono); font-size: 9px; fill: var(--cq-accent); font-weight: 500; }
.cq-playhead { stroke: var(--cq-gold); stroke-width: 1.4; }

.cq-turns-readout { border-left: 2px solid var(--cq-accent); padding-left: 1em; margin-top: 1.2em; min-height: 4em; }
.cq-turns-readout strong { font-family: var(--serif); font-size: 1.05rem; font-weight: 500; }
.cq-turns-readout p { margin-top: 0.4em; font-size: 0.88rem; color: var(--sand); opacity: 0.86; }

/* ------------------------------------------------------------ section -- */

.cq-block { margin-top: 2.6em; }
.cq-block-title {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--sand-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
}

.cq-block-lede { font-size: 0.92rem; color: var(--sand); opacity: 0.86; max-width: 62ch; }

@media (prefers-reduced-motion: reduce) {
  .cq-census-dot { opacity: 1; transform: none; transition: none; }
  .cq-dim-fill, .cq-var-fill, .cq-bar { transition: none; }
}
