/* ==========================================================================
   FROGLM feature pages: Compare (compare.html), Trends (trends.html) and OpenCode Go (opencode-go.html)
   Builds on the theme variables and components of styles.css.
   ========================================================================== */

/* Series colours (one per compared model / chart line), tuned per theme */
:root, [data-theme="emerald"] {
  --fx-s1: #10b981;
  --fx-s2: #38bdf8;
  --fx-s3: #c084fc;
  --fx-s4: #fb923c;
  --fx-best-bg: rgba(16, 185, 129, 0.14);
}
[data-theme="cyberpunk"] {
  --fx-s1: #818cf8;
  --fx-s2: #22d3ee;
  --fx-s3: #f472b6;
  --fx-s4: #fbbf24;
  --fx-best-bg: rgba(129, 140, 248, 0.16);
}
[data-theme="amber"] {
  --fx-s1: #f59e0b;
  --fx-s2: #38bdf8;
  --fx-s3: #c084fc;
  --fx-s4: #34d399;
  --fx-best-bg: rgba(245, 158, 11, 0.14);
}
[data-theme="light"] {
  --fx-s1: #047857;
  --fx-s2: #0369a1;
  --fx-s3: #7c3aed;
  --fx-s4: #c2410c;
  --fx-best-bg: rgba(4, 120, 87, 0.10);
}

.fx-s1 { fill: var(--fx-s1); background: var(--fx-s1); stroke: var(--fx-s1); }
.fx-s2 { fill: var(--fx-s2); background: var(--fx-s2); stroke: var(--fx-s2); }
.fx-s3 { fill: var(--fx-s3); background: var(--fx-s3); stroke: var(--fx-s3); }
.fx-s4 { fill: var(--fx-s4); background: var(--fx-s4); stroke: var(--fx-s4); }

.fx-swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fx-error { color: #ef4444; font-weight: 600; }

/* ----- Panels ----- */
.fx-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-card);
}

.fx-label {
  display: block;
  font-size: .8rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  margin-bottom: .65rem;
}

.fx-input,
.fx-select {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: .75rem 1rem;
  border-radius: var(--r-sm);
  font-size: .95rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
  width: 100%;
}
.fx-input::placeholder { color: var(--text-faint); }
.fx-input:hover,
.fx-select:hover { border-color: var(--border-hover); background: var(--bg-elev); }
.fx-input:focus,
.fx-select:focus {
  border-color: var(--primary);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 2px var(--primary-glow);
}
.fx-input:disabled { opacity: .6; cursor: not-allowed; }

.fx-notice {
  margin-top: 1rem;
  padding: .75rem 1rem;
  border-radius: var(--r-sm);
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  color: var(--text);
  font-size: .88rem;
  overflow-wrap: anywhere;
}

/* ----- Compare: picker ----- */
.fx-combo { position: relative; max-width: 560px; }

.fx-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 50;
  list-style: none;
  background: var(--bg-dropdown);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-dropdown);
  max-height: 340px;
  overflow-y: auto;
  padding: .35rem;
}
.fx-result {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .55rem .75rem;
  border-radius: 8px;
  cursor: pointer;
}
.fx-result:hover,
.fx-result.active { background: var(--bg-elev); }
.fx-result.active { box-shadow: inset 3px 0 0 var(--primary); }
.fx-result-name { font-weight: 600; color: var(--text); }
.fx-result-name .badge { font-size: .6rem; padding: .1rem .45rem; margin-left: .25rem; vertical-align: .1em; }
.fx-result-meta { font-size: .8rem; color: var(--text-dim); }
.fx-result-empty { padding: .6rem .75rem; color: var(--text-faint); }

.fx-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}
.fx-chips:empty { display: none; }
.fx-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  max-width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  padding: .3rem .35rem .3rem .75rem;
  font-size: .88rem;
}
.fx-chip .badge { font-size: .6rem; padding: .1rem .45rem; }
.fx-chip-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fx-chip-remove {
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.fx-chip-remove:hover { color: var(--text); background: var(--bg-elev-hover); border-color: var(--border-strong); }

/* ----- Compare: empty state ----- */
.fx-empty h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: .35rem;
}
.fx-suggestions {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.fx-suggestion {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  height: 100%;
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.fx-suggestion:hover {
  border-color: var(--primary-border);
  background: var(--bg-card-hover);
  text-shadow: none;
  filter: none;
}
.fx-suggestion-title { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--primary); }
.fx-suggestion-models { font-size: .85rem; color: var(--text-dim); }

/* ----- Compare: charts ----- */
.fx-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.fx-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-card);
}
.fx-chart figcaption { margin-bottom: .6rem; font-size: .8rem; }
.fx-chart-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
}
.fx-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.fx-svg-label { fill: var(--text-dim); font-size: 11px; font-family: 'Inter', sans-serif; }
.fx-svg-value { fill: var(--text); font-size: 12px; font-weight: 600; font-family: 'Inter', sans-serif; }
.fx-svg-track { fill: var(--bg-track); }

