/* ==========================================================================
   Copyparty Questions — design tokens & base components
   --------------------------------------------------------------------------
   A paper/print identity: warm cream page, whiter "sheet" surfaces, dark ink,
   one restrained slate accent, a quiet red reserved for the destructive
   Reset action.

   The signature is a corner convention that encodes the app's own split:
     · STATIC surfaces (cards, panels, the response container) are soft —
       10px radius, like a physical sheet.
     · INTERACTABLE elements (buttons, inputs, tick controls) are sharp —
       0 radius, like functional controls.
   Tappable option rows sit *inside* rounded question cards, so the geometry
   reads "this block is the document; these rows are things you click."

   Type is offline-only (ADR-0004: no CDN). A humanist serif carries the
   *document* (title, question prompts); a quiet system sans carries the
   *chrome* (buttons, inputs, hints).
   ========================================================================== */

:root {
  /* -- Palette ---------------------------------------------------------- */
  --bg:        #f6f4ee; /* page: warm paper                                */
  --surface:   #fffefb; /* cards / panels: whiter sheet                    */
  --hairline:  #e4e0d6; /* borders & dividers                              */
  --ink:       #2b2a26; /* primary text (print ink, not pure black)        */
  --muted:     #8a867b; /* secondary / auxiliary text                      */
  --accent:    #4f6b7d; /* slate — selection, links, primary action        */
  --reset:     #b23b32; /* destructive (Reset) only                        */

  /* -- Accent support (derived) ----------------------------------------- */
  --accent-deep: #3d5666; /* darker slate: hover fill, accent-colored text  */
  --accent-ink:  #35485a; /* slate as text on soft-slate ground             */
  --accent-soft: #eef2f4; /* selected-row ground, very light slate          */
  --reset-soft:  #f7e9e7; /* restrained-red hover ground                    */

  /* -- Focus & shadow --------------------------------------------------- */
  --focus-ring: 0 0 0 3px rgba(79, 107, 125, 0.22);
  --shadow-card: 0 1px 2px rgba(43, 42, 38, 0.05),
                 0 2px 6px rgba(43, 42, 38, 0.04);

  /* -- Type ------------------------------------------------------------- */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino,
           "Book Antiqua", Georgia, serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica,
           Arial, sans-serif;

  --fs-xs:   0.75rem;   /* 12 — captions, eyebrows, hints                  */
  --fs-sm:   0.875rem;  /* 14 — buttons, inputs                            */
  --fs-base: 1rem;      /* 16 — body, options                              */
  --fs-md:   1.125rem;  /* 18 — question prompt                            */
  --fs-lg:   1.375rem;  /* 22 — panel / card heading                       */
  --fs-xl:   1.75rem;   /* 28 — questionnaire title                        */
  --fs-2xl:  2.25rem;   /* 36 — large entry heading                        */

  --lh-tight: 1.2;
  --lh-snug:  1.4;
  --lh-body:  1.55;
  --tracking-wide: 0.04em;

  /* -- Space & layout --------------------------------------------------- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  --content-max: 44rem; /* reading measure for the document column        */
  --page-pad:    clamp(1rem, 4vw, 2rem);

  /* -- The corner convention -------------------------------------------- */
  --r-static: 10px; /* static surfaces: cards, panels, response container */
  --r-control: 0;   /* interactables: buttons, inputs, tick controls      */
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--ink);
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent-deep);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: var(--accent);
}

::selection {
  background: rgba(79, 107, 125, 0.22);
}

/* Keyboard focus: a single crisp accent ring, matched across controls.
   Tick options are deliberately *excluded* here: the hidden .option__input
   fills the whole row, so a ring on it would wrap the entire row. Their focus
   instead lands on the control via the .option__control rule below. */
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

/* The centered document column. */
.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--page-pad);
}

/* A static sheet: rounded, hairline-bounded, whisper-shadowed. */
.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-static);
  box-shadow: var(--shadow-card);
  padding: var(--sp-6);
}

/* The response container — a static sheet that holds the loaded
   questionnaire and its questions. */
.response {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-static);
  box-shadow: var(--shadow-card);
  padding: var(--sp-6);
}

/* The "Loaded from …" source line sits under the banner, above the questions. */
.response > .hint {
  margin: 0 0 var(--sp-4);
}

.response__questions {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Typography helpers
   ========================================================================== */

/* The authored document's title. */
.qn-title {
  font-family: var(--serif);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--ink);
}

