/* fold.geneticker.com — overlay on the shared Geneticker theme (styles.css,
   imported verbatim from Cipher). This sheet (1) sets Fold's own accent so it
   reads as a sibling of Cipher (teal) / Decipher (indigo) / Swap (violet) /
   Locus (cyan) / Logo (mark-teal) — Fold is AMBER — and (2) adds the components
   unique to a protein-structure browser: the viewer stage, the sequence and
   topology strips, the classification grids and the variant tables.

   DARK-MODE RULE (see darkmode-token-traps): every token and every hard-coded
   accent-rgba rule is declared THREE times — light :root, explicit
   [data-theme="dark"], and the @media prefers-dark block, with the two dark
   blocks byte-identical. Add to all three or one theme path silently misses it.
   Never write a colour whose only definition lives inside a media query. */

/* ---------------------------------------------------------------- accent */
:root {
  --fold:      #b45309;   /* amber-700 — holds AA as text on white */
  --fold-h:    #92400e;   /* amber-800 */
  --fold-on:   #fff;
  --fold-soft: rgba(180,83,9,.10);
  --fold-line: rgba(180,83,9,.40);
  --teal:      #b45309;   /* remap the family accent so brand/eyebrow/.btn-teal inherit amber */
  --teal-h:    #92400e;
  --indigo:    #4f46e5;
  --plum:      #7c3aed;
  --stage-bg:  #eceff3;   /* the 3D canvas ground in light mode */
  --helix:     #c2410c;
  --sheet:     #1d4ed8;
  --coil:      #78838f;
}
:root[data-theme="dark"] {
  --fold:      #fbbf24;   /* amber-400 */
  --fold-h:    #fcd34d;   /* amber-300 */
  --fold-on:   #2a1a02;
  --fold-soft: rgba(251,191,36,.14);
  --fold-line: rgba(251,191,36,.48);
  --teal:      #fbbf24;
  --teal-h:    #fcd34d;
  --indigo:    #7c73ff;
  --plum:      #a78bfa;
  --stage-bg:  #0e1016;
  --helix:     #f97316;
  --sheet:     #60a5fa;
  --coil:      #98a2ad;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fold:      #fbbf24;
    --fold-h:    #fcd34d;
    --fold-on:   #2a1a02;
    --fold-soft: rgba(251,191,36,.14);
    --fold-line: rgba(251,191,36,.48);
    --teal:      #fbbf24;
    --teal-h:    #fcd34d;
    --indigo:    #7c73ff;
    --plum:      #a78bfa;
    --stage-bg:  #0e1016;
    --helix:     #f97316;
    --sheet:     #60a5fa;
    --coil:      #98a2ad;
  }
}

/* Re-tint the places the shared sheet hard-codes Cipher's teal rgba. */
.brand .logo { background: linear-gradient(135deg, var(--fold), #d97706); }
.side-item.active { background: var(--fold-soft); color: var(--fold-h); }
.side-item.active .si-badge { background: var(--fold-soft); color: var(--fold-h); }
:root[data-theme="dark"] .side-item.active { background: var(--fold-soft); color: var(--fold-h); }
:root[data-theme="dark"] .side-item.active .si-badge { background: var(--fold-soft); color: var(--fold-h); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .side-item.active { background: var(--fold-soft); color: var(--fold-h); }
  :root:not([data-theme="light"]) .side-item.active .si-badge { background: var(--fold-soft); color: var(--fold-h); }
}

/* ---------------------------------------------------------------- shell */
.content { flex: 1; min-width: 0; }
.view { display: none; }
.view.show { display: block; animation: fd-fade .14s ease; }
@keyframes fd-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }

.fd-offline-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border-radius: 999px; border: 1px solid var(--fold-line); background: var(--fold-soft);
  color: var(--fold-h); font-family: var(--display); font-weight: 600; font-size: 12px; white-space: nowrap;
}
.fd-offline-chip .material-icons-outlined { font-size: 15px; }
@media (max-width: 720px) { .fd-offline-chip span:last-child { display: none; } }

.tab-status { font-size: 12px; color: var(--ink3); font-family: var(--mono); text-align: right; }

