/*
 * .seq-page — the page grid of docs/plans/seq-redesign.md § The composition system, written
 * first for the three redesign compositions (§ Prerequisite) and extended by § 1 with the
 * shell it replaces. It composes the gem's layout objects and type composites:
 * a page declares nothing about type here; the h1 carries .headline-md, the subtitle
 * .body-md, a fact's dt .body-sm and its dd .body-md, in the view. No .label-* composite is
 * used anywhere on a page: the gem's labels are uppercase, and Seq sets no text in capitals
 * (Martin's review of 2026-09-24).
 *
 * Named areas, one element each:
 *   <main class="container seq-page__main" id="main">
 *     <div class="seq-page">
 *       <header class="seq-page__header stack-8">
 *         <h1 class="headline-md">Run 4123 on sample S-04</h1>
 *         <p class="seq-page__subtitle body-md">…one sentence, with links…</p>
 *       </header>
 *       <div class="seq-page__primary stack-48">…the dominant element, then h2 sections…</div>
 *       <aside class="seq-page__secondary stack-48">…identity and provenance…</aside>
 *       <div class="seq-page__wide stack-48">…the graph, the notes…</div>
 *     </div>
 *   </main>
 *
 * At 1024px and up (the gem's desktop breakpoint, repeated as a literal because a token
 * cannot be read in a media query) the columns are 2fr 1fr with --spacing-48 between them;
 * below it the grid is one column and the secondary column follows the primary in DOM order.
 * --single is the variant with no secondary column (indexes, sign-in, errors): its primary
 * column is the page's full width. The row gap is --spacing-48, the page's .stack-48; each
 * column is a .stack-48 of its own so a section is 48px from the next, and a section is a
 * .stack-24 inside.
 *
 * The page starts --spacing-48 below the gem's fixed 80px bar at 1024px and up and
 * --spacing-24 below it under 1024px (§ Spacing): .seq-page__main, the class of the layout's
 * <main class="container"> (§ 1), carries that offset as block padding, so the bar, which is
 * out of flow, covers nothing on any page, rebuilt or not; the same class closes the page
 * with --spacing-48 above the footer. At 390 and 768 the offset is 104px, at 1280 128px.
 *
 * The narrow-viewport rules of the shell live here too (§ 1 moves the navigation onto this
 * file): the gem's drawer is a flex column inside the fixed .main-nav with no height cap, and
 * the account items make it taller than a phone's viewport, so below 1024px it scrolls inside
 * itself under the 80px bar. On a coarse pointer the 121 by 28px logo lockup takes a 44px hit
 * area (03-generic/_base.css).
 *
 * The header holds no actions (rule 2 of § The composition system): a page's actions are
 * the secondary column's "Actions" block, or sit below the dominant element on a single-column
 * page, with at most one .button--filled among them.
 * A block of small buttons is a .stack-16, not .stack-12: on a coarse pointer each
 * .button--sm carries a 44px hit area (_button-seq.css), and at 12px two neighbours' meet.
 *
 * .seq-page__facts is the definition list a single record is rendered as (§ Tables are not
 * the default): one dt/dd pair per row, the dt in .body-sm above the dd in .body-md, rows
 * divided by a hairline. A value that links gets the standard 44px hit area on a coarse
 * pointer (README.md § Touch targets).
 */

/* ---------- The page's main, under the fixed bar ---------- */
.seq-page__main {
  padding-block: calc(var(--spacing-80) + var(--spacing-24)) var(--spacing-48);
}

/* Below 1024px the open drawer scrolls inside itself rather than past the viewport. */
@media (max-width: 1023px) {
  .main-nav-drawer {
    max-height: calc(100dvh - var(--spacing-80));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  /* A capped flex column shrinks its items before it scrolls; the links keep their 48px. */
  .main-nav-drawer > * {
    flex-shrink: 0;
  }
}

.seq-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "header"
    "primary"
    "secondary"
    "wide";
  gap: var(--spacing-48);
}

@media (min-width: 1024px) {
  .seq-page__main {
    padding-block-start: calc(var(--spacing-80) + var(--spacing-48));
  }
  .seq-page {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-areas:
      "header header"
      "primary secondary"
      "wide wide";
  }
  /* The secondary column is set off from the primary by a hairline, so the two columns read
     as subject and provenance rather than as two halves. */
  .seq-page__secondary {
    padding-inline-start: var(--spacing-48);
    border-inline-start: var(--stroke-weight-1) solid var(--border-subtle);
  }
}