/* Small caps eyebrow / label. */
.eyebrow {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
}

.hint {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* ==========================================================================
   Buttons — interactable, so sharp (0 radius)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease,
    color 0.12s ease, box-shadow 0.12s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary: filled slate. */
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

/* Secondary: quiet sheet with hairline border. */
.btn--secondary {
  background: var(--surface);
  border-color: var(--hairline);
  color: var(--ink);
}

.btn--secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: #fff;
}

/* Restrained red (Reset): outlined, not filled — restrained by design. */
.btn--danger {
  background: var(--surface);
  border-color: var(--reset);
  color: var(--reset);
}

.btn--danger:hover:not(:disabled) {
  background: var(--reset-soft);
}

/* Small: compact controls for the top bar (Edit / Export / Reset). */
.btn--small {
  min-height: 30px;
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
}

/* ==========================================================================
   Answer top bar (Task 7) — a quiet, right-aligned cluster of controls that
   sits above the document. The title is the document's, so it is serif and
   large; the actions are the usual sharp controls, small.
   ========================================================================== */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.topbar__title {
  font-size: var(--fs-xl);
  margin: 0;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 0 auto;
}

/* Let a long title wrap rather than squeeze the actions off the line. */
.topbar__title {
  min-width: 0;
}

/* ==========================================================================
   Text inputs — interactable, so sharp (0 radius)
   ========================================================================== */

.input {
  width: 100%;
  min-height: 38px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-base);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.input::placeholder {
  color: var(--muted);
}

/* Text inputs show focus on click (convention for editable fields). */
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* ==========================================================================
   Question card — a static sheet (10px) holding the prompt + its options
   ========================================================================== */

.question {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-static);
  box-shadow: var(--shadow-card);
  padding: var(--sp-5);
}

.question + .question {
  margin-top: var(--sp-4);
}

/* The no-id non-persistence notice: a quiet inline banner above the questions. */
.banner {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-static);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.question__meta {
  margin: 0 0 var(--sp-2);
}

.question__prompt {
  font-family: var(--serif);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: var(--lh-snug);
  color: var(--ink);
}

.question__options {
  margin-top: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* ==========================================================================
   Options / tick controls
   --------------------------------------------------------------------------
   The row is a label + a visually-hidden real input (for a11y & keyboard).
   The visible control is a *square* box (multiple) or *circle* (single).
   The whole row is the hit target; the control + label carry the state.
   The row is an interactable, so it is sharp (0 radius) and nests inside
   the rounded question card above.
   ========================================================================== */

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.option:hover {
  border-color: var(--accent);
}

/* The real control: fills the row so the whole row is clickable & focusable,
   but invisible; the .option__control span below is what's seen. */
.option__input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.option__control {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid var(--hairline);
  background: var(--surface);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.option__control--square {
  border-radius: 0; /* square checkbox — multi-select */
}

.option__control--circle {
  border-radius: 50%; /* circle radio — single-select */
}

.option__label {
  font-size: var(--fs-base);
  color: var(--ink);
}

/* Selected state: accent fill + a white mark. */
.option__input:checked ~ .option__control--square,
.option__input:checked ~ .option__control--circle {
  background: var(--accent);
  border-color: var(--accent);
}

.option__input:checked ~ .option__control--square::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(0, -1px);
}

.option__input:checked ~ .option__control--circle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

/* Emphasize the chosen label. */
.option__input:checked ~ .option__label {
  color: var(--accent-ink);
  font-weight: 600;
}

/* Row-level selected state: soft-slate ground + accent border. */
.option:has(.option__input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Keyboard focus lands on the control, not the whole row. */
.option__input:focus-visible ~ .option__control {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Entry & recovery card (Answer view, Task 6)
   --------------------------------------------------------------------------
   The bare-page card and the ?q-failure card share their machinery: a URL
   row, an "or" divider, a file-picker row, and (entry only) the Create /
   Resume actions. Static card, interactable controls — the usual split.
   ========================================================================== */

/* URL field + Load/Try-again on one line. */
.entry__url-form {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.entry__url-form .input {
  flex: 1 1 auto; /* absorbs all width pressure… */
  min-width: 0;
}

/* …so the button keeps its content width and never wraps ("Try again"). */
.entry__url-form .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* A quiet "or" / "recover" divider between the primary and secondary
   load paths. */
.entry__divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-5) 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.entry__divider::before,
.entry__divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--hairline);
}

/* Secondary actions in a row: file picker, Resume. */
.entry__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* The file input lives inside its label, styled to disappear — the label
   itself is the button. */
.entry__file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* The failed ?q value, shown verbatim (word-wrapped) under the heading. */
.entry__failed-url {
  margin: 0 0 var(--sp-2);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--ink);
  word-break: break-all;
}