/* ----- Compare: table ----- */
.fx-table-wrap {
  position: relative; /* containing block for .sr-only cells, so they scroll with the table */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}
.fx-table { table-layout: auto; min-width: 520px; }
.fx-table th, .fx-table td { white-space: normal; }
.fx-table thead { position: static; }
.fx-table th { cursor: default; }
.fx-table th:hover { color: var(--text-dim); background: var(--bg-th); }
.fx-table tbody tr { cursor: default; height: auto; }
.fx-table td { padding: .6rem 1.1rem; vertical-align: top; }
.fx-table td.num { text-align: left; }
.fx-table tbody th[scope="row"] {
  text-transform: none;
  letter-spacing: 0;
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: .6rem 1.1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-th);
}
.fx-table tr.fx-group th {
  background: var(--bg-elev);
  color: var(--primary);
  font-size: .72rem;
  padding: .55rem 1.1rem;
}
.fx-table tr.fx-group th:hover { color: var(--primary); background: var(--bg-elev); }
.fx-corner { background: var(--bg-th); border-bottom: 1px solid var(--border-strong); }
.fx-model-col {
  vertical-align: top;
  text-transform: none;
  letter-spacing: 0;
  min-width: 150px;
}
.fx-model-col .fx-swatch { margin-right: .4rem; vertical-align: .05em; }
.fx-model-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.fx-model-name:hover { color: var(--primary); text-shadow: none; }
.fx-model-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.fx-model-meta:empty { display: none; }
.fx-model-meta .badge { font-size: .6rem; padding: .1rem .45rem; }
.fx-model-creator {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-top: .35rem;
  font-family: 'Inter', sans-serif;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-dim);
}
.fx-best {
  background: var(--fx-best-bg);
  color: var(--primary);
  font-weight: 700;
}
.fx-footnote { font-size: .8rem; margin-top: .85rem; }

/* ----- Trends ----- */
.fx-section { margin-bottom: 3.5rem; }
.fx-section > h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: .4rem;
  color: var(--text);
}
.fx-section > .fx-lead { color: var(--text-dim); margin-bottom: 1.25rem; max-width: 760px; }

.fx-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}
.fx-event-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.fx-event-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .6rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}
.fx-event-count {
  font-family: 'Inter', sans-serif;
  font-size: .8rem;
  color: var(--text-faint);
  font-weight: 600;
}
.fx-event-list { list-style: none; display: flex; flex-direction: column; gap: .45rem; }
.fx-event-list { gap: .6rem; }
/* Name on top (up to two lines), change detail below: cards are narrow on every screen size */
.fx-event-list li {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  font-size: .88rem;
  min-width: 0;
}
.fx-event-name {
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.fx-event-name a { color: var(--text); font-weight: 600; }
.fx-event-name a:hover { color: var(--primary); text-shadow: none; }
.fx-event-name .badge { font-size: .58rem; padding: .05rem .4rem; margin-left: .2rem; vertical-align: .1em; white-space: nowrap; }
.fx-event-detail { color: var(--text-faint); font-size: .82rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fx-down { color: var(--primary); }
.fx-up { color: var(--bronze); }
.fx-event-more { font-size: .8rem; color: var(--text-faint); margin-top: .5rem; }

.fx-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}
.fx-controls .tabs { margin-bottom: 0; }
.fx-field { display: flex; flex-direction: column; min-width: 0; flex: 1 1 240px; max-width: 420px; }
.fx-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.5rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4.5L6 7.5L9 4.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 12px 12px;
}

