/* ==========================================================================
   ImmGen home page - "Gene of the Day" panel
   Every rule is scoped under .gotd-* so nothing leaks into the existing page
   (the home page styles .btn globally as big circles - never use .btn here).
   ========================================================================== */

.gotd-panel {
  --gotd-ink: #1f2937;
  --gotd-muted: #64748b;
  --gotd-head: #1d4ed8;          /* same blue as Gene Page section titles */
  --gotd-brand: #7f1d1d;         /* ImmGen dark red */
  --gotd-brand-hover: #991b1b;
  --gotd-card: rgba(255, 255, 255, 0.96);
  --gotd-line: #e2e8f0;
  --gotd-track: #e2e8f0;
  --gotd-query: #f59e42;         /* Gene Page network colors */
  --gotd-partner: #69b3a2;

  box-sizing: border-box;
  position: relative;
  width: 100%;
  max-width: 1100px;
  /* Height depends only on the window size, never on the content: the AI texts scroll in place and
     long population lists scroll inside the Expression card. */
  height: clamp(580px, calc(100vh - 360px), 700px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  color: var(--gotd-ink);
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}
.gotd-panel *, .gotd-panel *::before, .gotd-panel *::after { box-sizing: border-box; }
/* neutralise site-wide h2 {color:#666; line-height:24px} and p {font: 11px raleway} from css/style.css */
.gotd-panel h2, .gotd-panel h3, .gotd-panel p { margin: 0; line-height: inherit; color: inherit;
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif; }
.gotd-panel a:hover, .gotd-panel a:focus { text-decoration: none; }

/* ---------- header ---------- */
.gotd-head {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}
.gotd-dna { width: 34px; height: 46px; flex: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.gotd-titles { min-width: 0; flex: 1; }
.gotd-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;                 /* rank pill follows the date; wraps flush-left on phones */
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.95;
}
.gotd-kicker-date { white-space: nowrap; }
.gotd-head { flex-wrap: wrap; }
.gotd-sep { margin: 0 6px; opacity: .8; }
.gotd-symbol-row { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.gotd-rank {
  padding: 1px 9px;
  line-height: 1.4;
  text-transform: none;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.14);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.gotd-panel .gotd-symbol {
  color: #fff;
  font-family: raleway, "Segoe UI", Arial, sans-serif;
  font-size: 30px;
  font-weight: 700;
  font-style: italic;            /* gene symbols are italic by convention */
  line-height: 1.1;
}
.gotd-name { font-size: 14px; opacity: 0.95; }

/* Call-to-action: same frosted-glass language as the circle menu buttons */
.gotd-panel .gotd-cta {
  margin-left: auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.25);
  transition: background .2s ease, color .2s ease, text-shadow .2s ease;
}
.gotd-panel .gotd-cta:hover, .gotd-panel .gotd-cta:focus-visible {
  background: rgba(255, 255, 255, 0.85);
  color: #1e293b;
  text-shadow: none;
}
.gotd-cta-arrow { margin-left: 4px; transition: transform .2s ease; }
.gotd-cta:hover .gotd-cta-arrow { transform: translateX(3px); }

/* ---------- body grid ---------- */
.gotd-body {
  position: relative;
  display: grid;
  /* row 1: Summary, full width; row 2: Interactions | Expression, sharing one height */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  flex: 1;
}
.gotd-summary { grid-column: 1 / -1; }

.gotd-card {
  background: var(--gotd-card);
  border-radius: 9px;
  padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.gotd-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gotd-head);
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

/* All AI text (Summary, Interactions, Expression): one style, black, the same size as the
   project description (14px; 13px on short screens and phones, see the media queries) */
.gotd-panel .gotd-text { color: #000; font-size: 14px; }
.gotd-panel .gotd-text strong { font-weight: 600; color: #000; }

/* Summary: the full text, shown completely (no scrolling) */
.gotd-fulltext { flex: none; }
.gotd-panel .gotd-fulltext p + p { margin-top: 0.5em; }
/* Interactions / Expression: whole opening sentences that fit in 3 lines, shown in full */
.gotd-text.gotd-fit { flex: none; margin-bottom: 4px; }
.gotd-text.gotd-fit-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }

/* ---------- interactions network ---------- */
.gotd-net { position: relative; width: 100%; flex: 1 1 0; min-height: 120px; }
.gotd-net svg { display: block; width: 100%; height: 100%; }
.gotd-net .gotd-node { cursor: grab; }
.gotd-net .gotd-node.gotd-partner { cursor: pointer; }
.gotd-net text { font: 600 10.5px "Segoe UI", system-ui, Arial, sans-serif; fill: #1f2937; pointer-events: none;
  paint-order: stroke; stroke: rgba(255,255,255,.9); stroke-width: 3px; }
.gotd-empty { color: var(--gotd-muted); font-size: 12px; padding: 18px 0; text-align: center; }

/* ---------- expression ---------- */
.gotd-expr { min-height: 0; }
.gotd-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.gotd-tab {
  border: 0;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.gotd-tab:hover { background: #cbd5e1; }
.gotd-tab[aria-selected="true"] { background: #3b82f6; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15); }


.gotd-bars { overflow-y: auto; min-height: 120px; flex: 1; padding-right: 4px; }
.gotd-bar { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 0; cursor: default; border-radius: 3px; }
.gotd-bar:hover { background: #f1f5f9; }
.gotd-bar-label { font-size: 10.5px; line-height: 1.25; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gotd-bar-track { height: 10px; background: var(--gotd-track); border-radius: 2px; overflow: hidden; }
.gotd-bar-fill { height: 100%; border-radius: 0 2px 2px 0; transition: width .35s ease; }
/* range legend: first row of the bar list (same grid), pinned while the list scrolls */
.gotd-bar.gotd-legend { position: sticky; top: 0; z-index: 1; background: #fff; padding: 2px 0 5px; }
.gotd-bar.gotd-legend:hover { background: #fff; }
.gotd-legend .gotd-bar-label { color: var(--gotd-muted); }
.gotd-legend-bar { display: flex; height: 8px; border-radius: 2px; overflow: hidden; }
.gotd-src { font-size: 10px; color: var(--gotd-muted); margin-top: 4px; }

.gotd-panel :focus-visible { outline: 2px solid #fbbf24 !important; outline-offset: 2px; }

/* ---------- shared tooltip (attached to <body>) ---------- */
.gotd-tooltip {
  position: fixed;
  z-index: 20000;
  max-width: 250px;
  padding: 8px 10px;
  overflow-wrap: anywhere;      /* long marker strings like "...CD44hiCD117hiCD25-/lo" wrap inside */
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.94);
  color: #e2e8f0;
  font: 11px/1.35 "Segoe UI", system-ui, Arial, sans-serif;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
}
.gotd-tt-title { color: #fff; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.gotd-tt-row + .gotd-tt-row { margin-top: 4px; }
.gotd-tt-label { display: block; font-size: 9px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: #94a3b8; }
.gotd-tt-val { display: block; font-size: 11px; color: #f1f5f9; }
.gotd-tt-note { margin-top: 2px; font-size: 10px; color: #94a3b8; font-style: italic; }

/* ---------- loading / error ---------- */
.gotd-skel { background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 200% 100%;
  animation: gotd-shimmer 1.2s infinite; border-radius: 4px; height: 10px; margin: 6px 0; }
@keyframes gotd-shimmer { to { background-position: -200% 0; } }
.gotd-error { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.gotd-error a { color: #fff !important; text-decoration: underline !important; }

/* ==========================================================================
   Page layout with the panel (opt-in via .gotd-* classes on the existing
   .wrapper / .left-col / .right-col, so the live index.html is unaffected
   until those classes are added).
   ========================================================================== */
/* Description and the ring + panel row share one width (ring column 420 + gap 48 +
   panel 1100 = 1568px), so the description lines up with both edges below it. */
.wrapper.gotd-wrapper,
.gotd-about {
  box-sizing: border-box;
  width: 96%;
  max-width: 1568px;
  margin-left: auto;
  margin-right: auto;
}
.wrapper.gotd-wrapper {
  gap: 48px;
  padding-left: 0;
  height: auto;               /* size to the ring/panel instead of calc(100vh - 150px) */
  margin-top: 0;
  margin-bottom: 8px;
}
.gotd-wrapper .left-col.gotd-left {
  flex: 0 0 420px;
  align-items: center;
}
.gotd-wrapper .right-col.gotd-right { flex: 1 1 auto; min-width: 0; }
/* the ring is a 300px circle whose buttons overhang ~60px; give it an explicit box */
.gotd-wrapper .gotd-left .menu-container { flex: none; width: 400px; height: 430px; }

/* Project description: full text above the ring and panel (glass style of the old .Water box) */
.gotd-about {
  flex: none;
  margin-top: -44px;          /* pull up into the title's large bottom margin */
  margin-bottom: 14px;
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: Geneva, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.gotd-about p { margin: 0; font: inherit; color: inherit; }
.gotd-about p + p { margin-top: 8px; }

/* short laptop screens (e.g. 1366x768): tighten the description. The ring keeps its normal
   size and stays vertically centred beside the panel; gotd.js scales the whole content
   to fit the window height (fitPage), so nothing needs pinning to the top any more. */
@media (max-height: 880px) and (min-width: 901px) {
  .gotd-about { font-size: 13px; line-height: 1.45; padding: 10px 16px; margin-top: -50px; margin-bottom: 14px; }
  .gotd-panel .gotd-text { font-size: 13px; }      /* stays the same size as the description */
}
@media (max-width: 1100px) {
  .wrapper.gotd-wrapper { gap: 24px; }
  .gotd-wrapper .left-col.gotd-left { flex-basis: 400px; }
}
@media (max-width: 900px) {
  .gotd-about { margin-top: 0; }
  .wrapper.gotd-wrapper { flex-direction: column; padding-bottom: 60px; }
  .gotd-wrapper .left-col.gotd-left { flex: none; width: 100%; }
  .gotd-wrapper .gotd-left .menu-container { width: 100%; max-width: 400px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  /* stacked cards: the panel grows to fit them, but every part has a fixed size,
     so scrolling text and switching lineage tabs still never change the height */
  .gotd-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .gotd-panel { height: auto; }
  .gotd-net { flex: none; height: 200px; }
  .gotd-bars { flex: none; height: 300px; }
}
@media (max-width: 768px) {
  .gotd-panel { padding: 12px; }
  .gotd-about { font-size: 13px; line-height: 1.45; padding: 12px 14px; }
  .gotd-panel .gotd-text { font-size: 13px; }
  .gotd-panel .gotd-symbol { font-size: 26px; }
  .gotd-kicker { font-size: 11px; }
  /* button drops to its own full-width row under the gene name */
  .gotd-panel .gotd-cta { order: 3; margin-left: 0; width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .gotd-bar-fill, .gotd-cta, .gotd-cta-arrow, .gotd-skel { transition: none; animation: none; }
}