/* ---------------------------------------------------------------- panels */
.fd-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-top: 16px;
}
.fd-panel.tight { padding: 14px 16px; }
.fd-panel-h {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 0 0 10px; font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink);
}
.fd-panel-h .sub { font-weight: 400; font-size: 12.5px; color: var(--ink3); font-family: var(--body); }
.fd-grid { display: grid; gap: 14px; }
.fd-grid.two { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.fd-grid.three { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.fd-note {
  font-size: 12.5px; line-height: 1.55; color: var(--ink2);
  border-left: 3px solid var(--line); padding: 2px 0 2px 12px; margin: 10px 0 0;
}
.fd-note.warn { border-left-color: var(--amber); }
.fd-note.stop { border-left-color: var(--red); }
.fd-note strong { color: var(--ink); font-weight: 600; }

/* Honesty callout — used wherever Fold must say what it did NOT do. */
.fd-limit {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel2);
  font-size: 12.5px; line-height: 1.6; color: var(--ink2);
}
.fd-limit .material-icons-outlined { font-size: 18px; color: var(--ink3); flex: none; margin-top: 1px; }
.fd-limit strong { color: var(--ink); font-weight: 600; }
.fd-limit.hard { border-color: rgba(217,48,37,.32); background: rgba(217,48,37,.06); }
.fd-limit.hard .material-icons-outlined { color: var(--red); }
:root[data-theme="dark"] .fd-limit.hard { border-color: rgba(255,107,94,.34); background: rgba(255,107,94,.09); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fd-limit.hard { border-color: rgba(255,107,94,.34); background: rgba(255,107,94,.09); }
}

/* ---------------------------------------------------------------- stats */
.fd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.fd-stat { background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 14px; }
.fd-stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink3); font-weight: 600; }
.fd-stat .v { font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--ink); margin-top: 3px; line-height: 1.15; }
.fd-stat .d { font-size: 11.5px; color: var(--ink3); margin-top: 3px; line-height: 1.4; }
.fd-stat.accent .v { color: var(--fold-h); }

/* ---------------------------------------------------------------- drop zone */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 34px 22px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.drag { border-color: var(--fold); background: var(--fold-soft); }
.drop .material-icons-outlined { font-size: 40px; color: var(--fold-h); }
.drop h3 { margin: 10px 0 4px; font-family: var(--display); font-size: 17px; color: var(--ink); }
.drop p { margin: 0; font-size: 13px; color: var(--ink2); }
.drop input[type=file] { display: none; }

.fd-progress { height: 6px; border-radius: 999px; background: var(--panel2); overflow: hidden; margin-top: 12px; }
.fd-progress > i { display: block; height: 100%; background: var(--fold); transition: width .2s ease; }

/* ---------------------------------------------------------------- chips */
.cq-chip, .zyg-chip, .cls-chip, .tag-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; font-family: var(--display); white-space: nowrap;
  border: 1px solid var(--line); background: var(--panel2); color: var(--ink2);
}
.cq-chip.quiet  { border-color: rgba(95,99,104,.30); background: rgba(95,99,104,.08); color: var(--ink2); }
.cq-chip.change { border-color: rgba(227,116,0,.38);  background: rgba(227,116,0,.10);  color: var(--amber); }
.cq-chip.severe { border-color: rgba(217,48,37,.38);  background: rgba(217,48,37,.09);  color: var(--red); }
:root[data-theme="dark"] .cq-chip.change { border-color: rgba(245,166,35,.42); background: rgba(245,166,35,.12); color: var(--amber); }
:root[data-theme="dark"] .cq-chip.severe { border-color: rgba(255,107,94,.42); background: rgba(255,107,94,.12); color: var(--red); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cq-chip.change { border-color: rgba(245,166,35,.42); background: rgba(245,166,35,.12); color: var(--amber); }
  :root:not([data-theme="light"]) .cq-chip.severe { border-color: rgba(255,107,94,.42); background: rgba(255,107,94,.12); color: var(--red); }
}
.zyg-chip.het      { border-color: rgba(26,115,232,.34); background: rgba(26,115,232,.08); color: var(--blue); }
.zyg-chip.hom_alt  { border-color: rgba(139,92,246,.36); background: rgba(139,92,246,.10); color: var(--violet); }
.zyg-chip.hemi     { border-color: rgba(13,144,79,.34);  background: rgba(13,144,79,.08);  color: var(--green); }
.zyg-chip.no_call, .zyg-chip.unknown { border-style: dashed; }
.cls-chip .material-icons-outlined { font-size: 14px; }
.tag-chip { font-weight: 500; font-size: 11px; }

.pr-sym { font-family: var(--mono); font-weight: 600; color: var(--ink); font-size: 13.5px; }
.pr-name { color: var(--ink2); font-size: 12.5px; margin-left: 8px; }

/* ---------------------------------------------------------------- tables */
.fd-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.fd-table th {
  text-align: left; font-family: var(--display); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink3);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.fd-table th.sortable { cursor: pointer; user-select: none; }
