:root {
  --color-bg: #f7f9fb;
  --color-surface: #ffffff;
  --color-text: #1a2733;
  --color-text-muted: #4b5c6b;
  /* UAM brand colors (Pantone 281 / Pantone 340), not an arbitrary choice -
     --color-primary-dark is primary darkened ~28% (same ratio the old
     teal->its own -dark used), --color-selected is UAM's own secondary
     brand green. Contrast verified computationally, not eyeballed: white
     text on --color-primary is 13.3:1, --color-primary text on --color-bg
     is 12.6:1 (both far above the 4.5:1 AA text minimum); --color-selected
     is only ever used as an SVG fill (never text - see track-viewer.js),
     so the applicable WCAG 1.4.11 non-text threshold is 3:1, and it hits
     3.5-3.7:1 against white/--color-bg. Blue vs green also remains a
     safer pair than red/green for the most common (red-green) colorblindness. */
  --color-primary: #002d69; /* Pantone 281 */
  --color-primary-dark: #00204c;
  /* WCAG AA needs 3:1 for non-text UI boundaries (input/card borders);
     the previous #d7dee3 only hit 1.29:1 against --color-bg. Verified
     computationally, not eyeballed - see the contrast formula check
     before trusting a border color change here. */
  --color-border: #7f909c;
  --color-focus: #002d69;
  --color-selected: #00985f; /* Pantone 340 */
  --radius: 8px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --max-width: 72rem;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-2);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-1) var(--space-2);
  z-index: 100;
}

.skip-link:focus {
  left: var(--space-2);
  top: var(--space-2);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  gap: var(--space-2);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: var(--space-2);
}

.site-header nav a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.site-header nav a:hover {
  text-decoration: underline;
}

.site-header nav a[aria-current="page"] {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-primary);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.hero {
  padding: var(--space-4) 0;
}

.hero h1 {
  margin: 0 0 var(--space-2);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.hero p {
  color: var(--color-text-muted);
  max-width: 42rem;
  margin: 0 0 var(--space-3);
}

/* Plain functional rundown, replacing the old marketing-style paragraph -
   see CLAUDE.md §16's landing-page rework notes, goal 2. */
.hero-summary {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  max-width: 42rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.hero-summary li {
  color: var(--color-text-muted);
  padding-left: 1.5em;
  position: relative;
}

.hero-summary li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 700;
}

.hero-summary a {
  color: var(--color-primary);
  font-weight: 600;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.search-form input[type="text"] {
  flex: 1 1 20rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.search-form select {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--color-surface);
}

.search-form button {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.search-form button:hover {
  background: var(--color-primary-dark);
}

.xref-results {
  margin-top: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-2);
}

.xref-results dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-2);
  margin: 0;
}

.xref-results dt {
  font-weight: 600;
  color: var(--color-text-muted);
}

.xref-results dd {
  margin: 0;
}

.viewer {
  padding: var(--space-3) 0 var(--space-4);
}

.viewer p {
  color: var(--color-text-muted);
}

.track-viewer {
  margin-top: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-2);
  overflow-x: auto;
}

.track-viewer-status {
  margin: 0;
  padding: var(--space-2);
  color: var(--color-text-muted);
  text-align: center;
}

.track-viewer-status.error {
  color: #8a1f1f;
}

.track-viewer-note {
  margin: var(--space-1) 0 0;
  padding: 0 var(--space-1);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.track-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-1);
  flex-wrap: wrap;
}

.track-viewer-toolbar .track-viewer-region {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  margin-right: auto;
}

.track-viewer-toolbar button {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}

.track-viewer-toolbar button:hover {
  background: var(--color-primary);
  color: #fff;
}

.track-viewer-svg {
  display: block;
  min-width: 40rem;
}

/* Instant hover/focus preview - see track-viewer.js's _showTooltip/
   _wireFeatureInteractions. Click still opens the full .track-detail-panel
   below; this is deliberately lightweight (name + position only, no
   network fetch) so it can appear the moment the cursor lands. */
