/* css/questionnaire.css — questionnaire field grid (js/qcomponents.js +
 * js/questionnaire.js render these classes). Reworked 2026-10-01 v4 S2 for
 * the premium layout (ANALYSIS #2/#7/#10): one shared renderer, one
 * equal-size 1-3 column grid for options/tiles, consistent padding scale,
 * Tomorrow titles with a gradient divider between questions. Uses the
 * shell's own tokens only — nothing here invents a new color. `.container`
 * is NOT redefined here (owned by site.css). The old index-only
 * `.widget`/`.widget__prompt`/`.widget__options`/`.choice-option` rules
 * (feedback-widget showcase on the removed index page, ANALYSIS #6) are
 * gone — the questionnaire is the only consumer of this file now.
 */

.qform-section { margin-bottom: 40px; }
.qform-section__title {
  font-family: var(--font-body); font-weight: 600; font-size: 1.15rem; margin-bottom: 16px; color: var(--fg-base);
}

/* ---------- question column ---------- */
#qform-root { max-width: 46rem; margin-inline: auto; }
#qform-root .section-lede { max-width: none; text-align: left; margin-bottom: 8px; }

.qfield {
  position: relative;
  /* symmetric rhythm: equal space above and below every divider */
  --q-gap: clamp(40px, 6vw, 72px);
  padding-block: var(--q-gap);
}
.qfield:first-child { padding-top: 0; }
.qfield + .qfield::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-bright) 50%, transparent);
  opacity: .35;
}

.qfield__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 20px; /* title -> answers, same with or without hint */
}
.qfield__label {
  display: block;
  font-family: var(--font-facet);
  font-weight: 600;
  font-size: clamp(1.25rem, 1rem + 1.2vw, 1.75rem);
  line-height: 1.25;
  color: var(--fg-base);
}
.qfield__hint-link {
  font-family: var(--font-facet);
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.qfield__hint-link:hover,
.qfield__hint-link:focus-visible { color: var(--accent-bright); text-decoration: underline; }
.qfield__hint {
  display: block;
  font-size: .85rem;
  color: var(--fg-subtle);
  margin-top: -12px; /* sits 8px under the title */
  margin-bottom: 20px;
}

/* ---------- equal-size 1-3 column grid (options, tiles, url-list sub-fields) ---------- */
.qfield__options,
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(190px, (100% - 2 * 10px) / 3), 1fr));
  gap: 10px;
  align-items: stretch;
  grid-auto-rows: 1fr; /* v4 polish: every row as tall as the tallest */
}
.qoption,
.tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  height: 100%;
  /* side padding leaves room for the corner check badge */
  padding: 12px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-ice);
  color: var(--fg-base);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}
.qoption:hover,
.tile:hover { border-color: var(--accent-bright); }
.qoption--sm { min-height: 44px; font-size: .82rem; }

/* native checkbox/radio stays in the DOM (keyboard + form semantics) but is
   visually hidden — the tile itself shows the state */
.qoption input {
  position: absolute; width: 1px; height: 1px; margin: 0; padding: 0;
  opacity: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0; pointer-events: none;
}

/* corner check badge: an empty ring when idle, accent disc + white check
   when selected (radio and checkbox alike) */
.qoption::after,
.tile::after {
  content: "";
  position: absolute; top: 9px; right: 9px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised) center / 10px 10px no-repeat;
  transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}
.qoption:has(input:checked),
.tile.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.qoption:has(input:checked)::after,
.tile.is-selected::after {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.2 2.2L9.5 3.6' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* keyboard focus lands on the hidden input / the tile button — ring the tile */
.qoption:has(input:focus-visible),
.tile:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}
.tile:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .qoption, .tile, .qoption::after, .tile::after { transition: none; }
}

.url-item-field.qfield__options { margin-top: 10px; }
.url-item-field__label { display: block; font-size: .72rem; color: var(--fg-subtle); margin-top: 12px; margin-bottom: 4px; }

/* ---------- option detail fields (js/qcomponents.js renderDetailPanels) ----------
   A selected "Inne"/detail option reveals its text field full-width under the
   option grid: grid-rows 0fr -> 1fr + opacity, ease-out, so the grid never
   moves and the questions below glide down. Closed panels are
   visibility:hidden (after the collapse) so they are out of the tab order. */
.qdetail {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows 280ms cubic-bezier(.2, .7, .2, 1), opacity 200ms ease-out, visibility 0s linear 280ms;
}
.qdetail.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  transition: grid-template-rows 280ms cubic-bezier(.2, .7, .2, 1), opacity 280ms ease-out, visibility 0s;
}
/* side padding keeps the input's focus ring inside the clip */
.qdetail__clip { overflow: hidden; min-height: 0; padding-inline: 4px; margin-inline: -4px; }
.qdetail__body { padding: 16px 0 4px; }
.qdetail__label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-facet);
  font-weight: 600;
  font-size: .85rem;
  color: var(--fg-muted);
}
@media (prefers-reduced-motion: reduce) {
  .qdetail, .qdetail.is-open { transition: none; }
}

/* ---------- plain inputs ---------- */
.fp-input {
  width: 100%;
  min-height: 48px;
  background: var(--bg-ice);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--fg-base);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.fp-input::placeholder { color: var(--fg-subtle); }
.fp-input:focus-visible { border-color: var(--accent-bright); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.fp-input { resize: vertical; min-height: 5.5rem; }

/* ---------- url-list rows ---------- */
.url-list-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.url-list-row:last-of-type { border-bottom: none; margin-bottom: 0; }
.url-list-row__fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.url-list-remove {
  flex-shrink: 0;
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-subtle);
  font-size: .9rem;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.url-list-remove:hover,
.url-list-remove:focus-visible { color: var(--accent); background: var(--bg-ice); }

.url-list-add {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-subtle);
  font-family: var(--font-facet);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.url-list-add:hover:not(:disabled),
.url-list-add:focus-visible:not(:disabled) { border-color: var(--accent-bright); color: var(--accent); }
.url-list-add:disabled { opacity: .4; cursor: not-allowed; }
.url-list-add__icon { font-size: 1rem; line-height: 1; }

/* ---------- button skins (kept for compatibility; no in-form submit
   button is rendered any more, ANALYSIS #1 — the feedback bar sends) ---------- */
.btn-primary {
  background: var(--accent-deep); color: #fff; border-radius: var(--radius-z3, 18px);
  padding: 13px 28px; font-family: var(--font-facet); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; font-size: .8rem;
}
.btn-primary:hover, .btn-primary:focus-visible { background: var(--accent); }
.btn-secondary {
  background: transparent; color: var(--fg-base); border: 1px solid var(--border);
  border-radius: var(--radius-z3, 18px); padding: 13px 28px;
  font-family: var(--font-facet); font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; font-size: .8rem;
}
.btn-secondary:hover, .btn-secondary:focus-visible { border-color: var(--accent-bright); background: var(--accent-soft); color: var(--accent); }

/* textarea is inline-block by default: its baseline gap added ~7px under note questions */
.qfield textarea { display: block; }
