/* ==========================================================================
   Glycosyltransferase Family Repository — site stylesheet
   Single stylesheet for all page types: landing, family index, gene record.
   ========================================================================== */

:root {
  --brand-dark:    #14304f;
  --brand:         #1d5b8f;
  --brand-light:   #2e7bb5;
  --brand-pale:    #eaf2f9;
  --accent:        #b8541e;
  --accent-pale:   #fdf1e8;
  /* Masthead accent for the GT-CORE wordmark. The body --accent (#b8541e) is
     tuned for dark-on-white body text and reaches only 1.07:1 against the light
     end of the masthead gradient; this amber holds 7.3:1 on --brand-dark and
     3.9:1 on --brand, clearing WCAG AA for large bold text across the gradient. */
  --brand-mark:    #ffb02e;
  --ink:           #1c2733;
  --ink-soft:      #4a5866;
  --ink-faint:     #7b8794;
  --rule:          #d3dbe3;
  --bg:            #ffffff;
  --bg-alt:        #f6f8fa;

  /* Record category colours (mirror the source spreadsheet legend) */
  --cat-model:     #ddebf7;
  --cat-nonmodel:  #fce4ec;
  --cat-low:       #e6d9f2;
  --cat-flag:      #c0392b;
  --gct-pdb:       #d4edda;
  --gct-user:      #fff3cd;

  --maxw: 1240px;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg-alt);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Masthead ---------------------------------------------------- */

.masthead {
  background: linear-gradient(100deg, var(--brand-dark) 0%, var(--brand) 62%, var(--brand-light) 100%);
  color: #fff;
  padding: 16px 24px 16px;
}
.masthead-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
/* The supplied logo is artwork on an opaque white background, so it sits on a
   white plate rather than directly on the gradient. */
.masthead .logo { flex: 0 0 auto; }
.masthead .logo a {
  display: block;
  background: #fff;
  padding: 7px 11px;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,.28);
}
.masthead .logo a:hover { box-shadow: 0 2px 7px rgba(0,0,0,.4); }
/* 96px is the smallest height at which the logo's third line ("Research,
   Education and Training") and the biofgreat.org URL stay legible. */
.masthead .logo img { display: block; height: 96px; width: auto; }
@media (max-width: 780px) {
  .masthead .logo img { height: 72px; }
}
/* Masthead type sits in three tiers: the GT-CORE wordmark, the expanded name,
   then the descriptor line. Sizes are deliberately far apart so the hierarchy
   survives being scanned rather than read. */
.masthead h1 {
  margin: 0;
  /* 2.7rem suits a bare "GT-CORE"; with a release qualifier appended the wordmark
     is ~3x longer, so it is sized to stay on one line beside the logo at common
     desktop widths. */
  font-size: 2.25rem;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: .015em;
}
.masthead h1 a {
  color: var(--brand-mark);
  /* The gradient's light end is the low-contrast case; a soft dark shadow keeps
     the wordmark crisp there without reading as a drop shadow on the dark end. */
  text-shadow: 0 1px 3px rgba(0,0,0,.38);
}
.masthead h1 a:hover { color: #ffc65c; }
.masthead .expansion {
  margin: 5px 0 0;
  font-size: 1.16rem;
  line-height: 1.25;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: .005em;
  max-width: 820px;
}
.masthead .tagline {
  margin: 5px 0 0;
  font-size: .92rem;
  color: #cfe2f2;
  max-width: 780px;
}
/* Below the logo/text flex wrap the wordmark would otherwise crowd the viewport. */
@media (max-width: 780px) {
  .masthead h1 { font-size: 1.75rem; }
  .masthead .expansion { font-size: 1.04rem; }
}

/* ---------- Primary navigation ------------------------------------------ */

.navbar { background: var(--brand-dark); border-bottom: 3px solid var(--accent); }
.navbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  padding: 0 12px;
}
.navbar a {
  display: block;
  color: #e8f1f8;
  padding: 11px 16px;
  font-size: .93rem;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
}
.navbar a:hover { background: rgba(255,255,255,.10); text-decoration: none; }
.navbar a[aria-current="page"] {
  background: rgba(255,255,255,.14);
  border-bottom-color: #fff;
}

/* ---------- Layout ------------------------------------------------------ */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 24px 60px;
}
.page {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 26px 30px 34px;
}
.breadcrumb {
  font-size: .85rem;
  color: var(--ink-faint);
  margin: 0 0 14px;
}
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb span.sep { padding: 0 6px; color: var(--rule); }