.fx-line-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-card);
}
.fx-line-chart svg { display: block; width: 100%; height: auto; }
.fx-axis { stroke: var(--border-strong); stroke-width: 1; }
.fx-grid { stroke: var(--border); stroke-width: 1; }
.fx-tick { fill: var(--text-faint); font-size: 10px; font-family: 'Inter', sans-serif; }
.fx-line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.fx-line.fx-dashed { stroke-dasharray: 5 4; }
.fx-dot { stroke: var(--bg); stroke-width: 1.5; }
.fx-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.1rem;
  margin-top: .65rem;
  font-size: .82rem;
  color: var(--text-dim);
  list-style: none;
}
.fx-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.fx-legend .fx-key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.fx-legend .fx-key-dashed {
  background: none;
  border-top: 3px dashed var(--fx-s2);
  height: 0;
  border-radius: 0;
}
.fx-legend .fx-key-rescore {
  width: 0;
  height: 14px;
  border-left: 1px dashed var(--text-faint);
  border-radius: 0;
  margin: 0 7px;
}
.fx-rescore { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.fx-line-chart #tr-model-chart,
.fx-line-chart #tr-frontier-chart { width: 100%; }
.fx-line-chart .fx-dot { cursor: help; }
.fx-holders .fx-swatch { margin-right: .3rem; }
.fx-chart-note { font-size: .8rem; color: var(--text-faint); margin-top: .5rem; }

.fx-holders { margin-top: 1rem; }
.fx-holders td, .fx-holders th { white-space: normal; }
.fx-holders td.num, .fx-holders th.num { text-align: right; }

.fx-empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-dim);
}
.fx-empty-state strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: .35rem; }

.fx-asof { font-size: .85rem; color: var(--text-faint); }

@media (max-width: 640px) {
  .fx-panel { padding: 1.1rem; }
  .fx-table td, .fx-table tbody th[scope="row"] { padding: .5rem .7rem; }
  .fx-model-col { min-width: 120px; padding: .8rem .7rem; }
  .fx-model-name { font-size: .92rem; }
  .fx-section > h2 { font-size: 1.35rem; }
  .fx-controls { align-items: stretch; }
  .fx-controls .tabs { flex-wrap: wrap; }
  .fx-field { max-width: none; }
  .page-head h1 { font-size: 1.9rem; }
}

/* ----- OpenCode Go models (opencode-go.html) ----- */
.og-table { min-width: 860px; }
.og-table td, .og-table tbody th[scope="row"] { vertical-align: middle; }
.og-table td.num, .og-table th.num { text-align: right; }
.og-table tbody th[scope="row"] { position: static; white-space: normal; min-width: 220px; color: var(--text); }
.og-table tbody tr.og-top th[scope="row"] .og-name { color: var(--primary); }
.og-name { font-weight: 700; color: var(--text); }
a.og-name:hover { color: var(--primary); }
.og-model .badge { font-size: .6rem; padding: .1rem .45rem; margin-left: .3rem; vertical-align: .12em; }
.og-free { background: var(--fx-best-bg); color: var(--primary); border: 1px solid var(--border-strong); }
.og-id {
  display: block;
  margin-top: .2rem;
  font-size: .75rem;
  font-weight: 400;
  color: var(--text-faint);
  word-break: break-all;
}
.og-sub { display: block; font-size: .72rem; color: var(--text-faint); white-space: nowrap; }
.og-val { display: inline-flex; align-items: center; gap: .55rem; font-variant-numeric: tabular-nums; }
.og-bar {
  display: inline-block;
  width: 72px;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-elev);
  overflow: hidden;
  flex-shrink: 0;
}
.og-bar > span { display: block; height: 100%; border-radius: 3px; }
.og-bar-ii > span { background: var(--fx-s1); }
.og-bar-use > span { background: var(--fx-s2); }
#og-notes p { margin-bottom: .5rem; max-width: 900px; }
#og-notes p:last-child { margin-bottom: 0; }

/* ----- Without JavaScript (<html class="no-js">, removed by theme-init.js and the page scripts) ----- */
/* Only the <noscript> message is shown: no endless spinner and no controls that need a script */
.no-js .loading-state,
.no-js .fx-panel,
.no-js #cmp-empty,
.no-js #cmp-result,
.no-js .fx-section,
.no-js #tr-empty,
.no-js #og-empty { display: none !important; }
noscript .fx-empty-state { display: block; margin-bottom: 2rem; }
noscript .fx-empty-state a { text-decoration: underline; text-underline-offset: 3px; }

/* ----- Data tables that back the trend charts (text alternative to the SVG) ----- */
.fx-data { margin-top: .85rem; }
.fx-data summary {
  cursor: pointer;
  width: fit-content;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-dim);
}
.fx-data summary:hover { color: var(--text); }
.fx-data .fx-table-wrap { margin-top: .6rem; max-height: 420px; overflow-y: auto; }
.fx-data td.num, .fx-data th.num { text-align: right; }
.fx-data tbody th[scope="row"] { font-variant-numeric: tabular-nums; }