/* An in-place load error (invalid picked file), appended to the card. */
.entry__load-error {
  margin: var(--sp-4) 0 0;
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--reset);
}

/* Create is the card's one primary action, set slightly apart. */
.entry__create {
  margin-top: var(--sp-5);
  width: 100%;
}

/* ==========================================================================
   Editor (Task 9)
   --------------------------------------------------------------------------
   The editor reuses the answer view's static sheets (the .response container,
   the rounded .question cards) but fills the cards with *controls* — inputs,
   checkboxes, and small square buttons. The corner convention holds: the card
   is a rounded static surface; everything you type or click inside it is a
   sharp interactable. The top bar carries the document's title as an *input*
   (the one place a serif heading becomes an editable field).
   ========================================================================== */

/* --- Top bar: the title is an input, not a heading ------------------------ */

.topbar__title-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
  /* Full first row: the title is an input (it can't wrap the way the answer
     view's heading does), so give it the whole measure and let the actions
     wrap beneath. */
  flex: 1 1 100%;
}

.topbar:has(.editor__title) {
  flex-wrap: wrap;
}

.topbar:has(.editor__title) .topbar__actions {
  flex: 1 1 100%;
  justify-content: flex-end;
  margin-top: var(--sp-3);
}

/* The title input keeps the document's type (serif, large) so it still reads
   as the questionnaire's title, while the .input chrome makes it clearly
   editable. */
.editor__title {
  font-family: var(--serif);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--ink);
  min-height: 0;
  padding-top: var(--sp-1);
  padding-bottom: var(--sp-1);
}

.editor__source {
  margin-top: var(--sp-1);
}

/* The hidden file input inside the Load label (same hiding trick as the
   answer view's file picker). */
.editor__file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Question card (editor variant) --------------------------------------- */

/* The per-question controls sit top-right of the card, apart from the prompt.
   A subtle right-aligned row; the card keeps its padding, so these never
   collide with the prompt below. */
.question__controls {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-1);
  margin-bottom: var(--sp-3);
}

.question__controls .btn {
  min-height: 26px;
  padding: var(--sp-1) var(--sp-2);
}

.question__prompt-label {
  display: block;
  margin-bottom: var(--sp-1);
}

.question__prompt-input {
  width: 100%;
}

/* --- Option rows ------------------------------------------------------------ */
/* (The .question__options container is the shared answer-view rule above —
   column flex with a 0.5rem gap — so no redefinition here.) */

/* Each option is a text input + a remove control on one line. */
.editor__option-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.editor__option-input {
  flex: 1 1 auto;
  min-width: 0;
}

/* The option-remove "×": a quiet square control, the only red-adjacent thing
   in the editor besides nothing — it is a secondary control here. */
.editor__remove-option {
  flex: 0 0 auto;
  width: 34px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
}

.editor__remove-option:hover:not(:disabled) {
  color: var(--reset);
  border-color: var(--reset);
  background: var(--reset-soft);
}

.question__add-option {
  align-self: flex-start;
  margin-top: var(--sp-2);
}

/* --- Multiple-select checkbox (inside the question card) ------------------- */

.question__multiple {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-sm);
  color: var(--ink);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.question__multiple:hover {
  border-color: var(--accent);
}

/* A square checkbox (multiple), matching the answer view's tick control — but
   here it is a real visible checkbox (the row is not the label's target the
   same way; keeping it a native control is the simplest correct a11y). */
.question__multiple-input {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid var(--hairline);
  border-radius: 0; /* square — multi-select, per the app's convention */
  background: var(--surface);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.question__multiple-input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.question__multiple-input:checked::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(0, -1px);
}

.question__multiple-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.question__multiple:has(.question__multiple-input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* --- Add question + the in-place load error -------------------------------- */

.editor__add-question {
  width: 100%;
  margin-top: var(--sp-4);
}

.editor__load-error {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--reset);
  border-radius: var(--r-static);
  background: var(--reset-soft);
  color: var(--reset);
  font-size: var(--fs-sm);
}

