/* UniProt-style entry view (entry.js, protein-page.js): TOC, sections, tables. */

.entry-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.entry-toc {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0 4px;
  border-left: 1px solid var(--line);
  font-size: 13.5px;
}
.entry-toc .toc-group { margin: 0 0 10px; }
.entry-toc .toc-group[hidden], .entry-toc li[hidden] { display: none; }
.entry-toc .toc-heading { margin: 0 0 2px; padding: 0 10px 0 12px; color: var(--ink-soft); font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.entry-toc ul { margin: 0; padding: 0; list-style: none; }
.entry-toc a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-left: -1px;
  padding: 2px 10px 2px 12px;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  line-height: 1.35;
  text-decoration: none;
}
.entry-toc a:hover { color: var(--teal); text-decoration: none; }
.entry-toc a.active { color: var(--ink); border-left-color: var(--teal); font-weight: 600; }
.entry-toc .toc-count { flex: none; color: var(--ink-soft); font-size: 12.5px; font-weight: 400; font-variant-numeric: tabular-nums; }
.entry-toc .toc-select { display: none; }
.toc-end { height: 1px; }

.entry-main { min-width: 0; }

.entry-section {
  margin: 0;
  padding: 18px 0 14px;
  border: 0;
  border-radius: 0;
  background: none;
  scroll-margin-top: 12px;
}
.entry-section > h2 {
  margin: 0 0 10px;
  padding: 0 0 5px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}
.entry-sub { margin: 16px 0 6px; color: var(--ink); font-size: 15px; font-weight: 600; text-transform: none; }
.entry-sub:first-child { margin-top: 0; }
.entry-lead { margin: 0 0 6px; color: var(--ink); font-size: 15px; }
.entry-list { margin: 0; padding-left: 18px; line-height: 1.6; }
.entry-list li small { margin-left: 4px; color: var(--ink-soft); }
.entry-list.inline { display: flex; flex-wrap: wrap; gap: 2px 16px; padding-left: 0; list-style: none; }
.entry-list.inline li { padding: 0; border: 0; border-radius: 0; background: none; font-size: 13.5px; }
.entry-dl { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin: 0; }
.entry-dl dt { color: var(--ink-soft); }
.entry-dl dd { margin: 0; }

/* Evidence codes: bordered square tags, text colour carries no extra meaning. */
.ev-badge,
.ev-experimental,
.ev-phylogenetic,
.ev-author,
.ev-computational,
.ev-transfer,
.ev-electronic,
.ev-other {
  display: inline-block;
  min-width: 0;
  margin: 0 4px 2px 0;
  padding: 0 4px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  text-align: center;
  cursor: help;
}
/* Evidence class is shown by text colour (desaturated) and weight; the GO
 * legend and the help text refer to this colouring. */
.ev-experimental { color: var(--ink); border-color: var(--line-strong); font-weight: 600; }
.ev-phylogenetic, .ev-author { color: #3b5b7a; }
.ev-computational, .ev-transfer { color: var(--orange); }
.ev-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }
.ev-legend .ev-badge { margin-right: 2px; }

/* GO */
.go-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.go-filter {
  padding: 3px 10px;
  color: var(--teal);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}
.go-filter:hover:not(:disabled) { border-color: var(--teal); }
.go-filter.active,
.go-filter.active:hover:not(:disabled) { color: var(--ink); border-color: var(--teal); background: var(--teal-soft); font-weight: 600; }
.go-redundant { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--ink-soft); font-size: 13px; }
.go-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.go-column h3 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 4px;
  padding-bottom: 4px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.go-count { padding: 0; color: var(--ink-soft); border-radius: 0; background: none; font-weight: 400; font-variant-numeric: tabular-nums; }
.go-list { margin: 0; padding: 0; list-style: none; }
.go-term { padding: 5px 0; border-top: 1px solid var(--line-soft); }
.go-term:first-child { border-top: 0; }
.go-term.hidden { display: none; }
.go-term-name { color: var(--ink); font-size: 13.5px; line-height: 1.4; }
.go-term-name small a { margin-left: 4px; color: var(--ink-soft); font-size: 12px; }
.go-term-evidence { margin-top: 2px; }
.go-refs { margin-left: 4px; font-size: 12px; }
.go-refs a { margin-right: 6px; }