.fd-table th.sortable:hover { color: var(--fold-h); }
.fd-table td { padding: 9px 10px; border-bottom: 1px solid var(--line2); color: var(--ink2); vertical-align: top; }
.fd-table tr:last-child td { border-bottom: 0; }
.fd-table tbody tr { cursor: pointer; }
.fd-table tbody tr:hover { background: var(--fold-soft); }
.fd-table tbody tr.sel { background: var(--fold-soft); box-shadow: inset 3px 0 0 var(--fold); }
.fd-table .mono { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.fd-scroll { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }

/* ---------------------------------------------------------------- proteome grid */
.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; margin-top: 14px; }
.pr-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px;
  cursor: pointer; transition: border-color .14s, transform .14s, box-shadow .14s; min-width: 0;
}
.pr-card:hover { border-color: var(--fold-line); transform: translateY(-1px); box-shadow: var(--shadow); }
.pr-card.hit { border-color: var(--fold-line); background: var(--fold-soft); }
.pr-card .top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pr-card .nm { font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--ink); }
.pr-card .desc { font-size: 12px; color: var(--ink2); margin-top: 5px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pr-card .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; align-items: center; }
.pr-card .cnt {
  font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--fold-on);
  background: var(--fold); border-radius: 999px; padding: 1px 8px;
}

/* Miniature secondary-structure ribbon shown on each card. */
.ss-mini { display: flex; height: 7px; border-radius: 3px; overflow: hidden; margin-top: 9px; background: var(--panel2); }
.ss-mini > i { display: block; height: 100%; }
.ss-mini > i.h { background: var(--helix); }
.ss-mini > i.e { background: var(--sheet); }
.ss-mini > i.c { background: var(--coil); opacity: .45; }

/* ---------------------------------------------------------------- viewer */
.vw-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 16px; margin-top: 16px; align-items: start; }
@media (max-width: 1080px) { .vw-wrap { grid-template-columns: minmax(0, 1fr); } }

.vw-stage {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--stage-bg); box-shadow: var(--shadow);
}
.vw-canvas { display: block; width: 100%; height: 62vh; min-height: 380px; background: var(--stage-bg); cursor: grab; outline: none; }
.vw-canvas:active { cursor: grabbing; }
.vw-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--fold); }
@media (max-width: 720px) { .vw-canvas { height: 46vh; min-height: 300px; } }

.vw-overlay { position: absolute; inset: 0; pointer-events: none; }
.vw-tools {
  position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; pointer-events: auto;
}
.vw-btn {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink2); box-shadow: var(--shadow);
}
.vw-btn:hover { color: var(--fold-h); border-color: var(--fold-line); }
.vw-btn.on { background: var(--fold-soft); color: var(--fold-h); border-color: var(--fold-line); }
.vw-btn .material-icons-outlined { font-size: 18px; }

.vw-badge {
  position: absolute; left: 10px; top: 10px; pointer-events: auto; max-width: 62%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  padding: 8px 11px; box-shadow: var(--shadow);
}
.vw-badge .t { font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--ink); }
.vw-badge .s { font-size: 11.5px; color: var(--ink3); margin-top: 2px; line-height: 1.4; }

.vw-legend {
  position: absolute; left: 10px; bottom: 10px; right: 10px; pointer-events: none;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  padding: 7px 11px; box-shadow: var(--shadow); font-size: 11.5px; color: var(--ink2);
}
.lg-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.lg-sw { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(0,0,0,.12); }
:root[data-theme="dark"] .lg-sw { border-color: rgba(255,255,255,.16); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lg-sw { border-color: rgba(255,255,255,.16); } }

.vw-side { display: flex; flex-direction: column; gap: 12px; }
.vw-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vw-mode {
  display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink2);
  font-size: 11.5px; font-family: var(--display); font-weight: 500; text-align: left; min-width: 0;
}
.vw-mode span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-mode .material-icons-outlined { font-size: 15px; flex: none; }
.vw-mode:hover { border-color: var(--fold-line); }
.vw-mode.on { background: var(--fold-soft); color: var(--fold-h); border-color: var(--fold-line); font-weight: 600; }

/* ---------------------------------------------------------------- residue rail */
.res-card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 13px 14px; }
.res-card .hd { display: flex; align-items: baseline; gap: 8px; }
.res-card .aa { font-family: var(--mono); font-size: 19px; font-weight: 600; color: var(--ink); }
.res-card .no { font-size: 12.5px; color: var(--ink3); }
.res-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 4px 0; border-bottom: 1px dashed var(--line2); }
.res-row:last-child { border-bottom: 0; }
.res-row .k { color: var(--ink3); }
.res-row .v { color: var(--ink); text-align: right; font-family: var(--mono); font-size: 11.5px; }

