/* Specials overlay (ADR 0017). Reuses the app's design tokens (styles.css
   :root) and follows the Research Explorer's overlay grammar under an sx-*
   namespace, so the two full-page surfaces never share a selector.
   The launcher button itself lives in styles.css, beside .mode-switch, because
   it is composer chrome. */

.sx-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--ink);
  display: none;
  overflow: hidden;
}
/* A full-page takeover fades rather than slides, for the reason the Explorer's
   does: there is no smaller surface for it to have come from. Same 0.18s. */
.sx-overlay.visible { display: block; animation: sx-enter 0.18s ease both; }
@keyframes sx-enter { from { opacity: 0; } }
body.sx-open { overflow: hidden; }

.sx-close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.sx-close:hover { color: var(--text); background: var(--panel-2); }

/* 56rem is the Explorer's own column — the established width for a full-page
   surface that has left the 42rem reading column. Not a new number. */
.sx-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 3.2rem clamp(1.1rem, 5vw, 3rem) 4rem;
  max-width: 56rem;
  margin: 0 auto;
}

.sx-header { margin-bottom: 2rem; }

.sx-eyebrow {
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  text-transform: uppercase;
  color: var(--gold);
}
/* rem in the middle term, like the chat hero and the Explorer's topic: a
   viewport-only clamp is deaf to the reader's own default text size. */
.sx-title,
.sx-work-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 0.75rem + 2vw, 2.15rem);
  line-height: 1.15;
  color: var(--text);
  margin: 0.5rem 0 0;
  text-wrap: balance;
}
.sx-title:focus-visible,
.sx-work-title:focus-visible { outline-offset: 4px; }

.sx-lede {
  max-width: var(--measure);
  margin: 0.9rem 0 0;
  font: 400 var(--ui-md)/1.6 var(--font-ui);
  color: var(--muted);
  text-wrap: pretty;
}

/* auto-fill, so the grid answers the window rather than a breakpoint list, and
   a single registered special does not stretch to fill the row. */
.sx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  gap: 12px;
}

.sx-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.sx-card:hover { background: var(--panel-2); border-color: var(--line); }
/* Not a disabled control — not a control. It recedes to the ground it sits on
   and stops answering the pointer, which is the whole of its disabled state. */
.sx-card.is-soon {
  background: rgba(30, 37, 49, 0.5);
  border-color: var(--line-soft);
  cursor: default;
}

.sx-card-name {
  margin: 0;
  font: 600 var(--ui-md)/1.3 var(--font-ui);
  color: var(--text);
}
.sx-card.is-soon .sx-card-name { color: var(--text-soft); }

.sx-card-tagline {
  margin: 0;
  font: 400 var(--ui)/1.5 var(--font-ui);
  color: var(--muted);
  text-wrap: pretty;
}

/* The system's container for absence, at label scale: a special that has not
   shipped is a gap, not a fault. No voice hue (they name speakers), no Signal
   Rose-Red (nothing failed), no second gold surface. */
.sx-card-soon {
  margin-top: 0.35rem;
  padding: 3px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  text-transform: uppercase;
  color: var(--faint);
}

.sx-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 24px;
  margin-bottom: 1.2rem;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 500 var(--ui-sm)/1 var(--font-ui);
  cursor: pointer;
}
.sx-back:hover { color: var(--text); background: var(--panel); }

/* Full width inside the overlay's column: a workspace owns its own layout, and
   this is only the ground it is handed. */
.sx-mount { margin-top: 1.6rem; }

/* Inline note, not an error bubble: a special that could not be fetched is the
   same fail-open absence as a research angle that dropped. */
.sx-note {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(30, 37, 49, 0.5);
  font: 400 var(--ui-md)/1.6 var(--font-ui);
  color: var(--muted);
  text-wrap: pretty;
}
.sx-note p { margin: 0; }

.sx-empty {
  margin: 0;
  font: 400 var(--ui-md)/1.6 var(--font-ui);
  color: var(--faint);
}

@media (max-width: 640px) {
  .sx-scroll { padding-top: 4rem; } /* clear the close button on a narrow row */
}

/* ---------------------------------------------------------------------------
   UC PIQ Workspace (specials/uc-piq.js). A special owns its own layout; these
   are its styles, kept in this file because there is one special and a second
   stylesheet per workspace would be a loader for no gain. Every value is an
   existing token — this surface introduces no new colours and no new type.
   --------------------------------------------------------------------------- */

.piq-intro {
  max-width: var(--measure);
  margin: 0 0 1.8rem;
  font: 400 var(--ui-md)/1.6 var(--font-ui);
  color: var(--muted);
  text-wrap: pretty;
}
.piq-intro strong { color: var(--text-soft); font-weight: 600; }

.piq-loading {
  margin: 0;
  font: 400 var(--ui-md)/1.6 var(--font-ui);
  color: var(--faint);
}

.piq-questions { display: flex; flex-direction: column; gap: 12px; }

/* Unchosen questions stay fully legible — the student is reading all eight to
   decide. Choosing marks the card, it does not dim the other seven. */