/* --single: no secondary column at any width. Declared after the media block so it wins at
   the same specificity. */
.seq-page--single {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "header"
    "primary"
    "wide";
}

.seq-page__header    { grid-area: header; min-width: 0; }
.seq-page__primary   { grid-area: primary; min-width: 0; }
.seq-page__secondary { grid-area: secondary; min-width: 0; }
.seq-page__wide      { grid-area: wide; min-width: 0; }

.seq-page__header h1 {
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;                /* a step name such as deepvariant.run_deepvariant in a job's title breaks rather than widening a 320px page */
}

.seq-page__subtitle {
  margin: 0;
  max-width: var(--width-740);
  color: var(--text-secondary);
  overflow-wrap: anywhere;                /* an accession such as GCA_000001405.15_GRCh38_no_alt_plus_hs38d1_analysis_set breaks rather than widening a 320px page */
}
.seq-page__subtitle a {
  color: var(--text-primary);
}

/* Every reference is a link (docs/plans/seq-redesign.md § Every id is a link), so a link in a
   page is shown as one: underlined in the hairline colour, the underline taking the text colour
   on hover. Buttons and the state mark are not links in this sense. */
.seq-page a:not(.button) {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: var(--underline-offset);
}
.seq-page a:not(.button):hover {
  text-decoration-color: currentColor;
}

/* A table on a page is the gem's .admin-table in the body face, its .is-mono cells included:
   mono is for identifiers, which a cell sets in <code>. A time in a cell stays on one line. */
.seq-page .admin-table td,
.seq-page .admin-table td.is-mono {
  font-family: inherit;
}
.seq-page .admin-table time,
.seq-page .admin-table .seq-state {
  white-space: nowrap;
}
/* A run's note title beside its id (the runs index, the sample page, the configuration page)
   takes its own line under the id and a column wide enough to read; the table is inside
   .o-scroll, so the column may widen past a phone's viewport. */
.seq-page .admin-table td .seq-page__subtitle {
  display: block;
  min-width: 14rem;
}

/* ---------- Definition list for one record ---------- */
.seq-page__facts {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.seq-page__fact {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
  padding-block: var(--spacing-12);
  border-block-start: var(--stroke-weight-1) solid var(--border-subtle);
}
.seq-page__fact:last-child {
  border-block-end: var(--stroke-weight-1) solid var(--border-subtle);
}
.seq-page__fact dt {
  margin: 0;
  color: var(--text-secondary);
}
.seq-page__fact dd {
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.seq-page__fact dd a {
  color: var(--text-primary);
}
/* A value with a copy control beside it: the two on one line, the control not wrapping alone. */
.seq-page__fact dd:has(> .seq-copy) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-4);
}

/* A section's heading is 24px from its first module (the section is a .stack-24); a
   sentence that closes a section ("Choose two runs of one sample to compare.") sits 8px under
   the control it explains, as a .stack-8 in the view. */

/* ---------- Touch: a link in a fact ---------- */
@media (pointer: coarse) {
  /* inline-block: a link that wraps ("Compiled 2026-09-17 20:23 of GeneOps standard" at
     390px) stays one box that wraps inside itself, so its ::before is measured from one box
     of one or two lines rather than from the union of two fragments. */
  .seq-page__fact dd a[href] {
    position: relative;
    display: inline-block;
    margin-block: calc(var(--spacing-12) + 1px); /* two links on adjacent lines: their 44px areas meet edge to edge instead of covering each other; the pixel keeps them apart when a line sits at a fractional position */
  }
  .seq-page__fact dd a[href]::before {
    content: "";
    position: absolute;
    inset: min(0px, calc((100% - 44px) / 2));
  }
  .seq-page__fact {
    padding-block: var(--spacing-16);
  }
  /* A plain list of linked records (the artifact page's lineage): each item's link is one
     .body-md line and gets the same 44px; the item's padding keeps the areas of two
     neighbours apart. */
  .seq-page ul.body-md > li > a[href] {
    position: relative;
  }
  .seq-page ul.body-md > li > a[href]::before {
    content: "";
    position: absolute;
    inset: min(0px, calc((100% - 44px) / 2));
  }
  .seq-page ul.body-md > li {
    padding-block: var(--spacing-12);
  }
}