h2.page-title {
  margin: 0 0 6px;
  font-size: 1.62rem;
  color: var(--brand-dark);
  line-height: 1.25;
}
h3.section {
  margin: 30px 0 10px;
  font-size: 1.12rem;
  color: var(--brand-dark);
  border-bottom: 2px solid var(--brand-pale);
  padding-bottom: 5px;
}
h4 { margin: 18px 0 6px; font-size: 1rem; color: var(--ink); }
p.lede { font-size: 1.02rem; color: var(--ink-soft); margin-top: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Landing page cards ------------------------------------------ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 16px;
  margin: 18px 0 6px;
}
.card {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--brand-light);
  border-radius: 5px;
  padding: 14px 16px 16px;
  background: var(--bg);
}
.card h4 { margin: 0 0 6px; font-size: 1.02rem; color: var(--brand-dark); }
.card p { margin: 0; font-size: .9rem; color: var(--ink-soft); }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 20px 0 8px;
}
.stat {
  background: var(--brand-pale);
  border: 1px solid #cfe0ee;
  border-radius: 5px;
  padding: 12px 14px;
  text-align: center;
}
.stat .num { display: block; font-size: 1.7rem; font-weight: 700; color: var(--brand-dark); line-height: 1.1; }
.stat .lbl { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }

/* ---------- Family chip grid -------------------------------------------- */

.family-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.fam-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 76px;
  padding: 7px 10px 6px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--bg);
  font-size: .92rem;
  font-weight: 600;
  color: var(--brand);
}
.fam-chip .n { font-size: .72rem; font-weight: 400; color: var(--ink-faint); }
.fam-chip:hover { background: var(--brand-pale); text-decoration: none; }
.fam-chip.built { border-left: 4px solid var(--brand); }
.fam-chip.pending {
  color: var(--ink-faint);
  background: var(--bg-alt);
  border-style: dashed;
  cursor: default;
}
.fam-chip.pending:hover { background: var(--bg-alt); }

/* ---------- Tables ------------------------------------------------------- */

.table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 16px 0 10px;
  padding: 12px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: 5px;
}
.table-tools input[type="search"], .table-tools select {
  font-family: var(--sans);
  font-size: .9rem;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}
.table-tools input[type="search"] { min-width: 260px; flex: 1 1 260px; }
.table-tools label { font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.table-tools .count { font-size: .85rem; color: var(--ink-soft); margin-left: auto; }

.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: 5px; }

