/*
 * Seq base — only what geneops-brand's generic layer does not already do.
 *
 * The gem's canonical/generic layer sets border-box, margin resets on headings, paragraphs
 * and lists, `a { color: inherit }`, button and form-control inheritance, font smoothing, the
 * sticky-footer flex column on body, and body itself in --font-family-body at --font-size-16
 * on --background-base in --text-primary. None of that is repeated here. Type on a page comes
 * from the gem's composites in the markup (.headline-*, .body-*; docs/plans/seq-redesign.md
 * § Type comes from the gem's composites); this file declares type only for code.
 */

/* A fieldset's user-agent min-inline-size is min-content, so one long line in it widened the
   form, and the page, past a 320px viewport (the run configuration form); like any block it
   takes its container's width. */
fieldset {
  min-inline-size: 0;
  margin: 0;
  padding: var(--spacing-16);
  border: var(--stroke-weight-1) solid var(--border-subtle);
  border-radius: var(--corner-radius-xs);
}
legend {
  padding-inline: var(--spacing-4);
}

/* Bold is the composites' 600 (.body-md-bold, .body-sm-bold), not the user agent's 700, so an
   emphasised word inside a .body-* composite matches its -bold variant. */
b, strong {
  font-weight: var(--font-weight-600);
}

/* Mono is for identifiers and code only (a digest, a parameter name, a step name): the gem's
   mono face with tabular numerals, at the size of the text around it. */
code, kbd, samp, pre {
  font-family: var(--font-family-mono);
  font-variant-numeric: var(--numerals);
}

/* A table name, path, digest or image reference has no break opportunity; inline code breaks
   anywhere rather than widening the page on a phone. Once here, so no component restates it.
   pre is laid out by lines on purpose and scrolls instead. */
code, kbd, samp {
  overflow-wrap: anywhere;
}
/* anywhere also lowers the min-content width a table's auto layout sizes columns by, so every
   table would redistribute its columns. Code in a table cell takes the cell's wrapping instead
   (normal, or anywhere where a component sets it on the cell); a table scrolls in its .o-scroll
   (05-objects/_scroll.css). */
:is(td, th) :is(code, kbd, samp) {
  overflow-wrap: inherit;
}

/* Visible focus everywhere: a ring of --focus-ring (the text colour, _color-semantic.css)
   offset from the element. The gem defines a focus treatment only for its form controls
   (.form-input:focus, a box-shadow in the brand colour) and .input-gradient-focus, and Seq
   keeps those as the gem draws them (docs/plans/seq-redesign.md § The golden double border:
   the focus ring is the gem's, not gold); the ring here is for everything the gem leaves to the
   user agent. */
:focus-visible {
  outline: var(--stroke-weight-2) solid var(--focus-ring);
  outline-offset: 2px;
}
.form-input:focus-visible {
  outline: none;                            /* the gem's focus shadow is the control's ring */
}

/* The gem sets placeholder text in --text-tertiary (3.29:1 on the input's surface-1 fill);
   Seq's placeholders are hints beside a visible <label>, and still must be readable. */
::placeholder {
  color: var(--text-secondary);
}

/* Anchored headings land below the sticky navigation. */
:target {
  scroll-margin-top: var(--spacing-80);
}

/* ---------- Touch: 44px targets in the gem's forms and tables on a coarse pointer ----------
   docs/plans/seq-narrow-viewports.md § 5; a finger needs 44 by 44 (WCAG 2.5.5), a mouse is
   left the layout it has. Three gem classes, corrected here beside the focus rules above
   because they are gem defaults, not a Seq component (README.md § Gem overrides):
   - .form-input--sm is 36px (an input) to 38px (a select). A form control draws no
     pseudo-element, so its hit area cannot be extended without repainting it: on a coarse
     pointer it is 44px tall.
   - A link in an .admin-table cell (a td, or a th such as the timings table's run heading) is one line of data, about 18px. A transparent ::before
     inset by half the shortfall makes it at least 44 by 44 without moving the text, and a cell
     holding a link has --spacing-16 of block padding, so the area stays inside its own row
     whatever the row's height and wherever in the cell the link's line falls (at the gem's
     8px, a link on the first line of a two-line cell reached 13px into the row above). The
     link keeps to one line (runs #217 wrapped to "runs" over "#217" in a column squeezed at
     390px, and the area of a link on two lines is drawn around both), and so does a cell that
     holds a link and then a second link or a .seq-copy, which otherwise wrapped under it with
     the two areas overlapping; the table scrolls in its .o-scroll instead.
   - A checkbox or radio is 13px and cannot grow without the platform's look changing, so its
     <label> is the target: in a .form-field the label is a block with --spacing-12 of block
     padding, which puts at least 21px of label above and below the control's centre on the
     label's first line (as an inline label on two lines, or one line below a text input, it
     had less, and an area reaching past it covered the input above), and a transparent
     ::before reaching --spacing-16 before the label, where the control sits. */
@media (pointer: coarse) {
  .form-input.form-input--sm {
    min-block-size: 44px;
  }
  .admin-table :is(td, th):has(a[href]) {
    padding-block: var(--spacing-16);
  }
  .admin-table :is(td, th):has(> a[href] ~ :is(a[href], .seq-copy)) {
    white-space: nowrap;
  }
  .admin-table :is(td, th) a[href] {
    position: relative;
    white-space: nowrap;
  }
  .admin-table :is(td, th) a[href]::before {
    content: "";
    position: absolute;
    inset: min(0px, calc((100% - 44px) / 2));
  }
  /* The gem's .main-nav-brand is the 121 by 28px logo lockup (docs/plans/seq-redesign.md
     § 1); a finger gets 44 from a transparent ::after, and the bar looks the same. */
  .main-nav-brand {
    position: relative;
  }
  .main-nav-brand::after {
    content: "";
    position: absolute;
    inset: min(0px, calc((100% - 44px) / 2));
  }
  .form-field label:has(> input:is([type="checkbox"], [type="radio"])) {
    position: relative;
    display: block;
    min-block-size: 44px;                   /* a label whose text is screen-reader-only is one 13px line, in a cell 13px wide */
    min-inline-size: 44px;
    padding-block: var(--spacing-12);
  }
  .form-field label:has(> input:is([type="checkbox"], [type="radio"]))::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline: calc(-1 * var(--spacing-16)) 0;
  }
}