/* ---------------------------------------------------------------- sequence strip */
.seq-strip { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 12px 14px; }
.seq-track { position: relative; height: 26px; margin-top: 6px; border-radius: 5px; background: var(--panel2); overflow: hidden; }
.seq-track > i { position: absolute; top: 0; bottom: 0; }
.seq-track > i.h { background: var(--helix); }
.seq-track > i.e { background: var(--sheet); }
.seq-track > i.dom { top: 0; bottom: 0; border-radius: 4px; opacity: .85; }
.seq-track.thin { height: 13px; }
.seq-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--red); box-shadow: 0 0 0 1px var(--panel); cursor: pointer; }
.seq-mark.sel { background: var(--fold); width: 3px; }
.seq-axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--ink3); margin-top: 4px; }
.seq-lab { font-size: 11px; color: var(--ink3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 10px; }

/* ---------------------------------------------------------------- taxonomy */
.tx-class { border: 1px solid var(--line); border-radius: 13px; background: var(--panel); overflow: hidden; }
.tx-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; cursor: pointer; }
.tx-head:hover { background: var(--panel2); }
.tx-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--fold-soft); color: var(--fold-h); }
.tx-t { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--ink); }
.tx-s { font-size: 12px; color: var(--ink3); margin-top: 1px; line-height: 1.4; }
.tx-n { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink3); white-space: nowrap; }
.tx-body { padding: 0 15px 14px; border-top: 1px solid var(--line2); }
.tx-fam { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line2); font-size: 12.5px; }
.tx-fam:last-child { border-bottom: 0; }
.tx-fam .nm { color: var(--ink); font-weight: 500; flex: none; min-width: 190px; }
.tx-fam .bar { flex: 1; height: 7px; border-radius: 999px; background: var(--panel2); overflow: hidden; }
.tx-fam .bar > i { display: block; height: 100%; background: var(--fold); }
.tx-fam .ct { font-family: var(--mono); font-size: 11.5px; color: var(--ink3); min-width: 58px; text-align: right; }

/* ---------------------------------------------------------------- filters */
.fd-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.fd-input, .fd-select {
  font-family: var(--body); font-size: 12.5px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; min-width: 0;
}
.fd-input:focus, .fd-select:focus { outline: none; border-color: var(--fold); box-shadow: 0 0 0 3px var(--fold-soft); }
.fd-input { flex: 1 1 220px; max-width: 340px; }
.fd-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink2); font-size: 12.5px; font-weight: 500;
}
.fd-toggle.on { background: var(--fold-soft); color: var(--fold-h); border-color: var(--fold-line); font-weight: 600; }
.fd-toggle .material-icons-outlined { font-size: 16px; }

/* ---------------------------------------------------------------- misc */
.dz-empty { text-align: center; padding: 46px 20px; color: var(--ink2); font-size: 13px; line-height: 1.6; }
.dz-empty .material-icons-outlined { font-size: 44px; color: var(--ink3); }
.dz-empty a { color: var(--fold-h); }

.fd-kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 14px; font-size: 12.5px; }
.fd-kv dt { color: var(--ink3); }
.fd-kv dd { margin: 0; color: var(--ink); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }

.fd-bars { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.fd-bar { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.fd-bar .nm { min-width: 172px; color: var(--ink2); }
.fd-bar .tr { flex: 1; height: 8px; border-radius: 999px; background: var(--panel2); overflow: hidden; }
.fd-bar .tr > i { display: block; height: 100%; border-radius: 999px; }
.fd-bar .ct { font-family: var(--mono); font-size: 11.5px; color: var(--ink3); min-width: 46px; text-align: right; }

.fd-prose { font-size: 13px; line-height: 1.68; color: var(--ink2); max-width: 76ch; }
.fd-prose h3 { font-family: var(--display); font-size: 15px; color: var(--ink); margin: 22px 0 6px; }
.fd-prose h3:first-child { margin-top: 0; }
.fd-prose p { margin: 0 0 10px; }
.fd-prose code { font-family: var(--mono); font-size: 12px; background: var(--panel2); padding: 1px 5px; border-radius: 5px; color: var(--ink); }
.fd-prose ul { margin: 0 0 10px; padding-left: 20px; }
.fd-prose li { margin-bottom: 5px; }
.fd-prose a { color: var(--fold-h); }

.footer-honest {
  max-width: 1180px; margin: 26px auto 30px; padding: 0 22px;
  font-size: 12px; line-height: 1.65; color: var(--ink3); text-align: center;
}
.footer-honest .mono { font-family: var(--mono); color: var(--ink2); }

.fd-src { font-size: 11.5px; color: var(--ink3); margin-top: 8px; line-height: 1.5; }
.fd-src a { color: var(--fold-h); }

.hl { color: var(--fold-h); font-weight: 600; }
.fd-spin { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line);
  border-top-color: var(--fold); border-radius: 50%; animation: fd-rot .7s linear infinite; vertical-align: -2px; }
@keyframes fd-rot { to { transform: rotate(360deg); } }

@media print {
  .topbar, .sidebar, .vw-tools, .fd-filters, .footer-honest { display: none !important; }
  .view { display: block !important; }
  .fd-panel { break-inside: avoid; box-shadow: none; }
}