table.records {
  border-collapse: collapse;
  width: 100%;
  font-size: .875rem;
  background: #fff;
}
table.records thead th {
  background: var(--brand-dark);
  color: #fff;
  text-align: left;
  padding: 9px 10px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
table.records thead th.sortable { cursor: pointer; user-select: none; }
table.records thead th.sortable:hover { background: var(--brand); }
table.records thead th .arrow { opacity: .45; font-size: .7rem; margin-left: 4px; }
table.records thead th[data-dir="asc"] .arrow,
table.records thead th[data-dir="desc"] .arrow { opacity: 1; }
table.records td { padding: 7px 10px; border-top: 1px solid var(--rule); vertical-align: top; }
table.records tbody tr:hover td { background: rgba(29,91,143,.06); }
table.records td.gene { font-weight: 700; white-space: nowrap; }
table.records td.species { font-style: italic; white-space: nowrap; }
table.records td.mono { font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
table.records td.wrapcell { min-width: 260px; }

tr.cat-model    td:first-child { box-shadow: inset 4px 0 0 #6fa8dc; }
tr.cat-nonmodel td:first-child { box-shadow: inset 4px 0 0 #e39ab4; }
tr.cat-low      td:first-child { box-shadow: inset 4px 0 0 #a884d0; }

/* Detail table on record pages */
table.detail { border-collapse: collapse; width: 100%; font-size: .92rem; margin: 4px 0 8px; }
table.detail th {
  text-align: left;
  width: 220px;
  padding: 8px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  font-weight: 600;
  vertical-align: top;
}
table.detail td { padding: 8px 12px; border: 1px solid var(--rule); vertical-align: top; }
table.detail td .empty { color: var(--ink-faint); font-style: italic; }

/* ---------- Badges ------------------------------------------------------- */

.badges { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 14px; }
.badge {
  display: inline-block;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 11px;
  border: 1px solid var(--rule);
  background: var(--bg-alt);
  color: var(--ink-soft);
  white-space: nowrap;
}
.badge.fam    { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.badge.model  { background: var(--cat-model); border-color: #9bc3e2; color: #14425f; }
.badge.nonmodel { background: var(--cat-nonmodel); border-color: #e7b3c6; color: #7b2c46; }
.badge.low    { background: var(--cat-low); border-color: #c3aade; color: #4a2f6b; }
.badge.flag   { background: var(--cat-flag); border-color: var(--cat-flag); color: #fff; }
.badge.gct-pdb  { background: var(--gct-pdb); border-color: #a9d5b5; color: #1e5730; }
.badge.gct-user { background: var(--gct-user); border-color: #e6d193; color: #6b551a; }

/* ---------- Sequences --------------------------------------------------- */

.seq-block { margin: 10px 0 18px; }
.seq-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.seq-head .len { font-size: .82rem; color: var(--ink-faint); }
.seq-head .btn-row { margin-left: auto; display: flex; gap: 7px; }
.seq {
  font-family: var(--mono);
  font-size: .8rem;
  line-height: 1.65;
  letter-spacing: .055em;
  word-break: break-all;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--brand-light);
  border-radius: 4px;
  padding: 11px 13px;
  margin: 0;
  white-space: pre-wrap;
  max-height: 320px;
  overflow-y: auto;
}
.btn {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  padding: 4px 11px;
  border: 1px solid var(--brand-light);
  border-radius: 4px;
  background: #fff;
  color: var(--brand);
  cursor: pointer;
}
.btn:hover { background: var(--brand-pale); text-decoration: none; }

/* ---------- Link pills, lists, misc ------------------------------------- */

.link-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.pill {
  display: inline-block;
  font-size: .85rem;
  font-weight: 600;
  padding: 6px 13px;
  border: 1px solid var(--brand-light);
  border-radius: 15px;
  background: #fff;
  color: var(--brand);
}
.pill:hover { background: var(--brand-pale); text-decoration: none; }
.pill.ext::after { content: " \2197"; font-weight: 400; }

ul.tight { margin: 6px 0 6px 20px; padding: 0; }
ul.tight li { margin-bottom: 5px; }
ul.plain { list-style: none; margin: 6px 0; padding: 0; }
ul.plain li { margin-bottom: 4px; }

.note {
  background: var(--accent-pale);
  border-left: 4px solid var(--accent);
  padding: 11px 14px;
  border-radius: 4px;
  font-size: .9rem;
  color: #5d3316;
  margin: 16px 0;
}
/* Public-beta feedback line. Deliberately lighter than .callout-strong: it is an
   invitation to report problems, not the scope caveat, and must not compete with
   it for attention. */
.beta-note {
  margin: 14px 0 0;
  padding: 9px 14px;
  background: var(--brand-pale);
  border-left: 4px solid var(--brand-light);
  border-radius: 4px;
  font-size: .92rem;
  color: var(--ink-soft);
}

/* Scope caveat on the landing page. Weightier than .note: it carries the
   "not comprehensive" statement, which a reader must not skim past. */
.callout-strong {
  background: var(--accent-pale);
  border: 1px solid #f0c9a8;
  border-left: 5px solid var(--accent);
  border-radius: 5px;
  padding: 14px 18px;
  margin: 18px 0;
}
.callout-strong .callout-head {
  margin: 0 0 8px;
  font-size: 1.02rem;
  font-weight: 700;
  color: #8f3d12;
  line-height: 1.35;
}
.callout-strong p { margin: 0 0 8px; }
.callout-strong ol { margin: 8px 0 0; padding-left: 22px; }
.callout-strong ol li { margin: 0 0 5px; }
.callout-strong ol li:last-child { margin-bottom: 0; }

/* Model organism page: per-taxon record counts. */
.mo-table td.num, .mo-table th.num { text-align: right; width: 7.5em; }
.mo-taxon { font-size: .95rem; }
.mo-strain {
  display: block;
  font-size: .8rem;
  color: var(--ink-faint);
  margin-top: 2px;
}
/* Listed organisms with no record in the current dataset: dimmed, not hidden —
   the gap between intended sampling frame and realised coverage is itself data. */
.mo-absent td { color: var(--ink-faint); background: var(--bg-alt); }
.mo-absent .mo-taxon { font-style: normal; }

.legend-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; margin: 12px 0; }
.legend-item { display: flex; align-items: flex-start; gap: 10px; font-size: .88rem; }
.swatch { flex: 0 0 auto; width: 26px; height: 18px; border: 1px solid #9aa5b1; border-radius: 3px; margin-top: 2px; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: .9rem; }
.pager .spacer { flex: 1; }

.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 24px 44px;
  font-size: .82rem;
  color: var(--ink-faint);
}
.footer a { color: var(--ink-soft); }
.footer hr { border: 0; border-top: 1px solid var(--rule); margin: 0 0 16px; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: 14px;
}
.footer-links a {
  font-size: .88rem;
  font-weight: 600;
  color: var(--brand);
}
.footer-links a[target="_blank"]::after { content: " \2197"; font-weight: 400; }

.footer-contact {
  margin: 0 0 12px;
  font-size: .9rem;
  color: var(--ink-soft);
}
.footer-contact a { color: var(--brand); font-weight: 600; }

.footer-address {
  margin: 0 0 14px;
  font-size: .78rem;
  letter-spacing: .045em;
  line-height: 1.75;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.footer-meta { margin: 0; font-size: .78rem; color: var(--ink-faint); }

code.inline { font-family: var(--mono); font-size: .85em; background: var(--bg-alt); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--rule); }

@media print {
  .navbar, .table-tools, .btn, .pager { display: none; }
  body { background: #fff; }
  .page { border: 0; }
  /* Browsers drop the masthead gradient when printing, so the light-on-dark
     masthead text has to be re-inked for white paper. */
  .masthead { background: #fff; color: var(--ink); padding-bottom: 8px; }
  .masthead h1 a { color: var(--brand-dark); text-shadow: none; }
  .masthead .expansion { color: var(--brand-dark); }
  .masthead .tagline { color: var(--ink-soft); }
}
