/*
 * The research pages fitted to the window (Scanner, Signals, Simulator,
 * Lab, Scheduler, News, a backtest; owner's request, 2026-10-17). On a wide
 * screen the inputs sit in a column on the left that stays in view, beside
 * the results, so changing an input and reading what it gives never needs
 * a scroll. A phone keeps one column, inputs first.
 */

/* The heading row: title, then what the page is about folded away. */
.fr-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-2); }
.fr-head h1 { margin: 0; font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fr-head .page-purpose { margin: 0; flex: 1 1 320px; }
.fr-about { margin: 0 0 var(--space-3); font-size: 0.8rem; color: var(--color-text-muted); max-width: 820px; }
.fr-about > summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 32px; color: var(--color-text-secondary); font-weight: 600; }
.fr-about > summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }
.fr-about p { margin: 4px 0 0; line-height: 1.5; }
.fr-about .which-tool { margin-top: 6px; }

/* Inputs on the left, results on the right. */
.fr-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.fr-split > * { min-width: 0; }
@media (min-width: 1101px) {
  .fr-split { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
  .fr-split.fr-side-wide { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
  /* The inputs stay in view beside a long result, and scroll inside themselves when they are long. */
  .fr-side { position: sticky; top: calc(var(--header-height, 56px) + var(--space-3)); max-height: calc(100dvh - var(--header-height, 56px) - var(--space-6)); overflow: auto; }
}

/* Where a result will show, before there is one. */
.fr-out:empty::before { content: attr(data-empty); display: block; padding: var(--space-4); border: 1px dashed var(--color-border); border-radius: var(--radius-md); color: var(--color-text-muted); font-size: 0.85rem; }

/* A box of cards, two to a row on a wide screen. */
.fr-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--space-4); align-items: start; }
.fr-pair > * { min-width: 0; }
@media (min-width: 1101px) {
  .fr-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fr-pair > .fr-full { grid-column: 1 / -1; }
}

/* Scheduler: the job form opens beside the jobs on a wide screen, above them on a phone. */
.fr-jobs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--space-4); align-items: start; }
.fr-jobs > * { min-width: 0; }
.fr-jobs > #job-form:empty { display: none; }
@media (min-width: 1101px) {
  .fr-jobs:has(> #job-form:not(:empty)) { grid-template-columns: minmax(0, 1fr) minmax(380px, 480px); }
  .fr-jobs > #job-form { order: 2; position: sticky; top: calc(var(--header-height, 56px) + var(--space-3)); max-height: calc(100dvh - var(--header-height, 56px) - var(--space-6)); overflow: auto; }
}

/* Scanner: on a phone, three figures to a row instead of two. */
@media (max-width: 760px) {
  .fr-scan .sc-table tr { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: var(--space-2) var(--space-3); }
  .fr-scan .sc-table tbody th { grid-column: 1 / -1; }
}

/* Touch targets on a phone. */
@media (max-width: 768px) {
  .fr-tap { min-height: 44px; }
}