.piq-q {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(30, 37, 49, 0.5);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.piq-q.is-chosen { border-color: var(--line); background: var(--panel); }

.piq-q-head { display: flex; align-items: center; gap: 0.6rem; }

.piq-pick {
  flex: none;
  width: 17px;
  height: 17px;
  accent-color: var(--gold);
  cursor: pointer;
}

.piq-q-label {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
  cursor: pointer;
  min-height: 24px;
}
.piq-q-num {
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  text-transform: uppercase;
  color: var(--gold);
}
.piq-q-short { font: 600 var(--ui-md)/1.3 var(--font-ui); color: var(--text); }

.piq-q-text {
  max-width: var(--measure);
  margin: 0.6rem 0 0.9rem;
  font: 400 var(--ui)/1.55 var(--font-ui);
  color: var(--muted);
  text-wrap: pretty;
}

.piq-area {
  display: block;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--ink);
  color: var(--text);
  font: 400 var(--ui-md)/1.65 var(--font-ui);
  resize: vertical;
}
.piq-area:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.piq-q-meta { display: flex; justify-content: flex-end; margin-top: 0.45rem; }

.piq-count {
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  color: var(--faint);
}
/* Over the limit is a fact UC will enforce, so it gets the system's one signal
   colour — this is the single place on the surface that earns it. */
.piq-count.is-over { color: var(--red); }

.piq-foot {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line-soft);
}

.piq-submit {
  min-height: 38px;
  padding: 0 1.15rem;
  border: 1px solid var(--gold);
  border-radius: 9px;
  background: var(--gold);
  color: var(--ink);
  font: 600 var(--ui-md)/1 var(--font-ui);
  cursor: pointer;
}
.piq-submit:hover:not(:disabled) { filter: brightness(1.06); }
.piq-submit:disabled {
  background: none;
  border-color: var(--line-soft);
  color: var(--faint);
  cursor: not-allowed;
}

.piq-credits, .piq-save {
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  text-transform: uppercase;
  color: var(--faint);
}
.piq-credits.is-out { color: var(--text-soft); }

/* Why submit is unavailable, stated rather than implied by a greyed control.
   Sentence case — it is a sentence, not a label. */
.piq-why {
  font: 400 var(--ui)/1.5 var(--font-ui);
  color: var(--text-soft);
}
.piq-save.is-error { color: var(--red); text-transform: none; letter-spacing: normal; }

/* The blocked-submit reason: absence vocabulary, full width so it sits above
   the button rather than squeezing into the row. */
.piq-notice {
  flex-basis: 100%;
  margin: 0 0 0.2rem;
  font: 400 var(--ui)/1.5 var(--font-ui);
  color: var(--text-soft);
}

/* ---- review run ---- */

.piq-back {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 1.2rem;
  padding: 4px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 500 var(--ui-sm)/1 var(--font-ui);
  cursor: pointer;
}
.piq-back:hover { color: var(--text); background: var(--panel); }

.piq-stage {
  margin: 0 0 1rem;
  font: 400 var(--ui-md)/1.6 var(--font-ui);
  color: var(--muted);
}

.piq-lenses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.6rem;
}

.piq-lens {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(30, 37, 49, 0.5);
}
.piq-lens.is-done { border-color: var(--line); background: var(--panel); }
.piq-lens.is-failed { opacity: 0.6; }

.piq-lens-name { font: 600 var(--ui-sm)/1.2 var(--font-ui); color: var(--text-soft); }
.piq-lens.is-done .piq-lens-name { color: var(--text); }
.piq-lens-state {
  font: var(--microlabel);
  letter-spacing: var(--microlabel-ls);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* The report is prose — it takes the reading measure, not the full 56rem. */
.piq-report {
  max-width: var(--measure);
  font: 400 var(--ui-md)/1.7 var(--font-ui);
  color: var(--text);
}
.piq-report h2 {
  margin: 2rem 0 0.7rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.3rem;
  line-height: 1.25;
  color: var(--text);
}
.piq-report h2:first-child { margin-top: 0; }
.piq-report h3 {
  margin: 1.4rem 0 0.5rem;
  font: 600 var(--ui-md)/1.3 var(--font-ui);
  color: var(--text-soft);
}
.piq-report p { margin: 0 0 1rem; text-wrap: pretty; }
.piq-report ul, .piq-report ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.piq-report li { margin-bottom: 0.4rem; }
.piq-report strong { color: var(--text); font-weight: 600; }
.piq-report blockquote {
  margin: 0 0 1rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
}
.piq-report a { color: var(--gold); }

.piq-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 1px;
  background: var(--gold);
  vertical-align: text-bottom;
  animation: piq-blink 1s steps(2) infinite;
}
@keyframes piq-blink { 50% { opacity: 0; } }

.piq-ghost-note {
  margin-bottom: 1.6rem;
  padding: 0.85rem 1.05rem;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(30, 37, 49, 0.5);
}
.piq-ghost-note p {
  margin: 0;
  font: 400 var(--ui)/1.55 var(--font-ui);
  color: var(--muted);
  text-wrap: pretty;
}

/* A failed review is a fault, so it gets the error container — unlike a
   'coming soon' card, which is an absence. */
/* Signal Rose-Red's wash + hairline grammar, never a fill — the send key keeps
   the only solid surface (styles.css :root). */
.piq-error {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--red-edge);
  border-radius: 10px;
  background: var(--red-dim);
}
.piq-error p { margin: 0; font: 400 var(--ui-md)/1.6 var(--font-ui); color: var(--red-lit); }
.piq-error-sub { margin-top: 0.4rem; font-size: var(--ui); color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .piq-caret { animation: none; }
}