/* Tables */
.entry-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.entry-table th {
  padding: 6px 10px;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.entry-table td { padding: 6px 10px; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.entry-table td.num, .entry-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry-table.compact td { padding: 5px 10px; font-size: 13px; }
/* Compact key/value tables: header cell is a row label, not a column head. */
.entry-table.compact th { border-top: 0; border-bottom: 1px solid var(--line-soft); background: none; color: var(--ink-soft); font-weight: 400; }
.entry-table.compact thead th { color: var(--ink); font-weight: 600; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-soft); }

/* Feature viewer */
.fv-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-bottom: 8px; }
.entry-chip { padding: 0 5px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 2px; background: var(--surface); font-size: 12.5px; }
.feature-viewer { display: block; width: 100%; height: auto; margin: 4px 0 8px; }
.feature-viewer .fv-label { font-size: 12px; fill: var(--ink-soft); }
.feature-viewer .fv-tick { font-size: 11px; fill: var(--ink-soft); }
.feature-viewer .fv-ruler { stroke: #9aa9af; stroke-width: 1; }
.feature-viewer .fv-axis { stroke: var(--line-soft); stroke-width: 1; }
.feature-viewer rect { cursor: help; }
.feature-viewer rect:hover { opacity: 1; stroke: var(--ink); stroke-width: 1; }
.entry-sequence {
  padding: 8px 10px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}

@media (max-width: 1100px) {
  .go-grid { grid-template-columns: 1fr; }
}
/* <= 900 px: the section menu collapses into one "On this page" select. */
@media (max-width: 900px) {
  .entry-layout { display: block; }
  .entry-toc { position: sticky; top: 0; z-index: 3; max-height: none; overflow: visible; margin: 0 0 8px; padding: 6px 0; border-left: 0; border-bottom: 1px solid var(--line); background: var(--surface); }
  .entry-toc .toc-group { display: none; }
  .entry-toc .toc-select { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink-soft); font-size: 13px; }
  .entry-toc .toc-select select { flex: 1 1 auto; min-width: 0; max-width: 100%; padding: 4px 6px; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font: inherit; font-size: 14px; }
}
.entry-legacy > summary { padding: 4px 0; color: var(--teal); cursor: pointer; font-weight: 400; }
.entry-legacy[open] > summary { margin-bottom: 10px; }

/* ---------- Overview at-a-glance (glance.js): a row of plain figures ---------- */
.glance { margin-bottom: 16px; }
.glance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.glance-tile,
.glance-tile.tone-strong,
.glance-tile.tone-mid,
.glance-tile.tone-up,
.glance-tile.tone-down {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 0;
  padding: 8px 12px 8px 0;
  color: inherit;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
.glance-tile:hover:not(:disabled) { border: 0; box-shadow: none; }
.glance-tile:hover .glance-title { color: var(--teal); text-decoration: underline; }
.glance-title { color: var(--ink-soft); font-size: 12.5px; font-weight: 400; letter-spacing: 0; }
.glance-value { color: var(--ink); font-size: 18px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; word-break: break-word; }
.glance-value small { color: var(--ink-soft); font-size: 12.5px; font-weight: 400; }
.glance-na { color: var(--ink-soft); font-size: 14px; font-weight: 400; font-style: italic; }
.glance-note { color: var(--ink-soft); font-size: 12.5px; line-height: 1.4; }

.glance-stages {
  margin-top: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}
.glance-stages-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.glance-stages-head > span { color: var(--ink); font-size: 13.5px; font-weight: 600; }
.glance-stages-head small { color: var(--ink-soft); font-size: 12.5px; }
.glance-stages-head .summary-text-action { margin-left: auto; }
.stage-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.stage-cell { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 2px 6px; align-items: center; cursor: help; }
.stage-swatch { grid-column: 1 / 3; height: 8px; border-radius: 0; background: #eef2f3; }
.stage-swatch.lvl-1 { background: #e5f1ef; }
.stage-swatch.lvl-2 { background: #bfe0da; }
.stage-swatch.lvl-3 { background: #86c4b9; }
.stage-swatch.lvl-4 { background: #3f9d8f; }
.stage-swatch.lvl-5 { background: #0b6f66; }
.stage-name { overflow: hidden; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.stage-pct { color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }

.summary-flag-note { margin-top: 8px; }
.summary-flag-note > summary { color: var(--teal); cursor: pointer; font-size: 13px; }
.names-differ { color: var(--orange); }
.measure-correction { margin: 0 0 10px; border-left: 3px solid var(--orange); font-size: 13px; }
.location-conflict { margin-bottom: 12px; border-left: 3px solid var(--orange); font-size: 13.5px; line-height: 1.5; }

/* Structure panel (structure.js) */
.structure-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-bottom: 8px; }
.structure-meta a.entry-chip { color: var(--teal); text-decoration: none; }
.structure-stage { position: relative; display: flex; align-items: center; justify-content: center; height: 460px; overflow: hidden; border: 1px solid var(--line); border-radius: 0; background: var(--surface); }
.structure-canvas { position: absolute; inset: 0; }
.structure-load { padding: 6px 14px; color: var(--teal); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 13.5px; cursor: pointer; }
.structure-load:hover:not(:disabled) { border-color: var(--teal); }
.structure-load small { color: var(--ink-soft); }
.structure-load:disabled { color: var(--ink-soft); border-color: var(--line); background: var(--surface); cursor: progress; }
.structure-highlight { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; color: var(--ink-soft); font-size: 13px; }
.plddt-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.plddt-key { display: inline-block; width: 12px; height: 12px; margin-left: 6px; border-radius: 0; }
/* AlphaFold pLDDT colours are the published convention and carry meaning. */
.plddt-key.very-high, .entry-chip.plddt-very-high { color: #fff; background: #0053d6; }
.plddt-key.confident, .entry-chip.plddt-confident { background: #65cbf3; }
.plddt-key.low, .entry-chip.plddt-low { background: #ffdb13; }
.plddt-key.very-low, .entry-chip.plddt-very-low { background: #ff7d45; }
.plddt-legend .plddt-key { margin-left: 8px; }
.plddt-legend .plddt-key:first-child { margin-left: 0; }
iframe.structure-canvas { display: block; width: 100%; height: 100%; border: 0; }