.track-hover-tip {
  position: fixed;
  z-index: 1000;
  max-width: 22rem;
  padding: 0.4rem 0.65rem;
  background: var(--color-text);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.3;
  border-radius: calc(var(--radius) / 2);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.track-ruler-line {
  stroke: var(--color-border);
  stroke-width: 1;
}

.track-ruler-tick {
  stroke: var(--color-border);
  stroke-width: 1;
}

.track-ruler-label {
  fill: var(--color-text-muted);
  font-size: 10px;
}

.track-row-label {
  fill: var(--color-text);
  font-size: 11px;
  font-weight: 600;
}

.track-ruler-label,
.track-row-label {
  user-select: none;
}

.track-feature {
  fill: var(--color-primary);
  cursor: pointer;
}

.track-feature:hover,
.track-feature:focus-visible {
  fill: var(--color-primary-dark);
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.track-feature.is-selected {
  fill: var(--color-selected);
}

.track-separator {
  stroke: var(--color-border);
  stroke-width: 1;
  opacity: 0.6;
}

/* Continuous bigWig signal tracks (kind: "signal", e.g. gnomadConstraint -
   see services/signal_track.py): bars around a zero baseline. Reuses
   --color-primary/--color-selected as the positive/negative pair rather
   than a literal red/green, for the same colorblind-accessibility reason
   --color-selected itself was chosen over red (see the :root comment above). */
.track-signal-baseline {
  stroke: var(--color-border);
  stroke-width: 1;
}

.track-signal-bar-pos {
  fill: var(--color-primary);
  cursor: pointer;
}

.track-signal-bar-neg {
  fill: var(--color-selected);
  cursor: pointer;
  opacity: 0.75;
}

.track-signal-bar-pos:hover,
.track-signal-bar-pos:focus-visible,
.track-signal-bar-neg:hover,
.track-signal-bar-neg:focus-visible {
  opacity: 1;
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

/* Shown in place of a permanently empty track's feature row - see
   track-viewer.js's _buildTrackRow. Reuses track.description, which for
   most tracks is only "context" but for a couple (DECIPHER - see
   track_data.py's _KNOWN_UNAVAILABLE_TRACKS) explains *why* the row is
   empty, which would otherwise be indistinguishable from "no data in this
   region", a normal and much more common outcome. */
.track-row-empty-note {
  fill: var(--color-text-muted);
  font-size: 10px;
  font-style: italic;
}

/* Gene-model structure: intron connector (thin line + strand chevrons),
   UTR blocks (thin), CDS blocks (thick) - the standard genePred thick/thin
   rendering convention, built from real exon/CDS data (see CLAUDE.md §16). */
.gene-intron {
  stroke: var(--color-primary);
  stroke-width: 1.5;
}

.gene-strand-arrow {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gene-exon-utr {
  fill: var(--color-primary);
  opacity: 0.55;
}

.gene-exon-cds {
  fill: var(--color-primary);
}

.track-gene-model:hover .gene-exon-cds,
.track-gene-model:focus-visible .gene-exon-cds,
.track-gene-model:hover .gene-exon-utr,
.track-gene-model:focus-visible .gene-exon-utr {
  fill: var(--color-primary-dark);
}

.track-gene-model:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.track-gene-model.is-selected .gene-exon-cds,
.track-gene-model.is-selected .gene-exon-utr {
  fill: var(--color-selected);
}

.track-detail-panel {
  margin-top: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.track-detail-panel h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  color: var(--color-primary);
}

.track-detail-position,
.track-detail-name {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.track-detail-description {
  margin: 0 0 var(--space-1);
  font-size: 0.85rem;
  color: var(--color-text);
}

.track-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.track-detail-links a {
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.85rem;
}

.track-detail-loading {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.track-detail-downloads {
  margin-top: var(--space-1);
}

.track-detail-download-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: underline dotted;
  text-underline-offset: 0.15em;
}

.track-detail-download-link::before {
  content: "⭳";
  font-weight: 400;
}

.profiles {
  padding: var(--space-4) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

/* profiles.html only - assembly filter above the grouped card list. */
.profile-assembly-toggle {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.profile-assembly-btn {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--color-primary);
  border-radius: 999px;
  background: #fff;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.profile-assembly-btn.is-active {
  background: var(--color-primary);
  color: #fff;
}

.profile-theme + .profile-theme {
  margin-top: var(--space-4);
}

.profile-theme-heading {
  margin: 0 0 var(--space-1);
  color: var(--color-text);
  font-size: 1.1rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.profile-card {
  display: block;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.profile-card:hover,
.profile-card:focus-visible {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.profile-card h3 {
  margin: 0 0 var(--space-1);
  color: var(--color-primary);
}

.profile-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.profile-card .assembly-tag {
  display: inline-block;
  margin-top: var(--space-1);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  background: #e6eaf0; /* ~10% --color-primary tinted into white */
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.loading,
.error {
  color: var(--color-text-muted);
}

.add-tracks {
  padding: var(--space-4) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.track-catalog-filter {
  display: block;
  width: 100%;
  max-width: 24rem;
  margin: var(--space-2) 0;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.track-catalog {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.track-catalog-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  padding: 0 var(--space-2);
}

.track-catalog-group summary {
  padding: var(--space-1) 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-primary);
}

.track-catalog-count {
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 0.85rem;
}

.track-catalog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.25rem var(--space-2);
  padding-bottom: var(--space-1);
}

.track-catalog-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.9rem;
  cursor: pointer;
}

.track-catalog-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-catalog-row select {
  font-size: 0.8rem;
  padding: 0.1rem 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface);
}

.track-catalog-row select:disabled {
  opacity: 0.5;
}

.galaxy {
  padding: var(--space-4) 0;
}

.galaxy-key-form {
  max-width: 28rem;
  margin: var(--space-2) 0 var(--space-3);
}

.galaxy-key-form label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.galaxy-key-form input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.galaxy-key-form .hint {
  margin: var(--space-1) 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.galaxy-workflow-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.galaxy-workflow-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-2);
  background: var(--color-surface);
}

.galaxy-workflow-card h3 {
  margin: 0 0 var(--space-1);
  color: var(--color-primary);
  font-size: 1.05rem;
}

.galaxy-workflow-card p {
  margin: 0 0 var(--space-1);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.galaxy-workflow-card .meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.galaxy-workflow-card .actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-1);
  flex-wrap: wrap;
}

.galaxy-workflow-card button {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
}

.galaxy-workflow-card button:hover {
  background: var(--color-primary);
  color: #fff;
}

.galaxy-workflow-card .status {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.site-footer {
  padding: var(--space-3) 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .profile-card {
    transition: none;
  }
}