/* ==========================================================================
   Export (Task 14) — modal + live preview
   --------------------------------------------------------------------------
   Two things, kept visually and structurally distinct:
     · The MODAL is the app's own chrome — it uses the design tokens and the
       corner convention (a rounded static sheet on a backdrop; sharp,
       interactable controls). It exists only on screen.
     · The EXPORT DOCUMENT (`.cpq-export*`) is the thing that gets rasterized.
       It must be self-contained and print-robust: solid colors from the
       palette (no gradients, no `:has()`, no inputs, no dependence on
       :checked), the same serif/sans split as the rest of the app, and a
       width that Tasks 15-16 can measure and slice. It is the one block of
       styling that will *leave the document* into a canvas — so it cannot
       lean on anything a rasterizer might drop.
   ========================================================================== */

/* --- The export document (shared by preview + rasterizers) ---------------- */
/* A "sheet" sized like a printed page. The fixed width is what html2canvas /
   jsPDF measure against in Tasks 15-16; the preview shows it at that size on
   wide screens and scrolls it on narrow ones. */

.cpq-export {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  width: 24rem;
  padding: var(--sp-6);
}

.cpq-export__title {
  font-family: var(--serif);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--ink);
  margin: 0 0 var(--sp-5);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--hairline);
}

.cpq-export__questions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.cpq-export__eyebrow {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--sp-1);
}

.cpq-export__prompt {
  font-family: var(--serif);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: var(--lh-snug);
  color: var(--ink);
  margin: 0 0 var(--sp-3);
}

.cpq-export__options {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* One option: a static control glyph + its text. Selected options carry
   `.cpq-export__option--selected` (set as a class by the builder — not via
   :checked/:has — so the mark survives rasterization faithfully). */
.cpq-export__option {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-static);
  background: var(--surface);
}

.cpq-export__control {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 2px solid var(--hairline);
  background: var(--surface);
}

.cpq-export__control--square {
  border-radius: 0;
}

.cpq-export__control--circle {
  border-radius: 50%;
}

.cpq-export__option-text {
  font-size: var(--fs-base);
  color: var(--ink);
}

/* Selected: filled accent control + a white mark, emphasized label, and a
   soft-slate row ground — the same "selected" language as the answer sheet,
   rendered with solid classes only. */
.cpq-export__option--selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cpq-export__option--selected .cpq-export__control {
  background: var(--accent);
  border-color: var(--accent);
}

.cpq-export__option--selected .cpq-export__control--square::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(0, -1px);
}

.cpq-export__option--selected .cpq-export__control--circle::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}

.cpq-export__option--selected .cpq-export__option-text {
  color: var(--accent-ink);
  font-weight: 600;
}

/* --- The modal: overlay + a rounded static sheet ------------------------- */

.export__overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  background: rgba(43, 42, 38, 0.45);
}

.export__modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 40rem;
  max-height: calc(100vh - 2.5rem);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-static);
  box-shadow: 0 8px 30px rgba(43, 42, 38, 0.22);
}

.export__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--hairline);
}

.export__title {
  font-family: var(--serif);
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--ink);
}

/* The PDF / Image format toggle: a small segmented control (interactable,
   sharp — 0 radius). The active segment is a filled slate; inactive is the
   quiet sheet. */
.export__toggle {
  display: inline-flex;
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  overflow: hidden;
}

.export__toggle-btn {
  appearance: none;
  min-height: 32px;
  padding: var(--sp-1) var(--sp-4);
  border: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.export__toggle-btn + .export__toggle-btn {
  border-left: 1px solid var(--hairline);
}

.export__toggle-btn:hover {
  background: #fff;
  color: var(--accent-deep);
}

.export__toggle-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.export__toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* The live preview: the export document on a paper-cream stage, so the
   whiter "sheet" reads as a page sitting on the page. It scrolls when the
   questionnaire is longer than the modal allows. */
.export__scroll {
  overflow: auto;
  padding: var(--sp-5);
  background: var(--bg);
}

.export__preview {
  display: flex;
  justify-content: center;
}

.export__preview .cpq-export {
  box-shadow: 0 1px 2px rgba(43, 42, 38, 0.08),
              0 3px 10px rgba(43, 42, 38, 0.06);
}

/* Footer: the standing hint (left) + Cancel / Export (right). */
.export__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--hairline);
}

.export__hint {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.export__footer-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 0 auto;
}

/* ==========================================================================
   Motion — deliberately minimal; a fast cross-fade to avoid a hard snap.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
